Skip to content

Conversation

@mikenye
Copy link
Contributor

@mikenye mikenye commented May 2, 2025

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

  • When a container is collapsed, we now calculate a collapsedBounds rectangle that excludes the body area by subtracting BodyBounds.Dy() from the bottom of the window.
  • We use this collapsedBounds to determine whether the pointer is hovering over a collapsed window’s visible area (i.e. just the title bar).
  • This ensures InputCapturingStateHover reflects only what is actually visible.
Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

mikenye added 2 commits May 2, 2025 10:59
 - Make code "Hajime-spec" :-)
 - Make code "Hajime-spec" :-)
context.go Outdated
for _, cnt := range c.rootContainers {
bounds := cnt.layout.Bounds
if cnt.collapsed {
bounds.Max.Y -= cnt.layout.BodyBounds.Dy()
Copy link
Member

@hajimehoshi hajimehoshi May 2, 2025

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 1733713

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@hajimehoshi hajimehoshi merged commit 6ec5151 into ebitengine:main May 2, 2025
6 checks passed
@mikenye mikenye deleted the fix_issue_34 branch May 2, 2025 03:18
hajimehoshi pushed a commit that referenced this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants