-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent UI events from propagating beyond imgui #569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the general approach is good. I made a few comments.
We should also document this as part of the jupyter_rfb event spec, but I can do that later.
Yay! Related: pygfx/pygfx#832 Nice that this PR seems to fix it in a general way |
Updated. :) |
If not, I'm fine with merging this. |
We need to provide a way to control the priority order of UI event propagation. For example, we would generally expect Imgui's event handler to be at the front of the queue. However, we cannot guarantee the order in which users initialize the ImguiRenderer and Pygfx Renderer, so we cannot control the insertion order in which the event handlers are added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I can't think of a better way to control the order.
We can merge this before #573, so it ends up in the 0.17 release. Otherwise it will be part of a next release, which is also fine.
After a UI event is handled by imgui, we generally don't want the event to be further processed by subsequent handlers (e.g., Pygfx).
For instance, in the following case, it is quite inconvenient
1.mp4
This PR allows imgui to capture canvas UI events and prevent them from further propagation, as shown below:
2.mp4
PS: The implementation might be a bit hacky, 😅 , and I’d be happy to hear your thoughts or suggestions.