Use correct pointer shape for hyperlinks

This commit is contained in:
Kovid Goyal
2024-05-07 12:26:28 +05:30
parent 96f8dbbbeb
commit 27a2e3c488
2 changed files with 11 additions and 0 deletions

View File

@@ -493,6 +493,8 @@ func (self *Loop) PopPointerShape() {
}
}
// Remove all pointer shapes from the shape stack resetting to default pointer
// shape. This is called automatically on loop termination.
func (self *Loop) ClearPointerShapes() (ans []PointerShape) {
ans = self.pointer_shapes
for i := len(self.pointer_shapes) - 1; i >= 0; i-- {

View File

@@ -289,11 +289,20 @@ func (m *MouseState) ApplyHoverStyles(lp *loop.Loop, style ...string) {
} else {
hs = style[0]
}
is_hovered := false
for id := range m.hovered_ids.Iterable() {
for _, r := range m.region_id_map[id] {
lp.StyleRegion(hs, r.TopLeft.X, r.TopLeft.Y, r.BottomRight.X, r.BottomRight.Y)
is_hovered = true
}
}
if is_hovered {
if s, has := lp.CurrentPointerShape(); !has || s != loop.POINTER_POINTER {
lp.PushPointerShape(loop.POINTER_POINTER)
}
} else {
lp.ClearPointerShapes()
}
}
func (m *MouseState) ClickHoveredRegions() error {