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 1f54d31

Browse filesBrowse files
committed
line slider works, not gc but not necessary for now
1 parent a05229c commit 1f54d31
Copy full SHA for 1f54d31

File tree

Expand file treeCollapse file tree

2 files changed

+10
-9
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-9
lines changed

‎fastplotlib/graphics/line_slider.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/line_slider.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(
7474
else:
7575
material = pygfx.LineMaterial
7676

77-
colors_inner = np.repeat([Color("w")], 2, axis=0).astype(np.float32)
77+
colors_inner = np.repeat([Color(color)], 2, axis=0).astype(np.float32)
7878
colors_outer = np.repeat([Color([1., 1., 1., 0.25])], 2, axis=0).astype(np.float32)
7979

8080
line_inner = pygfx.Line(
@@ -88,17 +88,19 @@ def __init__(
8888
material=material(thickness=thickness + 4, vertex_colors=True)
8989
)
9090

91-
self._world_object = pygfx.Group()
91+
world_object = pygfx.Group()
9292

93-
self._world_object.add(line_outer)
94-
self._world_object.add(line_inner)
93+
world_object.add(line_outer)
94+
world_object.add(line_inner)
95+
96+
self._set_world_object(world_object)
9597

9698
self.position.x = x_pos
9799

98100
self.slider = slider
99101
self.slider.observe(self.set_position, "value")
100102

101-
self.name = name
103+
super().__init__(name=name)
102104

103105
def set_position(self, change):
104106
self.position.x = change["new"]

‎fastplotlib/layouts/_base.py

Copy file name to clipboardExpand all lines: fastplotlib/layouts/_base.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,13 @@ def add_graphic(self, graphic: Graphic, center: bool = True):
186186
if graphic.name is not None: # skip for those that have no name
187187
self._check_graphic_name_exists(graphic.name)
188188

189-
# store in GRAPHICS dict
190-
loc = graphic.loc
191-
GRAPHICS[loc] = graphic
192-
193189
# TODO: need to refactor LineSlider entirely
194190
if isinstance(graphic, LineSlider):
195191
self._sliders.append(graphic) # don't manage garbage collection of LineSliders for now
196192
else:
193+
# store in GRAPHICS dict
194+
loc = graphic.loc
195+
GRAPHICS[loc] = graphic
197196
self._graphics.append(loc) # add hex id string for referencing this graphic instance
198197

199198
# add world object to scene

0 commit comments

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