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
@@ -53,7 +53,11 @@ func (d *Draggable) Dragging() bool {
// requested to offer data, if any
func (d *Draggable) Update(gtx layout.Context) (mime string, requested bool) {
pos := d.pos
for _, ev := range d.drag.Update(gtx.Metric, gtx.Source, gesture.Both) {
for {
ev, ok := d.drag.Update(gtx.Metric, gtx.Source, gesture.Both)
if !ok {
break
}
switch ev.Kind {
case pointer.Press:
d.click = ev.Position