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 0cbe368

Browse filesBrowse files
committed
bugfix pygfx events triggered by worldobject
1 parent 5a084c0 commit 0cbe368
Copy full SHA for 0cbe368

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎fastplotlib/graphics/_base.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/_base.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,13 @@ def _event_handler(self, event):
232232

233233
# for now we only have line collections so this works
234234
else:
235-
for i, item in enumerate(self._graphics):
236-
if item.world_object is event.pick_info["world_object"]:
235+
# get index of world object that made this event
236+
for i, item in enumerate(self.graphics):
237+
wo = WORLD_OBJECTS[item.loc]
238+
# we only store hex id of worldobject, but worldobject `pick_info` is always the real object
239+
# so if pygfx worldobject triggers an event by itself, such as `click`, etc., this will be
240+
# the real world object in the pick_info and not the proxy
241+
if wo is event.pick_info["world_object"]:
237242
indices = i
238243
target_info.target._set_feature(feature=target_info.feature, new_data=target_info.new_data, indices=indices)
239244
else:

0 commit comments

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