react-native-gesture-handler 2.23.0 → 2.23.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/RNGestureHandler.podspec +8 -0
- package/apple/RNGestureHandlerButton.mm +12 -2
- package/lib/commonjs/ActionType.js +3 -3
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js +8 -11
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +10 -2
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/GestureHandlerRootViewContext.js +7 -2
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/commonjs/PlatformConstants.js +6 -1
- package/lib/commonjs/PlatformConstants.js.map +1 -1
- package/lib/commonjs/PlatformConstants.web.js +3 -1
- package/lib/commonjs/PlatformConstants.web.js.map +1 -1
- package/lib/commonjs/PointerType.js +5 -3
- package/lib/commonjs/PointerType.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.js +6 -2
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +37 -11
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +32 -22
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/RNRenderer.js +3 -1
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.web.js +2 -1
- package/lib/commonjs/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/State.js +3 -4
- package/lib/commonjs/State.js.map +1 -1
- package/lib/commonjs/TouchEventType.js +3 -3
- package/lib/commonjs/TouchEventType.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +115 -90
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js +81 -28
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +37 -26
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +27 -13
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +6 -2
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +12 -4
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +15 -4
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +14 -4
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js +13 -4
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +77 -29
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -1
- package/lib/commonjs/components/Pressable/index.js +3 -1
- package/lib/commonjs/components/Pressable/index.js.map +1 -1
- package/lib/commonjs/components/Pressable/utils.js +20 -5
- package/lib/commonjs/components/Pressable/utils.js.map +1 -1
- package/lib/commonjs/components/ReanimatedDrawerLayout.js +76 -38
- package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js +45 -18
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +75 -34
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +23 -9
- package/lib/commonjs/components/Text.js.map +1 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js +14 -5
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +76 -40
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableHighlight.js +34 -19
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +32 -16
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +5 -2
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +25 -16
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +13 -9
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/index.js +12 -7
- package/lib/commonjs/components/touchables/index.js.map +1 -1
- package/lib/commonjs/findNodeHandle.js +4 -1
- package/lib/commonjs/findNodeHandle.js.map +1 -1
- package/lib/commonjs/findNodeHandle.web.js +14 -5
- package/lib/commonjs/findNodeHandle.web.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.js +6 -1
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.web.js +1 -0
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +14 -13
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +1 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js +2 -1
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/FlingGestureHandler.js +11 -9
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +22 -15
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js +11 -9
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +13 -10
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +32 -13
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PinchGestureHandler.js +9 -7
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
- package/lib/commonjs/handlers/RotationGestureHandler.js +9 -7
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +11 -9
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +134 -50
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +27 -17
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +1 -0
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +2 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +10 -9
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +14 -5
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +20 -10
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +29 -9
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +10 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +36 -11
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +3 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +24 -12
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +48 -12
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +13 -3
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +9 -2
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +14 -6
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +55 -27
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/commonjs/handlers/gestures/eventReceiver.js +46 -14
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +12 -5
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +19 -8
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +84 -44
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js +31 -17
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +27 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +9 -3
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +7 -2
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +25 -11
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +14 -6
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/manualGesture.js +6 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +12 -5
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +43 -18
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/pinchGesture.js +9 -2
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +8 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/rotationGesture.js +9 -2
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +22 -10
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js +1 -0
- package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
- package/lib/commonjs/handlers/handlersRegistry.js +21 -6
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +26 -6
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +104 -75
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.js +11 -4
- package/lib/commonjs/init.js.map +1 -1
- package/lib/commonjs/jestUtils/index.js +5 -4
- package/lib/commonjs/jestUtils/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js +83 -19
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mocks.js +15 -5
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +12 -3
- package/lib/commonjs/mountRegistry.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +5 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +7 -2
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +7 -2
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/commonjs/typeUtils.js.map +1 -1
- package/lib/commonjs/utils.js +28 -13
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +23 -5
- package/lib/commonjs/web/Gestures.js.map +1 -1
- package/lib/commonjs/web/constants.js +4 -2
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +41 -5
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +42 -13
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +49 -6
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +195 -62
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +19 -6
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +47 -6
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +11 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +49 -8
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +123 -8
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +41 -4
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +42 -4
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +67 -6
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +17 -9
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +15 -3
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js +41 -7
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +78 -11
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +48 -8
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +22 -5
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/KeyboardEventManager.js +26 -4
- package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/LeastSquareSolver.js +67 -30
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js +14 -7
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +45 -10
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +45 -9
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +18 -3
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +31 -9
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
- package/lib/commonjs/web/tools/WheelEventManager.js +17 -4
- package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
- package/lib/commonjs/web/utils.js +55 -26
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +19 -7
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +13 -3
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/Errors.js +3 -0
- package/lib/commonjs/web_hammer/Errors.js.map +1 -1
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +44 -13
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js +142 -55
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +11 -2
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +19 -5
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +24 -16
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js +16 -9
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/commonjs/web_hammer/PanGestureHandler.js +49 -8
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +11 -2
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js +43 -15
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +13 -2
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/TapGestureHandler.js +52 -33
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/constants.js +26 -13
- package/lib/commonjs/web_hammer/constants.js.map +1 -1
- package/lib/commonjs/web_hammer/utils.js +14 -4
- package/lib/commonjs/web_hammer/utils.js.map +1 -1
- package/lib/module/ActionType.js +1 -3
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js +3 -9
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +5 -2
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/module/PlatformConstants.js +1 -0
- package/lib/module/PlatformConstants.js.map +1 -1
- package/lib/module/PlatformConstants.web.js +1 -0
- package/lib/module/PlatformConstants.web.js.map +1 -1
- package/lib/module/PointerType.js +4 -3
- package/lib/module/PointerType.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +0 -1
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +20 -10
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +17 -18
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.web.js.map +1 -1
- package/lib/module/State.js +1 -4
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js +1 -3
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +99 -80
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js +55 -19
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureButtonsProps.js.map +1 -1
- package/lib/module/components/GestureComponents.js +12 -17
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +4 -4
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +2 -1
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +2 -1
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +2 -1
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.web.js +2 -1
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +59 -26
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/Pressable/PressableProps.js.map +1 -1
- package/lib/module/components/Pressable/index.js.map +1 -1
- package/lib/module/components/Pressable/utils.js +14 -4
- package/lib/module/components/Pressable/utils.js.map +1 -1
- package/lib/module/components/ReanimatedDrawerLayout.js +56 -34
- package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js +30 -14
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js +59 -28
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +10 -6
- package/lib/module/components/Text.js.map +1 -1
- package/lib/module/components/gestureHandlerRootHOC.js +2 -2
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +63 -34
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -1
- package/lib/module/components/touchables/TouchableHighlight.js +24 -15
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +20 -10
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.js +2 -2
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -1
- package/lib/module/components/touchables/TouchableOpacity.js +16 -10
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +3 -6
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/module/components/touchables/index.js.map +1 -1
- package/lib/module/findNodeHandle.js.map +1 -1
- package/lib/module/findNodeHandle.web.js +11 -5
- package/lib/module/findNodeHandle.web.js.map +1 -1
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.web.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +13 -13
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/FlingGestureHandler.js +0 -6
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js +8 -12
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/module/handlers/LongPressGestureHandler.js +0 -6
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/handlers/PanGestureHandler.js +19 -8
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PinchGestureHandler.js +0 -2
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -1
- package/lib/module/handlers/RotationGestureHandler.js +0 -2
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +0 -6
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +106 -47
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/createNativeWrapper.js +17 -12
- package/lib/module/handlers/createNativeWrapper.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +4 -9
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js +4 -3
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +6 -5
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +16 -8
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +1 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +13 -7
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +14 -11
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +39 -12
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +5 -5
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +6 -2
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -5
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +28 -23
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/eventReceiver.js +38 -14
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +9 -5
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +17 -8
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +73 -44
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureComposition.js +24 -16
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +14 -1
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +4 -3
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +18 -9
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +11 -6
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/manualGesture.js +4 -0
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +9 -5
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +41 -18
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/pinchGesture.js +7 -2
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +5 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/rotationGesture.js +7 -2
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +19 -10
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/handlers/getNextHandlerTag.js.map +1 -1
- package/lib/module/handlers/handlersRegistry.js +5 -0
- package/lib/module/handlers/handlersRegistry.js.map +1 -1
- package/lib/module/handlers/utils.js +13 -4
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.js +2 -3
- package/lib/module/init.js.map +1 -1
- package/lib/module/jestUtils/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js +66 -20
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mocks.js +7 -3
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/mountRegistry.js +10 -3
- package/lib/module/mountRegistry.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/module/typeUtils.js.map +1 -1
- package/lib/module/utils.js +11 -6
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/Gestures.js +1 -2
- package/lib/module/web/Gestures.js.map +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +38 -5
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +38 -13
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +39 -5
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +181 -61
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +11 -5
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/IGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +40 -5
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +6 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +41 -7
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +114 -7
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +33 -3
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +34 -3
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +59 -5
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +14 -9
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +13 -3
- package/lib/module/web/tools/CircularBuffer.js.map +1 -1
- package/lib/module/web/tools/EventManager.js +39 -7
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +71 -10
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +37 -7
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +19 -5
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/KeyboardEventManager.js +19 -3
- package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/module/web/tools/LeastSquareSolver.js +65 -30
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js +12 -7
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +35 -9
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +39 -8
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/Vector.js +14 -3
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +25 -8
- package/lib/module/web/tools/VelocityTracker.js.map +1 -1
- package/lib/module/web/tools/WheelEventManager.js +10 -3
- package/lib/module/web/tools/WheelEventManager.js.map +1 -1
- package/lib/module/web/utils.js +40 -21
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/DiscreteGestureHandler.js +13 -4
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/DraggingGestureHandler.js +5 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/Errors.js +1 -0
- package/lib/module/web_hammer/Errors.js.map +1 -1
- package/lib/module/web_hammer/FlingGestureHandler.js +35 -10
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js +130 -53
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +6 -1
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/LongPressGestureHandler.js +11 -2
- package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/NativeViewGestureHandler.js +12 -12
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js +8 -6
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/web_hammer/PanGestureHandler.js +40 -6
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PinchGestureHandler.js +5 -0
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js +34 -13
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/RotationGestureHandler.js +6 -0
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/TapGestureHandler.js +45 -31
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/constants.js +1 -2
- package/lib/module/web_hammer/constants.js.map +1 -1
- package/lib/module/web_hammer/utils.js +2 -2
- package/lib/module/web_hammer/utils.js.map +1 -1
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +2 -2
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +2 -2
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/touchables/TouchableHighlight.tsx +2 -2
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +1 -1
- package/src/components/touchables/TouchableNativeFeedback.tsx +1 -1
- package/src/components/touchables/TouchableNativeFeedbackProps.tsx +1 -1
- package/src/components/touchables/TouchableOpacity.tsx +2 -2
- package/src/components/touchables/TouchableWithoutFeedback.tsx +2 -2
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
|
5
3
|
import { PointerType } from '../../PointerType';
|
6
4
|
import { State } from '../../State';
|
7
5
|
import PointerTracker from './PointerTracker';
|
@@ -10,114 +8,149 @@ export default class GestureHandlerOrchestrator {
|
|
10
8
|
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
11
9
|
constructor() {
|
12
10
|
_defineProperty(this, "gestureHandlers", []);
|
11
|
+
|
13
12
|
_defineProperty(this, "awaitingHandlers", []);
|
13
|
+
|
14
14
|
_defineProperty(this, "awaitingHandlersTags", new Set());
|
15
|
+
|
15
16
|
_defineProperty(this, "handlingChangeSemaphore", 0);
|
17
|
+
|
16
18
|
_defineProperty(this, "activationIndex", 0);
|
17
19
|
}
|
20
|
+
|
18
21
|
scheduleFinishedHandlersCleanup() {
|
19
22
|
if (this.handlingChangeSemaphore === 0) {
|
20
23
|
this.cleanupFinishedHandlers();
|
21
24
|
}
|
22
25
|
}
|
26
|
+
|
23
27
|
cleanHandler(handler) {
|
24
28
|
handler.reset();
|
25
29
|
handler.active = false;
|
26
30
|
handler.awaiting = false;
|
27
31
|
handler.activationIndex = Number.MAX_VALUE;
|
28
32
|
}
|
33
|
+
|
29
34
|
removeHandlerFromOrchestrator(handler) {
|
30
35
|
const indexInGestureHandlers = this.gestureHandlers.indexOf(handler);
|
31
36
|
const indexInAwaitingHandlers = this.awaitingHandlers.indexOf(handler);
|
37
|
+
|
32
38
|
if (indexInGestureHandlers >= 0) {
|
33
39
|
this.gestureHandlers.splice(indexInGestureHandlers, 1);
|
34
40
|
}
|
41
|
+
|
35
42
|
if (indexInAwaitingHandlers >= 0) {
|
36
43
|
this.awaitingHandlers.splice(indexInAwaitingHandlers, 1);
|
37
44
|
this.awaitingHandlersTags.delete(handler.handlerTag);
|
38
45
|
}
|
39
46
|
}
|
47
|
+
|
40
48
|
cleanupFinishedHandlers() {
|
41
49
|
const handlersToRemove = new Set();
|
50
|
+
|
42
51
|
for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {
|
43
52
|
const handler = this.gestureHandlers[i];
|
53
|
+
|
44
54
|
if (this.isFinished(handler.state) && !handler.awaiting) {
|
45
55
|
this.cleanHandler(handler);
|
46
56
|
handlersToRemove.add(handler);
|
47
57
|
}
|
48
58
|
}
|
59
|
+
|
49
60
|
this.gestureHandlers = this.gestureHandlers.filter(handler => !handlersToRemove.has(handler));
|
50
61
|
}
|
62
|
+
|
51
63
|
hasOtherHandlerToWaitFor(handler) {
|
52
64
|
const hasToWaitFor = otherHandler => {
|
53
65
|
return !this.isFinished(otherHandler.state) && this.shouldHandlerWaitForOther(handler, otherHandler);
|
54
66
|
};
|
67
|
+
|
55
68
|
return this.gestureHandlers.some(hasToWaitFor);
|
56
69
|
}
|
70
|
+
|
57
71
|
shouldBeCancelledByFinishedHandler(handler) {
|
58
72
|
const shouldBeCancelled = otherHandler => {
|
59
73
|
return this.shouldHandlerWaitForOther(handler, otherHandler) && otherHandler.state === State.END;
|
60
74
|
};
|
75
|
+
|
61
76
|
return this.gestureHandlers.some(shouldBeCancelled);
|
62
77
|
}
|
78
|
+
|
63
79
|
tryActivate(handler) {
|
64
80
|
if (this.shouldBeCancelledByFinishedHandler(handler)) {
|
65
81
|
handler.cancel();
|
66
82
|
return;
|
67
83
|
}
|
84
|
+
|
68
85
|
if (this.hasOtherHandlerToWaitFor(handler)) {
|
69
86
|
this.addAwaitingHandler(handler);
|
70
87
|
return;
|
71
88
|
}
|
89
|
+
|
72
90
|
const handlerState = handler.state;
|
91
|
+
|
73
92
|
if (handlerState === State.CANCELLED || handlerState === State.FAILED) {
|
74
93
|
return;
|
75
94
|
}
|
95
|
+
|
76
96
|
if (this.shouldActivate(handler)) {
|
77
97
|
this.makeActive(handler);
|
78
98
|
return;
|
79
99
|
}
|
100
|
+
|
80
101
|
if (handlerState === State.ACTIVE) {
|
81
102
|
handler.fail();
|
82
103
|
return;
|
83
104
|
}
|
105
|
+
|
84
106
|
if (handlerState === State.BEGAN) {
|
85
107
|
handler.cancel();
|
86
108
|
}
|
87
109
|
}
|
110
|
+
|
88
111
|
shouldActivate(handler) {
|
89
112
|
const shouldBeCancelledBy = otherHandler => {
|
90
113
|
return this.shouldHandlerBeCancelledBy(handler, otherHandler);
|
91
114
|
};
|
115
|
+
|
92
116
|
return !this.gestureHandlers.some(shouldBeCancelledBy);
|
93
117
|
}
|
118
|
+
|
94
119
|
cleanupAwaitingHandlers(handler) {
|
95
120
|
const shouldWait = otherHandler => {
|
96
121
|
return !otherHandler.awaiting && this.shouldHandlerWaitForOther(otherHandler, handler);
|
97
122
|
};
|
123
|
+
|
98
124
|
for (const otherHandler of this.awaitingHandlers) {
|
99
125
|
if (shouldWait(otherHandler)) {
|
100
126
|
this.cleanHandler(otherHandler);
|
101
127
|
this.awaitingHandlersTags.delete(otherHandler.handlerTag);
|
102
128
|
}
|
103
129
|
}
|
130
|
+
|
104
131
|
this.awaitingHandlers = this.awaitingHandlers.filter(otherHandler => this.awaitingHandlersTags.has(otherHandler.handlerTag));
|
105
132
|
}
|
133
|
+
|
106
134
|
onHandlerStateChange(handler, newState, oldState, sendIfDisabled) {
|
107
135
|
if (!handler.enabled && !sendIfDisabled) {
|
108
136
|
return;
|
109
137
|
}
|
138
|
+
|
110
139
|
this.handlingChangeSemaphore += 1;
|
140
|
+
|
111
141
|
if (this.isFinished(newState)) {
|
112
142
|
for (const otherHandler of this.awaitingHandlers) {
|
113
143
|
if (!this.shouldHandlerWaitForOther(otherHandler, handler) || !this.awaitingHandlersTags.has(otherHandler.handlerTag)) {
|
114
144
|
continue;
|
115
145
|
}
|
146
|
+
|
116
147
|
if (newState !== State.END) {
|
117
148
|
this.tryActivate(otherHandler);
|
118
149
|
continue;
|
119
150
|
}
|
151
|
+
|
120
152
|
otherHandler.cancel();
|
153
|
+
|
121
154
|
if (otherHandler.state === State.END) {
|
122
155
|
// Handle edge case, where discrete gestures end immediately after activation thus
|
123
156
|
// their state is set to END and when the gesture they are waiting for activates they
|
@@ -125,9 +158,11 @@ export default class GestureHandlerOrchestrator {
|
|
125
158
|
// Send synthetic BEGAN -> CANCELLED to properly handle JS logic
|
126
159
|
otherHandler.sendEvent(State.CANCELLED, State.BEGAN);
|
127
160
|
}
|
161
|
+
|
128
162
|
otherHandler.awaiting = false;
|
129
163
|
}
|
130
164
|
}
|
165
|
+
|
131
166
|
if (newState === State.ACTIVE) {
|
132
167
|
this.tryActivate(handler);
|
133
168
|
} else if (oldState === State.ACTIVE || oldState === State.END) {
|
@@ -139,107 +174,130 @@ export default class GestureHandlerOrchestrator {
|
|
139
174
|
} else if (oldState !== State.UNDETERMINED || newState !== State.CANCELLED) {
|
140
175
|
handler.sendEvent(newState, oldState);
|
141
176
|
}
|
177
|
+
|
142
178
|
this.handlingChangeSemaphore -= 1;
|
143
179
|
this.scheduleFinishedHandlersCleanup();
|
180
|
+
|
144
181
|
if (!this.awaitingHandlers.includes(handler)) {
|
145
182
|
this.cleanupAwaitingHandlers(handler);
|
146
183
|
}
|
147
184
|
}
|
185
|
+
|
148
186
|
makeActive(handler) {
|
149
187
|
const currentState = handler.state;
|
150
188
|
handler.active = true;
|
151
189
|
handler.shouldResetProgress = true;
|
152
190
|
handler.activationIndex = this.activationIndex++;
|
191
|
+
|
153
192
|
for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {
|
154
193
|
if (this.shouldHandlerBeCancelledBy(this.gestureHandlers[i], handler)) {
|
155
194
|
this.gestureHandlers[i].cancel();
|
156
195
|
}
|
157
196
|
}
|
197
|
+
|
158
198
|
for (const otherHandler of this.awaitingHandlers) {
|
159
199
|
if (this.shouldHandlerBeCancelledBy(otherHandler, handler)) {
|
160
200
|
otherHandler.awaiting = false;
|
161
201
|
}
|
162
202
|
}
|
203
|
+
|
163
204
|
handler.sendEvent(State.ACTIVE, State.BEGAN);
|
205
|
+
|
164
206
|
if (currentState !== State.ACTIVE) {
|
165
207
|
handler.sendEvent(State.END, State.ACTIVE);
|
208
|
+
|
166
209
|
if (currentState !== State.END) {
|
167
210
|
handler.sendEvent(State.UNDETERMINED, State.END);
|
168
211
|
}
|
169
212
|
}
|
213
|
+
|
170
214
|
if (!handler.awaiting) {
|
171
215
|
return;
|
172
216
|
}
|
217
|
+
|
173
218
|
handler.awaiting = false;
|
174
219
|
this.awaitingHandlers = this.awaitingHandlers.filter(otherHandler => otherHandler !== handler);
|
175
220
|
}
|
221
|
+
|
176
222
|
addAwaitingHandler(handler) {
|
177
223
|
if (this.awaitingHandlers.includes(handler)) {
|
178
224
|
return;
|
179
225
|
}
|
226
|
+
|
180
227
|
this.awaitingHandlers.push(handler);
|
181
228
|
this.awaitingHandlersTags.add(handler.handlerTag);
|
182
229
|
handler.awaiting = true;
|
183
230
|
handler.activationIndex = this.activationIndex++;
|
184
231
|
}
|
232
|
+
|
185
233
|
recordHandlerIfNotPresent(handler) {
|
186
234
|
if (this.gestureHandlers.includes(handler)) {
|
187
235
|
return;
|
188
236
|
}
|
237
|
+
|
189
238
|
this.gestureHandlers.push(handler);
|
190
239
|
handler.active = false;
|
191
240
|
handler.awaiting = false;
|
192
241
|
handler.activationIndex = Number.MAX_SAFE_INTEGER;
|
193
242
|
}
|
243
|
+
|
194
244
|
shouldHandlerWaitForOther(handler, otherHandler) {
|
195
245
|
return handler !== otherHandler && (handler.shouldWaitForHandlerFailure(otherHandler) || otherHandler.shouldRequireToWaitForFailure(handler));
|
196
246
|
}
|
247
|
+
|
197
248
|
canRunSimultaneously(gh1, gh2) {
|
198
249
|
return gh1 === gh2 || gh1.shouldRecognizeSimultaneously(gh2) || gh2.shouldRecognizeSimultaneously(gh1);
|
199
250
|
}
|
251
|
+
|
200
252
|
shouldHandlerBeCancelledBy(handler, otherHandler) {
|
201
253
|
if (this.canRunSimultaneously(handler, otherHandler)) {
|
202
254
|
return false;
|
203
255
|
}
|
256
|
+
|
204
257
|
if (handler.awaiting || handler.state === State.ACTIVE) {
|
205
258
|
// For now it always returns false
|
206
259
|
return handler.shouldBeCancelledByOther(otherHandler);
|
207
260
|
}
|
261
|
+
|
208
262
|
const handlerPointers = handler.getTrackedPointersID();
|
209
263
|
const otherPointers = otherHandler.getTrackedPointersID();
|
264
|
+
|
210
265
|
if (!PointerTracker.shareCommonPointers(handlerPointers, otherPointers) && handler.delegate.view !== otherHandler.delegate.view) {
|
211
266
|
return this.checkOverlap(handler, otherHandler);
|
212
267
|
}
|
268
|
+
|
213
269
|
return true;
|
214
270
|
}
|
271
|
+
|
215
272
|
checkOverlap(handler, otherHandler) {
|
216
273
|
// If handlers don't have common pointers, default return value is false.
|
217
274
|
// However, if at least on pointer overlaps with both handlers, we return true
|
218
275
|
// This solves issue in overlapping parents example
|
219
|
-
|
220
276
|
// TODO: Find better way to handle that issue, for example by activation order and handler cancelling
|
221
|
-
|
222
277
|
const isPointerWithinBothBounds = pointer => {
|
223
278
|
const point = handler.tracker.getLastAbsoluteCoords(pointer);
|
224
279
|
return handler.delegate.isPointerInBounds(point) && otherHandler.delegate.isPointerInBounds(point);
|
225
280
|
};
|
281
|
+
|
226
282
|
return handler.getTrackedPointersID().some(isPointerWithinBothBounds);
|
227
283
|
}
|
284
|
+
|
228
285
|
isFinished(state) {
|
229
286
|
return state === State.END || state === State.FAILED || state === State.CANCELLED;
|
230
|
-
}
|
231
|
-
|
232
|
-
// This function is called when handler receives touchdown event
|
287
|
+
} // This function is called when handler receives touchdown event
|
233
288
|
// If handler is using mouse or pen as a pointer and any handler receives touch event,
|
234
289
|
// mouse/pen event dissappears - it doesn't send onPointerCancel nor onPointerUp (and others)
|
235
290
|
// This became a problem because handler was left at active state without any signal to end or fail
|
236
291
|
// To handle this, when new touch event is received, we loop through active handlers and check which type of
|
237
292
|
// pointer they're using. If there are any handler with mouse/pen as a pointer, we cancel them
|
293
|
+
|
294
|
+
|
238
295
|
cancelMouseAndPenGestures(currentHandler) {
|
239
296
|
this.gestureHandlers.forEach(handler => {
|
240
297
|
if (handler.pointerType !== PointerType.MOUSE && handler.pointerType !== PointerType.STYLUS) {
|
241
298
|
return;
|
242
299
|
}
|
300
|
+
|
243
301
|
if (handler !== currentHandler) {
|
244
302
|
handler.cancel();
|
245
303
|
} else {
|
@@ -254,13 +312,16 @@ export default class GestureHandlerOrchestrator {
|
|
254
312
|
}
|
255
313
|
});
|
256
314
|
}
|
315
|
+
|
257
316
|
static get instance() {
|
258
317
|
if (!GestureHandlerOrchestrator._instance) {
|
259
318
|
GestureHandlerOrchestrator._instance = new GestureHandlerOrchestrator();
|
260
319
|
}
|
320
|
+
|
261
321
|
return GestureHandlerOrchestrator._instance;
|
262
322
|
}
|
323
|
+
|
263
324
|
}
|
264
|
-
|
325
|
+
|
265
326
|
_defineProperty(GestureHandlerOrchestrator, "_instance", void 0);
|
266
327
|
//# sourceMappingURL=GestureHandlerOrchestrator.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PointerType","State","PointerTracker","GestureHandlerOrchestrator","constructor","_defineProperty","Set","scheduleFinishedHandlersCleanup","handlingChangeSemaphore","cleanupFinishedHandlers","cleanHandler","handler","reset","active","awaiting","activationIndex","Number","MAX_VALUE","removeHandlerFromOrchestrator","indexInGestureHandlers","gestureHandlers","indexOf","indexInAwaitingHandlers","awaitingHandlers","splice","awaitingHandlersTags","delete","handlerTag","handlersToRemove","i","length","isFinished","state","add","filter","has","hasOtherHandlerToWaitFor","hasToWaitFor","otherHandler","shouldHandlerWaitForOther","some","shouldBeCancelledByFinishedHandler","shouldBeCancelled","END","tryActivate","cancel","addAwaitingHandler","handlerState","CANCELLED","FAILED","shouldActivate","makeActive","ACTIVE","fail","BEGAN","shouldBeCancelledBy","shouldHandlerBeCancelledBy","cleanupAwaitingHandlers","shouldWait","onHandlerStateChange","newState","oldState","sendIfDisabled","enabled","sendEvent","UNDETERMINED","includes","currentState","shouldResetProgress","push","recordHandlerIfNotPresent","MAX_SAFE_INTEGER","shouldWaitForHandlerFailure","shouldRequireToWaitForFailure","canRunSimultaneously","gh1","gh2","shouldRecognizeSimultaneously","shouldBeCancelledByOther","handlerPointers","getTrackedPointersID","otherPointers","shareCommonPointers","delegate","view","checkOverlap","isPointerWithinBothBounds","pointer","point","tracker","getLastAbsoluteCoords","isPointerInBounds","cancelMouseAndPenGestures","currentHandler","forEach","pointerType","MOUSE","STYLUS","resetTracker","instance","_instance","_GestureHandlerOrchestrator"],"sources":["GestureHandlerOrchestrator.ts"],"sourcesContent":["import { PointerType } from '../../PointerType';\nimport { State } from '../../State';\n\nimport type IGestureHandler from '../handlers/IGestureHandler';\nimport PointerTracker from './PointerTracker';\n\nexport default class GestureHandlerOrchestrator {\n private static _instance: GestureHandlerOrchestrator;\n\n private gestureHandlers: IGestureHandler[] = [];\n private awaitingHandlers: IGestureHandler[] = [];\n private awaitingHandlersTags: Set<number> = new Set();\n\n private handlingChangeSemaphore = 0;\n private activationIndex = 0;\n\n // Private beacuse of Singleton\n // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function\n private constructor() {}\n\n private scheduleFinishedHandlersCleanup(): void {\n if (this.handlingChangeSemaphore === 0) {\n this.cleanupFinishedHandlers();\n }\n }\n\n private cleanHandler(handler: IGestureHandler): void {\n handler.reset();\n handler.active = false;\n handler.awaiting = false;\n handler.activationIndex = Number.MAX_VALUE;\n }\n\n public removeHandlerFromOrchestrator(handler: IGestureHandler): void {\n const indexInGestureHandlers = this.gestureHandlers.indexOf(handler);\n const indexInAwaitingHandlers = this.awaitingHandlers.indexOf(handler);\n\n if (indexInGestureHandlers >= 0) {\n this.gestureHandlers.splice(indexInGestureHandlers, 1);\n }\n\n if (indexInAwaitingHandlers >= 0) {\n this.awaitingHandlers.splice(indexInAwaitingHandlers, 1);\n this.awaitingHandlersTags.delete(handler.handlerTag);\n }\n }\n\n private cleanupFinishedHandlers(): void {\n const handlersToRemove = new Set<IGestureHandler>();\n\n for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {\n const handler = this.gestureHandlers[i];\n\n if (this.isFinished(handler.state) && !handler.awaiting) {\n this.cleanHandler(handler);\n handlersToRemove.add(handler);\n }\n }\n\n this.gestureHandlers = this.gestureHandlers.filter(\n (handler) => !handlersToRemove.has(handler)\n );\n }\n\n private hasOtherHandlerToWaitFor(handler: IGestureHandler): boolean {\n const hasToWaitFor = (otherHandler: IGestureHandler) => {\n return (\n !this.isFinished(otherHandler.state) &&\n this.shouldHandlerWaitForOther(handler, otherHandler)\n );\n };\n\n return this.gestureHandlers.some(hasToWaitFor);\n }\n\n private shouldBeCancelledByFinishedHandler(\n handler: IGestureHandler\n ): boolean {\n const shouldBeCancelled = (otherHandler: IGestureHandler) => {\n return (\n this.shouldHandlerWaitForOther(handler, otherHandler) &&\n otherHandler.state === State.END\n );\n };\n\n return this.gestureHandlers.some(shouldBeCancelled);\n }\n\n private tryActivate(handler: IGestureHandler): void {\n if (this.shouldBeCancelledByFinishedHandler(handler)) {\n handler.cancel();\n return;\n }\n\n if (this.hasOtherHandlerToWaitFor(handler)) {\n this.addAwaitingHandler(handler);\n return;\n }\n\n const handlerState = handler.state;\n\n if (handlerState === State.CANCELLED || handlerState === State.FAILED) {\n return;\n }\n\n if (this.shouldActivate(handler)) {\n this.makeActive(handler);\n return;\n }\n\n if (handlerState === State.ACTIVE) {\n handler.fail();\n return;\n }\n\n if (handlerState === State.BEGAN) {\n handler.cancel();\n }\n }\n\n private shouldActivate(handler: IGestureHandler): boolean {\n const shouldBeCancelledBy = (otherHandler: IGestureHandler) => {\n return this.shouldHandlerBeCancelledBy(handler, otherHandler);\n };\n\n return !this.gestureHandlers.some(shouldBeCancelledBy);\n }\n\n private cleanupAwaitingHandlers(handler: IGestureHandler): void {\n const shouldWait = (otherHandler: IGestureHandler) => {\n return (\n !otherHandler.awaiting &&\n this.shouldHandlerWaitForOther(otherHandler, handler)\n );\n };\n\n for (const otherHandler of this.awaitingHandlers) {\n if (shouldWait(otherHandler)) {\n this.cleanHandler(otherHandler);\n this.awaitingHandlersTags.delete(otherHandler.handlerTag);\n }\n }\n\n this.awaitingHandlers = this.awaitingHandlers.filter((otherHandler) =>\n this.awaitingHandlersTags.has(otherHandler.handlerTag)\n );\n }\n\n public onHandlerStateChange(\n handler: IGestureHandler,\n newState: State,\n oldState: State,\n sendIfDisabled?: boolean\n ): void {\n if (!handler.enabled && !sendIfDisabled) {\n return;\n }\n\n this.handlingChangeSemaphore += 1;\n\n if (this.isFinished(newState)) {\n for (const otherHandler of this.awaitingHandlers) {\n if (\n !this.shouldHandlerWaitForOther(otherHandler, handler) ||\n !this.awaitingHandlersTags.has(otherHandler.handlerTag)\n ) {\n continue;\n }\n\n if (newState !== State.END) {\n this.tryActivate(otherHandler);\n continue;\n }\n\n otherHandler.cancel();\n\n if (otherHandler.state === State.END) {\n // Handle edge case, where discrete gestures end immediately after activation thus\n // their state is set to END and when the gesture they are waiting for activates they\n // should be cancelled, however `cancel` was never sent as gestures were already in the END state.\n // Send synthetic BEGAN -> CANCELLED to properly handle JS logic\n otherHandler.sendEvent(State.CANCELLED, State.BEGAN);\n }\n\n otherHandler.awaiting = false;\n }\n }\n\n if (newState === State.ACTIVE) {\n this.tryActivate(handler);\n } else if (oldState === State.ACTIVE || oldState === State.END) {\n if (handler.active) {\n handler.sendEvent(newState, oldState);\n } else if (\n oldState === State.ACTIVE &&\n (newState === State.CANCELLED || newState === State.FAILED)\n ) {\n handler.sendEvent(newState, State.BEGAN);\n }\n } else if (\n oldState !== State.UNDETERMINED ||\n newState !== State.CANCELLED\n ) {\n handler.sendEvent(newState, oldState);\n }\n\n this.handlingChangeSemaphore -= 1;\n\n this.scheduleFinishedHandlersCleanup();\n\n if (!this.awaitingHandlers.includes(handler)) {\n this.cleanupAwaitingHandlers(handler);\n }\n }\n\n private makeActive(handler: IGestureHandler): void {\n const currentState = handler.state;\n\n handler.active = true;\n handler.shouldResetProgress = true;\n handler.activationIndex = this.activationIndex++;\n\n for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {\n if (this.shouldHandlerBeCancelledBy(this.gestureHandlers[i], handler)) {\n this.gestureHandlers[i].cancel();\n }\n }\n\n for (const otherHandler of this.awaitingHandlers) {\n if (this.shouldHandlerBeCancelledBy(otherHandler, handler)) {\n otherHandler.awaiting = false;\n }\n }\n\n handler.sendEvent(State.ACTIVE, State.BEGAN);\n\n if (currentState !== State.ACTIVE) {\n handler.sendEvent(State.END, State.ACTIVE);\n if (currentState !== State.END) {\n handler.sendEvent(State.UNDETERMINED, State.END);\n }\n }\n\n if (!handler.awaiting) {\n return;\n }\n\n handler.awaiting = false;\n\n this.awaitingHandlers = this.awaitingHandlers.filter(\n (otherHandler) => otherHandler !== handler\n );\n }\n\n private addAwaitingHandler(handler: IGestureHandler): void {\n if (this.awaitingHandlers.includes(handler)) {\n return;\n }\n\n this.awaitingHandlers.push(handler);\n this.awaitingHandlersTags.add(handler.handlerTag);\n\n handler.awaiting = true;\n handler.activationIndex = this.activationIndex++;\n }\n\n public recordHandlerIfNotPresent(handler: IGestureHandler): void {\n if (this.gestureHandlers.includes(handler)) {\n return;\n }\n\n this.gestureHandlers.push(handler);\n\n handler.active = false;\n handler.awaiting = false;\n handler.activationIndex = Number.MAX_SAFE_INTEGER;\n }\n\n private shouldHandlerWaitForOther(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n return (\n handler !== otherHandler &&\n (handler.shouldWaitForHandlerFailure(otherHandler) ||\n otherHandler.shouldRequireToWaitForFailure(handler))\n );\n }\n\n private canRunSimultaneously(\n gh1: IGestureHandler,\n gh2: IGestureHandler\n ): boolean {\n return (\n gh1 === gh2 ||\n gh1.shouldRecognizeSimultaneously(gh2) ||\n gh2.shouldRecognizeSimultaneously(gh1)\n );\n }\n\n private shouldHandlerBeCancelledBy(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n if (this.canRunSimultaneously(handler, otherHandler)) {\n return false;\n }\n\n if (handler.awaiting || handler.state === State.ACTIVE) {\n // For now it always returns false\n return handler.shouldBeCancelledByOther(otherHandler);\n }\n\n const handlerPointers: number[] = handler.getTrackedPointersID();\n const otherPointers: number[] = otherHandler.getTrackedPointersID();\n\n if (\n !PointerTracker.shareCommonPointers(handlerPointers, otherPointers) &&\n handler.delegate.view !== otherHandler.delegate.view\n ) {\n return this.checkOverlap(handler, otherHandler);\n }\n\n return true;\n }\n\n private checkOverlap(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n // If handlers don't have common pointers, default return value is false.\n // However, if at least on pointer overlaps with both handlers, we return true\n // This solves issue in overlapping parents example\n\n // TODO: Find better way to handle that issue, for example by activation order and handler cancelling\n\n const isPointerWithinBothBounds = (pointer: number) => {\n const point = handler.tracker.getLastAbsoluteCoords(pointer);\n\n return (\n handler.delegate.isPointerInBounds(point) &&\n otherHandler.delegate.isPointerInBounds(point)\n );\n };\n\n return handler.getTrackedPointersID().some(isPointerWithinBothBounds);\n }\n\n private isFinished(state: State): boolean {\n return (\n state === State.END || state === State.FAILED || state === State.CANCELLED\n );\n }\n\n // This function is called when handler receives touchdown event\n // If handler is using mouse or pen as a pointer and any handler receives touch event,\n // mouse/pen event dissappears - it doesn't send onPointerCancel nor onPointerUp (and others)\n // This became a problem because handler was left at active state without any signal to end or fail\n // To handle this, when new touch event is received, we loop through active handlers and check which type of\n // pointer they're using. If there are any handler with mouse/pen as a pointer, we cancel them\n public cancelMouseAndPenGestures(currentHandler: IGestureHandler): void {\n this.gestureHandlers.forEach((handler: IGestureHandler) => {\n if (\n handler.pointerType !== PointerType.MOUSE &&\n handler.pointerType !== PointerType.STYLUS\n ) {\n return;\n }\n\n if (handler !== currentHandler) {\n handler.cancel();\n } else {\n // Handler that received touch event should have its pointer tracker reset\n // This allows handler to smoothly change from mouse/pen to touch\n // The drawback is, that when we try to use mouse/pen one more time, it doesn't send onPointerDown at the first time\n // so it is required to click two times to get handler to work\n //\n // However, handler will receive manually created onPointerEnter that is triggered in EventManager in onPointerMove method.\n // There may be possibility to use that fact to make handler respond properly to first mouse click\n handler.tracker.resetTracker();\n }\n });\n }\n\n public static get instance(): GestureHandlerOrchestrator {\n if (!GestureHandlerOrchestrator._instance) {\n GestureHandlerOrchestrator._instance = new GestureHandlerOrchestrator();\n }\n\n return GestureHandlerOrchestrator._instance;\n }\n}\n"],"mappings":";;;;AAAA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,KAAK,QAAQ,aAAa;AAGnC,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,eAAe,MAAMC,0BAA0B,CAAC;EAU9C;EACA;EACQC,WAAWA,CAAA,EAAG;IAAAC,eAA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BAA0B,CAACiG,SAAS;EAC7C;AACF;AAACC,2BAAA,GAjYoBlG,0BAA0B;AAAAE,eAAA,CAA1BF,0BAA0B","ignoreList":[]}
|
1
|
+
{"version":3,"sources":["GestureHandlerOrchestrator.ts"],"names":["PointerType","State","PointerTracker","GestureHandlerOrchestrator","constructor","Set","scheduleFinishedHandlersCleanup","handlingChangeSemaphore","cleanupFinishedHandlers","cleanHandler","handler","reset","active","awaiting","activationIndex","Number","MAX_VALUE","removeHandlerFromOrchestrator","indexInGestureHandlers","gestureHandlers","indexOf","indexInAwaitingHandlers","awaitingHandlers","splice","awaitingHandlersTags","delete","handlerTag","handlersToRemove","i","length","isFinished","state","add","filter","has","hasOtherHandlerToWaitFor","hasToWaitFor","otherHandler","shouldHandlerWaitForOther","some","shouldBeCancelledByFinishedHandler","shouldBeCancelled","END","tryActivate","cancel","addAwaitingHandler","handlerState","CANCELLED","FAILED","shouldActivate","makeActive","ACTIVE","fail","BEGAN","shouldBeCancelledBy","shouldHandlerBeCancelledBy","cleanupAwaitingHandlers","shouldWait","onHandlerStateChange","newState","oldState","sendIfDisabled","enabled","sendEvent","UNDETERMINED","includes","currentState","shouldResetProgress","push","recordHandlerIfNotPresent","MAX_SAFE_INTEGER","shouldWaitForHandlerFailure","shouldRequireToWaitForFailure","canRunSimultaneously","gh1","gh2","shouldRecognizeSimultaneously","shouldBeCancelledByOther","handlerPointers","getTrackedPointersID","otherPointers","shareCommonPointers","delegate","view","checkOverlap","isPointerWithinBothBounds","pointer","point","tracker","getLastAbsoluteCoords","isPointerInBounds","cancelMouseAndPenGestures","currentHandler","forEach","pointerType","MOUSE","STYLUS","resetTracker","instance","_instance"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,mBAA5B;AACA,SAASC,KAAT,QAAsB,aAAtB;AAGA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,eAAe,MAAMC,0BAAN,CAAiC;AAU9C;AACA;AACQC,EAAAA,WAAW,GAAG;AAAA,6CATuB,EASvB;;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;;AAED,WAAOA,0BAA0B,CAACgG,SAAlC;AACD;;AAhY6C;;gBAA3BhG,0B","sourcesContent":["import { PointerType } from '../../PointerType';\nimport { State } from '../../State';\n\nimport type IGestureHandler from '../handlers/IGestureHandler';\nimport PointerTracker from './PointerTracker';\n\nexport default class GestureHandlerOrchestrator {\n private static _instance: GestureHandlerOrchestrator;\n\n private gestureHandlers: IGestureHandler[] = [];\n private awaitingHandlers: IGestureHandler[] = [];\n private awaitingHandlersTags: Set<number> = new Set();\n\n private handlingChangeSemaphore = 0;\n private activationIndex = 0;\n\n // Private beacuse of Singleton\n // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function\n private constructor() {}\n\n private scheduleFinishedHandlersCleanup(): void {\n if (this.handlingChangeSemaphore === 0) {\n this.cleanupFinishedHandlers();\n }\n }\n\n private cleanHandler(handler: IGestureHandler): void {\n handler.reset();\n handler.active = false;\n handler.awaiting = false;\n handler.activationIndex = Number.MAX_VALUE;\n }\n\n public removeHandlerFromOrchestrator(handler: IGestureHandler): void {\n const indexInGestureHandlers = this.gestureHandlers.indexOf(handler);\n const indexInAwaitingHandlers = this.awaitingHandlers.indexOf(handler);\n\n if (indexInGestureHandlers >= 0) {\n this.gestureHandlers.splice(indexInGestureHandlers, 1);\n }\n\n if (indexInAwaitingHandlers >= 0) {\n this.awaitingHandlers.splice(indexInAwaitingHandlers, 1);\n this.awaitingHandlersTags.delete(handler.handlerTag);\n }\n }\n\n private cleanupFinishedHandlers(): void {\n const handlersToRemove = new Set<IGestureHandler>();\n\n for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {\n const handler = this.gestureHandlers[i];\n\n if (this.isFinished(handler.state) && !handler.awaiting) {\n this.cleanHandler(handler);\n handlersToRemove.add(handler);\n }\n }\n\n this.gestureHandlers = this.gestureHandlers.filter(\n (handler) => !handlersToRemove.has(handler)\n );\n }\n\n private hasOtherHandlerToWaitFor(handler: IGestureHandler): boolean {\n const hasToWaitFor = (otherHandler: IGestureHandler) => {\n return (\n !this.isFinished(otherHandler.state) &&\n this.shouldHandlerWaitForOther(handler, otherHandler)\n );\n };\n\n return this.gestureHandlers.some(hasToWaitFor);\n }\n\n private shouldBeCancelledByFinishedHandler(\n handler: IGestureHandler\n ): boolean {\n const shouldBeCancelled = (otherHandler: IGestureHandler) => {\n return (\n this.shouldHandlerWaitForOther(handler, otherHandler) &&\n otherHandler.state === State.END\n );\n };\n\n return this.gestureHandlers.some(shouldBeCancelled);\n }\n\n private tryActivate(handler: IGestureHandler): void {\n if (this.shouldBeCancelledByFinishedHandler(handler)) {\n handler.cancel();\n return;\n }\n\n if (this.hasOtherHandlerToWaitFor(handler)) {\n this.addAwaitingHandler(handler);\n return;\n }\n\n const handlerState = handler.state;\n\n if (handlerState === State.CANCELLED || handlerState === State.FAILED) {\n return;\n }\n\n if (this.shouldActivate(handler)) {\n this.makeActive(handler);\n return;\n }\n\n if (handlerState === State.ACTIVE) {\n handler.fail();\n return;\n }\n\n if (handlerState === State.BEGAN) {\n handler.cancel();\n }\n }\n\n private shouldActivate(handler: IGestureHandler): boolean {\n const shouldBeCancelledBy = (otherHandler: IGestureHandler) => {\n return this.shouldHandlerBeCancelledBy(handler, otherHandler);\n };\n\n return !this.gestureHandlers.some(shouldBeCancelledBy);\n }\n\n private cleanupAwaitingHandlers(handler: IGestureHandler): void {\n const shouldWait = (otherHandler: IGestureHandler) => {\n return (\n !otherHandler.awaiting &&\n this.shouldHandlerWaitForOther(otherHandler, handler)\n );\n };\n\n for (const otherHandler of this.awaitingHandlers) {\n if (shouldWait(otherHandler)) {\n this.cleanHandler(otherHandler);\n this.awaitingHandlersTags.delete(otherHandler.handlerTag);\n }\n }\n\n this.awaitingHandlers = this.awaitingHandlers.filter((otherHandler) =>\n this.awaitingHandlersTags.has(otherHandler.handlerTag)\n );\n }\n\n public onHandlerStateChange(\n handler: IGestureHandler,\n newState: State,\n oldState: State,\n sendIfDisabled?: boolean\n ): void {\n if (!handler.enabled && !sendIfDisabled) {\n return;\n }\n\n this.handlingChangeSemaphore += 1;\n\n if (this.isFinished(newState)) {\n for (const otherHandler of this.awaitingHandlers) {\n if (\n !this.shouldHandlerWaitForOther(otherHandler, handler) ||\n !this.awaitingHandlersTags.has(otherHandler.handlerTag)\n ) {\n continue;\n }\n\n if (newState !== State.END) {\n this.tryActivate(otherHandler);\n continue;\n }\n\n otherHandler.cancel();\n\n if (otherHandler.state === State.END) {\n // Handle edge case, where discrete gestures end immediately after activation thus\n // their state is set to END and when the gesture they are waiting for activates they\n // should be cancelled, however `cancel` was never sent as gestures were already in the END state.\n // Send synthetic BEGAN -> CANCELLED to properly handle JS logic\n otherHandler.sendEvent(State.CANCELLED, State.BEGAN);\n }\n\n otherHandler.awaiting = false;\n }\n }\n\n if (newState === State.ACTIVE) {\n this.tryActivate(handler);\n } else if (oldState === State.ACTIVE || oldState === State.END) {\n if (handler.active) {\n handler.sendEvent(newState, oldState);\n } else if (\n oldState === State.ACTIVE &&\n (newState === State.CANCELLED || newState === State.FAILED)\n ) {\n handler.sendEvent(newState, State.BEGAN);\n }\n } else if (\n oldState !== State.UNDETERMINED ||\n newState !== State.CANCELLED\n ) {\n handler.sendEvent(newState, oldState);\n }\n\n this.handlingChangeSemaphore -= 1;\n\n this.scheduleFinishedHandlersCleanup();\n\n if (!this.awaitingHandlers.includes(handler)) {\n this.cleanupAwaitingHandlers(handler);\n }\n }\n\n private makeActive(handler: IGestureHandler): void {\n const currentState = handler.state;\n\n handler.active = true;\n handler.shouldResetProgress = true;\n handler.activationIndex = this.activationIndex++;\n\n for (let i = this.gestureHandlers.length - 1; i >= 0; --i) {\n if (this.shouldHandlerBeCancelledBy(this.gestureHandlers[i], handler)) {\n this.gestureHandlers[i].cancel();\n }\n }\n\n for (const otherHandler of this.awaitingHandlers) {\n if (this.shouldHandlerBeCancelledBy(otherHandler, handler)) {\n otherHandler.awaiting = false;\n }\n }\n\n handler.sendEvent(State.ACTIVE, State.BEGAN);\n\n if (currentState !== State.ACTIVE) {\n handler.sendEvent(State.END, State.ACTIVE);\n if (currentState !== State.END) {\n handler.sendEvent(State.UNDETERMINED, State.END);\n }\n }\n\n if (!handler.awaiting) {\n return;\n }\n\n handler.awaiting = false;\n\n this.awaitingHandlers = this.awaitingHandlers.filter(\n (otherHandler) => otherHandler !== handler\n );\n }\n\n private addAwaitingHandler(handler: IGestureHandler): void {\n if (this.awaitingHandlers.includes(handler)) {\n return;\n }\n\n this.awaitingHandlers.push(handler);\n this.awaitingHandlersTags.add(handler.handlerTag);\n\n handler.awaiting = true;\n handler.activationIndex = this.activationIndex++;\n }\n\n public recordHandlerIfNotPresent(handler: IGestureHandler): void {\n if (this.gestureHandlers.includes(handler)) {\n return;\n }\n\n this.gestureHandlers.push(handler);\n\n handler.active = false;\n handler.awaiting = false;\n handler.activationIndex = Number.MAX_SAFE_INTEGER;\n }\n\n private shouldHandlerWaitForOther(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n return (\n handler !== otherHandler &&\n (handler.shouldWaitForHandlerFailure(otherHandler) ||\n otherHandler.shouldRequireToWaitForFailure(handler))\n );\n }\n\n private canRunSimultaneously(\n gh1: IGestureHandler,\n gh2: IGestureHandler\n ): boolean {\n return (\n gh1 === gh2 ||\n gh1.shouldRecognizeSimultaneously(gh2) ||\n gh2.shouldRecognizeSimultaneously(gh1)\n );\n }\n\n private shouldHandlerBeCancelledBy(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n if (this.canRunSimultaneously(handler, otherHandler)) {\n return false;\n }\n\n if (handler.awaiting || handler.state === State.ACTIVE) {\n // For now it always returns false\n return handler.shouldBeCancelledByOther(otherHandler);\n }\n\n const handlerPointers: number[] = handler.getTrackedPointersID();\n const otherPointers: number[] = otherHandler.getTrackedPointersID();\n\n if (\n !PointerTracker.shareCommonPointers(handlerPointers, otherPointers) &&\n handler.delegate.view !== otherHandler.delegate.view\n ) {\n return this.checkOverlap(handler, otherHandler);\n }\n\n return true;\n }\n\n private checkOverlap(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n // If handlers don't have common pointers, default return value is false.\n // However, if at least on pointer overlaps with both handlers, we return true\n // This solves issue in overlapping parents example\n\n // TODO: Find better way to handle that issue, for example by activation order and handler cancelling\n\n const isPointerWithinBothBounds = (pointer: number) => {\n const point = handler.tracker.getLastAbsoluteCoords(pointer);\n\n return (\n handler.delegate.isPointerInBounds(point) &&\n otherHandler.delegate.isPointerInBounds(point)\n );\n };\n\n return handler.getTrackedPointersID().some(isPointerWithinBothBounds);\n }\n\n private isFinished(state: State): boolean {\n return (\n state === State.END || state === State.FAILED || state === State.CANCELLED\n );\n }\n\n // This function is called when handler receives touchdown event\n // If handler is using mouse or pen as a pointer and any handler receives touch event,\n // mouse/pen event dissappears - it doesn't send onPointerCancel nor onPointerUp (and others)\n // This became a problem because handler was left at active state without any signal to end or fail\n // To handle this, when new touch event is received, we loop through active handlers and check which type of\n // pointer they're using. If there are any handler with mouse/pen as a pointer, we cancel them\n public cancelMouseAndPenGestures(currentHandler: IGestureHandler): void {\n this.gestureHandlers.forEach((handler: IGestureHandler) => {\n if (\n handler.pointerType !== PointerType.MOUSE &&\n handler.pointerType !== PointerType.STYLUS\n ) {\n return;\n }\n\n if (handler !== currentHandler) {\n handler.cancel();\n } else {\n // Handler that received touch event should have its pointer tracker reset\n // This allows handler to smoothly change from mouse/pen to touch\n // The drawback is, that when we try to use mouse/pen one more time, it doesn't send onPointerDown at the first time\n // so it is required to click two times to get handler to work\n //\n // However, handler will receive manually created onPointerEnter that is triggered in EventManager in onPointerMove method.\n // There may be possibility to use that fact to make handler respond properly to first mouse click\n handler.tracker.resetTracker();\n }\n });\n }\n\n public static get instance(): GestureHandlerOrchestrator {\n if (!GestureHandlerOrchestrator._instance) {\n GestureHandlerOrchestrator._instance = new GestureHandlerOrchestrator();\n }\n\n return GestureHandlerOrchestrator._instance;\n }\n}\n"]}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
function _defineProperty(
|
2
|
-
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
|
4
3
|
import findNodeHandle from '../../findNodeHandle';
|
5
4
|
import PointerEventManager from './PointerEventManager';
|
6
5
|
import { State } from '../../State';
|
@@ -11,18 +10,24 @@ import WheelEventManager from './WheelEventManager';
|
|
11
10
|
export class GestureHandlerWebDelegate {
|
12
11
|
constructor() {
|
13
12
|
_defineProperty(this, "isInitialized", false);
|
13
|
+
|
14
14
|
_defineProperty(this, "_view", void 0);
|
15
|
+
|
15
16
|
_defineProperty(this, "gestureHandler", void 0);
|
17
|
+
|
16
18
|
_defineProperty(this, "eventManagers", []);
|
19
|
+
|
17
20
|
_defineProperty(this, "defaultViewStyles", {
|
18
21
|
userSelect: '',
|
19
22
|
touchAction: ''
|
20
23
|
});
|
21
24
|
}
|
25
|
+
|
22
26
|
init(viewRef, handler) {
|
23
27
|
if (!viewRef) {
|
24
28
|
throw new Error(`Cannot find HTML Element for handler ${handler.handlerTag}`);
|
25
29
|
}
|
30
|
+
|
26
31
|
this.isInitialized = true;
|
27
32
|
this.gestureHandler = handler;
|
28
33
|
this.view = findNodeHandle(viewRef);
|
@@ -39,6 +44,7 @@ export class GestureHandlerWebDelegate {
|
|
39
44
|
this.eventManagers.push(new WheelEventManager(this.view));
|
40
45
|
this.eventManagers.forEach(manager => this.gestureHandler.attachEventManager(manager));
|
41
46
|
}
|
47
|
+
|
42
48
|
isPointerInBounds({
|
43
49
|
x,
|
44
50
|
y
|
@@ -48,6 +54,7 @@ export class GestureHandlerWebDelegate {
|
|
48
54
|
y
|
49
55
|
});
|
50
56
|
}
|
57
|
+
|
51
58
|
measureView() {
|
52
59
|
const rect = this.view.getBoundingClientRect();
|
53
60
|
return {
|
@@ -57,18 +64,23 @@ export class GestureHandlerWebDelegate {
|
|
57
64
|
height: rect.height
|
58
65
|
};
|
59
66
|
}
|
67
|
+
|
60
68
|
reset() {
|
61
69
|
this.eventManagers.forEach(manager => manager.resetManager());
|
62
70
|
}
|
71
|
+
|
63
72
|
tryResetCursor() {
|
64
73
|
const config = this.gestureHandler.config;
|
74
|
+
|
65
75
|
if (config.activeCursor && config.activeCursor !== 'auto' && this.gestureHandler.state === State.ACTIVE) {
|
66
76
|
this.view.style.cursor = 'auto';
|
67
77
|
}
|
68
78
|
}
|
79
|
+
|
69
80
|
shouldDisableContextMenu(config) {
|
70
81
|
return config.enableContextMenu === undefined && this.gestureHandler.isButtonInConfig(MouseButton.RIGHT) || config.enableContextMenu === false;
|
71
82
|
}
|
83
|
+
|
72
84
|
addContextMenuListeners(config) {
|
73
85
|
if (this.shouldDisableContextMenu(config)) {
|
74
86
|
this.view.addEventListener('contextmenu', this.disableContextMenu);
|
@@ -76,6 +88,7 @@ export class GestureHandlerWebDelegate {
|
|
76
88
|
this.view.addEventListener('contextmenu', this.enableContextMenu);
|
77
89
|
}
|
78
90
|
}
|
91
|
+
|
79
92
|
removeContextMenuListeners(config) {
|
80
93
|
if (this.shouldDisableContextMenu(config)) {
|
81
94
|
this.view.removeEventListener('contextmenu', this.disableContextMenu);
|
@@ -83,12 +96,15 @@ export class GestureHandlerWebDelegate {
|
|
83
96
|
this.view.removeEventListener('contextmenu', this.enableContextMenu);
|
84
97
|
}
|
85
98
|
}
|
99
|
+
|
86
100
|
disableContextMenu(e) {
|
87
101
|
e.preventDefault();
|
88
102
|
}
|
103
|
+
|
89
104
|
enableContextMenu(e) {
|
90
105
|
e.stopPropagation();
|
91
106
|
}
|
107
|
+
|
92
108
|
setUserSelect(isHandlerEnabled) {
|
93
109
|
const {
|
94
110
|
userSelect
|
@@ -96,30 +112,35 @@ export class GestureHandlerWebDelegate {
|
|
96
112
|
this.view.style['userSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
97
113
|
this.view.style['webkitUserSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
98
114
|
}
|
115
|
+
|
99
116
|
setTouchAction(isHandlerEnabled) {
|
100
117
|
const {
|
101
118
|
touchAction
|
102
119
|
} = this.gestureHandler.config;
|
103
|
-
this.view.style['touchAction'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
120
|
+
this.view.style['touchAction'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction; // @ts-ignore This one disables default events on Safari
|
104
121
|
|
105
|
-
// @ts-ignore This one disables default events on Safari
|
106
122
|
this.view.style['WebkitTouchCallout'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
107
123
|
}
|
124
|
+
|
108
125
|
setContextMenu(isHandlerEnabled) {
|
109
126
|
const config = this.gestureHandler.config;
|
127
|
+
|
110
128
|
if (isHandlerEnabled) {
|
111
129
|
this.addContextMenuListeners(config);
|
112
130
|
} else {
|
113
131
|
this.removeContextMenuListeners(config);
|
114
132
|
}
|
115
133
|
}
|
134
|
+
|
116
135
|
onEnabledChange(enabled) {
|
117
136
|
if (!this.isInitialized) {
|
118
137
|
return;
|
119
138
|
}
|
139
|
+
|
120
140
|
this.setUserSelect(enabled);
|
121
141
|
this.setTouchAction(enabled);
|
122
142
|
this.setContextMenu(enabled);
|
143
|
+
|
123
144
|
if (enabled) {
|
124
145
|
this.eventManagers.forEach(manager => {
|
125
146
|
// It may look like managers will be registered twice when handler is mounted for the first time.
|
@@ -135,35 +156,44 @@ export class GestureHandlerWebDelegate {
|
|
135
156
|
});
|
136
157
|
}
|
137
158
|
}
|
138
|
-
|
139
|
-
|
159
|
+
|
160
|
+
onBegin() {// no-op for now
|
140
161
|
}
|
162
|
+
|
141
163
|
onActivate() {
|
142
164
|
const config = this.gestureHandler.config;
|
165
|
+
|
143
166
|
if ((!this.view.style.cursor || this.view.style.cursor === 'auto') && config.activeCursor) {
|
144
167
|
this.view.style.cursor = config.activeCursor;
|
145
168
|
}
|
146
169
|
}
|
170
|
+
|
147
171
|
onEnd() {
|
148
172
|
this.tryResetCursor();
|
149
173
|
}
|
174
|
+
|
150
175
|
onCancel() {
|
151
176
|
this.tryResetCursor();
|
152
177
|
}
|
178
|
+
|
153
179
|
onFail() {
|
154
180
|
this.tryResetCursor();
|
155
181
|
}
|
182
|
+
|
156
183
|
destroy(config) {
|
157
184
|
this.removeContextMenuListeners(config);
|
158
185
|
this.eventManagers.forEach(manager => {
|
159
186
|
manager.unregisterListeners();
|
160
187
|
});
|
161
188
|
}
|
189
|
+
|
162
190
|
get view() {
|
163
191
|
return this._view;
|
164
192
|
}
|
193
|
+
|
165
194
|
set view(value) {
|
166
195
|
this._view = value;
|
167
196
|
}
|
197
|
+
|
168
198
|
}
|
169
199
|
//# sourceMappingURL=GestureHandlerWebDelegate.js.map
|