| 64 | } |
| 65 | |
| 66 | export function isGesture(eventOrGestureName: string): boolean { |
| 67 | // Not sure whether this trimming and lowercasing is still needed in practice |
| 68 | // (all Core tests pass without it), so worth revisiting in future. I think |
| 69 | // this is used exclusively by the XML flavour, and my best guess is that |
| 70 | // maybe it's to handle how getEventOrGestureName("onTap") might pass "Tap" |
| 71 | // into this. |
| 72 | const t = eventOrGestureName.trim().toLowerCase(); |
| 73 | |
| 74 | // Would be nice to have a convenience function for getting all GestureState |
| 75 | // names in `gestures-common.ts`, but when I tried introducing it, it created |
| 76 | // a circular dependency that crashed the automated tests app. |
| 77 | return t === 'tap' || t === 'doubletap' || t === 'pinch' || t === 'pan' || t === 'swipe' || t === 'rotation' || t === 'longpress' || t === 'touch'; |
| 78 | } |
| 79 | |
| 80 | // TODO: Make this instance function so that we dont need public static tapEvent = "tap" |
| 81 | // in controls. They will just override this one and provide their own event support. |