From 4206d7fe5cf450fbc1f9a16e8d57b85c08df3dab Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 17 Jun 2025 11:43:34 -0500 Subject: make input events consumable Having a input queue of consumable input events allow widgets to prevent the further handling of the same event by different collections by consuming the event. --- go/ui/touchManager.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'go/ui/touchManager.go') diff --git a/go/ui/touchManager.go b/go/ui/touchManager.go index cedff82c..ef4448d5 100644 --- a/go/ui/touchManager.go +++ b/go/ui/touchManager.go @@ -49,6 +49,14 @@ type TouchInput struct { Taps []Tap } +func (t *TouchInput) consumeTap(i int) { + if len(t.Taps) == 1 { + t.Taps = []Tap{} + } else { + t.Taps[i] = t.Taps[len(t.Taps)-1] + } +} + var ( TouchManager *TouchInput ) -- cgit v1.2.3