gesture: report one event at a time

Events are now delivered one at a time, and this change makes the
corresponding change to gestures.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-11-25 16:38:48 -06:00
parent ab9f42c820
commit 8e209fd2eb
9 changed files with 82 additions and 36 deletions
+5 -1
View File
@@ -48,7 +48,11 @@ func (f *Float) Layout(gtx layout.Context, axis layout.Axis, pointerMargin unit.
// The range of f is set by the minimum constraints main axis value.
func (f *Float) Update(gtx layout.Context) bool {
changed := false
for _, e := range f.drag.Update(gtx.Metric, gtx.Source, gesture.Axis(f.axis)) {
for {
e, ok := f.drag.Update(gtx.Metric, gtx.Source, gesture.Axis(f.axis))
if !ok {
break
}
if f.length > 0 && (e.Kind == pointer.Press || e.Kind == pointer.Drag) {
pos := e.Position.X
if f.axis == layout.Vertical {