Skip to content

Commit 4acbbd7

Browse files
committed
debugui: refactoring
1 parent 1dd6dae commit 4acbbd7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

widget.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package debugui
55

66
import (
77
"image"
8+
"slices"
89
)
910

1011
// WidgetID is a unique identifier for a widget.
@@ -32,18 +33,9 @@ const (
3233
optionExpanded
3334
)
3435

35-
func (c *Context) inHoverRoot() bool {
36-
for i := len(c.containerStack) - 1; i >= 0; i-- {
37-
if c.containerStack[i] == c.hoverRoot {
38-
return true
39-
}
40-
}
41-
return false
42-
}
43-
4436
func (c *Context) pointingOver(bounds image.Rectangle) bool {
4537
p := c.pointingPosition()
46-
return p.In(bounds) && p.In(c.clipRect()) && c.inHoverRoot()
38+
return p.In(bounds) && p.In(c.clipRect()) && slices.Contains(c.containerStack, c.hoverRoot)
4739
}
4840

4941
func (c *Context) pointingDelta() image.Point {

0 commit comments

Comments
 (0)