Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc6dece

Browse filesBrowse files
authored
making picking default for all graphics (#484)
1 parent 25aa9e3 commit cc6dece
Copy full SHA for cc6dece

File tree

9 files changed

+45
-16
lines changed
Filter options

9 files changed

+45
-16
lines changed

‎fastplotlib/graphics/image.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/image.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,15 @@ def __init__(
282282
# if data is RGB or RGBA
283283
if data.ndim > 2:
284284
material = pygfx.ImageBasicMaterial(
285-
clim=(vmin, vmax), map_interpolation=filter
285+
clim=(vmin, vmax), map_interpolation=filter, pick_write=True
286286
)
287287
# if data is just 2D without color information, use colormap LUT
288288
else:
289289
material = pygfx.ImageBasicMaterial(
290-
clim=(vmin, vmax), map=self.cmap(), map_interpolation=filter
290+
clim=(vmin, vmax),
291+
map=self.cmap(),
292+
map_interpolation=filter,
293+
pick_write=True,
291294
)
292295

293296
world_object = pygfx.Image(geometry, material)
@@ -443,7 +446,10 @@ def __init__(
443446

444447
self.cmap = HeatmapCmapFeature(self, cmap)
445448
self._material = pygfx.ImageBasicMaterial(
446-
clim=(vmin, vmax), map=self.cmap(), map_interpolation=filter
449+
clim=(vmin, vmax),
450+
map=self.cmap(),
451+
map_interpolation=filter,
452+
pick_write=True,
447453
)
448454

449455
for start, stop, chunk in zip(start_ixs, stop_ixs, chunks):

‎fastplotlib/graphics/line.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/line.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def __init__(
114114
world_object: pygfx.Line = pygfx.Line(
115115
# self.data.feature_data because data is a Buffer
116116
geometry=pygfx.Geometry(positions=self.data(), colors=self.colors()),
117-
material=material(thickness=self.thickness(), color_mode="vertex"),
117+
material=material(
118+
thickness=self.thickness(), color_mode="vertex", pick_write=True
119+
),
118120
)
119121

120122
self._set_world_object(world_object)

‎fastplotlib/graphics/scatter.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/scatter.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ def __init__(
9393
pygfx.Geometry(
9494
positions=self.data(), sizes=self.sizes(), colors=self.colors()
9595
),
96-
material=pygfx.PointsMaterial(color_mode="vertex", size_mode="vertex"),
96+
material=pygfx.PointsMaterial(
97+
color_mode="vertex", size_mode="vertex", pick_write=True
98+
),
9799
)
98100

99101
self._set_world_object(world_object)

‎fastplotlib/graphics/selectors/_linear.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/selectors/_linear.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ def __init__(
125125
line_inner = pygfx.Line(
126126
# self.data.feature_data because data is a Buffer
127127
geometry=pygfx.Geometry(positions=line_data),
128-
material=material(thickness=thickness, color=color),
128+
material=material(thickness=thickness, color=color, pick_write=True),
129129
)
130130

131131
self.line_outer = pygfx.Line(
132132
geometry=pygfx.Geometry(positions=line_data),
133-
material=material(thickness=thickness + 6, color=self.colors_outer),
133+
material=material(
134+
thickness=thickness + 6, color=self.colors_outer, pick_write=True
135+
),
134136
)
135137

136138
line_inner.world.z = self.line_outer.world.z + 1

‎fastplotlib/graphics/selectors/_linear_region.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/selectors/_linear_region.py
+14-6Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ def __init__(
139139
if axis == "x":
140140
mesh = pygfx.Mesh(
141141
pygfx.box_geometry(1, size, 1),
142-
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color)),
142+
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color), pick_write=True),
143143
)
144144

145145
elif axis == "y":
146146
mesh = pygfx.Mesh(
147147
pygfx.box_geometry(size, 1, 1),
148-
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color)),
148+
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color), pick_write=True),
149149
)
150150
else:
151151
raise ValueError("`axis` must be one of 'x' or 'y'")
@@ -169,7 +169,9 @@ def __init__(
169169

170170
left_line = pygfx.Line(
171171
pygfx.Geometry(positions=left_line_data),
172-
pygfx.LineMaterial(thickness=edge_thickness, color=edge_color),
172+
pygfx.LineMaterial(
173+
thickness=edge_thickness, color=edge_color, pick_write=True
174+
),
173175
)
174176

175177
# position data for the right edge line
@@ -182,7 +184,9 @@ def __init__(
182184

183185
right_line = pygfx.Line(
184186
pygfx.Geometry(positions=right_line_data),
185-
pygfx.LineMaterial(thickness=edge_thickness, color=edge_color),
187+
pygfx.LineMaterial(
188+
thickness=edge_thickness, color=edge_color, pick_write=True
189+
),
186190
)
187191

188192
self.edges: Tuple[pygfx.Line, pygfx.Line] = (left_line, right_line)
@@ -198,7 +202,9 @@ def __init__(
198202

199203
bottom_line = pygfx.Line(
200204
pygfx.Geometry(positions=bottom_line_data),
201-
pygfx.LineMaterial(thickness=edge_thickness, color=edge_color),
205+
pygfx.LineMaterial(
206+
thickness=edge_thickness, color=edge_color, pick_write=True
207+
),
202208
)
203209

204210
# position data for the right edge line
@@ -211,7 +217,9 @@ def __init__(
211217

212218
top_line = pygfx.Line(
213219
pygfx.Geometry(positions=top_line_data),
214-
pygfx.LineMaterial(thickness=edge_thickness, color=edge_color),
220+
pygfx.LineMaterial(
221+
thickness=edge_thickness, color=edge_color, pick_write=True
222+
),
215223
)
216224

217225
self.edges: Tuple[pygfx.Line, pygfx.Line] = (bottom_line, top_line)

‎fastplotlib/graphics/selectors/_polygon.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/selectors/_polygon.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def _add_segment(self, ev):
7171
new_line = pygfx.Line(
7272
geometry=pygfx.Geometry(positions=data.astype(np.float32)),
7373
material=pygfx.LineMaterial(
74-
thickness=self.edge_width, color=pygfx.Color(self.edge_color)
74+
thickness=self.edge_width,
75+
color=pygfx.Color(self.edge_color),
76+
pick_write=True,
7577
),
7678
)
7779

@@ -126,7 +128,9 @@ def _finish_polygon(self, ev):
126128
new_line = pygfx.Line(
127129
geometry=pygfx.Geometry(positions=data.astype(np.float32)),
128130
material=pygfx.LineMaterial(
129-
thickness=self.edge_width, color=pygfx.Color(self.edge_color)
131+
thickness=self.edge_width,
132+
color=pygfx.Color(self.edge_color),
133+
pick_write=True,
130134
),
131135
)
132136

‎fastplotlib/graphics/selectors/_rectangle_region.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/selectors/_rectangle_region.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def __init__(
214214

215215
self.fill = pygfx.Mesh(
216216
pygfx.box_geometry(width, height, 1),
217-
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color)),
217+
pygfx.MeshBasicMaterial(color=pygfx.Color(fill_color), pick_write=True),
218218
)
219219

220220
self.fill.position.set(*origin, -2)

‎fastplotlib/graphics/text.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/text.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(
7070
color=face_color,
7171
outline_color=outline_color,
7272
outline_thickness=outline_thickness,
73+
pick_write=True,
7374
),
7475
)
7576

‎fastplotlib/widgets/histogram_lut.py

Copy file name to clipboardExpand all lines: fastplotlib/widgets/histogram_lut.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def __init__(
8080
outline_thickness=1,
8181
)
8282

83+
self._text_vmin.world_object.material.pick_write = False
84+
8385
self._text_vmax = TextGraphic(
8486
text=vmax_str,
8587
size=16,
@@ -89,6 +91,8 @@ def __init__(
8991
outline_thickness=1,
9092
)
9193

94+
self._text_vmax.world_object.material.pick_write = False
95+
9296
widget_wo = Group()
9397
widget_wo.add(
9498
self._histogram_line.world_object,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.