react-native-gesture-handler 2.16.1 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -3
- package/android/build.gradle +105 -0
- package/android/gradle.properties +7 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +7 -7
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -5
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +4 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +1 -0
- package/apple/RNGestureHandlerButtonComponentView.mm +10 -0
- package/apple/RNGestureHandlerModule.mm +2 -3
- package/lib/commonjs/RNGestureHandlerModule.js +4 -97
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +109 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +10 -5
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.web.js +11 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +27 -12
- package/lib/commonjs/components/GestureButtons.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.js +82 -19
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +52 -0
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +3 -13
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +6 -0
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -7
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.js +12 -1
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.web.js +11 -0
- package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +34 -5
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +15 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js +7 -5
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +1 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +8 -5
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +11 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +3 -3
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +42 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +83 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +25 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +143 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +25 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js +6 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +80 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +180 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +55 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +47 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +176 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +3 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +8 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/utils.js +36 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +6 -8
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +5 -6
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +56 -64
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +7 -4
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +28 -18
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +18 -12
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +1 -6
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +7 -2
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +89 -57
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +6 -2
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +2 -1
- package/lib/commonjs/web/tools/Vector.js.map +1 -1
- package/lib/commonjs/web/utils.js +31 -0
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +4 -84
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +85 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/RNRenderer.js +3 -3
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.web.js +4 -0
- package/lib/module/RNRenderer.web.js.map +1 -0
- package/lib/module/components/GestureButtons.js +24 -6
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureComponents.js +80 -18
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +28 -0
- package/lib/module/components/GestureComponents.web.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +2 -8
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.web.js +9 -0
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +5 -0
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -6
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/getReactNativeVersion.js +7 -1
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.web.js +4 -0
- package/lib/module/getReactNativeVersion.web.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +33 -4
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.web.js +8 -0
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.js +2 -4
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/module/handlers/createHandler.js +2 -4
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +2 -4
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.web.js +5 -0
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js +26 -0
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +65 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +12 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js +115 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +18 -0
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/types.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +64 -0
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +165 -0
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +41 -0
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +36 -0
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector/utils.js +142 -0
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +3 -1
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +8 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/utils.js +34 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +6 -8
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +5 -6
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +56 -64
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +7 -4
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +28 -18
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +18 -12
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +1 -6
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +8 -3
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +89 -57
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +7 -3
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/Vector.js +2 -1
- package/lib/module/web/tools/Vector.js.map +1 -1
- package/lib/module/web/utils.js +29 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -15
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +15 -0
- package/lib/typescript/RNRenderer.d.ts +1 -3
- package/lib/typescript/RNRenderer.web.d.ts +3 -0
- package/lib/typescript/components/GestureButtons.d.ts +3 -34
- package/lib/typescript/components/GestureComponents.d.ts +21 -7
- package/lib/typescript/components/GestureComponents.web.d.ts +8 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.d.ts +4 -1
- package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -2
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +2 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +3 -2
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +13 -0
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +13 -0
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +2 -0
- package/lib/typescript/handlers/gestures/{GestureDetector.d.ts → GestureDetector/index.d.ts} +4 -12
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +3 -0
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +20 -0
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +4 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +2 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +5 -0
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +3 -0
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +12 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -1
- package/lib/typescript/utils.d.ts +10 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +1 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +34 -31
- package/lib/typescript/web/utils.d.ts +4 -0
- package/package.json +5 -5
- package/src/RNGestureHandlerModule.ts +4 -104
- package/src/RNGestureHandlerModule.web.ts +105 -0
- package/src/RNRenderer.ts +3 -3
- package/src/RNRenderer.web.ts +3 -0
- package/src/components/GestureButtons.tsx +36 -4
- package/src/components/GestureComponents.tsx +131 -24
- package/src/components/GestureComponents.web.tsx +41 -0
- package/src/components/GestureHandlerButton.tsx +4 -5
- package/src/components/GestureHandlerButton.web.tsx +6 -0
- package/src/components/GestureHandlerRootView.tsx +6 -0
- package/src/components/{GestureHandlerRootView.native.tsx → GestureHandlerRootView.web.tsx} +0 -6
- package/src/getReactNativeVersion.ts +9 -1
- package/src/getReactNativeVersion.web.ts +3 -0
- package/src/getShadowNodeFromRef.ts +41 -4
- package/src/getShadowNodeFromRef.web.ts +7 -0
- package/src/handlers/PressabilityDebugView.tsx +2 -4
- package/src/handlers/PressabilityDebugView.web.tsx +4 -0
- package/src/handlers/createHandler.tsx +1 -3
- package/src/handlers/customDirectEventTypes.ts +2 -5
- package/src/handlers/customDirectEventTypes.web.ts +5 -0
- package/src/handlers/gestureHandlerCommon.ts +4 -1
- package/src/handlers/gestures/GestureDetector/Wrap.tsx +35 -0
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +112 -0
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +14 -0
- package/src/handlers/gestures/GestureDetector/index.tsx +187 -0
- package/src/handlers/gestures/GestureDetector/needsToReattach.ts +27 -0
- package/src/handlers/gestures/GestureDetector/types.ts +32 -0
- package/src/handlers/gestures/GestureDetector/updateHandlers.ts +94 -0
- package/src/handlers/gestures/GestureDetector/useAnimatedGesture.ts +206 -0
- package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +69 -0
- package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +54 -0
- package/src/handlers/gestures/GestureDetector/utils.ts +185 -0
- package/src/handlers/gestures/gestureComposition.ts +2 -0
- package/src/handlers/gestures/gestureStateManager.ts +12 -4
- package/src/handlers/gestures/reanimatedWrapper.ts +19 -17
- package/src/utils.ts +39 -0
- package/src/web/detectors/RotationGestureDetector.ts +6 -8
- package/src/web/detectors/ScaleGestureDetector.ts +5 -6
- package/src/web/handlers/FlingGestureHandler.ts +2 -0
- package/src/web/handlers/GestureHandler.ts +53 -62
- package/src/web/handlers/LongPressGestureHandler.ts +2 -0
- package/src/web/handlers/ManualGestureHandler.ts +2 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +8 -4
- package/src/web/handlers/PanGestureHandler.ts +32 -19
- package/src/web/handlers/PinchGestureHandler.ts +2 -0
- package/src/web/handlers/RotationGestureHandler.ts +2 -0
- package/src/web/handlers/TapGestureHandler.ts +20 -12
- package/src/web/interfaces.ts +1 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +1 -7
- package/src/web/tools/PointerEventManager.ts +10 -3
- package/src/web/tools/PointerTracker.ts +81 -74
- package/src/web/tools/TouchEventManager.ts +5 -3
- package/src/web/tools/Vector.ts +2 -4
- package/src/web/utils.ts +34 -0
- package/lib/commonjs/RNGestureHandlerModule.native.js +0 -16
- package/lib/commonjs/RNGestureHandlerModule.native.js.map +0 -1
- package/lib/commonjs/RNRenderer.native.js +0 -16
- package/lib/commonjs/RNRenderer.native.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.native.js +0 -115
- package/lib/commonjs/components/GestureComponents.native.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.native.js +0 -14
- package/lib/commonjs/components/GestureHandlerButton.native.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.native.js.map +0 -1
- package/lib/commonjs/getReactNativeVersion.native.js +0 -22
- package/lib/commonjs/getReactNativeVersion.native.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.native.js +0 -44
- package/lib/commonjs/getShadowNodeFromRef.native.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.native.js +0 -14
- package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.native.js +0 -14
- package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -704
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.native.js +0 -5
- package/lib/module/RNGestureHandlerModule.native.js.map +0 -1
- package/lib/module/RNRenderer.native.js +0 -4
- package/lib/module/RNRenderer.native.js.map +0 -1
- package/lib/module/components/GestureComponents.native.js +0 -90
- package/lib/module/components/GestureComponents.native.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.native.js +0 -3
- package/lib/module/components/GestureHandlerButton.native.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.native.js.map +0 -1
- package/lib/module/getReactNativeVersion.native.js +0 -10
- package/lib/module/getReactNativeVersion.native.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.native.js +0 -37
- package/lib/module/getShadowNodeFromRef.native.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.native.js +0 -3
- package/lib/module/handlers/PressabilityDebugView.native.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.native.js +0 -3
- package/lib/module/handlers/customDirectEventTypes.native.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector.js +0 -654
- package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.native.d.ts +0 -2
- package/lib/typescript/RNRenderer.native.d.ts +0 -1
- package/lib/typescript/components/GestureComponents.native.d.ts +0 -22
- package/lib/typescript/components/GestureHandlerButton.native.d.ts +0 -4
- package/lib/typescript/getReactNativeVersion.native.d.ts +0 -4
- package/lib/typescript/getShadowNodeFromRef.native.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +0 -1
- package/src/RNGestureHandlerModule.native.ts +0 -5
- package/src/RNRenderer.native.ts +0 -3
- package/src/components/GestureComponents.native.tsx +0 -148
- package/src/components/GestureHandlerButton.native.tsx +0 -5
- package/src/getReactNativeVersion.native.ts +0 -11
- package/src/getShadowNodeFromRef.native.ts +0 -44
- package/src/handlers/PressabilityDebugView.native.tsx +0 -2
- package/src/handlers/customDirectEventTypes.native.ts +0 -2
- package/src/handlers/gestures/GestureDetector.tsx +0 -894
- /package/lib/typescript/components/{GestureHandlerRootView.native.d.ts → GestureHandlerRootView.web.d.ts} +0 -0
@@ -76,11 +76,10 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
76
76
|
|
77
77
|
const div: number = pointerUp ? numOfPointers - 1 : numOfPointers;
|
78
78
|
|
79
|
-
const
|
80
|
-
const sumY = tracker.getSumY(ignoredPointer);
|
79
|
+
const coordsSum = tracker.getAbsoluteCoordsSum();
|
81
80
|
|
82
|
-
const focusX =
|
83
|
-
const focusY =
|
81
|
+
const focusX = coordsSum.x / div;
|
82
|
+
const focusY = coordsSum.y / div;
|
84
83
|
|
85
84
|
//Determine average deviation from focal point
|
86
85
|
|
@@ -92,8 +91,8 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
|
|
92
91
|
return;
|
93
92
|
}
|
94
93
|
|
95
|
-
devSumX += Math.abs(value.
|
96
|
-
devSumY += Math.abs(value.
|
94
|
+
devSumX += Math.abs(value.abosoluteCoords.x - focusX);
|
95
|
+
devSumY += Math.abs(value.abosoluteCoords.y - focusY);
|
97
96
|
});
|
98
97
|
|
99
98
|
const devX: number = devSumX / div;
|
@@ -289,32 +289,21 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
289
289
|
GestureHandlerOrchestrator.getInstance().cancelMouseAndPenGestures(this);
|
290
290
|
}
|
291
291
|
|
292
|
-
|
293
|
-
this.sendTouchEvent(event);
|
294
|
-
}
|
292
|
+
// TODO: Bring back touch events along with introducing `handleDown` method that will handle handler specific stuff
|
295
293
|
}
|
296
294
|
// Adding another pointer to existing ones
|
297
295
|
protected onPointerAdd(event: AdaptedEvent): void {
|
298
|
-
|
299
|
-
this.sendTouchEvent(event);
|
300
|
-
}
|
296
|
+
this.tryToSendTouchEvent(event);
|
301
297
|
}
|
302
298
|
protected onPointerUp(event: AdaptedEvent): void {
|
303
|
-
|
304
|
-
this.sendTouchEvent(event);
|
305
|
-
}
|
299
|
+
this.tryToSendTouchEvent(event);
|
306
300
|
}
|
307
301
|
// Removing pointer, when there is more than one pointers
|
308
302
|
protected onPointerRemove(event: AdaptedEvent): void {
|
309
|
-
|
310
|
-
this.sendTouchEvent(event);
|
311
|
-
}
|
303
|
+
this.tryToSendTouchEvent(event);
|
312
304
|
}
|
313
305
|
protected onPointerMove(event: AdaptedEvent): void {
|
314
|
-
this.tryToSendMoveEvent(false);
|
315
|
-
if (this.config.needsPointerData) {
|
316
|
-
this.sendTouchEvent(event);
|
317
|
-
}
|
306
|
+
this.tryToSendMoveEvent(false, event);
|
318
307
|
}
|
319
308
|
protected onPointerLeave(event: AdaptedEvent): void {
|
320
309
|
if (this.shouldCancelWhenOutside) {
|
@@ -329,28 +318,19 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
329
318
|
return;
|
330
319
|
}
|
331
320
|
|
332
|
-
|
333
|
-
this.sendTouchEvent(event);
|
334
|
-
}
|
321
|
+
this.tryToSendTouchEvent(event);
|
335
322
|
}
|
336
323
|
protected onPointerEnter(event: AdaptedEvent): void {
|
337
|
-
|
338
|
-
this.sendTouchEvent(event);
|
339
|
-
}
|
324
|
+
this.tryToSendTouchEvent(event);
|
340
325
|
}
|
341
326
|
protected onPointerCancel(event: AdaptedEvent): void {
|
342
|
-
|
343
|
-
this.sendTouchEvent(event);
|
344
|
-
}
|
327
|
+
this.tryToSendTouchEvent(event);
|
345
328
|
|
346
329
|
this.cancel();
|
347
330
|
this.reset();
|
348
331
|
}
|
349
332
|
protected onPointerOutOfBounds(event: AdaptedEvent): void {
|
350
|
-
this.tryToSendMoveEvent(true);
|
351
|
-
if (this.config.needsPointerData) {
|
352
|
-
this.sendTouchEvent(event);
|
353
|
-
}
|
333
|
+
this.tryToSendMoveEvent(true, event);
|
354
334
|
}
|
355
335
|
protected onPointerMoveOver(_event: AdaptedEvent): void {
|
356
336
|
// used only by hover gesture handler atm
|
@@ -358,14 +338,22 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
358
338
|
protected onPointerMoveOut(_event: AdaptedEvent): void {
|
359
339
|
// used only by hover gesture handler atm
|
360
340
|
}
|
361
|
-
private tryToSendMoveEvent(out: boolean): void {
|
362
|
-
if (
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
) {
|
341
|
+
private tryToSendMoveEvent(out: boolean, event: AdaptedEvent): void {
|
342
|
+
if ((out && this.shouldCancelWhenOutside) || !this.enabled) {
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
|
346
|
+
if (this.active) {
|
367
347
|
this.sendEvent(this.currentState, this.currentState);
|
368
348
|
}
|
349
|
+
|
350
|
+
this.tryToSendTouchEvent(event);
|
351
|
+
}
|
352
|
+
|
353
|
+
protected tryToSendTouchEvent(event: AdaptedEvent): void {
|
354
|
+
if (this.config.needsPointerData) {
|
355
|
+
this.sendTouchEvent(event);
|
356
|
+
}
|
369
357
|
}
|
370
358
|
|
371
359
|
public sendTouchEvent(event: AdaptedEvent): void {
|
@@ -417,10 +405,9 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
417
405
|
nativeEvent: {
|
418
406
|
numberOfPointers: this.tracker.getTrackedPointersCount(),
|
419
407
|
state: newState,
|
420
|
-
pointerInside: this.delegate.isPointerInBounds(
|
421
|
-
|
422
|
-
|
423
|
-
}),
|
408
|
+
pointerInside: this.delegate.isPointerInBounds(
|
409
|
+
this.tracker.getAbsoluteCoordsAverage()
|
410
|
+
),
|
424
411
|
...this.transformNativeEvent(),
|
425
412
|
handlerTag: this.handlerTag,
|
426
413
|
target: this.viewRef,
|
@@ -454,10 +441,10 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
454
441
|
|
455
442
|
all.push({
|
456
443
|
id: id,
|
457
|
-
x: element.
|
458
|
-
y: element.
|
459
|
-
absoluteX: element.
|
460
|
-
absoluteY: element.
|
444
|
+
x: element.abosoluteCoords.x - rect.pageX,
|
445
|
+
y: element.abosoluteCoords.y - rect.pageY,
|
446
|
+
absoluteX: element.abosoluteCoords.x,
|
447
|
+
absoluteY: element.abosoluteCoords.y,
|
461
448
|
});
|
462
449
|
});
|
463
450
|
|
@@ -477,10 +464,10 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
477
464
|
|
478
465
|
changed.push({
|
479
466
|
id: id,
|
480
|
-
x: element.
|
481
|
-
y: element.
|
482
|
-
absoluteX: element.
|
483
|
-
absoluteY: element.
|
467
|
+
x: element.abosoluteCoords.x - rect.pageX,
|
468
|
+
y: element.abosoluteCoords.y - rect.pageY,
|
469
|
+
absoluteX: element.abosoluteCoords.x,
|
470
|
+
absoluteY: element.abosoluteCoords.y,
|
484
471
|
});
|
485
472
|
});
|
486
473
|
}
|
@@ -524,6 +511,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
524
511
|
changedTouches: changed,
|
525
512
|
allTouches: all,
|
526
513
|
numberOfTouches: numberOfTouches,
|
514
|
+
pointerType: this.pointerType,
|
527
515
|
},
|
528
516
|
timeStamp: Date.now(),
|
529
517
|
};
|
@@ -546,18 +534,18 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
546
534
|
|
547
535
|
all.push({
|
548
536
|
id: id,
|
549
|
-
x: element.
|
550
|
-
y: element.
|
551
|
-
absoluteX: element.
|
552
|
-
absoluteY: element.
|
537
|
+
x: element.abosoluteCoords.x - rect.pageX,
|
538
|
+
y: element.abosoluteCoords.y - rect.pageY,
|
539
|
+
absoluteX: element.abosoluteCoords.x,
|
540
|
+
absoluteY: element.abosoluteCoords.y,
|
553
541
|
});
|
554
542
|
|
555
543
|
changed.push({
|
556
544
|
id: id,
|
557
|
-
x: element.
|
558
|
-
y: element.
|
559
|
-
absoluteX: element.
|
560
|
-
absoluteY: element.
|
545
|
+
x: element.abosoluteCoords.x - rect.pageX,
|
546
|
+
y: element.abosoluteCoords.y - rect.pageY,
|
547
|
+
absoluteX: element.abosoluteCoords.x,
|
548
|
+
absoluteY: element.abosoluteCoords.y,
|
561
549
|
});
|
562
550
|
});
|
563
551
|
|
@@ -569,6 +557,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
569
557
|
changedTouches: changed,
|
570
558
|
allTouches: all,
|
571
559
|
numberOfTouches: all.length,
|
560
|
+
pointerType: this.pointerType,
|
572
561
|
},
|
573
562
|
timeStamp: Date.now(),
|
574
563
|
};
|
@@ -581,13 +570,14 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
581
570
|
|
582
571
|
protected transformNativeEvent(): Record<string, unknown> {
|
583
572
|
// those properties are shared by most handlers and if not this method will be overriden
|
584
|
-
const
|
573
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
574
|
+
const lastRelativeCoords = this.tracker.getRelativeCoordsAverage();
|
585
575
|
|
586
576
|
return {
|
587
|
-
x:
|
588
|
-
y:
|
589
|
-
absoluteX:
|
590
|
-
absoluteY:
|
577
|
+
x: lastRelativeCoords.x,
|
578
|
+
y: lastRelativeCoords.y,
|
579
|
+
absoluteX: lastCoords.x,
|
580
|
+
absoluteY: lastCoords.y,
|
591
581
|
};
|
592
582
|
}
|
593
583
|
|
@@ -732,8 +722,9 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
732
722
|
}
|
733
723
|
|
734
724
|
const rect = this.delegate.measureView();
|
735
|
-
const
|
736
|
-
const
|
725
|
+
const { x, y } = this.tracker.getLastAbsoluteCoords();
|
726
|
+
const offsetX: number = x - rect.pageX;
|
727
|
+
const offsetY: number = y - rect.pageY;
|
737
728
|
|
738
729
|
if (
|
739
730
|
offsetX >= left &&
|
@@ -53,6 +53,8 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
53
53
|
this.tracker.addToTracker(event);
|
54
54
|
super.onPointerDown(event);
|
55
55
|
this.newPointerAction();
|
56
|
+
|
57
|
+
this.tryToSendTouchEvent(event);
|
56
58
|
}
|
57
59
|
|
58
60
|
protected onPointerAdd(event: AdaptedEvent): void {
|
@@ -62,8 +64,9 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
62
64
|
}
|
63
65
|
|
64
66
|
private newPointerAction(): void {
|
65
|
-
|
66
|
-
this.
|
67
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
68
|
+
this.startX = lastCoords.x;
|
69
|
+
this.startY = lastCoords.y;
|
67
70
|
|
68
71
|
if (this.currentState !== State.UNDETERMINED) {
|
69
72
|
return;
|
@@ -78,8 +81,9 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
78
81
|
protected onPointerMove(event: AdaptedEvent): void {
|
79
82
|
this.tracker.track(event);
|
80
83
|
|
81
|
-
const
|
82
|
-
const
|
84
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
85
|
+
const dx = this.startX - lastCoords.x;
|
86
|
+
const dy = this.startY - lastCoords.y;
|
83
87
|
const distSq = dx * dx + dy * dy;
|
84
88
|
|
85
89
|
if (distSq >= this.minDistSq) {
|
@@ -219,14 +219,17 @@ export default class PanGestureHandler extends GestureHandler {
|
|
219
219
|
this.tracker.addToTracker(event);
|
220
220
|
super.onPointerDown(event);
|
221
221
|
|
222
|
-
|
223
|
-
this.
|
222
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
223
|
+
this.lastX = lastCoords.x;
|
224
|
+
this.lastY = lastCoords.y;
|
224
225
|
|
225
226
|
this.startX = this.lastX;
|
226
227
|
this.startY = this.lastY;
|
227
228
|
|
228
229
|
this.tryBegin(event);
|
229
230
|
this.checkBegan();
|
231
|
+
|
232
|
+
this.tryToSendTouchEvent(event);
|
230
233
|
}
|
231
234
|
|
232
235
|
protected onPointerAdd(event: AdaptedEvent): void {
|
@@ -237,8 +240,9 @@ export default class PanGestureHandler extends GestureHandler {
|
|
237
240
|
this.offsetX += this.lastX - this.startX;
|
238
241
|
this.offsetY += this.lastY - this.startY;
|
239
242
|
|
240
|
-
|
241
|
-
this.
|
243
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
244
|
+
this.lastX = lastCoords.x;
|
245
|
+
this.lastY = lastCoords.y;
|
242
246
|
|
243
247
|
this.startX = this.lastX;
|
244
248
|
this.startY = this.lastY;
|
@@ -256,10 +260,10 @@ export default class PanGestureHandler extends GestureHandler {
|
|
256
260
|
|
257
261
|
protected onPointerUp(event: AdaptedEvent): void {
|
258
262
|
super.onPointerUp(event);
|
259
|
-
|
260
263
|
if (this.currentState === State.ACTIVE) {
|
261
|
-
|
262
|
-
this.
|
264
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
265
|
+
this.lastX = lastCoords.x;
|
266
|
+
this.lastY = lastCoords.y;
|
263
267
|
}
|
264
268
|
|
265
269
|
this.tracker.removeFromTracker(event.pointerId);
|
@@ -271,6 +275,7 @@ export default class PanGestureHandler extends GestureHandler {
|
|
271
275
|
this.fail();
|
272
276
|
}
|
273
277
|
}
|
278
|
+
|
274
279
|
protected onPointerRemove(event: AdaptedEvent): void {
|
275
280
|
super.onPointerRemove(event);
|
276
281
|
this.tracker.removeFromTracker(event.pointerId);
|
@@ -278,8 +283,9 @@ export default class PanGestureHandler extends GestureHandler {
|
|
278
283
|
this.offsetX += this.lastX - this.startX;
|
279
284
|
this.offsetY += this.lastY - this.startY;
|
280
285
|
|
281
|
-
|
282
|
-
this.
|
286
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
287
|
+
this.lastX = lastCoords.x;
|
288
|
+
this.lastY = lastCoords.y;
|
283
289
|
|
284
290
|
this.startX = this.lastX;
|
285
291
|
this.startY = this.lastY;
|
@@ -297,10 +303,13 @@ export default class PanGestureHandler extends GestureHandler {
|
|
297
303
|
protected onPointerMove(event: AdaptedEvent): void {
|
298
304
|
this.tracker.track(event);
|
299
305
|
|
300
|
-
|
301
|
-
this.
|
302
|
-
this.
|
303
|
-
|
306
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
307
|
+
this.lastX = lastCoords.x;
|
308
|
+
this.lastY = lastCoords.y;
|
309
|
+
|
310
|
+
const velocity = this.tracker.getVelocity(event.pointerId);
|
311
|
+
this.velocityX = velocity.x;
|
312
|
+
this.velocityY = velocity.y;
|
304
313
|
|
305
314
|
this.checkBegan();
|
306
315
|
|
@@ -314,10 +323,13 @@ export default class PanGestureHandler extends GestureHandler {
|
|
314
323
|
|
315
324
|
this.tracker.track(event);
|
316
325
|
|
317
|
-
|
318
|
-
this.
|
319
|
-
this.
|
320
|
-
|
326
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
327
|
+
this.lastX = lastCoords.x;
|
328
|
+
this.lastY = lastCoords.y;
|
329
|
+
|
330
|
+
const velocity = this.tracker.getVelocity(event.pointerId);
|
331
|
+
this.velocityX = velocity.x;
|
332
|
+
this.velocityY = velocity.y;
|
321
333
|
|
322
334
|
this.checkBegan();
|
323
335
|
|
@@ -451,8 +463,9 @@ export default class PanGestureHandler extends GestureHandler {
|
|
451
463
|
}, this.activateAfterLongPress);
|
452
464
|
}
|
453
465
|
} else {
|
454
|
-
|
455
|
-
this.
|
466
|
+
const velocity = this.tracker.getVelocity(event.pointerId);
|
467
|
+
this.velocityX = velocity.x;
|
468
|
+
this.velocityY = velocity.y;
|
456
469
|
}
|
457
470
|
}
|
458
471
|
|
@@ -71,6 +71,8 @@ export default class PinchGestureHandler extends GestureHandler {
|
|
71
71
|
protected onPointerDown(event: AdaptedEvent): void {
|
72
72
|
this.tracker.addToTracker(event);
|
73
73
|
super.onPointerDown(event);
|
74
|
+
|
75
|
+
this.tryToSendTouchEvent(event);
|
74
76
|
}
|
75
77
|
|
76
78
|
protected onPointerAdd(event: AdaptedEvent): void {
|
@@ -78,6 +78,8 @@ export default class RotationGestureHandler extends GestureHandler {
|
|
78
78
|
protected onPointerDown(event: AdaptedEvent): void {
|
79
79
|
this.tracker.addToTracker(event);
|
80
80
|
super.onPointerDown(event);
|
81
|
+
|
82
|
+
this.tryToSendTouchEvent(event);
|
81
83
|
}
|
82
84
|
|
83
85
|
protected onPointerAdd(event: AdaptedEvent): void {
|
@@ -121,6 +121,8 @@ export default class TapGestureHandler extends GestureHandler {
|
|
121
121
|
this.lastY = event.y;
|
122
122
|
|
123
123
|
this.updateState(event);
|
124
|
+
|
125
|
+
this.tryToSendTouchEvent(event);
|
124
126
|
}
|
125
127
|
|
126
128
|
protected onPointerAdd(event: AdaptedEvent): void {
|
@@ -131,19 +133,22 @@ export default class TapGestureHandler extends GestureHandler {
|
|
131
133
|
this.offsetX += this.lastX - this.startX;
|
132
134
|
this.offsetY += this.lastY - this.startY;
|
133
135
|
|
134
|
-
|
135
|
-
this.
|
136
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
137
|
+
this.lastX = lastCoords.x;
|
138
|
+
this.lastY = lastCoords.y;
|
136
139
|
|
137
|
-
this.startX =
|
138
|
-
this.startY =
|
140
|
+
this.startX = lastCoords.x;
|
141
|
+
this.startY = lastCoords.y;
|
139
142
|
|
140
143
|
this.updateState(event);
|
141
144
|
}
|
142
145
|
|
143
146
|
protected onPointerUp(event: AdaptedEvent): void {
|
144
147
|
super.onPointerUp(event);
|
145
|
-
|
146
|
-
|
148
|
+
|
149
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
150
|
+
this.lastX = lastCoords.x;
|
151
|
+
this.lastY = lastCoords.y;
|
147
152
|
|
148
153
|
this.tracker.removeFromTracker(event.pointerId);
|
149
154
|
|
@@ -157,8 +162,9 @@ export default class TapGestureHandler extends GestureHandler {
|
|
157
162
|
this.offsetX += this.lastX - this.startX;
|
158
163
|
this.offsetY += this.lastY = this.startY;
|
159
164
|
|
160
|
-
|
161
|
-
this.
|
165
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
166
|
+
this.lastX = lastCoords.x;
|
167
|
+
this.lastY = lastCoords.y;
|
162
168
|
|
163
169
|
this.startX = this.lastX;
|
164
170
|
this.startY = this.lastY;
|
@@ -170,8 +176,9 @@ export default class TapGestureHandler extends GestureHandler {
|
|
170
176
|
this.trySettingPosition(event);
|
171
177
|
this.tracker.track(event);
|
172
178
|
|
173
|
-
|
174
|
-
this.
|
179
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
180
|
+
this.lastX = lastCoords.x;
|
181
|
+
this.lastY = lastCoords.y;
|
175
182
|
|
176
183
|
this.updateState(event);
|
177
184
|
|
@@ -182,8 +189,9 @@ export default class TapGestureHandler extends GestureHandler {
|
|
182
189
|
this.trySettingPosition(event);
|
183
190
|
this.tracker.track(event);
|
184
191
|
|
185
|
-
|
186
|
-
this.
|
192
|
+
const lastCoords = this.tracker.getAbsoluteCoordsAverage();
|
193
|
+
this.lastX = lastCoords.x;
|
194
|
+
this.lastY = lastCoords.y;
|
187
195
|
|
188
196
|
this.updateState(event);
|
189
197
|
|
package/src/web/interfaces.ts
CHANGED
@@ -113,6 +113,7 @@ interface NativeTouchEvent extends Record<string, TouchNativeArgs> {
|
|
113
113
|
changedTouches: PointerData[];
|
114
114
|
allTouches: PointerData[];
|
115
115
|
numberOfTouches: number;
|
116
|
+
pointerType: PointerType;
|
116
117
|
}
|
117
118
|
|
118
119
|
export interface ResultEvent extends Record<string, NativeEvent | number> {
|
@@ -335,13 +335,7 @@ export default class GestureHandlerOrchestrator {
|
|
335
335
|
// TODO: Find better way to handle that issue, for example by activation order and handler cancelling
|
336
336
|
|
337
337
|
const isPointerWithinBothBounds = (pointer: number) => {
|
338
|
-
const
|
339
|
-
const handlerY: number = handler.getTracker().getLastY(pointer);
|
340
|
-
|
341
|
-
const point = {
|
342
|
-
x: handlerX,
|
343
|
-
y: handlerY,
|
344
|
-
};
|
338
|
+
const point = handler.getTracker().getLastAbsoluteCoords(pointer);
|
345
339
|
|
346
340
|
return (
|
347
341
|
handler.getDelegate().isPointerInBounds(point) &&
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import EventManager from './EventManager';
|
2
2
|
import { MouseButton } from '../../handlers/gestureHandlerCommon';
|
3
3
|
import { AdaptedEvent, EventTypes, Point } from '../interfaces';
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
PointerTypeMapping,
|
6
|
+
calculateViewScale,
|
7
|
+
isPointerInBounds,
|
8
|
+
} from '../utils';
|
5
9
|
import { PointerType } from '../../PointerType';
|
6
10
|
|
7
11
|
const POINTER_CAPTURE_EXCLUDE_LIST = new Set<string>(['SELECT', 'INPUT']);
|
@@ -234,11 +238,14 @@ export default class PointerEventManager extends EventManager<HTMLElement> {
|
|
234
238
|
}
|
235
239
|
|
236
240
|
protected mapEvent(event: PointerEvent, eventType: EventTypes): AdaptedEvent {
|
241
|
+
const rect = this.view.getBoundingClientRect();
|
242
|
+
const { scaleX, scaleY } = calculateViewScale(this.view);
|
243
|
+
|
237
244
|
return {
|
238
245
|
x: event.clientX,
|
239
246
|
y: event.clientY,
|
240
|
-
offsetX: event.
|
241
|
-
offsetY: event.
|
247
|
+
offsetX: (event.clientX - rect.left) / scaleX,
|
248
|
+
offsetY: (event.clientY - rect.top) / scaleY,
|
242
249
|
pointerId: event.pointerId,
|
243
250
|
eventType: eventType,
|
244
251
|
pointerType:
|