diff --git a/gesture/gesture.go b/gesture/gesture.go index 189b86a2..df4df32c 100644 --- a/gesture/gesture.go +++ b/gesture/gesture.go @@ -368,6 +368,9 @@ func (d *Drag) Events(cfg unit.Metric, q event.Queue, axis Axis) []pointer.Event return events } +// Dragging reports whether it's currently in use. +func (d *Drag) Dragging() bool { return d.dragging } + func (a Axis) String() string { switch a { case Horizontal: diff --git a/widget/float.go b/widget/float.go index a439f325..8d21c681 100644 --- a/widget/float.go +++ b/widget/float.go @@ -21,6 +21,9 @@ type Float struct { changed bool } +// Dragging returns whether the value is being interacted with. +func (f *Float) Dragging() bool { return f.drag.Dragging() } + // Layout processes events. func (f *Float) Layout(gtx layout.Context, pointerMargin int, min, max float32) layout.Dimensions { size := gtx.Constraints.Min