react-native-gesture-handler 2.22.0 → 2.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +14 -0
- package/android/src/main/jni/cpp-adapter.cpp +19 -12
- package/apple/RNGestureHandler.mm +15 -8
- package/apple/RNGestureHandlerModule.mm +17 -5
- package/lib/commonjs/ActionType.js +3 -3
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js +11 -8
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +2 -10
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/GestureHandlerRootViewContext.js +2 -7
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/commonjs/PlatformConstants.js +1 -6
- package/lib/commonjs/PlatformConstants.js.map +1 -1
- package/lib/commonjs/PlatformConstants.web.js +1 -3
- package/lib/commonjs/PlatformConstants.web.js.map +1 -1
- package/lib/commonjs/PointerType.js +3 -5
- package/lib/commonjs/PointerType.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.js +2 -6
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +13 -39
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +22 -32
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/RNRenderer.js +1 -3
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.web.js +1 -2
- package/lib/commonjs/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/State.js +4 -3
- 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 +96 -115
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureButtons.js +36 -80
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureButtonsProps.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +26 -37
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +13 -27
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +2 -6
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +4 -12
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +4 -15
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +4 -14
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js +4 -13
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +46 -78
- 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 +1 -3
- package/lib/commonjs/components/Pressable/index.js.map +1 -1
- package/lib/commonjs/components/Pressable/utils.js +5 -20
- package/lib/commonjs/components/Pressable/utils.js.map +1 -1
- package/lib/commonjs/components/ReanimatedDrawerLayout.js +38 -76
- package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js +133 -98
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +34 -75
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +18 -26
- package/lib/commonjs/components/Text.js.map +1 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js +5 -14
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +40 -76
- 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 +20 -33
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +17 -31
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +5 -4
- 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 +17 -24
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +12 -13
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/index.js +7 -12
- package/lib/commonjs/components/touchables/index.js.map +1 -1
- package/lib/commonjs/findNodeHandle.js +1 -4
- package/lib/commonjs/findNodeHandle.js.map +1 -1
- package/lib/commonjs/findNodeHandle.web.js +9 -10
- package/lib/commonjs/findNodeHandle.web.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.js +1 -6
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.web.js +0 -1
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +13 -14
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js +1 -2
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/FlingGestureHandler.js +16 -10
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +20 -23
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js +16 -10
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +17 -12
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +20 -31
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PinchGestureHandler.js +14 -8
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -1
- package/lib/commonjs/handlers/RotationGestureHandler.js +14 -8
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +16 -10
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +55 -135
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +33 -32
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +1 -2
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +9 -10
- 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 +5 -14
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +10 -20
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -29
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +1 -10
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +12 -37
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +0 -3
- 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 +12 -24
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -48
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +3 -13
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +2 -9
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +8 -16
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +28 -56
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/commonjs/handlers/gestures/eventReceiver.js +14 -46
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +5 -12
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +8 -19
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +44 -84
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js +17 -31
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +1 -27
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +3 -9
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +2 -7
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +11 -25
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +6 -14
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/manualGesture.js +0 -6
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +5 -12
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +18 -43
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/pinchGesture.js +2 -9
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +1 -8
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/rotationGesture.js +2 -9
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +10 -22
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js +0 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -1
- package/lib/commonjs/handlers/handlersRegistry.js +11 -21
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +6 -26
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +75 -104
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.js +4 -11
- package/lib/commonjs/init.js.map +1 -1
- package/lib/commonjs/jestUtils/index.js +4 -5
- package/lib/commonjs/jestUtils/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js +19 -83
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mocks.js +5 -15
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +3 -12
- package/lib/commonjs/mountRegistry.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +1 -5
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +2 -7
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +2 -7
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -1
- package/lib/commonjs/typeUtils.js.map +1 -1
- package/lib/commonjs/utils.js +15 -30
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +5 -23
- package/lib/commonjs/web/Gestures.js.map +1 -1
- package/lib/commonjs/web/constants.js +2 -4
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +26 -62
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +36 -65
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +12 -55
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +160 -273
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +8 -21
- 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 +12 -53
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -11
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +21 -62
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +23 -138
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +19 -56
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +16 -54
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +10 -71
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +9 -17
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +17 -29
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js +7 -41
- 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 +51 -118
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +37 -58
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +21 -40
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/KeyboardEventManager.js +4 -26
- package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/LeastSquareSolver.js +30 -67
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js +9 -16
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +10 -45
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +24 -60
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +3 -18
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +10 -32
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
- package/lib/commonjs/web/tools/WheelEventManager.js +4 -17
- package/lib/commonjs/web/tools/WheelEventManager.js.map +1 -1
- package/lib/commonjs/web/utils.js +26 -55
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +7 -19
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +3 -13
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/Errors.js +0 -3
- package/lib/commonjs/web_hammer/Errors.js.map +1 -1
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +13 -44
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js +55 -142
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +2 -11
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +5 -19
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +16 -24
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js +9 -16
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/commonjs/web_hammer/PanGestureHandler.js +8 -49
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +2 -11
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js +15 -43
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +2 -13
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/TapGestureHandler.js +33 -52
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/constants.js +13 -26
- package/lib/commonjs/web_hammer/constants.js.map +1 -1
- package/lib/commonjs/web_hammer/utils.js +4 -14
- package/lib/commonjs/web_hammer/utils.js.map +1 -1
- package/lib/module/ActionType.js +3 -1
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js +9 -3
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +2 -5
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -1
- package/lib/module/PlatformConstants.js +0 -1
- package/lib/module/PlatformConstants.js.map +1 -1
- package/lib/module/PlatformConstants.web.js +0 -1
- package/lib/module/PlatformConstants.web.js.map +1 -1
- package/lib/module/PointerType.js +3 -4
- package/lib/module/PointerType.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +1 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +12 -22
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +18 -17
- 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 +4 -1
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js +3 -1
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +87 -99
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureButtons.js +27 -55
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureButtonsProps.js.map +1 -1
- package/lib/module/components/GestureComponents.js +17 -12
- 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 +1 -2
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +1 -2
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +1 -2
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.web.js +1 -2
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +44 -61
- 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 +4 -14
- package/lib/module/components/Pressable/utils.js.map +1 -1
- package/lib/module/components/ReanimatedDrawerLayout.js +34 -56
- package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js +130 -84
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js +28 -59
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +14 -13
- 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 +34 -63
- 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 +16 -23
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +11 -19
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.js +6 -1
- 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 +13 -14
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +9 -2
- 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 +9 -8
- 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 +13 -0
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js +16 -8
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
- package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -1
- package/lib/module/handlers/LongPressGestureHandler.js +13 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +13 -0
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/handlers/PanGestureHandler.js +15 -19
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PinchGestureHandler.js +13 -0
- 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 +13 -0
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +13 -0
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +54 -108
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/createNativeWrapper.js +28 -22
- 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 +9 -4
- 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 +3 -4
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +5 -6
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +8 -16
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +0 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +9 -15
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +0 -2
- 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 +11 -14
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +12 -39
- 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 +2 -6
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +7 -9
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +25 -30
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
- package/lib/module/handlers/gestures/eventReceiver.js +14 -38
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +5 -9
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +8 -17
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +44 -73
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureComposition.js +16 -24
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +1 -14
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +3 -4
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +0 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +9 -18
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +6 -11
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/manualGesture.js +0 -4
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +5 -9
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +18 -41
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/pinchGesture.js +2 -7
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +0 -5
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/rotationGesture.js +2 -7
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +10 -19
- 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 +6 -8
- package/lib/module/handlers/handlersRegistry.js.map +1 -1
- package/lib/module/handlers/utils.js +4 -13
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.js +3 -2
- package/lib/module/init.js.map +1 -1
- package/lib/module/jestUtils/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js +20 -66
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mocks.js +3 -7
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/mountRegistry.js +3 -10
- 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 +8 -13
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/Gestures.js +2 -1
- 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 +26 -59
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +36 -61
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +11 -45
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +159 -259
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +7 -13
- 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 +11 -46
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -6
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +20 -54
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +22 -129
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +18 -48
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +15 -46
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +9 -63
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +9 -14
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +17 -27
- package/lib/module/web/tools/CircularBuffer.js.map +1 -1
- package/lib/module/web/tools/EventManager.js +7 -39
- 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 +50 -111
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +36 -47
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +21 -35
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/KeyboardEventManager.js +3 -19
- package/lib/module/web/tools/KeyboardEventManager.js.map +1 -1
- package/lib/module/web/tools/LeastSquareSolver.js +30 -65
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js +9 -14
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +9 -35
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +23 -54
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/Vector.js +3 -14
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +9 -26
- package/lib/module/web/tools/VelocityTracker.js.map +1 -1
- package/lib/module/web/tools/WheelEventManager.js +3 -10
- package/lib/module/web/tools/WheelEventManager.js.map +1 -1
- package/lib/module/web/utils.js +21 -40
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/DiscreteGestureHandler.js +4 -13
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/DraggingGestureHandler.js +0 -5
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/Errors.js +0 -1
- package/lib/module/web_hammer/Errors.js.map +1 -1
- package/lib/module/web_hammer/FlingGestureHandler.js +10 -35
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js +53 -130
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +1 -6
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/LongPressGestureHandler.js +2 -11
- 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 +6 -8
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/web_hammer/PanGestureHandler.js +6 -40
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PinchGestureHandler.js +0 -5
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js +13 -34
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/RotationGestureHandler.js +0 -6
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/TapGestureHandler.js +31 -45
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/constants.js +2 -1
- 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/DrawerLayout.d.ts +27 -0
- package/lib/typescript/components/GestureButtonsProps.d.ts +18 -2
- package/lib/typescript/components/Pressable/PressableProps.d.ts +3 -10
- package/lib/typescript/components/Pressable/index.d.ts +1 -1
- package/lib/typescript/components/ReanimatedSwipeable.d.ts +6 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +5 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +5 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +3 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +5 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +6 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +9 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/utils.d.ts +1 -1
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +7 -7
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +8 -8
- package/lib/typescript/web/handlers/GestureHandler.d.ts +33 -28
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +12 -13
- package/lib/typescript/web/tools/CircularBuffer.d.ts +3 -3
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -1
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +2 -2
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -2
- package/lib/typescript/web/tools/InteractionManager.d.ts +2 -2
- package/lib/typescript/web/tools/NodeManager.d.ts +1 -1
- package/lib/typescript/web/tools/PointerTracker.d.ts +4 -4
- package/lib/typescript/web/tools/VelocityTracker.d.ts +1 -1
- package/package.json +2 -2
- package/src/RNGestureHandlerModule.web.ts +2 -2
- package/src/components/DrawerLayout.tsx +29 -0
- package/src/components/GestureButtons.tsx +13 -2
- package/src/components/GestureButtonsProps.ts +31 -2
- package/src/components/Pressable/Pressable.tsx +22 -5
- package/src/components/Pressable/PressableProps.tsx +4 -11
- package/src/components/Pressable/index.ts +4 -1
- package/src/components/ReanimatedSwipeable.tsx +194 -113
- package/src/components/Text.tsx +13 -4
- package/src/components/touchables/TouchableHighlight.tsx +5 -0
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -0
- package/src/components/touchables/TouchableNativeFeedback.tsx +6 -1
- package/src/components/touchables/TouchableNativeFeedbackProps.tsx +3 -0
- package/src/components/touchables/TouchableOpacity.tsx +5 -0
- package/src/components/touchables/TouchableWithoutFeedback.tsx +6 -0
- package/src/findNodeHandle.web.ts +6 -0
- package/src/handlers/FlingGestureHandler.ts +10 -0
- package/src/handlers/ForceTouchGestureHandler.ts +9 -0
- package/src/handlers/LongPressGestureHandler.ts +10 -0
- package/src/handlers/NativeViewGestureHandler.ts +10 -0
- package/src/handlers/PanGestureHandler.ts +10 -0
- package/src/handlers/PinchGestureHandler.ts +10 -0
- package/src/handlers/RotationGestureHandler.ts +10 -0
- package/src/handlers/TapGestureHandler.ts +10 -0
- package/src/handlers/createHandler.tsx +11 -4
- package/src/handlers/createNativeWrapper.tsx +10 -4
- package/src/handlers/gestures/GestureDetector/index.tsx +2 -2
- package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +3 -3
- package/src/handlers/gestures/GestureDetector/utils.ts +2 -2
- package/src/handlers/handlersRegistry.ts +7 -3
- package/src/index.ts +4 -1
- package/src/utils.ts +2 -2
- package/src/web/detectors/RotationGestureDetector.ts +22 -22
- package/src/web/detectors/ScaleGestureDetector.ts +24 -24
- package/src/web/handlers/FlingGestureHandler.ts +6 -7
- package/src/web/handlers/GestureHandler.ts +115 -105
- package/src/web/handlers/HoverGestureHandler.ts +2 -2
- package/src/web/handlers/IGestureHandler.ts +12 -13
- package/src/web/handlers/LongPressGestureHandler.ts +7 -7
- package/src/web/handlers/NativeViewGestureHandler.ts +14 -19
- package/src/web/handlers/PanGestureHandler.ts +17 -17
- package/src/web/handlers/PinchGestureHandler.ts +17 -21
- package/src/web/handlers/RotationGestureHandler.ts +12 -12
- package/src/web/handlers/TapGestureHandler.ts +4 -6
- package/src/web/tools/CircularBuffer.ts +15 -15
- package/src/web/tools/GestureHandlerDelegate.ts +1 -1
- package/src/web/tools/GestureHandlerOrchestrator.ts +42 -42
- package/src/web/tools/GestureHandlerWebDelegate.ts +32 -13
- package/src/web/tools/InteractionManager.ts +16 -16
- package/src/web/tools/NodeManager.ts +2 -2
- package/src/web/tools/PointerTracker.ts +20 -20
- package/src/web/tools/Vector.ts +1 -1
- package/src/web/tools/VelocityTracker.ts +1 -1
@@ -1,5 +1,6 @@
|
|
1
|
-
function _defineProperty(
|
2
|
-
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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); }
|
3
4
|
import findNodeHandle from '../../findNodeHandle';
|
4
5
|
import PointerEventManager from './PointerEventManager';
|
5
6
|
import { State } from '../../State';
|
@@ -10,28 +11,18 @@ import WheelEventManager from './WheelEventManager';
|
|
10
11
|
export class GestureHandlerWebDelegate {
|
11
12
|
constructor() {
|
12
13
|
_defineProperty(this, "isInitialized", false);
|
13
|
-
|
14
|
-
_defineProperty(this, "view", void 0);
|
15
|
-
|
14
|
+
_defineProperty(this, "_view", void 0);
|
16
15
|
_defineProperty(this, "gestureHandler", void 0);
|
17
|
-
|
18
16
|
_defineProperty(this, "eventManagers", []);
|
19
|
-
|
20
17
|
_defineProperty(this, "defaultViewStyles", {
|
21
18
|
userSelect: '',
|
22
19
|
touchAction: ''
|
23
20
|
});
|
24
21
|
}
|
25
|
-
|
26
|
-
getView() {
|
27
|
-
return this.view;
|
28
|
-
}
|
29
|
-
|
30
22
|
init(viewRef, handler) {
|
31
23
|
if (!viewRef) {
|
32
|
-
throw new Error(`Cannot find HTML Element for handler ${handler.
|
24
|
+
throw new Error(`Cannot find HTML Element for handler ${handler.handlerTag}`);
|
33
25
|
}
|
34
|
-
|
35
26
|
this.isInitialized = true;
|
36
27
|
this.gestureHandler = handler;
|
37
28
|
this.view = findNodeHandle(viewRef);
|
@@ -39,7 +30,7 @@ export class GestureHandlerWebDelegate {
|
|
39
30
|
userSelect: this.view.style.userSelect,
|
40
31
|
touchAction: this.view.style.touchAction
|
41
32
|
};
|
42
|
-
const config = handler.
|
33
|
+
const config = handler.config;
|
43
34
|
this.setUserSelect(config.enabled);
|
44
35
|
this.setTouchAction(config.enabled);
|
45
36
|
this.setContextMenu(config.enabled);
|
@@ -48,7 +39,6 @@ export class GestureHandlerWebDelegate {
|
|
48
39
|
this.eventManagers.push(new WheelEventManager(this.view));
|
49
40
|
this.eventManagers.forEach(manager => this.gestureHandler.attachEventManager(manager));
|
50
41
|
}
|
51
|
-
|
52
42
|
isPointerInBounds({
|
53
43
|
x,
|
54
44
|
y
|
@@ -58,7 +48,6 @@ export class GestureHandlerWebDelegate {
|
|
58
48
|
y
|
59
49
|
});
|
60
50
|
}
|
61
|
-
|
62
51
|
measureView() {
|
63
52
|
const rect = this.view.getBoundingClientRect();
|
64
53
|
return {
|
@@ -68,23 +57,18 @@ export class GestureHandlerWebDelegate {
|
|
68
57
|
height: rect.height
|
69
58
|
};
|
70
59
|
}
|
71
|
-
|
72
60
|
reset() {
|
73
61
|
this.eventManagers.forEach(manager => manager.resetManager());
|
74
62
|
}
|
75
|
-
|
76
63
|
tryResetCursor() {
|
77
|
-
const config = this.gestureHandler.
|
78
|
-
|
79
|
-
if (config.activeCursor && config.activeCursor !== 'auto' && this.gestureHandler.getState() === State.ACTIVE) {
|
64
|
+
const config = this.gestureHandler.config;
|
65
|
+
if (config.activeCursor && config.activeCursor !== 'auto' && this.gestureHandler.state === State.ACTIVE) {
|
80
66
|
this.view.style.cursor = 'auto';
|
81
67
|
}
|
82
68
|
}
|
83
|
-
|
84
69
|
shouldDisableContextMenu(config) {
|
85
70
|
return config.enableContextMenu === undefined && this.gestureHandler.isButtonInConfig(MouseButton.RIGHT) || config.enableContextMenu === false;
|
86
71
|
}
|
87
|
-
|
88
72
|
addContextMenuListeners(config) {
|
89
73
|
if (this.shouldDisableContextMenu(config)) {
|
90
74
|
this.view.addEventListener('contextmenu', this.disableContextMenu);
|
@@ -92,7 +76,6 @@ export class GestureHandlerWebDelegate {
|
|
92
76
|
this.view.addEventListener('contextmenu', this.enableContextMenu);
|
93
77
|
}
|
94
78
|
}
|
95
|
-
|
96
79
|
removeContextMenuListeners(config) {
|
97
80
|
if (this.shouldDisableContextMenu(config)) {
|
98
81
|
this.view.removeEventListener('contextmenu', this.disableContextMenu);
|
@@ -100,81 +83,87 @@ export class GestureHandlerWebDelegate {
|
|
100
83
|
this.view.removeEventListener('contextmenu', this.enableContextMenu);
|
101
84
|
}
|
102
85
|
}
|
103
|
-
|
104
86
|
disableContextMenu(e) {
|
105
87
|
e.preventDefault();
|
106
88
|
}
|
107
|
-
|
108
89
|
enableContextMenu(e) {
|
109
90
|
e.stopPropagation();
|
110
91
|
}
|
111
|
-
|
112
92
|
setUserSelect(isHandlerEnabled) {
|
113
93
|
const {
|
114
94
|
userSelect
|
115
|
-
} = this.gestureHandler.
|
95
|
+
} = this.gestureHandler.config;
|
116
96
|
this.view.style['userSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
117
97
|
this.view.style['webkitUserSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
118
98
|
}
|
119
|
-
|
120
99
|
setTouchAction(isHandlerEnabled) {
|
121
100
|
const {
|
122
101
|
touchAction
|
123
|
-
} = this.gestureHandler.
|
124
|
-
this.view.style['touchAction'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
102
|
+
} = this.gestureHandler.config;
|
103
|
+
this.view.style['touchAction'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
125
104
|
|
105
|
+
// @ts-ignore This one disables default events on Safari
|
126
106
|
this.view.style['WebkitTouchCallout'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
127
107
|
}
|
128
|
-
|
129
108
|
setContextMenu(isHandlerEnabled) {
|
130
|
-
const config = this.gestureHandler.
|
131
|
-
|
109
|
+
const config = this.gestureHandler.config;
|
132
110
|
if (isHandlerEnabled) {
|
133
111
|
this.addContextMenuListeners(config);
|
134
112
|
} else {
|
135
113
|
this.removeContextMenuListeners(config);
|
136
114
|
}
|
137
115
|
}
|
138
|
-
|
139
116
|
onEnabledChange(enabled) {
|
140
117
|
if (!this.isInitialized) {
|
141
118
|
return;
|
142
119
|
}
|
143
|
-
|
144
120
|
this.setUserSelect(enabled);
|
145
121
|
this.setTouchAction(enabled);
|
146
122
|
this.setContextMenu(enabled);
|
123
|
+
if (enabled) {
|
124
|
+
this.eventManagers.forEach(manager => {
|
125
|
+
// It may look like managers will be registered twice when handler is mounted for the first time.
|
126
|
+
// However, `init` method is called AFTER `updateGestureConfig` - it means that delegate has not
|
127
|
+
// been initialized yet, so this code won't be executed.
|
128
|
+
//
|
129
|
+
// Also, because we use defined functions, not lambdas, they will not be registered multiple times.
|
130
|
+
manager.registerListeners();
|
131
|
+
});
|
132
|
+
} else {
|
133
|
+
this.eventManagers.forEach(manager => {
|
134
|
+
manager.unregisterListeners();
|
135
|
+
});
|
136
|
+
}
|
147
137
|
}
|
148
|
-
|
149
|
-
|
138
|
+
onBegin() {
|
139
|
+
// no-op for now
|
150
140
|
}
|
151
|
-
|
152
141
|
onActivate() {
|
153
|
-
const config = this.gestureHandler.
|
154
|
-
|
142
|
+
const config = this.gestureHandler.config;
|
155
143
|
if ((!this.view.style.cursor || this.view.style.cursor === 'auto') && config.activeCursor) {
|
156
144
|
this.view.style.cursor = config.activeCursor;
|
157
145
|
}
|
158
146
|
}
|
159
|
-
|
160
147
|
onEnd() {
|
161
148
|
this.tryResetCursor();
|
162
149
|
}
|
163
|
-
|
164
150
|
onCancel() {
|
165
151
|
this.tryResetCursor();
|
166
152
|
}
|
167
|
-
|
168
153
|
onFail() {
|
169
154
|
this.tryResetCursor();
|
170
155
|
}
|
171
|
-
|
172
156
|
destroy(config) {
|
173
157
|
this.removeContextMenuListeners(config);
|
174
158
|
this.eventManagers.forEach(manager => {
|
175
159
|
manager.unregisterListeners();
|
176
160
|
});
|
177
161
|
}
|
178
|
-
|
162
|
+
get view() {
|
163
|
+
return this._view;
|
164
|
+
}
|
165
|
+
set view(value) {
|
166
|
+
this._view = value;
|
167
|
+
}
|
179
168
|
}
|
180
169
|
//# sourceMappingURL=GestureHandlerWebDelegate.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["GestureHandlerWebDelegate.ts"],"names":["findNodeHandle","PointerEventManager","State","isPointerInBounds","MouseButton","KeyboardEventManager","WheelEventManager","GestureHandlerWebDelegate","userSelect","touchAction","getView","view","init","viewRef","handler","Error","getTag","isInitialized","gestureHandler","defaultViewStyles","style","config","getConfig","setUserSelect","enabled","setTouchAction","setContextMenu","eventManagers","push","forEach","manager","attachEventManager","x","y","measureView","rect","getBoundingClientRect","pageX","left","pageY","top","width","height","reset","resetManager","tryResetCursor","activeCursor","getState","ACTIVE","cursor","shouldDisableContextMenu","enableContextMenu","undefined","isButtonInConfig","RIGHT","addContextMenuListeners","addEventListener","disableContextMenu","removeContextMenuListeners","removeEventListener","e","preventDefault","stopPropagation","isHandlerEnabled","onEnabledChange","onBegin","onActivate","onEnd","onCancel","onFail","destroy","unregisterListeners"],"mappings":";;AAAA,OAAOA,cAAP,MAA2B,sBAA3B;AAMA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAGA,SAASC,WAAT,QAA4B,qCAA5B;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AAOA,OAAO,MAAMC,yBAAN,CAEP;AAAA;AAAA,2CAC0B,KAD1B;;AAAA;;AAAA;;AAAA,2CAImD,EAJnD;;AAAA,+CAKiD;AAC7CC,MAAAA,UAAU,EAAE,EADiC;AAE7CC,MAAAA,WAAW,EAAE;AAFgC,KALjD;AAAA;;AAUEC,EAAAA,OAAO,GAAgB;AACrB,WAAO,KAAKC,IAAZ;AACD;;AAEDC,EAAAA,IAAI,CAACC,OAAD,EAAkBC,OAAlB,EAAkD;AACpD,QAAI,CAACD,OAAL,EAAc;AACZ,YAAM,IAAIE,KAAJ,CACH,wCAAuCD,OAAO,CAACE,MAAR,EAAiB,EADrD,CAAN;AAGD;;AAED,SAAKC,aAAL,GAAqB,IAArB;AAEA,SAAKC,cAAL,GAAsBJ,OAAtB;AACA,SAAKH,IAAL,GAAYX,cAAc,CAACa,OAAD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BAAJ,EAAsB;AACpB,WAAKR,uBAAL,CAA6BlC,MAA7B;AACD,KAFD,MAEO;AACL,WAAKqC,0BAAL,CAAgCrC,MAAhC;AACD;AACF;;AAED2C,EAAAA,eAAe,CAACxC,OAAD,EAAyB;AACtC,QAAI,CAAC,KAAKP,aAAV,EAAyB;AACvB;AACD;;AAED,SAAKM,aAAL,CAAmBC,OAAnB;AACA,SAAKC,cAAL,CAAoBD,OAApB;AACA,SAAKE,cAAL,CAAoBF,OAApB;AACD;;AAEDyC,EAAAA,OAAO,GAAS,CACd;AACD;;AAEDC,EAAAA,UAAU,GAAS;AACjB,UAAM7C,MAAM,GAAG,KAAKH,cAAL,CAAoBI,SAApB,EAAf;;AAEA,QACE,CAAC,CAAC,KAAKX,IAAL,CAAUS,KAAV,CAAgB6B,MAAjB,IAA2B,KAAKtC,IAAL,CAAUS,KAAV,CAAgB6B,MAAhB,KAA2B,MAAvD,KACA5B,MAAM,CAACyB,YAFT,EAGE;AACA,WAAKnC,IAAL,CAAUS,KAAV,CAAgB6B,MAAhB,GAAyB5B,MAAM,CAACyB,YAAhC;AACD;AACF;;AAEDqB,EAAAA,KAAK,GAAS;AACZ,SAAKtB,cAAL;AACD;;AAEDuB,EAAAA,QAAQ,GAAS;AACf,SAAKvB,cAAL;AACD;;AAEDwB,EAAAA,MAAM,GAAS;AACb,SAAKxB,cAAL;AACD;;AAEMyB,EAAAA,OAAO,CAACjD,MAAD,EAAuB;AACnC,SAAKqC,0BAAL,CAAgCrC,MAAhC;AAEA,SAAKM,aAAL,CAAmBE,OAAnB,CAA4BC,OAAD,IAAa;AACtCA,MAAAA,OAAO,CAACyC,mBAAR;AACD,KAFD;AAGD;;AA7LH","sourcesContent":["import findNodeHandle from '../../findNodeHandle';\nimport type IGestureHandler from '../handlers/IGestureHandler';\nimport {\n GestureHandlerDelegate,\n MeasureResult,\n} from './GestureHandlerDelegate';\nimport PointerEventManager from './PointerEventManager';\nimport { State } from '../../State';\nimport { isPointerInBounds } from '../utils';\nimport EventManager from './EventManager';\nimport { Config } from '../interfaces';\nimport { MouseButton } from '../../handlers/gestureHandlerCommon';\nimport KeyboardEventManager from './KeyboardEventManager';\nimport WheelEventManager from './WheelEventManager';\n\ninterface DefaultViewStyles {\n userSelect: string;\n touchAction: string;\n}\n\nexport class GestureHandlerWebDelegate\n implements GestureHandlerDelegate<HTMLElement, IGestureHandler>\n{\n private isInitialized = false;\n private view!: HTMLElement;\n private gestureHandler!: IGestureHandler;\n private eventManagers: EventManager<unknown>[] = [];\n private defaultViewStyles: DefaultViewStyles = {\n userSelect: '',\n touchAction: '',\n };\n\n getView(): HTMLElement {\n return this.view;\n }\n\n init(viewRef: number, handler: IGestureHandler): void {\n if (!viewRef) {\n throw new Error(\n `Cannot find HTML Element for handler ${handler.getTag()}`\n );\n }\n\n this.isInitialized = true;\n\n this.gestureHandler = handler;\n this.view = findNodeHandle(viewRef) as unknown as HTMLElement;\n\n this.defaultViewStyles = {\n userSelect: this.view.style.userSelect,\n touchAction: this.view.style.touchAction,\n };\n\n const config = handler.getConfig();\n\n this.setUserSelect(config.enabled);\n this.setTouchAction(config.enabled);\n this.setContextMenu(config.enabled);\n\n this.eventManagers.push(new PointerEventManager(this.view));\n this.eventManagers.push(new KeyboardEventManager(this.view));\n this.eventManagers.push(new WheelEventManager(this.view));\n\n this.eventManagers.forEach((manager) =>\n this.gestureHandler.attachEventManager(manager)\n );\n }\n\n isPointerInBounds({ x, y }: { x: number; y: number }): boolean {\n return isPointerInBounds(this.view, { x, y });\n }\n\n measureView(): MeasureResult {\n const rect = this.view.getBoundingClientRect();\n\n return {\n pageX: rect.left,\n pageY: rect.top,\n width: rect.width,\n height: rect.height,\n };\n }\n\n reset(): void {\n this.eventManagers.forEach((manager: EventManager<unknown>) =>\n manager.resetManager()\n );\n }\n\n tryResetCursor() {\n const config = this.gestureHandler.getConfig();\n\n if (\n config.activeCursor &&\n config.activeCursor !== 'auto' &&\n this.gestureHandler.getState() === State.ACTIVE\n ) {\n this.view.style.cursor = 'auto';\n }\n }\n\n private shouldDisableContextMenu(config: Config) {\n return (\n (config.enableContextMenu === undefined &&\n this.gestureHandler.isButtonInConfig(MouseButton.RIGHT)) ||\n config.enableContextMenu === false\n );\n }\n\n private addContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.addEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.addEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private removeContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.removeEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.removeEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private disableContextMenu(this: void, e: MouseEvent): void {\n e.preventDefault();\n }\n\n private enableContextMenu(this: void, e: MouseEvent): void {\n e.stopPropagation();\n }\n\n private setUserSelect(isHandlerEnabled: boolean) {\n const { userSelect } = this.gestureHandler.getConfig();\n\n this.view.style['userSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n\n this.view.style['webkitUserSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n }\n\n private setTouchAction(isHandlerEnabled: boolean) {\n const { touchAction } = this.gestureHandler.getConfig();\n\n this.view.style['touchAction'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n\n // @ts-ignore This one disables default events on Safari\n this.view.style['WebkitTouchCallout'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n }\n\n private setContextMenu(isHandlerEnabled: boolean) {\n const config = this.gestureHandler.getConfig();\n\n if (isHandlerEnabled) {\n this.addContextMenuListeners(config);\n } else {\n this.removeContextMenuListeners(config);\n }\n }\n\n onEnabledChange(enabled: boolean): void {\n if (!this.isInitialized) {\n return;\n }\n\n this.setUserSelect(enabled);\n this.setTouchAction(enabled);\n this.setContextMenu(enabled);\n }\n\n onBegin(): void {\n // no-op for now\n }\n\n onActivate(): void {\n const config = this.gestureHandler.getConfig();\n\n if (\n (!this.view.style.cursor || this.view.style.cursor === 'auto') &&\n config.activeCursor\n ) {\n this.view.style.cursor = config.activeCursor;\n }\n }\n\n onEnd(): void {\n this.tryResetCursor();\n }\n\n onCancel(): void {\n this.tryResetCursor();\n }\n\n onFail(): void {\n this.tryResetCursor();\n }\n\n public destroy(config: Config): void {\n this.removeContextMenuListeners(config);\n\n this.eventManagers.forEach((manager) => {\n manager.unregisterListeners();\n });\n }\n}\n"]}
|
1
|
+
{"version":3,"names":["findNodeHandle","PointerEventManager","State","isPointerInBounds","MouseButton","KeyboardEventManager","WheelEventManager","GestureHandlerWebDelegate","constructor","_defineProperty","userSelect","touchAction","init","viewRef","handler","Error","handlerTag","isInitialized","gestureHandler","view","defaultViewStyles","style","config","setUserSelect","enabled","setTouchAction","setContextMenu","eventManagers","push","forEach","manager","attachEventManager","x","y","measureView","rect","getBoundingClientRect","pageX","left","pageY","top","width","height","reset","resetManager","tryResetCursor","activeCursor","state","ACTIVE","cursor","shouldDisableContextMenu","enableContextMenu","undefined","isButtonInConfig","RIGHT","addContextMenuListeners","addEventListener","disableContextMenu","removeContextMenuListeners","removeEventListener","e","preventDefault","stopPropagation","isHandlerEnabled","onEnabledChange","registerListeners","unregisterListeners","onBegin","onActivate","onEnd","onCancel","onFail","destroy","_view","value"],"sources":["GestureHandlerWebDelegate.ts"],"sourcesContent":["import findNodeHandle from '../../findNodeHandle';\nimport type IGestureHandler from '../handlers/IGestureHandler';\nimport {\n GestureHandlerDelegate,\n MeasureResult,\n} from './GestureHandlerDelegate';\nimport PointerEventManager from './PointerEventManager';\nimport { State } from '../../State';\nimport { isPointerInBounds } from '../utils';\nimport EventManager from './EventManager';\nimport { Config } from '../interfaces';\nimport { MouseButton } from '../../handlers/gestureHandlerCommon';\nimport KeyboardEventManager from './KeyboardEventManager';\nimport WheelEventManager from './WheelEventManager';\n\ninterface DefaultViewStyles {\n userSelect: string;\n touchAction: string;\n}\n\nexport class GestureHandlerWebDelegate\n implements GestureHandlerDelegate<HTMLElement, IGestureHandler>\n{\n private isInitialized = false;\n private _view!: HTMLElement;\n\n private gestureHandler!: IGestureHandler;\n private eventManagers: EventManager<unknown>[] = [];\n private defaultViewStyles: DefaultViewStyles = {\n userSelect: '',\n touchAction: '',\n };\n\n init(viewRef: number, handler: IGestureHandler): void {\n if (!viewRef) {\n throw new Error(\n `Cannot find HTML Element for handler ${handler.handlerTag}`\n );\n }\n\n this.isInitialized = true;\n\n this.gestureHandler = handler;\n this.view = findNodeHandle(viewRef) as unknown as HTMLElement;\n\n this.defaultViewStyles = {\n userSelect: this.view.style.userSelect,\n touchAction: this.view.style.touchAction,\n };\n\n const config = handler.config;\n\n this.setUserSelect(config.enabled);\n this.setTouchAction(config.enabled);\n this.setContextMenu(config.enabled);\n\n this.eventManagers.push(new PointerEventManager(this.view));\n this.eventManagers.push(new KeyboardEventManager(this.view));\n this.eventManagers.push(new WheelEventManager(this.view));\n\n this.eventManagers.forEach((manager) =>\n this.gestureHandler.attachEventManager(manager)\n );\n }\n\n isPointerInBounds({ x, y }: { x: number; y: number }): boolean {\n return isPointerInBounds(this.view, { x, y });\n }\n\n measureView(): MeasureResult {\n const rect = this.view.getBoundingClientRect();\n\n return {\n pageX: rect.left,\n pageY: rect.top,\n width: rect.width,\n height: rect.height,\n };\n }\n\n reset(): void {\n this.eventManagers.forEach((manager: EventManager<unknown>) =>\n manager.resetManager()\n );\n }\n\n tryResetCursor() {\n const config = this.gestureHandler.config;\n\n if (\n config.activeCursor &&\n config.activeCursor !== 'auto' &&\n this.gestureHandler.state === State.ACTIVE\n ) {\n this.view.style.cursor = 'auto';\n }\n }\n\n private shouldDisableContextMenu(config: Config) {\n return (\n (config.enableContextMenu === undefined &&\n this.gestureHandler.isButtonInConfig(MouseButton.RIGHT)) ||\n config.enableContextMenu === false\n );\n }\n\n private addContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.addEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.addEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private removeContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.removeEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.removeEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private disableContextMenu(this: void, e: MouseEvent): void {\n e.preventDefault();\n }\n\n private enableContextMenu(this: void, e: MouseEvent): void {\n e.stopPropagation();\n }\n\n private setUserSelect(isHandlerEnabled: boolean) {\n const { userSelect } = this.gestureHandler.config;\n\n this.view.style['userSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n\n this.view.style['webkitUserSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n }\n\n private setTouchAction(isHandlerEnabled: boolean) {\n const { touchAction } = this.gestureHandler.config;\n\n this.view.style['touchAction'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n\n // @ts-ignore This one disables default events on Safari\n this.view.style['WebkitTouchCallout'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n }\n\n private setContextMenu(isHandlerEnabled: boolean) {\n const config = this.gestureHandler.config;\n\n if (isHandlerEnabled) {\n this.addContextMenuListeners(config);\n } else {\n this.removeContextMenuListeners(config);\n }\n }\n\n onEnabledChange(enabled: boolean): void {\n if (!this.isInitialized) {\n return;\n }\n\n this.setUserSelect(enabled);\n this.setTouchAction(enabled);\n this.setContextMenu(enabled);\n\n if (enabled) {\n this.eventManagers.forEach((manager) => {\n // It may look like managers will be registered twice when handler is mounted for the first time.\n // However, `init` method is called AFTER `updateGestureConfig` - it means that delegate has not\n // been initialized yet, so this code won't be executed.\n //\n // Also, because we use defined functions, not lambdas, they will not be registered multiple times.\n manager.registerListeners();\n });\n } else {\n this.eventManagers.forEach((manager) => {\n manager.unregisterListeners();\n });\n }\n }\n\n onBegin(): void {\n // no-op for now\n }\n\n onActivate(): void {\n const config = this.gestureHandler.config;\n\n if (\n (!this.view.style.cursor || this.view.style.cursor === 'auto') &&\n config.activeCursor\n ) {\n this.view.style.cursor = config.activeCursor;\n }\n }\n\n onEnd(): void {\n this.tryResetCursor();\n }\n\n onCancel(): void {\n this.tryResetCursor();\n }\n\n onFail(): void {\n this.tryResetCursor();\n }\n\n public destroy(config: Config): void {\n this.removeContextMenuListeners(config);\n\n this.eventManagers.forEach((manager) => {\n manager.unregisterListeners();\n });\n }\n\n public get view() {\n return this._view;\n }\n public set view(value: HTMLElement) {\n this._view = value;\n }\n}\n"],"mappings":";;;AAAA,OAAOA,cAAc,MAAM,sBAAsB;AAMjD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,iBAAiB,QAAQ,UAAU;AAG5C,SAASC,WAAW,QAAQ,qCAAqC;AACjE,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,iBAAiB,MAAM,qBAAqB;AAOnD,OAAO,MAAMC,yBAAyB,CAEtC;EAAAC,YAAA;IAAAC,eAAA,wBAC0B,KAAK;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,wBAIoB,EAAE;IAAAA,eAAA,4BACJ;MAC7CC,UAAU,EAAE,EAAE;MACdC,WAAW,EAAE;IACf,CAAC;EAAA;EAEDC,IAAIA,CAACC,OAAe,EAAEC,OAAwB,EAAQ;IACpD,IAAI,CAACD,OAAO,EAAE;MACZ,MAAM,IAAIE,KAAK,CACb,wCAAwCD,OAAO,CAACE,UAAU,EAC5D,CAAC;IACH;IAEA,IAAI,CAACC,aAAa,GAAG,IAAI;IAEzB,IAAI,CAACC,cAAc,GAAGJ,OAAO;IAC7B,IAAI,CAACK,IAAI,GAAGnB,cAAc,CAACa,OAAO,CAA2B;IAE7D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cAAc,CAAC,CAAC;EACvB;EAEO2B,OAAOA,CAAClD,MAAc,EAAQ;IACnC,IAAI,CAACoC,0BAA0B,CAACpC,MAAM,CAAC;IAEvC,IAAI,CAACK,aAAa,CAACE,OAAO,CAAEC,OAAO,IAAK;MACtCA,OAAO,CAACoC,mBAAmB,CAAC,CAAC;IAC/B,CAAC,CAAC;EACJ;EAEA,IAAW/C,IAAIA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACsD,KAAK;EACnB;EACA,IAAWtD,IAAIA,CAACuD,KAAkB,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGC,KAAK;EACpB;AACF","ignoreList":[]}
|
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
var _InteractionManager;
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
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); }
|
3
5
|
import { State } from '../../State';
|
4
6
|
export default class InteractionManager {
|
5
7
|
// Private becaues of singleton
|
6
8
|
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
7
9
|
constructor() {
|
8
10
|
_defineProperty(this, "waitForRelations", new Map());
|
9
|
-
|
10
11
|
_defineProperty(this, "simultaneousRelations", new Map());
|
11
|
-
|
12
12
|
_defineProperty(this, "blocksHandlersRelations", new Map());
|
13
13
|
}
|
14
|
-
|
15
14
|
configureInteractions(handler, config) {
|
16
|
-
this.dropRelationsForHandlerWithTag(handler.
|
17
|
-
|
15
|
+
this.dropRelationsForHandlerWithTag(handler.handlerTag);
|
18
16
|
if (config.waitFor) {
|
19
17
|
const waitFor = [];
|
20
18
|
config.waitFor.forEach(otherHandler => {
|
@@ -26,9 +24,8 @@ export default class InteractionManager {
|
|
26
24
|
waitFor.push(otherHandler.handlerTag);
|
27
25
|
}
|
28
26
|
});
|
29
|
-
this.waitForRelations.set(handler.
|
27
|
+
this.waitForRelations.set(handler.handlerTag, waitFor);
|
30
28
|
}
|
31
|
-
|
32
29
|
if (config.simultaneousHandlers) {
|
33
30
|
const simultaneousHandlers = [];
|
34
31
|
config.simultaneousHandlers.forEach(otherHandler => {
|
@@ -38,9 +35,8 @@ export default class InteractionManager {
|
|
38
35
|
simultaneousHandlers.push(otherHandler.handlerTag);
|
39
36
|
}
|
40
37
|
});
|
41
|
-
this.simultaneousRelations.set(handler.
|
38
|
+
this.simultaneousRelations.set(handler.handlerTag, simultaneousHandlers);
|
42
39
|
}
|
43
|
-
|
44
40
|
if (config.blocksHandlers) {
|
45
41
|
const blocksHandlers = [];
|
46
42
|
config.blocksHandlers.forEach(otherHandler => {
|
@@ -50,62 +46,52 @@ export default class InteractionManager {
|
|
50
46
|
blocksHandlers.push(otherHandler.handlerTag);
|
51
47
|
}
|
52
48
|
});
|
53
|
-
this.blocksHandlersRelations.set(handler.
|
49
|
+
this.blocksHandlersRelations.set(handler.handlerTag, blocksHandlers);
|
54
50
|
}
|
55
51
|
}
|
56
|
-
|
57
52
|
shouldWaitForHandlerFailure(handler, otherHandler) {
|
58
|
-
const waitFor = this.waitForRelations.get(handler.
|
53
|
+
const waitFor = this.waitForRelations.get(handler.handlerTag);
|
59
54
|
return (waitFor === null || waitFor === void 0 ? void 0 : waitFor.find(tag => {
|
60
|
-
return tag === otherHandler.
|
55
|
+
return tag === otherHandler.handlerTag;
|
61
56
|
})) !== undefined;
|
62
57
|
}
|
63
|
-
|
64
58
|
shouldRecognizeSimultaneously(handler, otherHandler) {
|
65
|
-
const simultaneousHandlers = this.simultaneousRelations.get(handler.
|
59
|
+
const simultaneousHandlers = this.simultaneousRelations.get(handler.handlerTag);
|
66
60
|
return (simultaneousHandlers === null || simultaneousHandlers === void 0 ? void 0 : simultaneousHandlers.find(tag => {
|
67
|
-
return tag === otherHandler.
|
61
|
+
return tag === otherHandler.handlerTag;
|
68
62
|
})) !== undefined;
|
69
63
|
}
|
70
|
-
|
71
64
|
shouldRequireHandlerToWaitForFailure(handler, otherHandler) {
|
72
|
-
const waitFor = this.blocksHandlersRelations.get(handler.
|
65
|
+
const waitFor = this.blocksHandlersRelations.get(handler.handlerTag);
|
73
66
|
return (waitFor === null || waitFor === void 0 ? void 0 : waitFor.find(tag => {
|
74
|
-
return tag === otherHandler.
|
67
|
+
return tag === otherHandler.handlerTag;
|
75
68
|
})) !== undefined;
|
76
69
|
}
|
77
|
-
|
78
70
|
shouldHandlerBeCancelledBy(_handler, otherHandler) {
|
79
71
|
var _otherHandler$isButto;
|
80
|
-
|
81
72
|
// We check constructor name instead of using `instanceof` in order do avoid circular dependencies
|
82
73
|
const isNativeHandler = otherHandler.constructor.name === 'NativeViewGestureHandler';
|
83
|
-
const isActive = otherHandler.
|
74
|
+
const isActive = otherHandler.state === State.ACTIVE;
|
84
75
|
const isButton = ((_otherHandler$isButto = otherHandler.isButton) === null || _otherHandler$isButto === void 0 ? void 0 : _otherHandler$isButto.call(otherHandler)) === true;
|
85
76
|
return isNativeHandler && isActive && !isButton;
|
86
77
|
}
|
87
|
-
|
88
78
|
dropRelationsForHandlerWithTag(handlerTag) {
|
89
79
|
this.waitForRelations.delete(handlerTag);
|
90
80
|
this.simultaneousRelations.delete(handlerTag);
|
91
81
|
this.blocksHandlersRelations.delete(handlerTag);
|
92
82
|
}
|
93
|
-
|
94
83
|
reset() {
|
95
84
|
this.waitForRelations.clear();
|
96
85
|
this.simultaneousRelations.clear();
|
97
86
|
this.blocksHandlersRelations.clear();
|
98
87
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
this.instance = new InteractionManager();
|
88
|
+
static get instance() {
|
89
|
+
if (!this._instance) {
|
90
|
+
this._instance = new InteractionManager();
|
103
91
|
}
|
104
|
-
|
105
|
-
return this.instance;
|
92
|
+
return this._instance;
|
106
93
|
}
|
107
|
-
|
108
94
|
}
|
109
|
-
|
110
|
-
_defineProperty(InteractionManager, "
|
95
|
+
_InteractionManager = InteractionManager;
|
96
|
+
_defineProperty(InteractionManager, "_instance", void 0);
|
111
97
|
//# sourceMappingURL=InteractionManager.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["State","InteractionManager","constructor","_defineProperty","Map","configureInteractions","handler","config","dropRelationsForHandlerWithTag","handlerTag","waitFor","forEach","otherHandler","push","waitForRelations","set","simultaneousHandlers","simultaneousRelations","blocksHandlers","blocksHandlersRelations","shouldWaitForHandlerFailure","get","find","tag","undefined","shouldRecognizeSimultaneously","shouldRequireHandlerToWaitForFailure","shouldHandlerBeCancelledBy","_handler","_otherHandler$isButto","isNativeHandler","name","isActive","state","ACTIVE","isButton","call","delete","reset","clear","instance","_instance","_InteractionManager"],"sources":["InteractionManager.ts"],"sourcesContent":["import type IGestureHandler from '../handlers/IGestureHandler';\nimport { State } from '../../State';\nimport { Config, Handler } from '../interfaces';\n\nexport default class InteractionManager {\n private static _instance: InteractionManager;\n private readonly waitForRelations: Map<number, number[]> = new Map();\n private readonly simultaneousRelations: Map<number, number[]> = new Map();\n private readonly blocksHandlersRelations: Map<number, number[]> = new Map();\n\n // Private becaues of singleton\n // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function\n private constructor() {}\n\n public configureInteractions(handler: IGestureHandler, config: Config) {\n this.dropRelationsForHandlerWithTag(handler.handlerTag);\n\n if (config.waitFor) {\n const waitFor: number[] = [];\n config.waitFor.forEach((otherHandler: Handler): void => {\n // New API reference\n if (typeof otherHandler === 'number') {\n waitFor.push(otherHandler);\n } else {\n // Old API reference\n waitFor.push(otherHandler.handlerTag);\n }\n });\n\n this.waitForRelations.set(handler.handlerTag, waitFor);\n }\n\n if (config.simultaneousHandlers) {\n const simultaneousHandlers: number[] = [];\n config.simultaneousHandlers.forEach((otherHandler: Handler): void => {\n if (typeof otherHandler === 'number') {\n simultaneousHandlers.push(otherHandler);\n } else {\n simultaneousHandlers.push(otherHandler.handlerTag);\n }\n });\n\n this.simultaneousRelations.set(handler.handlerTag, simultaneousHandlers);\n }\n\n if (config.blocksHandlers) {\n const blocksHandlers: number[] = [];\n config.blocksHandlers.forEach((otherHandler: Handler): void => {\n if (typeof otherHandler === 'number') {\n blocksHandlers.push(otherHandler);\n } else {\n blocksHandlers.push(otherHandler.handlerTag);\n }\n });\n\n this.blocksHandlersRelations.set(handler.handlerTag, blocksHandlers);\n }\n }\n\n public shouldWaitForHandlerFailure(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const waitFor: number[] | undefined = this.waitForRelations.get(\n handler.handlerTag\n );\n\n return (\n waitFor?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldRecognizeSimultaneously(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const simultaneousHandlers: number[] | undefined =\n this.simultaneousRelations.get(handler.handlerTag);\n\n return (\n simultaneousHandlers?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldRequireHandlerToWaitForFailure(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const waitFor: number[] | undefined = this.blocksHandlersRelations.get(\n handler.handlerTag\n );\n\n return (\n waitFor?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldHandlerBeCancelledBy(\n _handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n // We check constructor name instead of using `instanceof` in order do avoid circular dependencies\n const isNativeHandler =\n otherHandler.constructor.name === 'NativeViewGestureHandler';\n const isActive = otherHandler.state === State.ACTIVE;\n const isButton = otherHandler.isButton?.() === true;\n\n return isNativeHandler && isActive && !isButton;\n }\n\n public dropRelationsForHandlerWithTag(handlerTag: number): void {\n this.waitForRelations.delete(handlerTag);\n this.simultaneousRelations.delete(handlerTag);\n this.blocksHandlersRelations.delete(handlerTag);\n }\n\n public reset() {\n this.waitForRelations.clear();\n this.simultaneousRelations.clear();\n this.blocksHandlersRelations.clear();\n }\n\n public static get instance(): InteractionManager {\n if (!this._instance) {\n this._instance = new InteractionManager();\n }\n\n return this._instance;\n }\n}\n"],"mappings":";;;;AACA,SAASA,KAAK,QAAQ,aAAa;AAGnC,eAAe,MAAMC,kBAAkB,CAAC;EAMtC;EACA;EACQC,WAAWA,CAAA,EAAG;IAAAC,eAAA,2BANqC,IAAIC,GAAG,CAAC,CAAC;IAAAD,eAAA,gCACJ,IAAIC,GAAG,CAAC,CAAC;IAAAD,eAAA,kCACP,IAAIC,GAAG,CAAC,CAAC;EAIpD;EAEhBC,qBAAqBA,CAACC,OAAwB,EAAEC,MAAc,EAAE;IACrE,IAAI,CAACC,8BAA8B,CAACF,OAAO,CAACG,UAAU,CAAC;IAEvD,IAAIF,MAAM,CAACG,OAAO,EAAE;MAClB,MAAMA,OAAiB,GAAG,EAAE;MAC5BH,MAAM,CAACG,OAAO,CAACC,OAAO,CAAEC,YAAqB,IAAW;QACtD;QACA,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;UACpCF,OAAO,CAACG,IAAI,CAACD,YAAY,CAAC;QAC5B,CAAC,MAAM;UACL;UACAF,OAAO,CAACG,IAAI,CAACD,YAAY,CAACH,UAAU,CAAC;QACvC;MACF,CAAC,CAAC;MAEF,IAAI,CAACK,gBAAgB,CAACC,GAAG,CAACT,OAAO,CAACG,UAAU,EAAEC,OAAO,CAAC;IACxD;IAEA,IAAIH,MAAM,CAACS,oBAAoB,EAAE;MAC/B,MAAMA,oBAA8B,GAAG,EAAE;MACzCT,MAAM,CAACS,oBAAoB,CAACL,OAAO,CAAEC,YAAqB,IAAW;QACnE,IAAI,OAAOA,YAAY,KAAK,QAAQ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A,CAAA,EAAuB;IAC/C,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAIxC,kBAAkB,CAAC,CAAC;IAC3C;IAEA,OAAO,IAAI,CAACwC,SAAS;EACvB;AACF;AAACC,mBAAA,GAnIoBzC,kBAAkB;AAAAE,eAAA,CAAlBF,kBAAkB","ignoreList":[]}
|
@@ -1,75 +1,60 @@
|
|
1
|
-
function _defineProperty(
|
2
|
-
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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); }
|
3
4
|
import { EventTypes } from '../interfaces';
|
4
5
|
import EventManager from './EventManager';
|
5
6
|
import { PointerType } from '../../PointerType';
|
6
7
|
export default class KeyboardEventManager extends EventManager {
|
7
8
|
constructor(...args) {
|
8
9
|
super(...args);
|
9
|
-
|
10
10
|
_defineProperty(this, "activationKeys", ['Enter', ' ']);
|
11
|
-
|
12
11
|
_defineProperty(this, "cancelationKeys", ['Tab']);
|
13
|
-
|
14
12
|
_defineProperty(this, "isPressed", false);
|
15
|
-
|
16
13
|
_defineProperty(this, "keyDownCallback", event => {
|
17
14
|
if (this.cancelationKeys.indexOf(event.key) !== -1 && this.isPressed) {
|
18
15
|
this.dispatchEvent(event, EventTypes.CANCEL);
|
19
16
|
return;
|
20
17
|
}
|
21
|
-
|
22
18
|
if (this.activationKeys.indexOf(event.key) === -1) {
|
23
19
|
return;
|
24
20
|
}
|
25
|
-
|
26
21
|
this.dispatchEvent(event, EventTypes.DOWN);
|
27
22
|
});
|
28
|
-
|
29
23
|
_defineProperty(this, "keyUpCallback", event => {
|
30
24
|
if (this.activationKeys.indexOf(event.key) === -1 || !this.isPressed) {
|
31
25
|
return;
|
32
26
|
}
|
33
|
-
|
34
27
|
this.dispatchEvent(event, EventTypes.UP);
|
35
28
|
});
|
36
29
|
}
|
37
|
-
|
38
30
|
dispatchEvent(event, eventType) {
|
39
31
|
if (!(event.target instanceof HTMLElement)) {
|
40
32
|
return;
|
41
33
|
}
|
42
|
-
|
43
34
|
const adaptedEvent = this.mapEvent(event, eventType);
|
44
|
-
|
45
35
|
switch (eventType) {
|
46
36
|
case EventTypes.UP:
|
47
37
|
this.isPressed = false;
|
48
38
|
this.onPointerUp(adaptedEvent);
|
49
39
|
break;
|
50
|
-
|
51
40
|
case EventTypes.DOWN:
|
52
41
|
this.isPressed = true;
|
53
42
|
this.onPointerDown(adaptedEvent);
|
54
43
|
break;
|
55
|
-
|
56
44
|
case EventTypes.CANCEL:
|
57
45
|
this.isPressed = false;
|
58
46
|
this.onPointerCancel(adaptedEvent);
|
59
47
|
break;
|
60
48
|
}
|
61
49
|
}
|
62
|
-
|
63
50
|
registerListeners() {
|
64
51
|
this.view.addEventListener('keydown', this.keyDownCallback);
|
65
52
|
this.view.addEventListener('keyup', this.keyUpCallback);
|
66
53
|
}
|
67
|
-
|
68
54
|
unregisterListeners() {
|
69
55
|
this.view.removeEventListener('keydown', this.keyDownCallback);
|
70
56
|
this.view.removeEventListener('keyup', this.keyUpCallback);
|
71
57
|
}
|
72
|
-
|
73
58
|
mapEvent(event, eventType) {
|
74
59
|
const viewRect = event.target.getBoundingClientRect();
|
75
60
|
const viewportPosition = {
|
@@ -91,6 +76,5 @@ export default class KeyboardEventManager extends EventManager {
|
|
91
76
|
time: event.timeStamp
|
92
77
|
};
|
93
78
|
}
|
94
|
-
|
95
79
|
}
|
96
80
|
//# sourceMappingURL=KeyboardEventManager.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["EventTypes","EventManager","PointerType","KeyboardEventManager","constructor","args","_defineProperty","event","cancelationKeys","indexOf","key","isPressed","dispatchEvent","CANCEL","activationKeys","DOWN","UP","eventType","target","HTMLElement","adaptedEvent","mapEvent","onPointerUp","onPointerDown","onPointerCancel","registerListeners","view","addEventListener","keyDownCallback","keyUpCallback","unregisterListeners","removeEventListener","viewRect","getBoundingClientRect","viewportPosition","x","width","y","height","relativePosition","offsetX","offsetY","pointerId","pointerType","KEY","time","timeStamp"],"sources":["KeyboardEventManager.ts"],"sourcesContent":["import { AdaptedEvent, EventTypes } from '../interfaces';\nimport EventManager from './EventManager';\nimport { PointerType } from '../../PointerType';\n\nexport default class KeyboardEventManager extends EventManager<HTMLElement> {\n private activationKeys = ['Enter', ' '];\n private cancelationKeys = ['Tab'];\n private isPressed = false;\n\n private keyDownCallback = (event: KeyboardEvent): void => {\n if (this.cancelationKeys.indexOf(event.key) !== -1 && this.isPressed) {\n this.dispatchEvent(event, EventTypes.CANCEL);\n return;\n }\n\n if (this.activationKeys.indexOf(event.key) === -1) {\n return;\n }\n\n this.dispatchEvent(event, EventTypes.DOWN);\n };\n\n private keyUpCallback = (event: KeyboardEvent): void => {\n if (this.activationKeys.indexOf(event.key) === -1 || !this.isPressed) {\n return;\n }\n\n this.dispatchEvent(event, EventTypes.UP);\n };\n\n private dispatchEvent(event: KeyboardEvent, eventType: EventTypes) {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n const adaptedEvent = this.mapEvent(event, eventType);\n\n switch (eventType) {\n case EventTypes.UP:\n this.isPressed = false;\n this.onPointerUp(adaptedEvent);\n break;\n case EventTypes.DOWN:\n this.isPressed = true;\n this.onPointerDown(adaptedEvent);\n break;\n case EventTypes.CANCEL:\n this.isPressed = false;\n this.onPointerCancel(adaptedEvent);\n break;\n }\n }\n\n public registerListeners(): void {\n this.view.addEventListener('keydown', this.keyDownCallback);\n this.view.addEventListener('keyup', this.keyUpCallback);\n }\n\n public unregisterListeners(): void {\n this.view.removeEventListener('keydown', this.keyDownCallback);\n this.view.removeEventListener('keyup', this.keyUpCallback);\n }\n\n protected mapEvent(\n event: KeyboardEvent,\n eventType: EventTypes\n ): AdaptedEvent {\n const viewRect = (event.target as HTMLElement).getBoundingClientRect();\n\n const viewportPosition = {\n x: viewRect?.x + viewRect?.width / 2,\n y: viewRect?.y + viewRect?.height / 2,\n };\n\n const relativePosition = {\n x: viewRect?.width / 2,\n y: viewRect?.height / 2,\n };\n\n return {\n x: viewportPosition.x,\n y: viewportPosition.y,\n offsetX: relativePosition.x,\n offsetY: relativePosition.y,\n pointerId: 0,\n eventType: eventType,\n pointerType: PointerType.KEY,\n time: event.timeStamp,\n };\n }\n}\n"],"mappings":";;;AAAA,SAAuBA,UAAU,QAAQ,eAAe;AACxD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,eAAe,MAAMC,oBAAoB,SAASF,YAAY,CAAc;EAAAG,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,yBACjD,CAAC,OAAO,EAAE,GAAG,CAAC;IAAAA,eAAA,0BACb,CAAC,KAAK,CAAC;IAAAA,eAAA,oBACb,KAAK;IAAAA,eAAA,0BAEEC,KAAoB,IAAW;MACxD,IAAI,IAAI,CAACC,eAAe,CAACC,OAAO,CAACF,KAAK,CAACG,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAACC,SAAS,EAAE;QACpE,IAAI,CAACC,aAAa,CAACL,KAAK,EAAEP,UAAU,CAACa,MAAM,CAAC;QAC5C;MACF;MAEA,IAAI,IAAI,CAACC,cAAc,CAACL,OAAO,CAACF,KAAK,CAACG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;QACjD;MACF;MAEA,IAAI,CAACE,aAAa,CAACL,KAAK,EAAEP,UAAU,CAACe,IAAI,CAAC;IAC5C,CAAC;IAAAT,eAAA,wBAEwBC,KAAoB,IA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