-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow overlapping interactive widgets #2244
Conversation
@emilk This PR introduces a usability issue for use-case: If a scroll area has interactive widgets such as buttons which occupy majority of available space then, because those end up being places after the scrolling interactivity (in content function) and therefore steal interaction, it is impossible to actually scroll. use-case: text-editor filling the entirety of a scroll area. When clicking on the text editing space the editing starts working but it is impossible to scroll with the finger when dragging the text editor. I am currently trying to figure out a solution/workaround and the only possible solution I imagine is to use |
This reverts commit d5eb877.
edit: never mind. I fixed it by using original comment:
I am exactly in this situation. What is the workaround to still allow that? Basically my scenario is: I have a some kind of graph with nodes represented as boxes which can have What was the rationale behind that change? I can't see the benefit of not allowing it any more. Note: example of crate that is broken: |
Issue in 0.20 because of emilk/egui#2244
Closes #980
By interactive widget, I mean any widget with
Sense::click
orSense::drag
(or both).This design is based on the idea that the latest added (which usually mean the top-most) widget gets the interaction.
For instance: say you have a big interactive canvas and on top of that put some widgets. If you hover the widgets, they get all the input. If you hover the canvas outside of the widgets, the canvas gets the input.
This is done by storing where all interactive widgets are, frame-to-frame. When a new interactive widget is added, we check if there is anything interactive above it (=added later in the previous frame), and if there is, the first widget gets
hovered=false
.This change required some changes to
ScrollArea
,Area
andWindow
to make sure they were properly layering interaction back-to-front.There may be other looming bugs I haven't found yet.
Most user code should be unaffected, unless the user has added layers of interaction on top of each other.
You can visualize this using
style.debug.show_blocking_widget
andstyle.debug.show_interactive_widgets
.