-
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
Fix: Non-resizable Area
s now ignore mouse input outside their bounds
#3039
Conversation
As described in emilk#576, the function `Memory::layer_id_at` expands the hit-testing region for every `Area` slightly. This is necessary so that, when the user clicks to resize a `Window`, the mouse input isn't routed to a different `Window`. For non-resizable `Area`s (such as dropdown menus, context menus, date pickers, and any non-resizable `Window`), this causes them to be surrounded by a "dead zone" where any underlying widgets can't be hovered or clicked. The effect is particularly noticeable in menu bars. This commit adds a persisted `edges_padded_for_resize` property to `Area`, which is `true` when the `Area` belongs to a resizable `Window` and `false` for all other `Area`s. The hit-testing region is only expanded when this property is `true`.
I'm a little uneasy about my approach here, because it forces |
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.
It's a bit hacky I agree, but I fail to see any obviously better way
I'm not sure why the CI isn't kicking in. Perhaps try merging in latest |
Area
s now ignore mouse input outside their bounds
For instance: `Window::new(…).resizable([true, false])` is a window that is only resizable in the horizontal direction. This PR also removes a hack added in emilk#3039 which is no longer needed since emilk#4026
As described in #576, the method
Memory::layer_id_at
expands the hit-testing region for everyArea
slightly. This is necessary so that, when the user clicks to resize aWindow
, the mouse input isn't routed to a differentWindow
.For non-resizable
Area
s (such as dropdown menus, context menus, date pickers, and any non-resizableWindow
), this causes them to be surrounded by a "dead zone" where any underlying widgets can't be hovered or clicked. The effect is particularly noticeable in menu bars.This commit adds a persisted
edges_padded_for_resize
property toArea
, which istrue
when theArea
belongs to a resizableWindow
andfalse
for all otherArea
s. The hit-testing region is only expanded when this property istrue
.