react-native-gesture-handler 2.26.0 → 2.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/android/src/main/jni/CMakeLists.txt +7 -26
- package/lib/commonjs/components/Pressable/Pressable.js +139 -188
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/Pressable/StateMachine.js +38 -0
- package/lib/commonjs/components/Pressable/StateMachine.js.map +1 -0
- package/lib/commonjs/components/Pressable/stateDefinitions.js +88 -0
- package/lib/commonjs/components/Pressable/stateDefinitions.js.map +1 -0
- package/lib/commonjs/components/Pressable/utils.js +1 -1
- package/lib/commonjs/components/Pressable/utils.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +12 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +3 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +3 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +3 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +6 -6
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +24 -33
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +15 -17
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +12 -11
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +1 -1
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +141 -190
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/Pressable/StateMachine.js +34 -0
- package/lib/module/components/Pressable/StateMachine.js.map +1 -0
- package/lib/module/components/Pressable/stateDefinitions.js +83 -0
- package/lib/module/components/Pressable/stateDefinitions.js.map +1 -0
- package/lib/module/components/Pressable/utils.js +1 -1
- package/lib/module/components/Pressable/utils.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +13 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +3 -1
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +3 -0
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +3 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +6 -6
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +24 -33
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +15 -17
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +1 -1
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +12 -11
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/Vector.js +1 -1
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +0 -1
- package/lib/typescript/ActionType.js +6 -0
- package/lib/typescript/Directions.d.ts +0 -1
- package/lib/typescript/Directions.js +18 -0
- package/lib/typescript/EnableNewWebImplementation.d.ts +0 -1
- package/lib/typescript/EnableNewWebImplementation.js +30 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +0 -1
- package/lib/typescript/GestureHandlerRootViewContext.js +2 -0
- package/lib/typescript/PlatformConstants.d.ts +0 -1
- package/lib/typescript/PlatformConstants.js +3 -0
- package/lib/typescript/PlatformConstants.web.d.ts +0 -1
- package/lib/typescript/PlatformConstants.web.js +5 -0
- package/lib/typescript/PointerType.d.ts +0 -1
- package/lib/typescript/PointerType.js +8 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +0 -1
- package/lib/typescript/RNGestureHandlerModule.js +4 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -1
- package/lib/typescript/RNGestureHandlerModule.web.js +92 -0
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +0 -1
- package/lib/typescript/RNGestureHandlerModule.windows.js +47 -0
- package/lib/typescript/RNRenderer.d.ts +0 -1
- package/lib/typescript/RNRenderer.js +3 -0
- package/lib/typescript/RNRenderer.web.d.ts +0 -1
- package/lib/typescript/RNRenderer.web.js +3 -0
- package/lib/typescript/State.d.ts +0 -1
- package/lib/typescript/State.js +9 -0
- package/lib/typescript/TouchEventType.d.ts +0 -1
- package/lib/typescript/TouchEventType.js +7 -0
- package/lib/typescript/components/DrawerLayout.d.ts +0 -1
- package/lib/typescript/components/DrawerLayout.js +417 -0
- package/lib/typescript/components/GestureButtons.d.ts +0 -1
- package/lib/typescript/components/GestureButtons.js +165 -0
- package/lib/typescript/components/GestureButtonsProps.d.ts +0 -1
- package/lib/typescript/components/GestureButtonsProps.js +1 -0
- package/lib/typescript/components/GestureComponents.d.ts +0 -1
- package/lib/typescript/components/GestureComponents.js +67 -0
- package/lib/typescript/components/GestureComponents.web.d.ts +0 -1
- package/lib/typescript/components/GestureComponents.web.js +21 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +0 -1
- package/lib/typescript/components/GestureHandlerButton.js +2 -0
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -1
- package/lib/typescript/components/GestureHandlerButton.web.js +3 -0
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +0 -1
- package/lib/typescript/components/GestureHandlerRootView.android.js +17 -0
- package/lib/typescript/components/GestureHandlerRootView.d.ts +0 -1
- package/lib/typescript/components/GestureHandlerRootView.js +16 -0
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +0 -1
- package/lib/typescript/components/GestureHandlerRootView.web.js +11 -0
- package/lib/typescript/components/Pressable/Pressable.d.ts +1 -3
- package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/Pressable.js +231 -0
- package/lib/typescript/components/Pressable/PressableProps.d.ts +15 -2
- package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/PressableProps.js +1 -0
- package/lib/typescript/components/Pressable/StateMachine.d.ts +14 -0
- package/lib/typescript/components/Pressable/StateMachine.d.ts.map +1 -0
- package/lib/typescript/components/Pressable/StateMachine.js +34 -0
- package/lib/typescript/components/Pressable/index.d.ts +0 -1
- package/lib/typescript/components/Pressable/index.js +1 -0
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts +9 -0
- package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -0
- package/lib/typescript/components/Pressable/stateDefinitions.js +104 -0
- package/lib/typescript/components/Pressable/utils.d.ts +3 -7
- package/lib/typescript/components/Pressable/utils.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/utils.js +80 -0
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +0 -1
- package/lib/typescript/components/ReanimatedDrawerLayout.js +364 -0
- package/lib/typescript/components/ReanimatedSwipeable.d.ts +0 -1
- package/lib/typescript/components/ReanimatedSwipeable.js +400 -0
- package/lib/typescript/components/Swipeable.d.ts +0 -1
- package/lib/typescript/components/Swipeable.js +287 -0
- package/lib/typescript/components/Text.d.ts +0 -1
- package/lib/typescript/components/Text.js +38 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +0 -1
- package/lib/typescript/components/gestureHandlerRootHOC.js +18 -0
- package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +0 -1
- package/lib/typescript/components/touchables/ExtraButtonProps.js +1 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -1
- package/lib/typescript/components/touchables/GenericTouchable.js +221 -0
- package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +0 -1
- package/lib/typescript/components/touchables/GenericTouchableProps.js +1 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableHighlight.js +75 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.js +65 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.js +6 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.js +1 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableOpacity.js +51 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -1
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.js +10 -0
- package/lib/typescript/components/touchables/index.d.ts +0 -1
- package/lib/typescript/components/touchables/index.js +4 -0
- package/lib/typescript/components/utils.d.ts +0 -1
- package/lib/typescript/components/utils.js +11 -0
- package/lib/typescript/findNodeHandle.d.ts +0 -1
- package/lib/typescript/findNodeHandle.js +2 -0
- package/lib/typescript/findNodeHandle.web.d.ts +0 -1
- package/lib/typescript/findNodeHandle.web.js +31 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.js +45 -0
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.web.js +7 -0
- package/lib/typescript/ghQueueMicrotask.d.ts +0 -1
- package/lib/typescript/ghQueueMicrotask.js +7 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/FlingGestureHandler.js +19 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/ForceTouchGestureHandler.js +37 -0
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +3 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts.map +1 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.js +1 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/LongPressGestureHandler.js +22 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.js +20 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/PanGestureHandler.js +128 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/PinchGestureHandler.js +12 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.js +2 -0
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.js +4 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/RotationGestureHandler.js +12 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -1
- package/lib/typescript/handlers/TapGestureHandler.js +26 -0
- package/lib/typescript/handlers/createHandler.d.ts +0 -1
- package/lib/typescript/handlers/createHandler.js +375 -0
- package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -1
- package/lib/typescript/handlers/createNativeWrapper.js +67 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.js +2 -0
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.web.js +4 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -1
- package/lib/typescript/handlers/gestureHandlerCommon.js +42 -0
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +9 -1
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts.map +1 -1
- package/lib/typescript/handlers/gestureHandlerTypesCompat.js +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.js +22 -0
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.js +24 -0
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.js +55 -0
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.js +12 -0
- package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/index.js +114 -0
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.js +18 -0
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/types.js +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.js +54 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.js +137 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.js +48 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.js +35 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.js +32 -0
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector/utils.js +140 -0
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +0 -1
- package/lib/typescript/handlers/gestures/eventReceiver.js +105 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/flingGesture.js +27 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +9 -1
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/forceTouchGesture.js +57 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/gesture.js +303 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +0 -1
- package/lib/typescript/handlers/gestures/gestureComposition.js +78 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +3 -2
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/gestureObjects.js +125 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +0 -1
- package/lib/typescript/handlers/gestures/gestureStateManager.js +60 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +0 -1
- package/lib/typescript/handlers/gestures/gestureStateManager.web.js +19 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/hoverGesture.js +45 -0
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/longPressGesture.js +35 -0
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/manualGesture.js +16 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/nativeGesture.js +24 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/panGesture.js +181 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/pinchGesture.js +27 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +0 -1
- package/lib/typescript/handlers/gestures/reanimatedWrapper.js +23 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/rotationGesture.js +27 -0
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +0 -1
- package/lib/typescript/handlers/gestures/tapGesture.js +72 -0
- package/lib/typescript/handlers/getNextHandlerTag.d.ts +0 -1
- package/lib/typescript/handlers/getNextHandlerTag.js +4 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +0 -1
- package/lib/typescript/handlers/handlersRegistry.js +36 -0
- package/lib/typescript/handlers/utils.d.ts +0 -1
- package/lib/typescript/handlers/utils.js +58 -0
- package/lib/typescript/index.d.ts +0 -1
- package/lib/typescript/index.js +28 -0
- package/lib/typescript/init.d.ts +0 -1
- package/lib/typescript/init.js +15 -0
- package/lib/typescript/jestUtils/index.d.ts +0 -1
- package/lib/typescript/jestUtils/index.js +1 -0
- package/lib/typescript/jestUtils/jestUtils.d.ts +0 -1
- package/lib/typescript/jestUtils/jestUtils.js +290 -0
- package/lib/typescript/mocks.d.ts +0 -1
- package/lib/typescript/mocks.js +59 -0
- package/lib/typescript/mountRegistry.d.ts +0 -1
- package/lib/typescript/mountRegistry.js +29 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +0 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.js +2 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +0 -1
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.js +2 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +0 -1
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.js +2 -0
- package/lib/typescript/typeUtils.d.ts +0 -1
- package/lib/typescript/typeUtils.js +1 -0
- package/lib/typescript/utils.d.ts +0 -1
- package/lib/typescript/utils.js +80 -0
- package/lib/typescript/web/Gestures.d.ts +0 -1
- package/lib/typescript/web/Gestures.js +38 -0
- package/lib/typescript/web/constants.d.ts +0 -1
- package/lib/typescript/web/constants.js +2 -0
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +0 -1
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts.map +1 -1
- package/lib/typescript/web/detectors/RotationGestureDetector.js +122 -0
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +0 -1
- package/lib/typescript/web/detectors/ScaleGestureDetector.js +117 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/FlingGestureHandler.js +133 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/GestureHandler.js +656 -0
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/HoverGestureHandler.js +37 -0
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/IGestureHandler.js +1 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/LongPressGestureHandler.js +136 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/ManualGestureHandler.js +29 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.js +133 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +2 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/PanGestureHandler.js +420 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PinchGestureHandler.js +117 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/RotationGestureHandler.js +122 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -1
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts.map +1 -1
- package/lib/typescript/web/handlers/TapGestureHandler.js +202 -0
- package/lib/typescript/web/interfaces.d.ts +0 -1
- package/lib/typescript/web/interfaces.js +25 -0
- package/lib/typescript/web/tools/CircularBuffer.d.ts +0 -1
- package/lib/typescript/web/tools/CircularBuffer.js +37 -0
- package/lib/typescript/web/tools/EventManager.d.ts +0 -1
- package/lib/typescript/web/tools/EventManager.js +85 -0
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +0 -1
- package/lib/typescript/web/tools/GestureHandlerDelegate.js +1 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +0 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts.map +1 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.js +273 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +0 -1
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.js +169 -0
- package/lib/typescript/web/tools/InteractionManager.d.ts +0 -1
- package/lib/typescript/web/tools/InteractionManager.js +91 -0
- package/lib/typescript/web/tools/KeyboardEventManager.d.ts +0 -1
- package/lib/typescript/web/tools/KeyboardEventManager.js +73 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +0 -1
- package/lib/typescript/web/tools/LeastSquareSolver.js +147 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +0 -1
- package/lib/typescript/web/tools/NodeManager.js +28 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +0 -1
- package/lib/typescript/web/tools/PointerEventManager.js +179 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +3 -4
- package/lib/typescript/web/tools/PointerTracker.d.ts.map +1 -1
- package/lib/typescript/web/tools/PointerTracker.js +161 -0
- package/lib/typescript/web/tools/Vector.d.ts +1 -2
- package/lib/typescript/web/tools/Vector.js +43 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +0 -1
- package/lib/typescript/web/tools/VelocityTracker.js +76 -0
- package/lib/typescript/web/tools/WheelEventManager.d.ts +0 -1
- package/lib/typescript/web/tools/WheelEventManager.js +40 -0
- package/lib/typescript/web/utils.d.ts +0 -1
- package/lib/typescript/web/utils.js +233 -0
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/DiscreteGestureHandler.js +48 -0
- package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/DraggingGestureHandler.js +25 -0
- package/lib/typescript/web_hammer/Errors.d.ts +0 -1
- package/lib/typescript/web_hammer/Errors.js +5 -0
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/FlingGestureHandler.js +119 -0
- package/lib/typescript/web_hammer/GestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/GestureHandler.js +469 -0
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.js +26 -0
- package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/LongPressGestureHandler.js +46 -0
- package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/NativeViewGestureHandler.js +40 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +0 -1
- package/lib/typescript/web_hammer/NodeManager.js +28 -0
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/PanGestureHandler.js +151 -0
- package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/PinchGestureHandler.js +19 -0
- package/lib/typescript/web_hammer/PressGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/PressGestureHandler.js +133 -0
- package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/RotationGestureHandler.js +20 -0
- package/lib/typescript/web_hammer/TapGestureHandler.d.ts +0 -1
- package/lib/typescript/web_hammer/TapGestureHandler.js +142 -0
- package/lib/typescript/web_hammer/constants.d.ts +0 -1
- package/lib/typescript/web_hammer/constants.js +42 -0
- package/lib/typescript/web_hammer/utils.d.ts +0 -1
- package/lib/typescript/web_hammer/utils.js +15 -0
- package/package.json +4 -2
- package/src/components/Pressable/Pressable.tsx +357 -445
- package/src/components/Pressable/PressableProps.tsx +15 -0
- package/src/components/Pressable/StateMachine.tsx +49 -0
- package/src/components/Pressable/stateDefinitions.ts +125 -0
- package/src/components/Pressable/utils.ts +11 -7
- package/src/handlers/GestureHandlerEventPayload.ts +3 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +9 -0
- package/src/handlers/gestures/forceTouchGesture.ts +9 -0
- package/src/handlers/gestures/gestureObjects.ts +3 -1
- package/src/web/detectors/RotationGestureDetector.ts +4 -0
- package/src/web/handlers/FlingGestureHandler.ts +4 -0
- package/src/web/handlers/GestureHandler.ts +9 -3
- package/src/web/handlers/PanGestureHandler.ts +25 -36
- package/src/web/handlers/TapGestureHandler.ts +14 -19
- package/src/web/tools/GestureHandlerOrchestrator.ts +1 -0
- package/src/web/tools/PointerEventManager.ts +1 -1
- package/src/web/tools/PointerTracker.ts +17 -15
- package/src/web/tools/Vector.ts +1 -1
@@ -0,0 +1,122 @@
|
|
1
|
+
import { EventTypes } from '../interfaces';
|
2
|
+
export default class RotationGestureDetector {
|
3
|
+
onRotationBegin;
|
4
|
+
onRotation;
|
5
|
+
onRotationEnd;
|
6
|
+
currentTime = 0;
|
7
|
+
previousTime = 0;
|
8
|
+
previousAngle = 0;
|
9
|
+
_rotation = 0;
|
10
|
+
_anchorX = 0;
|
11
|
+
_anchorY = 0;
|
12
|
+
isInProgress = false;
|
13
|
+
keyPointers = [NaN, NaN];
|
14
|
+
constructor(callbacks) {
|
15
|
+
this.onRotationBegin = callbacks.onRotationBegin;
|
16
|
+
this.onRotation = callbacks.onRotation;
|
17
|
+
this.onRotationEnd = callbacks.onRotationEnd;
|
18
|
+
}
|
19
|
+
updateCurrent(event, tracker) {
|
20
|
+
this.previousTime = this.currentTime;
|
21
|
+
this.currentTime = event.time;
|
22
|
+
const [firstPointerID, secondPointerID] = this.keyPointers;
|
23
|
+
const firstPointerCoords = tracker.getLastAbsoluteCoords(firstPointerID);
|
24
|
+
const secondPointerCoords = tracker.getLastAbsoluteCoords(secondPointerID);
|
25
|
+
if (!firstPointerCoords || !secondPointerCoords) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
const vectorX = secondPointerCoords.x - firstPointerCoords.x;
|
29
|
+
const vectorY = secondPointerCoords.y - firstPointerCoords.y;
|
30
|
+
this._anchorX = (firstPointerCoords.x + secondPointerCoords.x) / 2;
|
31
|
+
this._anchorY = (firstPointerCoords.y + secondPointerCoords.y) / 2;
|
32
|
+
// Angle diff should be positive when rotating in clockwise direction
|
33
|
+
const angle = -Math.atan2(vectorY, vectorX);
|
34
|
+
this._rotation = Number.isNaN(this.previousAngle)
|
35
|
+
? 0
|
36
|
+
: this.previousAngle - angle;
|
37
|
+
this.previousAngle = angle;
|
38
|
+
if (this.rotation > Math.PI) {
|
39
|
+
this._rotation -= Math.PI;
|
40
|
+
}
|
41
|
+
else if (this.rotation < -Math.PI) {
|
42
|
+
this._rotation += Math.PI;
|
43
|
+
}
|
44
|
+
if (this.rotation > Math.PI / 2) {
|
45
|
+
this._rotation -= Math.PI;
|
46
|
+
}
|
47
|
+
else if (this.rotation < -Math.PI / 2) {
|
48
|
+
this._rotation += Math.PI;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
finish() {
|
52
|
+
if (!this.isInProgress) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
this.isInProgress = false;
|
56
|
+
this.keyPointers = [NaN, NaN];
|
57
|
+
this.onRotationEnd(this);
|
58
|
+
}
|
59
|
+
setKeyPointers(tracker) {
|
60
|
+
if (this.keyPointers[0] && this.keyPointers[1]) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
const pointerIDs = tracker.trackedPointers.keys();
|
64
|
+
this.keyPointers[0] = pointerIDs.next().value;
|
65
|
+
this.keyPointers[1] = pointerIDs.next().value;
|
66
|
+
}
|
67
|
+
onTouchEvent(event, tracker) {
|
68
|
+
switch (event.eventType) {
|
69
|
+
case EventTypes.DOWN:
|
70
|
+
this.isInProgress = false;
|
71
|
+
break;
|
72
|
+
case EventTypes.ADDITIONAL_POINTER_DOWN:
|
73
|
+
if (this.isInProgress) {
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
this.isInProgress = true;
|
77
|
+
this.previousTime = event.time;
|
78
|
+
this.previousAngle = NaN;
|
79
|
+
this.setKeyPointers(tracker);
|
80
|
+
this.updateCurrent(event, tracker);
|
81
|
+
this.onRotationBegin(this);
|
82
|
+
break;
|
83
|
+
case EventTypes.MOVE:
|
84
|
+
if (!this.isInProgress) {
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
this.updateCurrent(event, tracker);
|
88
|
+
this.onRotation(this);
|
89
|
+
break;
|
90
|
+
case EventTypes.ADDITIONAL_POINTER_UP:
|
91
|
+
if (!this.isInProgress) {
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
if (this.keyPointers.indexOf(event.pointerId) >= 0) {
|
95
|
+
this.finish();
|
96
|
+
}
|
97
|
+
break;
|
98
|
+
case EventTypes.UP:
|
99
|
+
if (this.isInProgress) {
|
100
|
+
this.finish();
|
101
|
+
}
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
return true;
|
105
|
+
}
|
106
|
+
reset() {
|
107
|
+
this.keyPointers = [NaN, NaN];
|
108
|
+
this.isInProgress = false;
|
109
|
+
}
|
110
|
+
get anchorX() {
|
111
|
+
return this._anchorX;
|
112
|
+
}
|
113
|
+
get anchorY() {
|
114
|
+
return this._anchorY;
|
115
|
+
}
|
116
|
+
get rotation() {
|
117
|
+
return this._rotation;
|
118
|
+
}
|
119
|
+
get timeDelta() {
|
120
|
+
return this.currentTime + this.previousTime;
|
121
|
+
}
|
122
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import { DEFAULT_TOUCH_SLOP } from '../constants';
|
2
|
+
import { EventTypes } from '../interfaces';
|
3
|
+
export default class ScaleGestureDetector {
|
4
|
+
onScaleBegin;
|
5
|
+
onScale;
|
6
|
+
onScaleEnd;
|
7
|
+
_focusX;
|
8
|
+
_focusY;
|
9
|
+
_currentSpan;
|
10
|
+
prevSpan;
|
11
|
+
initialSpan;
|
12
|
+
currentTime;
|
13
|
+
prevTime;
|
14
|
+
inProgress = false;
|
15
|
+
spanSlop;
|
16
|
+
minSpan;
|
17
|
+
constructor(callbacks) {
|
18
|
+
this.onScaleBegin = callbacks.onScaleBegin;
|
19
|
+
this.onScale = callbacks.onScale;
|
20
|
+
this.onScaleEnd = callbacks.onScaleEnd;
|
21
|
+
this.spanSlop = DEFAULT_TOUCH_SLOP * 2;
|
22
|
+
this.minSpan = 0;
|
23
|
+
}
|
24
|
+
onTouchEvent(event, tracker) {
|
25
|
+
this.currentTime = event.time;
|
26
|
+
const action = event.eventType;
|
27
|
+
const numOfPointers = tracker.trackedPointersCount;
|
28
|
+
const streamComplete = action === EventTypes.UP ||
|
29
|
+
action === EventTypes.ADDITIONAL_POINTER_UP ||
|
30
|
+
action === EventTypes.CANCEL;
|
31
|
+
if (action === EventTypes.DOWN || streamComplete) {
|
32
|
+
if (this.inProgress) {
|
33
|
+
this.onScaleEnd(this);
|
34
|
+
this.inProgress = false;
|
35
|
+
this.initialSpan = 0;
|
36
|
+
}
|
37
|
+
if (streamComplete) {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
const configChanged = action === EventTypes.DOWN ||
|
42
|
+
action === EventTypes.ADDITIONAL_POINTER_UP ||
|
43
|
+
action === EventTypes.ADDITIONAL_POINTER_DOWN;
|
44
|
+
const pointerUp = action === EventTypes.ADDITIONAL_POINTER_UP;
|
45
|
+
const ignoredPointer = pointerUp
|
46
|
+
? event.pointerId
|
47
|
+
: undefined;
|
48
|
+
// Determine focal point
|
49
|
+
const div = pointerUp ? numOfPointers - 1 : numOfPointers;
|
50
|
+
const coordsSum = tracker.getAbsoluteCoordsSum();
|
51
|
+
const focusX = coordsSum.x / div;
|
52
|
+
const focusY = coordsSum.y / div;
|
53
|
+
// Determine average deviation from focal point
|
54
|
+
let devSumX = 0;
|
55
|
+
let devSumY = 0;
|
56
|
+
tracker.trackedPointers.forEach((value, key) => {
|
57
|
+
if (key === ignoredPointer) {
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
devSumX += Math.abs(value.abosoluteCoords.x - focusX);
|
61
|
+
devSumY += Math.abs(value.abosoluteCoords.y - focusY);
|
62
|
+
});
|
63
|
+
const devX = devSumX / div;
|
64
|
+
const devY = devSumY / div;
|
65
|
+
const spanX = devX * 2;
|
66
|
+
const spanY = devY * 2;
|
67
|
+
const span = Math.hypot(spanX, spanY);
|
68
|
+
// Begin/end events
|
69
|
+
const wasInProgress = this.inProgress;
|
70
|
+
this._focusX = focusX;
|
71
|
+
this._focusY = focusY;
|
72
|
+
if (this.inProgress && (span < this.minSpan || configChanged)) {
|
73
|
+
this.onScaleEnd(this);
|
74
|
+
this.inProgress = false;
|
75
|
+
this.initialSpan = span;
|
76
|
+
}
|
77
|
+
if (configChanged) {
|
78
|
+
this.initialSpan = this.prevSpan = this._currentSpan = span;
|
79
|
+
}
|
80
|
+
if (!this.inProgress &&
|
81
|
+
span >= this.minSpan &&
|
82
|
+
(wasInProgress || Math.abs(span - this.initialSpan) > this.spanSlop)) {
|
83
|
+
this.prevSpan = this._currentSpan = span;
|
84
|
+
this.prevTime = this.currentTime;
|
85
|
+
this.inProgress = this.onScaleBegin(this);
|
86
|
+
}
|
87
|
+
// Handle motion
|
88
|
+
if (action !== EventTypes.MOVE) {
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
this._currentSpan = span;
|
92
|
+
if (this.inProgress && !this.onScale(this)) {
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
this.prevSpan = this.currentSpan;
|
96
|
+
this.prevTime = this.currentTime;
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
calculateScaleFactor(numOfPointers) {
|
100
|
+
if (numOfPointers < 2) {
|
101
|
+
return 1;
|
102
|
+
}
|
103
|
+
return this.prevSpan > 0 ? this.currentSpan / this.prevSpan : 1;
|
104
|
+
}
|
105
|
+
get currentSpan() {
|
106
|
+
return this._currentSpan;
|
107
|
+
}
|
108
|
+
get focusX() {
|
109
|
+
return this._focusX;
|
110
|
+
}
|
111
|
+
get focusY() {
|
112
|
+
return this._focusY;
|
113
|
+
}
|
114
|
+
get timeDelta() {
|
115
|
+
return this.currentTime - this.prevTime;
|
116
|
+
}
|
117
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FlingGestureHandler.d.ts","sourceRoot":"","sources":["../../../../src/web/handlers/FlingGestureHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAa9C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,cAAc;IAC7D,OAAO,CAAC,wBAAwB,CAAsC;IACtE,OAAO,CAAC,SAAS,CAAi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IAKzD,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAOhD,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAKpD,OAAO,CAAC,IAAI;IAQL,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,SAAS,CAAC,WAAW,IAAI,IAAI;CAK9B"}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import { State } from '../../State';
|
2
|
+
import { DiagonalDirections, Directions } from '../../Directions';
|
3
|
+
import GestureHandler from './GestureHandler';
|
4
|
+
import Vector from '../tools/Vector';
|
5
|
+
import { coneToDeviation } from '../utils';
|
6
|
+
const DEFAULT_MAX_DURATION_MS = 800;
|
7
|
+
const DEFAULT_MIN_VELOCITY = 700;
|
8
|
+
const DEFAULT_ALIGNMENT_CONE = 30;
|
9
|
+
const DEFAULT_DIRECTION = Directions.RIGHT;
|
10
|
+
const DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;
|
11
|
+
const AXIAL_DEVIATION_COSINE = coneToDeviation(DEFAULT_ALIGNMENT_CONE);
|
12
|
+
const DIAGONAL_DEVIATION_COSINE = coneToDeviation(90 - DEFAULT_ALIGNMENT_CONE);
|
13
|
+
export default class FlingGestureHandler extends GestureHandler {
|
14
|
+
numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;
|
15
|
+
direction = DEFAULT_DIRECTION;
|
16
|
+
maxDurationMs = DEFAULT_MAX_DURATION_MS;
|
17
|
+
minVelocity = DEFAULT_MIN_VELOCITY;
|
18
|
+
delayTimeout;
|
19
|
+
maxNumberOfPointersSimultaneously = 0;
|
20
|
+
keyPointer = NaN;
|
21
|
+
updateGestureConfig({ enabled = true, ...props }) {
|
22
|
+
super.updateGestureConfig({ enabled: enabled, ...props });
|
23
|
+
if (this.config.direction) {
|
24
|
+
this.direction = this.config.direction;
|
25
|
+
}
|
26
|
+
if (this.config.numberOfPointers) {
|
27
|
+
this.numberOfPointersRequired = this.config.numberOfPointers;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
startFling() {
|
31
|
+
this.begin();
|
32
|
+
this.maxNumberOfPointersSimultaneously = 1;
|
33
|
+
this.delayTimeout = setTimeout(() => this.fail(), this.maxDurationMs);
|
34
|
+
}
|
35
|
+
tryEndFling() {
|
36
|
+
const velocityVector = Vector.fromVelocity(this.tracker, this.keyPointer);
|
37
|
+
if (!velocityVector) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
const getAlignment = (direction, minimalAlignmentCosine) => {
|
41
|
+
return ((direction & this.direction) === direction &&
|
42
|
+
velocityVector.isSimilar(Vector.fromDirection(direction), minimalAlignmentCosine));
|
43
|
+
};
|
44
|
+
const axialDirectionsList = Object.values(Directions);
|
45
|
+
const diagonalDirectionsList = Object.values(DiagonalDirections);
|
46
|
+
// List of alignments to all activated directions
|
47
|
+
const axialAlignmentList = axialDirectionsList.map((direction) => getAlignment(direction, AXIAL_DEVIATION_COSINE));
|
48
|
+
const diagonalAlignmentList = diagonalDirectionsList.map((direction) => getAlignment(direction, DIAGONAL_DEVIATION_COSINE));
|
49
|
+
const isAligned = axialAlignmentList.some(Boolean) || diagonalAlignmentList.some(Boolean);
|
50
|
+
const isFast = velocityVector.magnitude > this.minVelocity;
|
51
|
+
if (this.maxNumberOfPointersSimultaneously ===
|
52
|
+
this.numberOfPointersRequired &&
|
53
|
+
isAligned &&
|
54
|
+
isFast) {
|
55
|
+
clearTimeout(this.delayTimeout);
|
56
|
+
this.activate();
|
57
|
+
return true;
|
58
|
+
}
|
59
|
+
return false;
|
60
|
+
}
|
61
|
+
endFling() {
|
62
|
+
if (!this.tryEndFling()) {
|
63
|
+
this.fail();
|
64
|
+
}
|
65
|
+
}
|
66
|
+
onPointerDown(event) {
|
67
|
+
if (!this.isButtonInConfig(event.button)) {
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
this.tracker.addToTracker(event);
|
71
|
+
this.keyPointer = event.pointerId;
|
72
|
+
super.onPointerDown(event);
|
73
|
+
this.newPointerAction();
|
74
|
+
this.tryToSendTouchEvent(event);
|
75
|
+
}
|
76
|
+
onPointerAdd(event) {
|
77
|
+
this.tracker.addToTracker(event);
|
78
|
+
super.onPointerAdd(event);
|
79
|
+
this.newPointerAction();
|
80
|
+
}
|
81
|
+
newPointerAction() {
|
82
|
+
if (this.state === State.UNDETERMINED) {
|
83
|
+
this.startFling();
|
84
|
+
}
|
85
|
+
if (this.state !== State.BEGAN) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
this.tryEndFling();
|
89
|
+
if (this.tracker.trackedPointersCount > this.maxNumberOfPointersSimultaneously) {
|
90
|
+
this.maxNumberOfPointersSimultaneously =
|
91
|
+
this.tracker.trackedPointersCount;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
pointerMoveAction(event) {
|
95
|
+
this.tracker.track(event);
|
96
|
+
if (this.state !== State.BEGAN) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
this.tryEndFling();
|
100
|
+
}
|
101
|
+
onPointerMove(event) {
|
102
|
+
this.pointerMoveAction(event);
|
103
|
+
super.onPointerMove(event);
|
104
|
+
}
|
105
|
+
onPointerOutOfBounds(event) {
|
106
|
+
this.pointerMoveAction(event);
|
107
|
+
super.onPointerOutOfBounds(event);
|
108
|
+
}
|
109
|
+
onPointerUp(event) {
|
110
|
+
super.onPointerUp(event);
|
111
|
+
this.onUp(event);
|
112
|
+
this.keyPointer = NaN;
|
113
|
+
}
|
114
|
+
onPointerRemove(event) {
|
115
|
+
super.onPointerRemove(event);
|
116
|
+
this.onUp(event);
|
117
|
+
}
|
118
|
+
onUp(event) {
|
119
|
+
if (this.state === State.BEGAN) {
|
120
|
+
this.endFling();
|
121
|
+
}
|
122
|
+
this.tracker.removeFromTracker(event.pointerId);
|
123
|
+
}
|
124
|
+
activate(force) {
|
125
|
+
super.activate(force);
|
126
|
+
this.end();
|
127
|
+
}
|
128
|
+
resetConfig() {
|
129
|
+
super.resetConfig();
|
130
|
+
this.numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;
|
131
|
+
this.direction = DEFAULT_DIRECTION;
|
132
|
+
}
|
133
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GestureHandler.d.ts","sourceRoot":"","sources":["../../../../src/web/handlers/GestureHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EAOb,MAAM,eAAe,CAAC;AACvB,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAGjD,OAAO,cAAkC,MAAM,yBAAyB,CAAC;AACzE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAe,YAAW,eAAe;IACrE,OAAO,CAAC,aAAa,CAAsB;IAE3C,OAAO,CAAC,MAAM,CAA6B;IAE3C,OAAO,CAAC,wBAAwB,CAAS;IACzC,SAAS,CAAC,2BAA2B,UAAS;IAC9C,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,OAAO,CAA8B;IAE7C,OAAO,CAAC,QAAQ,CAAwC;IAGxD,OAAO,CAAC,gBAAgB,CAAK;IAE7B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,YAAY,CAAkC;IAEtD,OAAO,CAAC,SAAS,CAAmD;gBAGlE,QAAQ,EAAE,sBAAsB,CAAC,OAAO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