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
@@ -3,13 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.PointerTypeMapping = void 0;
|
7
|
-
exports.calculateViewScale = calculateViewScale;
|
8
|
-
exports.degToRad = exports.coneToDeviation = void 0;
|
9
6
|
exports.isPointerInBounds = isPointerInBounds;
|
10
|
-
exports.
|
7
|
+
exports.calculateViewScale = calculateViewScale;
|
11
8
|
exports.tryExtractStylusData = tryExtractStylusData;
|
9
|
+
exports.isRNSVGElement = isRNSVGElement;
|
10
|
+
exports.coneToDeviation = exports.degToRad = exports.PointerTypeMapping = void 0;
|
11
|
+
|
12
12
|
var _PointerType = require("../PointerType");
|
13
|
+
|
13
14
|
function isPointerInBounds(view, {
|
14
15
|
x,
|
15
16
|
y
|
@@ -17,51 +18,64 @@ function isPointerInBounds(view, {
|
|
17
18
|
const rect = view.getBoundingClientRect();
|
18
19
|
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
19
20
|
}
|
20
|
-
|
21
|
+
|
22
|
+
const PointerTypeMapping = new Map([['mouse', _PointerType.PointerType.MOUSE], ['touch', _PointerType.PointerType.TOUCH], ['pen', _PointerType.PointerType.STYLUS], ['none', _PointerType.PointerType.OTHER]]);
|
23
|
+
exports.PointerTypeMapping = PointerTypeMapping;
|
24
|
+
|
21
25
|
const degToRad = degrees => degrees * Math.PI / 180;
|
26
|
+
|
22
27
|
exports.degToRad = degToRad;
|
28
|
+
|
23
29
|
const coneToDeviation = degrees => Math.cos(degToRad(degrees / 2));
|
30
|
+
|
24
31
|
exports.coneToDeviation = coneToDeviation;
|
32
|
+
|
25
33
|
function calculateViewScale(view) {
|
26
34
|
var _RegExp$exec;
|
35
|
+
|
27
36
|
const styles = getComputedStyle(view);
|
28
37
|
const resultScales = {
|
29
38
|
scaleX: 1,
|
30
39
|
scaleY: 1
|
31
|
-
};
|
40
|
+
}; // Get scales from scale property
|
32
41
|
|
33
|
-
// Get scales from scale property
|
34
42
|
if (styles.scale !== undefined && styles.scale !== 'none') {
|
35
43
|
const scales = styles.scale.split(' ');
|
44
|
+
|
36
45
|
if (scales[0]) {
|
37
46
|
resultScales.scaleX = parseFloat(scales[0]);
|
38
47
|
}
|
48
|
+
|
39
49
|
resultScales.scaleY = scales[1] ? parseFloat(scales[1]) : parseFloat(scales[0]);
|
40
|
-
}
|
50
|
+
} // Get scales from transform property
|
51
|
+
|
41
52
|
|
42
|
-
// Get scales from transform property
|
43
53
|
const matrixElements = (_RegExp$exec = new RegExp(/matrix\((.+)\)/).exec(styles.transform)) === null || _RegExp$exec === void 0 ? void 0 : _RegExp$exec[1];
|
54
|
+
|
44
55
|
if (matrixElements) {
|
45
56
|
const matrixElementsArray = matrixElements.split(', ');
|
46
57
|
resultScales.scaleX *= parseFloat(matrixElementsArray[0]);
|
47
58
|
resultScales.scaleY *= parseFloat(matrixElementsArray[3]);
|
48
59
|
}
|
60
|
+
|
49
61
|
return resultScales;
|
50
62
|
}
|
63
|
+
|
51
64
|
function tryExtractStylusData(event) {
|
52
65
|
const pointerType = PointerTypeMapping.get(event.pointerType);
|
66
|
+
|
53
67
|
if (pointerType !== _PointerType.PointerType.STYLUS) {
|
54
68
|
return;
|
55
|
-
}
|
69
|
+
} // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)
|
70
|
+
|
71
|
+
|
72
|
+
const eventAzimuthAngle = event.azimuthAngle; // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)
|
56
73
|
|
57
|
-
// @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)
|
58
|
-
const eventAzimuthAngle = event.azimuthAngle;
|
59
|
-
// @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)
|
60
74
|
const eventAltitudeAngle = event.altitudeAngle;
|
75
|
+
|
61
76
|
if (event.tiltX === 0 && event.tiltY === 0) {
|
62
77
|
// If we are in this branch, it means that either tilt properties are not supported and we have to calculate them from altitude and azimuth angles,
|
63
78
|
// or stylus is perpendicular to the screen and we can use altitude / azimuth instead of tilt
|
64
|
-
|
65
79
|
// If azimuth and altitude are undefined in this branch, it means that we are either perpendicular to the screen,
|
66
80
|
// or that none of the position sets is supported. In that case, we can treat stylus as perpendicular
|
67
81
|
if (eventAzimuthAngle === undefined || eventAltitudeAngle === undefined) {
|
@@ -73,6 +87,7 @@ function tryExtractStylusData(event) {
|
|
73
87
|
pressure: event.pressure
|
74
88
|
};
|
75
89
|
}
|
90
|
+
|
76
91
|
const {
|
77
92
|
tiltX,
|
78
93
|
tiltY
|
@@ -85,6 +100,7 @@ function tryExtractStylusData(event) {
|
|
85
100
|
pressure: event.pressure
|
86
101
|
};
|
87
102
|
}
|
103
|
+
|
88
104
|
const {
|
89
105
|
altitudeAngle,
|
90
106
|
azimuthAngle
|
@@ -96,18 +112,18 @@ function tryExtractStylusData(event) {
|
|
96
112
|
altitudeAngle,
|
97
113
|
pressure: event.pressure
|
98
114
|
};
|
99
|
-
}
|
100
|
-
|
101
|
-
// `altitudeAngle` and `azimuthAngle` are experimental properties, which are not supported on Firefox and Safari.
|
115
|
+
} // `altitudeAngle` and `azimuthAngle` are experimental properties, which are not supported on Firefox and Safari.
|
102
116
|
// Given that, we use `tilt` properties and algorithm that converts one value to another.
|
103
117
|
//
|
104
118
|
// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle
|
119
|
+
|
120
|
+
|
105
121
|
function tilt2spherical(tiltX, tiltY) {
|
106
122
|
const tiltXrad = tiltX * Math.PI / 180;
|
107
|
-
const tiltYrad = tiltY * Math.PI / 180;
|
123
|
+
const tiltYrad = tiltY * Math.PI / 180; // calculate azimuth angle
|
108
124
|
|
109
|
-
// calculate azimuth angle
|
110
125
|
let azimuthAngle = 0;
|
126
|
+
|
111
127
|
if (tiltX === 0) {
|
112
128
|
if (tiltY > 0) {
|
113
129
|
azimuthAngle = Math.PI / 2;
|
@@ -126,13 +142,15 @@ function tilt2spherical(tiltX, tiltY) {
|
|
126
142
|
const tanX = Math.tan(tiltXrad);
|
127
143
|
const tanY = Math.tan(tiltYrad);
|
128
144
|
azimuthAngle = Math.atan2(tanY, tanX);
|
145
|
+
|
129
146
|
if (azimuthAngle < 0) {
|
130
147
|
azimuthAngle += 2 * Math.PI;
|
131
148
|
}
|
132
|
-
}
|
149
|
+
} // calculate altitude angle
|
150
|
+
|
133
151
|
|
134
|
-
// calculate altitude angle
|
135
152
|
let altitudeAngle = 0;
|
153
|
+
|
136
154
|
if (Math.abs(tiltX) === 90 || Math.abs(tiltY) === 90) {
|
137
155
|
altitudeAngle = 0;
|
138
156
|
} else if (tiltX === 0) {
|
@@ -143,59 +161,70 @@ function tilt2spherical(tiltX, tiltY) {
|
|
143
161
|
// Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90
|
144
162
|
altitudeAngle = Math.atan(1.0 / Math.sqrt(Math.pow(Math.tan(tiltXrad), 2) + Math.pow(Math.tan(tiltYrad), 2)));
|
145
163
|
}
|
164
|
+
|
146
165
|
return {
|
147
166
|
altitudeAngle: altitudeAngle,
|
148
167
|
azimuthAngle: azimuthAngle
|
149
168
|
};
|
150
|
-
}
|
151
|
-
|
152
|
-
// If we are on a platform that doesn't support `tiltX` and `tiltY`, we have to calculate them from `altitude` and `azimuth` angles.
|
169
|
+
} // If we are on a platform that doesn't support `tiltX` and `tiltY`, we have to calculate them from `altitude` and `azimuth` angles.
|
153
170
|
//
|
154
171
|
// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle
|
172
|
+
|
173
|
+
|
155
174
|
function spherical2tilt(altitudeAngle, azimuthAngle) {
|
156
175
|
const radToDeg = 180 / Math.PI;
|
157
176
|
let tiltXrad = 0;
|
158
177
|
let tiltYrad = 0;
|
178
|
+
|
159
179
|
if (altitudeAngle === 0) {
|
160
180
|
// the pen is in the X-Y plane
|
161
181
|
if (azimuthAngle === 0 || azimuthAngle === 2 * Math.PI) {
|
162
182
|
// pen is on positive X axis
|
163
183
|
tiltXrad = Math.PI / 2;
|
164
184
|
}
|
185
|
+
|
165
186
|
if (azimuthAngle === Math.PI / 2) {
|
166
187
|
// pen is on positive Y axis
|
167
188
|
tiltYrad = Math.PI / 2;
|
168
189
|
}
|
190
|
+
|
169
191
|
if (azimuthAngle === Math.PI) {
|
170
192
|
// pen is on negative X axis
|
171
193
|
tiltXrad = -Math.PI / 2;
|
172
194
|
}
|
195
|
+
|
173
196
|
if (azimuthAngle === 3 * Math.PI / 2) {
|
174
197
|
// pen is on negative Y axis
|
175
198
|
tiltYrad = -Math.PI / 2;
|
176
199
|
}
|
200
|
+
|
177
201
|
if (azimuthAngle > 0 && azimuthAngle < Math.PI / 2) {
|
178
202
|
tiltXrad = Math.PI / 2;
|
179
203
|
tiltYrad = Math.PI / 2;
|
180
204
|
}
|
205
|
+
|
181
206
|
if (azimuthAngle > Math.PI / 2 && azimuthAngle < Math.PI) {
|
182
207
|
tiltXrad = -Math.PI / 2;
|
183
208
|
tiltYrad = Math.PI / 2;
|
184
209
|
}
|
210
|
+
|
185
211
|
if (azimuthAngle > Math.PI && azimuthAngle < 3 * Math.PI / 2) {
|
186
212
|
tiltXrad = -Math.PI / 2;
|
187
213
|
tiltYrad = -Math.PI / 2;
|
188
214
|
}
|
215
|
+
|
189
216
|
if (azimuthAngle > 3 * Math.PI / 2 && azimuthAngle < 2 * Math.PI) {
|
190
217
|
tiltXrad = Math.PI / 2;
|
191
218
|
tiltYrad = -Math.PI / 2;
|
192
219
|
}
|
193
220
|
}
|
221
|
+
|
194
222
|
if (altitudeAngle !== 0) {
|
195
223
|
const tanAlt = Math.tan(altitudeAngle);
|
196
224
|
tiltXrad = Math.atan(Math.cos(azimuthAngle) / tanAlt);
|
197
225
|
tiltYrad = Math.atan(Math.sin(azimuthAngle) / tanAlt);
|
198
226
|
}
|
227
|
+
|
199
228
|
const tiltX = Math.round(tiltXrad * radToDeg);
|
200
229
|
const tiltY = Math.round(tiltYrad * radToDeg);
|
201
230
|
return {
|
@@ -203,9 +232,8 @@ function spherical2tilt(altitudeAngle, azimuthAngle) {
|
|
203
232
|
tiltY
|
204
233
|
};
|
205
234
|
}
|
206
|
-
const RNSVGElements = ['Circle', 'ClipPath', 'Ellipse', 'ForeignObject', 'G', 'Image', 'Line', 'Marker', 'Mask', 'Path', 'Pattern', 'Polygon', 'Polyline', 'Rect', 'Svg', 'Symbol', 'TSpan', 'Text', 'TextPath', 'Use'];
|
207
235
|
|
208
|
-
// This function helps us determine whether given node is SVGElement or not. In our implementation of
|
236
|
+
const RNSVGElements = ['Circle', 'ClipPath', 'Ellipse', 'ForeignObject', 'G', 'Image', 'Line', 'Marker', 'Mask', 'Path', 'Pattern', 'Polygon', 'Polyline', 'Rect', 'Svg', 'Symbol', 'TSpan', 'Text', 'TextPath', 'Use']; // This function helps us determine whether given node is SVGElement or not. In our implementation of
|
209
237
|
// findNodeHandle, we can encounter such element in 2 forms - SVG tag or ref to SVG Element. Since Gesture Handler
|
210
238
|
// does not depend on SVG, we use our simplified SVGRef type that has `elementRef` field. This is something that is present
|
211
239
|
// in actual SVG ref object.
|
@@ -214,6 +242,7 @@ const RNSVGElements = ['Circle', 'ClipPath', 'Ellipse', 'ForeignObject', 'G', 'I
|
|
214
242
|
// corresponds to one of the possible SVG elements. Then we also check if `elementRef` field exists.
|
215
243
|
// By doing both steps we decrease probability of detecting situations where, for example, user makes custom `Circle` and
|
216
244
|
// we treat it as SVG.
|
245
|
+
|
217
246
|
function isRNSVGElement(viewRef) {
|
218
247
|
const componentClassName = Object.getPrototypeOf(viewRef).constructor.name;
|
219
248
|
return RNSVGElements.indexOf(componentClassName) >= 0 && Object.hasOwn(viewRef, 'elementRef');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_PointerType","require","isPointerInBounds","view","x","y","rect","getBoundingClientRect","left","right","top","bottom","PointerTypeMapping","exports","Map","PointerType","MOUSE","TOUCH","STYLUS","OTHER","degToRad","degrees","Math","PI","coneToDeviation","cos","calculateViewScale","_RegExp$exec","styles","getComputedStyle","resultScales","scaleX","scaleY","scale","undefined","scales","split","parseFloat","matrixElements","RegExp","exec","transform","matrixElementsArray","tryExtractStylusData","event","pointerType","get","eventAzimuthAngle","azimuthAngle","eventAltitudeAngle","altitudeAngle","tiltX","tiltY","pressure","spherical2tilt","tilt2spherical","tiltXrad","tiltYrad","abs","tanX","tan","tanY","atan2","atan","sqrt","pow","radToDeg","tanAlt","sin","round","RNSVGElements","isRNSVGElement","viewRef","componentClassName","Object","getPrototypeOf","constructor","name","indexOf","hasOwn"],"sources":["utils.ts"],"sourcesContent":["import { PointerType } from '../PointerType';\nimport type {\n GestureHandlerRef,\n Point,\n StylusData,\n SVGRef,\n} from './interfaces';\n\nexport function isPointerInBounds(view: HTMLElement, { x, y }: Point): boolean {\n const rect: DOMRect = view.getBoundingClientRect();\n\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n}\n\nexport const PointerTypeMapping = new Map<string, PointerType>([\n ['mouse', PointerType.MOUSE],\n ['touch', PointerType.TOUCH],\n ['pen', PointerType.STYLUS],\n ['none', PointerType.OTHER],\n]);\n\nexport const degToRad = (degrees: number) => (degrees * Math.PI) / 180;\n\nexport const coneToDeviation = (degrees: number) =>\n Math.cos(degToRad(degrees / 2));\n\nexport function calculateViewScale(view: HTMLElement) {\n const styles = getComputedStyle(view);\n\n const resultScales = {\n scaleX: 1,\n scaleY: 1,\n };\n\n // Get scales from scale property\n if (styles.scale !== undefined && styles.scale !== 'none') {\n const scales = styles.scale.split(' ');\n\n if (scales[0]) {\n resultScales.scaleX = parseFloat(scales[0]);\n }\n\n resultScales.scaleY = scales[1]\n ? parseFloat(scales[1])\n : parseFloat(scales[0]);\n }\n\n // Get scales from transform property\n const matrixElements = new RegExp(/matrix\\((.+)\\)/).exec(\n styles.transform\n )?.[1];\n\n if (matrixElements) {\n const matrixElementsArray = matrixElements.split(', ');\n\n resultScales.scaleX *= parseFloat(matrixElementsArray[0]);\n resultScales.scaleY *= parseFloat(matrixElementsArray[3]);\n }\n\n return resultScales;\n}\n\nexport function tryExtractStylusData(\n event: PointerEvent\n): StylusData | undefined {\n const pointerType = PointerTypeMapping.get(event.pointerType);\n\n if (pointerType !== PointerType.STYLUS) {\n return;\n }\n\n // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)\n const eventAzimuthAngle: number | undefined = event.azimuthAngle;\n // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)\n const eventAltitudeAngle: number | undefined = event.altitudeAngle;\n\n if (event.tiltX === 0 && event.tiltY === 0) {\n // If we are in this branch, it means that either tilt properties are not supported and we have to calculate them from altitude and azimuth angles,\n // or stylus is perpendicular to the screen and we can use altitude / azimuth instead of tilt\n\n // If azimuth and altitude are undefined in this branch, it means that we are either perpendicular to the screen,\n // or that none of the position sets is supported. In that case, we can treat stylus as perpendicular\n if (eventAzimuthAngle === undefined || eventAltitudeAngle === undefined) {\n return {\n tiltX: 0,\n tiltY: 0,\n azimuthAngle: Math.PI / 2,\n altitudeAngle: Math.PI / 2,\n pressure: event.pressure,\n };\n }\n\n const { tiltX, tiltY } = spherical2tilt(\n eventAltitudeAngle,\n eventAzimuthAngle\n );\n\n return {\n tiltX,\n tiltY,\n azimuthAngle: eventAzimuthAngle,\n altitudeAngle: eventAltitudeAngle,\n pressure: event.pressure,\n };\n }\n\n const { altitudeAngle, azimuthAngle } = tilt2spherical(\n event.tiltX,\n event.tiltY\n );\n\n return {\n tiltX: event.tiltX,\n tiltY: event.tiltY,\n azimuthAngle,\n altitudeAngle,\n pressure: event.pressure,\n };\n}\n\n// `altitudeAngle` and `azimuthAngle` are experimental properties, which are not supported on Firefox and Safari.\n// Given that, we use `tilt` properties and algorithm that converts one value to another.\n//\n// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle\nfunction tilt2spherical(tiltX: number, tiltY: number) {\n const tiltXrad = (tiltX * Math.PI) / 180;\n const tiltYrad = (tiltY * Math.PI) / 180;\n\n // calculate azimuth angle\n let azimuthAngle = 0;\n\n if (tiltX === 0) {\n if (tiltY > 0) {\n azimuthAngle = Math.PI / 2;\n } else if (tiltY < 0) {\n azimuthAngle = (3 * Math.PI) / 2;\n }\n } else if (tiltY === 0) {\n if (tiltX < 0) {\n azimuthAngle = Math.PI;\n }\n } else if (Math.abs(tiltX) === 90 || Math.abs(tiltY) === 90) {\n // not enough information to calculate azimuth\n azimuthAngle = 0;\n } else {\n // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90\n const tanX = Math.tan(tiltXrad);\n const tanY = Math.tan(tiltYrad);\n\n azimuthAngle = Math.atan2(tanY, tanX);\n if (azimuthAngle < 0) {\n azimuthAngle += 2 * Math.PI;\n }\n }\n\n // calculate altitude angle\n let altitudeAngle = 0;\n\n if (Math.abs(tiltX) === 90 || Math.abs(tiltY) === 90) {\n altitudeAngle = 0;\n } else if (tiltX === 0) {\n altitudeAngle = Math.PI / 2 - Math.abs(tiltYrad);\n } else if (tiltY === 0) {\n altitudeAngle = Math.PI / 2 - Math.abs(tiltXrad);\n } else {\n // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90\n altitudeAngle = Math.atan(\n 1.0 /\n Math.sqrt(\n Math.pow(Math.tan(tiltXrad), 2) + Math.pow(Math.tan(tiltYrad), 2)\n )\n );\n }\n\n return { altitudeAngle: altitudeAngle, azimuthAngle: azimuthAngle };\n}\n\n// If we are on a platform that doesn't support `tiltX` and `tiltY`, we have to calculate them from `altitude` and `azimuth` angles.\n//\n// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle\nfunction spherical2tilt(altitudeAngle: number, azimuthAngle: number) {\n const radToDeg = 180 / Math.PI;\n\n let tiltXrad = 0;\n let tiltYrad = 0;\n\n if (altitudeAngle === 0) {\n // the pen is in the X-Y plane\n if (azimuthAngle === 0 || azimuthAngle === 2 * Math.PI) {\n // pen is on positive X axis\n tiltXrad = Math.PI / 2;\n }\n if (azimuthAngle === Math.PI / 2) {\n // pen is on positive Y axis\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle === Math.PI) {\n // pen is on negative X axis\n tiltXrad = -Math.PI / 2;\n }\n if (azimuthAngle === (3 * Math.PI) / 2) {\n // pen is on negative Y axis\n tiltYrad = -Math.PI / 2;\n }\n if (azimuthAngle > 0 && azimuthAngle < Math.PI / 2) {\n tiltXrad = Math.PI / 2;\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle > Math.PI / 2 && azimuthAngle < Math.PI) {\n tiltXrad = -Math.PI / 2;\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle > Math.PI && azimuthAngle < (3 * Math.PI) / 2) {\n tiltXrad = -Math.PI / 2;\n tiltYrad = -Math.PI / 2;\n }\n if (azimuthAngle > (3 * Math.PI) / 2 && azimuthAngle < 2 * Math.PI) {\n tiltXrad = Math.PI / 2;\n tiltYrad = -Math.PI / 2;\n }\n }\n\n if (altitudeAngle !== 0) {\n const tanAlt = Math.tan(altitudeAngle);\n\n tiltXrad = Math.atan(Math.cos(azimuthAngle) / tanAlt);\n tiltYrad = Math.atan(Math.sin(azimuthAngle) / tanAlt);\n }\n\n const tiltX = Math.round(tiltXrad * radToDeg);\n const tiltY = Math.round(tiltYrad * radToDeg);\n\n return { tiltX, tiltY };\n}\n\nconst RNSVGElements = [\n 'Circle',\n 'ClipPath',\n 'Ellipse',\n 'ForeignObject',\n 'G',\n 'Image',\n 'Line',\n 'Marker',\n 'Mask',\n 'Path',\n 'Pattern',\n 'Polygon',\n 'Polyline',\n 'Rect',\n 'Svg',\n 'Symbol',\n 'TSpan',\n 'Text',\n 'TextPath',\n 'Use',\n];\n\n// This function helps us determine whether given node is SVGElement or not. In our implementation of\n// findNodeHandle, we can encounter such element in 2 forms - SVG tag or ref to SVG Element. Since Gesture Handler\n// does not depend on SVG, we use our simplified SVGRef type that has `elementRef` field. This is something that is present\n// in actual SVG ref object.\n//\n// In order to make sure that node passed into this function is in fact SVG element, first we check if its constructor name\n// corresponds to one of the possible SVG elements. Then we also check if `elementRef` field exists.\n// By doing both steps we decrease probability of detecting situations where, for example, user makes custom `Circle` and\n// we treat it as SVG.\nexport function isRNSVGElement(viewRef: SVGRef | GestureHandlerRef) {\n const componentClassName = Object.getPrototypeOf(viewRef).constructor.name;\n\n return (\n RNSVGElements.indexOf(componentClassName) >= 0 &&\n Object.hasOwn(viewRef, 'elementRef')\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,SAASC,iBAAiBA,CAACC,IAAiB,EAAE;EAAEC,CAAC;EAAEC;AAAS,CAAC,EAAW;EAC7E,MAAMC,IAAa,GAAGH,IAAI,CAACI,qBAAqB,CAAC,CAAC;EAElD,OAAOH,CAAC,IAAIE,IAAI,CAACE,IAAI,IAAIJ,CAAC,IAAIE,IAAI,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T,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAU,EACV,KAAK,CACN;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,OAAmC,EAAE;EAClE,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,cAAc,CAACH,OAAO,CAAC,CAACI,WAAW,CAACC,IAAI;EAE1E,OACEP,aAAa,CAACQ,OAAO,CAACL,kBAAkB,CAAC,IAAI,CAAC,IAC9CC,MAAM,CAACK,MAAM,CAACP,OAAO,EAAE,YAAY,CAAC;AAExC","ignoreList":[]}
|
1
|
+
{"version":3,"sources":["utils.ts"],"names":["isPointerInBounds","view","x","y","rect","getBoundingClientRect","left","right","top","bottom","PointerTypeMapping","Map","PointerType","MOUSE","TOUCH","STYLUS","OTHER","degToRad","degrees","Math","PI","coneToDeviation","cos","calculateViewScale","styles","getComputedStyle","resultScales","scaleX","scaleY","scale","undefined","scales","split","parseFloat","matrixElements","RegExp","exec","transform","matrixElementsArray","tryExtractStylusData","event","pointerType","get","eventAzimuthAngle","azimuthAngle","eventAltitudeAngle","altitudeAngle","tiltX","tiltY","pressure","spherical2tilt","tilt2spherical","tiltXrad","tiltYrad","abs","tanX","tan","tanY","atan2","atan","sqrt","pow","radToDeg","tanAlt","sin","round","RNSVGElements","isRNSVGElement","viewRef","componentClassName","Object","getPrototypeOf","constructor","name","indexOf","hasOwn"],"mappings":";;;;;;;;;;;AAAA;;AAQO,SAASA,iBAAT,CAA2BC,IAA3B,EAA8C;AAAEC,EAAAA,CAAF;AAAKC,EAAAA;AAAL,CAA9C,EAAwE;AAC7E,QAAMC,IAAa,GAAGH,IAAI,CAACI,qBAAL,EAAtB;AAEA,SAAOH,CAAC,IAAIE,IAAI,CAACE,IAAV,IAAkBJ,CAAC,IAAIE,IAAI,CAACG,KAA5B,IAAqCJ,CAAC,IAAIC,IAAI,CAACI,GAA/C,IAAsDL,CAAC,IAAIC,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;AAEA,SAAO;AAAEf,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAP;AACD;;AAED,MAAMkB,aAAa,GAAG,CACpB,QADoB,EAEpB,UAFoB,EAGpB,SAHoB,EAIpB,eAJoB,EAKpB,GALoB,EAMpB,OANoB,EAOpB,MAPoB,EAQpB,QARoB,EASpB,MAToB,EAUpB,MAVoB,EAWpB,SAXoB,EAYpB,SAZoB,EAapB,UAboB,EAcpB,MAdoB,EAepB,KAfoB,EAgBpB,QAhBoB,EAiBpB,OAjBoB,EAkBpB,MAlBoB,EAmBpB,UAnBoB,EAoBpB,KApBoB,CAAtB,C,CAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,cAAT,CAAwBC,OAAxB,EAA6D;AAClE,QAAMC,kBAAkB,GAAGC,MAAM,CAACC,cAAP,CAAsBH,OAAtB,EAA+BI,WAA/B,CAA2CC,IAAtE;AAEA,SACEP,aAAa,CAACQ,OAAd,CAAsBL,kBAAtB,KAA6C,CAA7C,IACAC,MAAM,CAACK,MAAP,CAAcP,OAAd,EAAuB,YAAvB,CAFF;AAID","sourcesContent":["import { PointerType } from '../PointerType';\nimport type {\n GestureHandlerRef,\n Point,\n StylusData,\n SVGRef,\n} from './interfaces';\n\nexport function isPointerInBounds(view: HTMLElement, { x, y }: Point): boolean {\n const rect: DOMRect = view.getBoundingClientRect();\n\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n}\n\nexport const PointerTypeMapping = new Map<string, PointerType>([\n ['mouse', PointerType.MOUSE],\n ['touch', PointerType.TOUCH],\n ['pen', PointerType.STYLUS],\n ['none', PointerType.OTHER],\n]);\n\nexport const degToRad = (degrees: number) => (degrees * Math.PI) / 180;\n\nexport const coneToDeviation = (degrees: number) =>\n Math.cos(degToRad(degrees / 2));\n\nexport function calculateViewScale(view: HTMLElement) {\n const styles = getComputedStyle(view);\n\n const resultScales = {\n scaleX: 1,\n scaleY: 1,\n };\n\n // Get scales from scale property\n if (styles.scale !== undefined && styles.scale !== 'none') {\n const scales = styles.scale.split(' ');\n\n if (scales[0]) {\n resultScales.scaleX = parseFloat(scales[0]);\n }\n\n resultScales.scaleY = scales[1]\n ? parseFloat(scales[1])\n : parseFloat(scales[0]);\n }\n\n // Get scales from transform property\n const matrixElements = new RegExp(/matrix\\((.+)\\)/).exec(\n styles.transform\n )?.[1];\n\n if (matrixElements) {\n const matrixElementsArray = matrixElements.split(', ');\n\n resultScales.scaleX *= parseFloat(matrixElementsArray[0]);\n resultScales.scaleY *= parseFloat(matrixElementsArray[3]);\n }\n\n return resultScales;\n}\n\nexport function tryExtractStylusData(\n event: PointerEvent\n): StylusData | undefined {\n const pointerType = PointerTypeMapping.get(event.pointerType);\n\n if (pointerType !== PointerType.STYLUS) {\n return;\n }\n\n // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)\n const eventAzimuthAngle: number | undefined = event.azimuthAngle;\n // @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties)\n const eventAltitudeAngle: number | undefined = event.altitudeAngle;\n\n if (event.tiltX === 0 && event.tiltY === 0) {\n // If we are in this branch, it means that either tilt properties are not supported and we have to calculate them from altitude and azimuth angles,\n // or stylus is perpendicular to the screen and we can use altitude / azimuth instead of tilt\n\n // If azimuth and altitude are undefined in this branch, it means that we are either perpendicular to the screen,\n // or that none of the position sets is supported. In that case, we can treat stylus as perpendicular\n if (eventAzimuthAngle === undefined || eventAltitudeAngle === undefined) {\n return {\n tiltX: 0,\n tiltY: 0,\n azimuthAngle: Math.PI / 2,\n altitudeAngle: Math.PI / 2,\n pressure: event.pressure,\n };\n }\n\n const { tiltX, tiltY } = spherical2tilt(\n eventAltitudeAngle,\n eventAzimuthAngle\n );\n\n return {\n tiltX,\n tiltY,\n azimuthAngle: eventAzimuthAngle,\n altitudeAngle: eventAltitudeAngle,\n pressure: event.pressure,\n };\n }\n\n const { altitudeAngle, azimuthAngle } = tilt2spherical(\n event.tiltX,\n event.tiltY\n );\n\n return {\n tiltX: event.tiltX,\n tiltY: event.tiltY,\n azimuthAngle,\n altitudeAngle,\n pressure: event.pressure,\n };\n}\n\n// `altitudeAngle` and `azimuthAngle` are experimental properties, which are not supported on Firefox and Safari.\n// Given that, we use `tilt` properties and algorithm that converts one value to another.\n//\n// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle\nfunction tilt2spherical(tiltX: number, tiltY: number) {\n const tiltXrad = (tiltX * Math.PI) / 180;\n const tiltYrad = (tiltY * Math.PI) / 180;\n\n // calculate azimuth angle\n let azimuthAngle = 0;\n\n if (tiltX === 0) {\n if (tiltY > 0) {\n azimuthAngle = Math.PI / 2;\n } else if (tiltY < 0) {\n azimuthAngle = (3 * Math.PI) / 2;\n }\n } else if (tiltY === 0) {\n if (tiltX < 0) {\n azimuthAngle = Math.PI;\n }\n } else if (Math.abs(tiltX) === 90 || Math.abs(tiltY) === 90) {\n // not enough information to calculate azimuth\n azimuthAngle = 0;\n } else {\n // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90\n const tanX = Math.tan(tiltXrad);\n const tanY = Math.tan(tiltYrad);\n\n azimuthAngle = Math.atan2(tanY, tanX);\n if (azimuthAngle < 0) {\n azimuthAngle += 2 * Math.PI;\n }\n }\n\n // calculate altitude angle\n let altitudeAngle = 0;\n\n if (Math.abs(tiltX) === 90 || Math.abs(tiltY) === 90) {\n altitudeAngle = 0;\n } else if (tiltX === 0) {\n altitudeAngle = Math.PI / 2 - Math.abs(tiltYrad);\n } else if (tiltY === 0) {\n altitudeAngle = Math.PI / 2 - Math.abs(tiltXrad);\n } else {\n // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90\n altitudeAngle = Math.atan(\n 1.0 /\n Math.sqrt(\n Math.pow(Math.tan(tiltXrad), 2) + Math.pow(Math.tan(tiltYrad), 2)\n )\n );\n }\n\n return { altitudeAngle: altitudeAngle, azimuthAngle: azimuthAngle };\n}\n\n// If we are on a platform that doesn't support `tiltX` and `tiltY`, we have to calculate them from `altitude` and `azimuth` angles.\n//\n// Source: https://w3c.github.io/pointerevents/#converting-between-tiltx-tilty-and-altitudeangle-azimuthangle\nfunction spherical2tilt(altitudeAngle: number, azimuthAngle: number) {\n const radToDeg = 180 / Math.PI;\n\n let tiltXrad = 0;\n let tiltYrad = 0;\n\n if (altitudeAngle === 0) {\n // the pen is in the X-Y plane\n if (azimuthAngle === 0 || azimuthAngle === 2 * Math.PI) {\n // pen is on positive X axis\n tiltXrad = Math.PI / 2;\n }\n if (azimuthAngle === Math.PI / 2) {\n // pen is on positive Y axis\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle === Math.PI) {\n // pen is on negative X axis\n tiltXrad = -Math.PI / 2;\n }\n if (azimuthAngle === (3 * Math.PI) / 2) {\n // pen is on negative Y axis\n tiltYrad = -Math.PI / 2;\n }\n if (azimuthAngle > 0 && azimuthAngle < Math.PI / 2) {\n tiltXrad = Math.PI / 2;\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle > Math.PI / 2 && azimuthAngle < Math.PI) {\n tiltXrad = -Math.PI / 2;\n tiltYrad = Math.PI / 2;\n }\n if (azimuthAngle > Math.PI && azimuthAngle < (3 * Math.PI) / 2) {\n tiltXrad = -Math.PI / 2;\n tiltYrad = -Math.PI / 2;\n }\n if (azimuthAngle > (3 * Math.PI) / 2 && azimuthAngle < 2 * Math.PI) {\n tiltXrad = Math.PI / 2;\n tiltYrad = -Math.PI / 2;\n }\n }\n\n if (altitudeAngle !== 0) {\n const tanAlt = Math.tan(altitudeAngle);\n\n tiltXrad = Math.atan(Math.cos(azimuthAngle) / tanAlt);\n tiltYrad = Math.atan(Math.sin(azimuthAngle) / tanAlt);\n }\n\n const tiltX = Math.round(tiltXrad * radToDeg);\n const tiltY = Math.round(tiltYrad * radToDeg);\n\n return { tiltX, tiltY };\n}\n\nconst RNSVGElements = [\n 'Circle',\n 'ClipPath',\n 'Ellipse',\n 'ForeignObject',\n 'G',\n 'Image',\n 'Line',\n 'Marker',\n 'Mask',\n 'Path',\n 'Pattern',\n 'Polygon',\n 'Polyline',\n 'Rect',\n 'Svg',\n 'Symbol',\n 'TSpan',\n 'Text',\n 'TextPath',\n 'Use',\n];\n\n// This function helps us determine whether given node is SVGElement or not. In our implementation of\n// findNodeHandle, we can encounter such element in 2 forms - SVG tag or ref to SVG Element. Since Gesture Handler\n// does not depend on SVG, we use our simplified SVGRef type that has `elementRef` field. This is something that is present\n// in actual SVG ref object.\n//\n// In order to make sure that node passed into this function is in fact SVG element, first we check if its constructor name\n// corresponds to one of the possible SVG elements. Then we also check if `elementRef` field exists.\n// By doing both steps we decrease probability of detecting situations where, for example, user makes custom `Circle` and\n// we treat it as SVG.\nexport function isRNSVGElement(viewRef: SVGRef | GestureHandlerRef) {\n const componentClassName = Object.getPrototypeOf(viewRef).constructor.name;\n\n return (\n RNSVGElements.indexOf(componentClassName) >= 0 &&\n Object.hasOwn(viewRef, 'elementRef')\n );\n}\n"]}
|
@@ -4,19 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _GestureHandler = _interopRequireDefault(require("./GestureHandler"));
|
9
|
+
|
8
10
|
var _utils = require("./utils");
|
9
|
-
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
/* eslint-disable eslint-comments/no-unlimited-disable */
|
11
|
-
/* eslint-disable */
|
12
15
|
|
16
|
+
/* eslint-disable */
|
13
17
|
class DiscreteGestureHandler extends _GestureHandler.default {
|
14
18
|
get isDiscrete() {
|
15
19
|
return true;
|
16
20
|
}
|
21
|
+
|
17
22
|
get shouldEnableGestureOnSetup() {
|
18
23
|
return true;
|
19
24
|
}
|
25
|
+
|
20
26
|
shouldFailUnderCustomCriteria({
|
21
27
|
x,
|
22
28
|
y,
|
@@ -36,8 +42,10 @@ class DiscreteGestureHandler extends _GestureHandler.default {
|
|
36
42
|
return true;
|
37
43
|
}
|
38
44
|
}
|
45
|
+
|
39
46
|
return (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaX), maxDeltaX) || (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaY), maxDeltaY) || (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaY * deltaY + deltaX * deltaX), maxDistSq);
|
40
47
|
}
|
48
|
+
|
41
49
|
transformNativeEvent({
|
42
50
|
center: {
|
43
51
|
x,
|
@@ -53,6 +61,7 @@ class DiscreteGestureHandler extends _GestureHandler.default {
|
|
53
61
|
y: y - rect.top
|
54
62
|
};
|
55
63
|
}
|
64
|
+
|
56
65
|
isGestureEnabledForEvent({
|
57
66
|
minPointers,
|
58
67
|
maxPointers,
|
@@ -67,8 +76,8 @@ class DiscreteGestureHandler extends _GestureHandler.default {
|
|
67
76
|
deltaY
|
68
77
|
}) {
|
69
78
|
const validPointerCount = pointerLength >= minPointers && pointerLength <= maxPointers;
|
70
|
-
|
71
|
-
|
79
|
+
|
80
|
+
if (this.shouldFailUnderCustomCriteria({ ...center,
|
72
81
|
deltaX,
|
73
82
|
deltaY
|
74
83
|
}, {
|
@@ -76,18 +85,21 @@ class DiscreteGestureHandler extends _GestureHandler.default {
|
|
76
85
|
maxDeltaY,
|
77
86
|
maxDistSq,
|
78
87
|
shouldCancelWhenOutside
|
79
|
-
}) ||
|
80
|
-
// A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)
|
88
|
+
}) || // A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)
|
81
89
|
// but if the gesture is running and the user adds or subtracts another pointer then it should fail.
|
82
90
|
!validPointerCount && this.isGestureRunning) {
|
83
91
|
return {
|
84
92
|
failed: true
|
85
93
|
};
|
86
94
|
}
|
95
|
+
|
87
96
|
return {
|
88
97
|
success: validPointerCount
|
89
98
|
};
|
90
99
|
}
|
100
|
+
|
91
101
|
}
|
92
|
-
|
102
|
+
|
103
|
+
var _default = DiscreteGestureHandler;
|
104
|
+
exports.default = _default;
|
93
105
|
//# sourceMappingURL=DiscreteGestureHandler.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["DiscreteGestureHandler.ts"],"names":["DiscreteGestureHandler","GestureHandler","isDiscrete","shouldEnableGestureOnSetup","shouldFailUnderCustomCriteria","x","y","deltaX","deltaY","maxDeltaX","maxDeltaY","maxDistSq","shouldCancelWhenOutside","isPointInView","Math","abs","transformNativeEvent","center","rect","view","getBoundingClientRect","absoluteX","absoluteY","left","top","isGestureEnabledForEvent","minPointers","maxPointers","_recognizer","pointerLength","validPointerCount","isGestureRunning","failed","success"],"mappings":";;;;;;;AAEA;;AACA;;;;AAHA;;AACA;AAIA,MAAeA,sBAAf,SAA8CC,uBAA9C,CAA6D;AAC7C,MAAVC,UAAU,GAAG;AACf,WAAO,IAAP;AACD;;AAE6B,MAA1BC,0BAA0B,GAAG;AAC/B,WAAO,IAAP;AACD;;AAEDC,EAAAA,6BAA6B,CAC3B;AAAEC,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA,MAAR;AAAgBC,IAAAA;AAAhB,GAD2B,EAE3B;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA,SAAxB;AAAmCC,IAAAA;AAAnC,GAF2B,EAG3B;AACA,QAAIA,uBAAJ,EAA6B;AAC3B,UAAI,CAAC,KAAKC,aAAL,CAAmB;AAAER,QAAAA,CAAF;AAAKC,QAAAA;AAAL,OAAnB,CAAL,EAAmC;AACjC,eAAO,IAAP;AACD;AACF;;AACD,WACE,gCAAoBQ,IAAI,CAACC,GAAL,CAASR,MAAT,CAApB,EAAsCE,SAAtC,KACA,gCAAoBK,IAAI,CAACC,GAAL,CAASP,MAAT,CAApB,EAAsCE,SAAtC,CADA,IAEA,gCACEI,IAAI,CAACC,GA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","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler from './GestureHandler';\nimport { TEST_MAX_IF_NOT_NAN } from './utils';\n\nabstract class DiscreteGestureHandler extends GestureHandler {\n get isDiscrete() {\n return true;\n }\n\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n shouldFailUnderCustomCriteria(\n { x, y, deltaX, deltaY }: any,\n { maxDeltaX, maxDeltaY, maxDistSq, shouldCancelWhenOutside }: any\n ) {\n if (shouldCancelWhenOutside) {\n if (!this.isPointInView({ x, y })) {\n return true;\n }\n }\n return (\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaX), maxDeltaX) ||\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaY), maxDeltaY) ||\n TEST_MAX_IF_NOT_NAN(\n Math.abs(deltaY * deltaY + deltaX * deltaX),\n maxDistSq\n )\n );\n }\n\n transformNativeEvent({ center: { x, y } }: any) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n\n return {\n absoluteX: x,\n absoluteY: y,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n\n isGestureEnabledForEvent(\n {\n minPointers,\n maxPointers,\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }: any,\n _recognizer: any,\n { maxPointers: pointerLength, center, deltaX, deltaY }: any\n ) {\n const validPointerCount =\n pointerLength >= minPointers && pointerLength <= maxPointers;\n\n if (\n this.shouldFailUnderCustomCriteria(\n { ...center, deltaX, deltaY },\n {\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }\n ) ||\n // A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)\n // but if the gesture is running and the user adds or subtracts another pointer then it should fail.\n (!validPointerCount && this.isGestureRunning)\n ) {\n return { failed: true };\n }\n\n return { success: validPointerCount };\n }\n}\n\nexport default DiscreteGestureHandler;\n"]}
|
@@ -4,16 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _GestureHandler = _interopRequireDefault(require("./GestureHandler"));
|
9
|
+
|
8
10
|
var _reactNative = require("react-native");
|
9
|
-
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
/* eslint-disable eslint-comments/no-unlimited-disable */
|
11
|
-
/* eslint-disable */
|
12
15
|
|
16
|
+
/* eslint-disable */
|
13
17
|
class DraggingGestureHandler extends _GestureHandler.default {
|
14
18
|
get shouldEnableGestureOnSetup() {
|
15
19
|
return true;
|
16
20
|
}
|
21
|
+
|
17
22
|
transformNativeEvent({
|
18
23
|
deltaX,
|
19
24
|
deltaY,
|
@@ -26,7 +31,9 @@ class DraggingGestureHandler extends _GestureHandler.default {
|
|
26
31
|
}) {
|
27
32
|
// @ts-ignore FIXME(TS)
|
28
33
|
const rect = this.view.getBoundingClientRect();
|
34
|
+
|
29
35
|
const ratio = _reactNative.PixelRatio.get();
|
36
|
+
|
30
37
|
return {
|
31
38
|
translationX: deltaX - (this.__initialX || 0),
|
32
39
|
translationY: deltaY - (this.__initialY || 0),
|
@@ -38,6 +45,9 @@ class DraggingGestureHandler extends _GestureHandler.default {
|
|
38
45
|
y: y - rect.top
|
39
46
|
};
|
40
47
|
}
|
48
|
+
|
41
49
|
}
|
42
|
-
|
50
|
+
|
51
|
+
var _default = DraggingGestureHandler;
|
52
|
+
exports.default = _default;
|
43
53
|
//# sourceMappingURL=DraggingGestureHandler.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["DraggingGestureHandler.ts"],"names":["DraggingGestureHandler","GestureHandler","shouldEnableGestureOnSetup","transformNativeEvent","deltaX","deltaY","velocityX","velocityY","center","x","y","rect","view","getBoundingClientRect","ratio","PixelRatio","get","translationX","__initialX","translationY","__initialY","absoluteX","absoluteY","left","top"],"mappings":";;;;;;;AAEA;;AACA;;;;AAHA;;AACA;AAIA,MAAeA,sBAAf,SAA8CC,uBAA9C,CAA6D;AAC7B,MAA1BC,0BAA0B,GAAG;AAC/B,WAAO,IAAP;AACD;;AAEDC,EAAAA,oBAAoB,CAAC;AACnBC,IAAAA,MADmB;AAEnBC,IAAAA,MAFmB;AAGnBC,IAAAA,SAHmB;AAInBC,IAAAA,SAJmB;AAKnBC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,CAAF;AAAKC,MAAAA;AAAL;AALW,GAAD,EAMD;AACjB;AACA,UAAMC,IAAI,GAAG,KAAKC,IAAL,CAAWC,qBAAX,EAAb;;AACA,UAAMC,KAAK,GAAGC,wBAAWC,GAAX,EAAd;;AACA,WAAO;AACLC,MAAAA,YAAY,EAAEb,MAAM,IAAI,KAAKc,UAAL,IAAmB,CAAvB,CADf;AAELC,MAAAA,YAAY,EAAEd,MAAM,IAAI,KAAKe,UAAL,IAAmB,CAAvB,CAFf;AAGLC,MAAAA,SAAS,EAAEZ,CAHN;AAILa,MAAAA,SAAS,EAAEZ,CAJN;AAKLJ,MAAAA,SAAS,EAAEA,SAAS,GAAGQ,KALlB;AAMLP,MAAAA,SAAS,EAAEA,SAAS,GAAGO,KANlB;AAOLL,MAAAA,CAAC,EAAEA,CAAC,GAAGE,IAAI,CAACY,IAPP;AAQLb,MAAAA,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACa;AARP,KAAP;AAUD;;AAzB0D;;eA4B9CxB,sB","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler, { HammerInputExt } from './GestureHandler';\nimport { PixelRatio } from 'react-native';\n\nabstract class DraggingGestureHandler extends GestureHandler {\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n transformNativeEvent({\n deltaX,\n deltaY,\n velocityX,\n velocityY,\n center: { x, y },\n }: HammerInputExt) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n const ratio = PixelRatio.get();\n return {\n translationX: deltaX - (this.__initialX || 0),\n translationY: deltaY - (this.__initialY || 0),\n absoluteX: x,\n absoluteY: y,\n velocityX: velocityX * ratio,\n velocityY: velocityY * ratio,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n}\n\nexport default DraggingGestureHandler;\n"]}
|
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.GesturePropError = void 0;
|
7
|
+
|
7
8
|
class GesturePropError extends Error {
|
8
9
|
constructor(name, value, expectedType) {
|
9
10
|
super(`Invalid property \`${name}: ${value}\` expected \`${expectedType}\``);
|
10
11
|
}
|
12
|
+
|
11
13
|
}
|
14
|
+
|
12
15
|
exports.GesturePropError = GesturePropError;
|
13
16
|
//# sourceMappingURL=Errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["GesturePropError","Error","constructor","name","value","expectedType"
|
1
|
+
{"version":3,"sources":["Errors.ts"],"names":["GesturePropError","Error","constructor","name","value","expectedType"],"mappings":";;;;;;;AAAO,MAAMA,gBAAN,SAA+BC,KAA/B,CAAqC;AAC1CC,EAAAA,WAAW,CAACC,IAAD,EAAeC,KAAf,EAA+BC,YAA/B,EAAqD;AAC9D,UACG,sBAAqBF,IAAK,KAAIC,KAAM,iBAAgBC,YAAa,IADpE;AAGD;;AALyC","sourcesContent":["export class GesturePropError extends Error {\n constructor(name: string, value: unknown, expectedType: string) {\n super(\n `Invalid property \\`${name}: ${value}\\` expected \\`${expectedType}\\``\n );\n }\n}\n"]}
|