Scrollbar.IndicatorHovered returns false while the scrollbar is being
dragged because Scrollbar.drag is grabbing the pointer while dragging.
Add a new method Dragging and use that. This would allow us to render
the indicator differently for hovering and dragging, but for now we just
draw it as hovered while it's being dragged.
Signed-off-by: Dominik Honnef <dominik@honnef.co>
---
widget/list.go | 8 +++++++-widget/material/list.go | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/widget/list.go b/widget/list.go
index ae395736..9c442943 100644
--- a/widget/list.go+++ b/widget/list.go
@@ -163,7 +163,8 @@ func (s *Scrollbar) AddDrag(ops *op.Ops) {
}
// IndicatorHovered returns whether the scroll indicator is currently being
-// hovered by the pointer.+// hovered by the pointer. Note that this returns false while the scrollbar+// is being dragged.
// List holds the persistent state for a layout.List that has a
// scrollbar attached.
type List struct {
diff --git a/widget/material/list.go b/widget/material/list.go
index 81a7c984..cc1a2b01 100644
--- a/widget/material/list.go+++ b/widget/material/list.go
@@ -126,7 +126,7 @@ func (s ScrollbarStyle) Layout(gtx layout.Context, axis layout.Axis, viewportSta
s.Scrollbar.Layout(gtx, axis, viewportStart, viewportEnd)
// Darken indicator if hovered.
- if s.Scrollbar.IndicatorHovered() {+ if s.Scrollbar.IndicatorHovered() || s.Scrollbar.Dragging() {