Commit c2916f47 authored by Kris Giesing's avatar Kris Giesing

Add assertions to tap recognizer

parent 709b3550
...@@ -112,7 +112,7 @@ class TapGesture extends TapTracker { ...@@ -112,7 +112,7 @@ class TapGesture extends TapTracker {
} }
void cancel() { void cancel() {
// If we won the arena already, then _entry is resolved, so resolving // If we won the arena already, then entry is resolved, so resolving
// again is a no-op. But we still need to clean up our own state. // again is a no-op. But we still need to clean up our own state.
if (_wonArena) if (_wonArena)
reject(); reject();
...@@ -138,6 +138,7 @@ class TapGestureRecognizer extends DisposableArenaMember { ...@@ -138,6 +138,7 @@ class TapGestureRecognizer extends DisposableArenaMember {
Map<int, TapGesture> _gestureMap = new Map<int, TapGesture>(); Map<int, TapGesture> _gestureMap = new Map<int, TapGesture>();
void addPointer(PointerInputEvent event) { void addPointer(PointerInputEvent event) {
assert(!_gestureMap.containsKey(event.pointer));
_gestureMap[event.pointer] = new TapGesture( _gestureMap[event.pointer] = new TapGesture(
gestureRecognizer: this, gestureRecognizer: this,
event: event event: event
...@@ -147,10 +148,12 @@ class TapGestureRecognizer extends DisposableArenaMember { ...@@ -147,10 +148,12 @@ class TapGestureRecognizer extends DisposableArenaMember {
} }
void acceptGesture(int pointer) { void acceptGesture(int pointer) {
assert(_gestureMap.containsKey(pointer));
_gestureMap[pointer]?.accept(); _gestureMap[pointer]?.accept();
} }
void rejectGesture(int pointer) { void rejectGesture(int pointer) {
assert(_gestureMap.containsKey(pointer));
_gestureMap[pointer]?.reject(); _gestureMap[pointer]?.reject();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment