-
Notifications
You must be signed in to change notification settings - Fork 2
Update InputCapturingStateHover calculation to support collapsed panels #35
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
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.
Thanks!
- Make code "Hajime-spec" :-)
- Make code "Hajime-spec" :-)
context.go
Outdated
@@ -96,6 +96,10 @@ func (c *Context) update(f func(ctx *Context) error) (inputCapturingState InputC | |||
// Check whether the cursor is on any of the root containers. | |||
pt := c.pointingPosition() | |||
for _, cnt := range c.rootContainers { | |||
bounds := cnt.layout.Bounds | |||
if cnt.collapsed { | |||
bounds.Max.Y -= cnt.layout.BodyBounds.Dy() |
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.
bounds.Max.Y = cnt.layout.BodyBounds.Min.Y
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.
Updated in 1733713
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.
LGTM, thanks!
Resolves #34 by updating InputCapturingStateHover calculation to support collapsed panels.
This PR fixes an issue where
InputCapturingStateHover
could still be returned for a collapsed window.Problem
When a debug UI window is collapsed, the full
layout.Bounds
was still being checked for pointer containment. This meant that even when only the title bar was visible,InputCapturingStateHover
would be set if the pointer was anywhere in the (now-hidden) body area.Fix
collapsedBounds
rectangle that excludes the body area by subtractingBodyBounds.Dy()
from the bottom of the window.collapsedBounds
to determine whether the pointer is hovering over a collapsed window’s visible area (i.e. just the title bar).InputCapturingStateHover
reflects only what is actually visible.