react-native-gesture-handler 2.25.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/RNGestureHandler.podspec +1 -0
- package/android/build.gradle +41 -42
- package/android/fabric/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +1 -1
- package/android/gradle.properties +1 -1
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +2 -2
- package/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +4 -1
- package/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +1 -1
- package/android/{package77/src → src}/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +14 -19
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +29 -5
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +229 -114
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerInteractionController.kt +4 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +91 -49
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerRegistry.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +13 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +20 -6
- package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +52 -21
- package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +12 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +65 -35
- package/android/src/main/java/com/swmansion/gesturehandler/core/OnTouchEventListener.kt +3 -3
- package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +187 -92
- package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +12 -5
- package/android/src/main/java/com/swmansion/gesturehandler/core/PointerEventsConfig.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +3 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +12 -5
- package/android/src/main/java/com/swmansion/gesturehandler/core/StylusData.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +55 -33
- package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +13 -18
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +27 -21
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +7 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +13 -12
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDispatcher.kt +189 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerFactoryUtil.kt +34 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +7 -11
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +29 -590
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +8 -14
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +26 -16
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +15 -12
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +2 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +17 -16
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +6 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +7 -5
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +2 -1
- package/android/src/main/jni/CMakeLists.txt +8 -18
- package/android/svg/src/main/java/com/swmansion/gesturehandler/RNSVGHitTester.kt +1 -3
- package/apple/RNGestureHandlerButton.mm +6 -2
- package/package.json +29 -47
- package/src/components/DrawerLayout.tsx +5 -2
- package/src/components/GestureButtons.tsx +2 -2
- package/src/components/GestureComponents.web.tsx +1 -1
- package/src/components/GestureHandlerButton.web.tsx +3 -3
- package/src/components/Pressable/Pressable.tsx +362 -425
- package/src/components/Pressable/PressableProps.tsx +34 -0
- package/src/components/Pressable/StateMachine.tsx +49 -0
- package/src/components/Pressable/stateDefinitions.ts +125 -0
- package/src/components/Pressable/utils.ts +11 -7
- package/src/components/ReanimatedSwipeable.tsx +55 -33
- package/src/components/Swipeable.tsx +3 -0
- package/src/components/Text.tsx +5 -2
- package/src/components/utils.ts +26 -0
- package/src/getShadowNodeFromRef.ts +2 -2
- package/src/handlers/GestureHandlerEventPayload.ts +3 -0
- package/src/handlers/createHandler.tsx +1 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +9 -0
- package/src/handlers/gestures/forceTouchGesture.ts +9 -0
- package/src/handlers/gestures/gestureObjects.ts +3 -1
- package/src/handlers/gestures/reanimatedWrapper.ts +0 -1
- package/src/handlers/utils.ts +1 -1
- package/src/utils.ts +0 -1
- package/src/web/detectors/RotationGestureDetector.ts +4 -0
- package/src/web/handlers/FlingGestureHandler.ts +4 -0
- package/src/web/handlers/GestureHandler.ts +9 -3
- package/src/web/handlers/PanGestureHandler.ts +25 -36
- package/src/web/handlers/TapGestureHandler.ts +14 -19
- package/src/web/tools/GestureHandlerOrchestrator.ts +1 -0
- package/src/web/tools/PointerEventManager.ts +1 -1
- package/src/web/tools/PointerTracker.ts +17 -15
- package/src/web/tools/Vector.ts +1 -1
- package/src/web_hammer/DiscreteGestureHandler.ts +1 -1
- package/src/web_hammer/DraggingGestureHandler.ts +1 -1
- package/src/web_hammer/FlingGestureHandler.ts +1 -1
- package/src/web_hammer/GestureHandler.ts +2 -1
- package/src/web_hammer/LongPressGestureHandler.ts +1 -1
- package/android/packageDeprecated/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -85
- package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +0 -60
- package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +0 -26
- package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +0 -26
- package/android/paper77/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +0 -16
- package/android/paper77/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +0 -67
- package/android/paper77/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -13
- package/lib/commonjs/ActionType.js +0 -15
- package/lib/commonjs/ActionType.js.map +0 -1
- package/lib/commonjs/Directions.js +0 -28
- package/lib/commonjs/Directions.js.map +0 -1
- package/lib/commonjs/EnableNewWebImplementation.js +0 -48
- package/lib/commonjs/EnableNewWebImplementation.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootViewContext.js +0 -15
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +0 -1
- package/lib/commonjs/PlatformConstants.js +0 -15
- package/lib/commonjs/PlatformConstants.js.map +0 -1
- package/lib/commonjs/PlatformConstants.web.js +0 -14
- package/lib/commonjs/PlatformConstants.web.js.map +0 -1
- package/lib/commonjs/PointerType.js +0 -17
- package/lib/commonjs/PointerType.js.map +0 -1
- package/lib/commonjs/RNGestureHandlerModule.js +0 -16
- package/lib/commonjs/RNGestureHandlerModule.js.map +0 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +0 -122
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +0 -66
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +0 -1
- package/lib/commonjs/RNRenderer.js +0 -16
- package/lib/commonjs/RNRenderer.js.map +0 -1
- package/lib/commonjs/RNRenderer.web.js +0 -11
- package/lib/commonjs/RNRenderer.web.js.map +0 -1
- package/lib/commonjs/State.js +0 -18
- package/lib/commonjs/State.js.map +0 -1
- package/lib/commonjs/TouchEventType.js +0 -16
- package/lib/commonjs/TouchEventType.js.map +0 -1
- package/lib/commonjs/components/DrawerLayout.js +0 -574
- package/lib/commonjs/components/DrawerLayout.js.map +0 -1
- package/lib/commonjs/components/GestureButtons.js +0 -269
- package/lib/commonjs/components/GestureButtons.js.map +0 -1
- package/lib/commonjs/components/GestureButtonsProps.js +0 -6
- package/lib/commonjs/components/GestureButtonsProps.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.js +0 -115
- package/lib/commonjs/components/GestureComponents.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.web.js +0 -52
- package/lib/commonjs/components/GestureComponents.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.js +0 -14
- package/lib/commonjs/components/GestureHandlerButton.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +0 -24
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.android.js +0 -46
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +0 -44
- package/lib/commonjs/components/GestureHandlerRootView.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js +0 -38
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/components/Pressable/Pressable.js +0 -370
- package/lib/commonjs/components/Pressable/Pressable.js.map +0 -1
- package/lib/commonjs/components/Pressable/PressableProps.js +0 -6
- package/lib/commonjs/components/Pressable/PressableProps.js.map +0 -1
- package/lib/commonjs/components/Pressable/index.js +0 -16
- package/lib/commonjs/components/Pressable/index.js.map +0 -1
- package/lib/commonjs/components/Pressable/utils.js +0 -114
- package/lib/commonjs/components/Pressable/utils.js.map +0 -1
- package/lib/commonjs/components/ReanimatedDrawerLayout.js +0 -393
- package/lib/commonjs/components/ReanimatedDrawerLayout.js.map +0 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js +0 -367
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +0 -1
- package/lib/commonjs/components/Swipeable.js +0 -415
- package/lib/commonjs/components/Swipeable.js.map +0 -1
- package/lib/commonjs/components/Text.js +0 -71
- package/lib/commonjs/components/Text.js.map +0 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js +0 -40
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +0 -1
- package/lib/commonjs/components/touchables/ExtraButtonProps.js +0 -2
- package/lib/commonjs/components/touchables/ExtraButtonProps.js.map +0 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +0 -290
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/commonjs/components/touchables/GenericTouchableProps.js +0 -6
- package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableHighlight.js +0 -111
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +0 -102
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +0 -16
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js +0 -6
- package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +0 -79
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +0 -37
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/commonjs/components/touchables/index.js +0 -40
- package/lib/commonjs/components/touchables/index.js.map +0 -1
- package/lib/commonjs/findNodeHandle.js +0 -12
- package/lib/commonjs/findNodeHandle.js.map +0 -1
- package/lib/commonjs/findNodeHandle.web.js +0 -48
- package/lib/commonjs/findNodeHandle.web.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.js +0 -52
- package/lib/commonjs/getShadowNodeFromRef.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -15
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/commonjs/ghQueueMicrotask.js +0 -11
- package/lib/commonjs/ghQueueMicrotask.js.map +0 -1
- package/lib/commonjs/handlers/FlingGestureHandler.js +0 -33
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +0 -53
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js +0 -6
- package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +0 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js +0 -35
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -35
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +0 -131
- package/lib/commonjs/handlers/PanGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/PinchGestureHandler.js +0 -31
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +0 -14
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -12
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/commonjs/handlers/RotationGestureHandler.js +0 -31
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +0 -35
- package/lib/commonjs/handlers/TapGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/createHandler.js +0 -494
- package/lib/commonjs/handlers/createHandler.js.map +0 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +0 -87
- package/lib/commonjs/handlers/createNativeWrapper.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +0 -14
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +0 -11
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -28
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +0 -6
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +0 -42
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js +0 -49
- package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.web.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +0 -87
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +0 -29
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +0 -148
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +0 -25
- package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js +0 -6
- package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +0 -77
- package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +0 -180
- package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +0 -57
- package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +0 -48
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +0 -49
- package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +0 -172
- package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +0 -1
- package/lib/commonjs/handlers/gestures/eventReceiver.js +0 -147
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +0 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +0 -47
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +0 -82
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/gesture.js +0 -381
- package/lib/commonjs/handlers/gestures/gesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/gestureComposition.js +0 -107
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +0 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +0 -156
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +0 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +0 -75
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +0 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +0 -32
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +0 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +0 -74
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +0 -57
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/manualGesture.js +0 -31
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +0 -44
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +0 -225
- package/lib/commonjs/handlers/gestures/panGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/pinchGesture.js +0 -45
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +0 -37
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +0 -1
- package/lib/commonjs/handlers/gestures/rotationGesture.js +0 -45
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +0 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +0 -102
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +0 -1
- package/lib/commonjs/handlers/getNextHandlerTag.js +0 -12
- package/lib/commonjs/handlers/getNextHandlerTag.js.map +0 -1
- package/lib/commonjs/handlers/handlersRegistry.js +0 -66
- package/lib/commonjs/handlers/handlersRegistry.js.map +0 -1
- package/lib/commonjs/handlers/utils.js +0 -92
- package/lib/commonjs/handlers/utils.js.map +0 -1
- package/lib/commonjs/index.js +0 -298
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/init.js +0 -32
- package/lib/commonjs/init.js.map +0 -1
- package/lib/commonjs/jestUtils/index.js +0 -20
- package/lib/commonjs/jestUtils/index.js.map +0 -1
- package/lib/commonjs/jestUtils/jestUtils.js +0 -383
- package/lib/commonjs/jestUtils/jestUtils.js.map +0 -1
- package/lib/commonjs/mocks.js +0 -81
- package/lib/commonjs/mocks.js.map +0 -1
- package/lib/commonjs/mountRegistry.js +0 -49
- package/lib/commonjs/mountRegistry.js.map +0 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +0 -13
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +0 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +0 -15
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +0 -15
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +0 -1
- package/lib/commonjs/typeUtils.js +0 -2
- package/lib/commonjs/typeUtils.js.map +0 -1
- package/lib/commonjs/utils.js +0 -116
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/commonjs/web/Gestures.js +0 -66
- package/lib/commonjs/web/Gestures.js.map +0 -1
- package/lib/commonjs/web/constants.js +0 -11
- package/lib/commonjs/web/constants.js.map +0 -1
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +0 -163
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +0 -1
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +0 -155
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +0 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -190
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +0 -821
- package/lib/commonjs/web/handlers/GestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -65
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js +0 -2
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +0 -194
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -48
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -189
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -530
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -165
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -173
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +0 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -286
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +0 -1
- package/lib/commonjs/web/interfaces.js +0 -40
- package/lib/commonjs/web/interfaces.js.map +0 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +0 -59
- package/lib/commonjs/web/tools/CircularBuffer.js.map +0 -1
- package/lib/commonjs/web/tools/EventManager.js +0 -133
- package/lib/commonjs/web/tools/EventManager.js.map +0 -1
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js +0 -6
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +0 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +0 -340
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +0 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +0 -217
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +0 -1
- package/lib/commonjs/web/tools/InteractionManager.js +0 -119
- package/lib/commonjs/web/tools/InteractionManager.js.map +0 -1
- package/lib/commonjs/web/tools/KeyboardEventManager.js +0 -110
- package/lib/commonjs/web/tools/KeyboardEventManager.js.map +0 -1
- package/lib/commonjs/web/tools/LeastSquareSolver.js +0 -204
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +0 -1
- package/lib/commonjs/web/tools/NodeManager.js +0 -49
- package/lib/commonjs/web/tools/NodeManager.js.map +0 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +0 -229
- package/lib/commonjs/web/tools/PointerEventManager.js.map +0 -1
- package/lib/commonjs/web/tools/PointerTracker.js +0 -234
- package/lib/commonjs/web/tools/PointerTracker.js.map +0 -1
- package/lib/commonjs/web/tools/Vector.js +0 -61
- package/lib/commonjs/web/tools/Vector.js.map +0 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +0 -111
- package/lib/commonjs/web/tools/VelocityTracker.js.map +0 -1
- package/lib/commonjs/web/tools/WheelEventManager.js +0 -74
- package/lib/commonjs/web/tools/WheelEventManager.js.map +0 -1
- package/lib/commonjs/web/utils.js +0 -270
- package/lib/commonjs/web/utils.js.map +0 -1
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +0 -105
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +0 -53
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/Errors.js +0 -16
- package/lib/commonjs/web_hammer/Errors.js.map +0 -1
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +0 -170
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/GestureHandler.js +0 -579
- package/lib/commonjs/web_hammer/GestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +0 -54
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +0 -71
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +0 -66
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/NodeManager.js +0 -48
- package/lib/commonjs/web_hammer/NodeManager.js.map +0 -1
- package/lib/commonjs/web_hammer/PanGestureHandler.js +0 -208
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +0 -40
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js +0 -188
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +0 -44
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/TapGestureHandler.js +0 -192
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +0 -1
- package/lib/commonjs/web_hammer/constants.js +0 -64
- package/lib/commonjs/web_hammer/constants.js.map +0 -1
- package/lib/commonjs/web_hammer/utils.js +0 -42
- package/lib/commonjs/web_hammer/utils.js.map +0 -1
- package/lib/module/ActionType.js +0 -7
- package/lib/module/ActionType.js.map +0 -1
- package/lib/module/Directions.js +0 -19
- package/lib/module/Directions.js.map +0 -1
- package/lib/module/EnableNewWebImplementation.js +0 -35
- package/lib/module/EnableNewWebImplementation.js.map +0 -1
- package/lib/module/GestureHandlerRootViewContext.js +0 -3
- package/lib/module/GestureHandlerRootViewContext.js.map +0 -1
- package/lib/module/PlatformConstants.js +0 -5
- package/lib/module/PlatformConstants.js.map +0 -1
- package/lib/module/PlatformConstants.web.js +0 -7
- package/lib/module/PlatformConstants.web.js.map +0 -1
- package/lib/module/PointerType.js +0 -10
- package/lib/module/PointerType.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.js +0 -5
- package/lib/module/RNGestureHandlerModule.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.web.js +0 -98
- package/lib/module/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.windows.js +0 -47
- package/lib/module/RNGestureHandlerModule.windows.js.map +0 -1
- package/lib/module/RNRenderer.js +0 -4
- package/lib/module/RNRenderer.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -4
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/module/State.js +0 -10
- package/lib/module/State.js.map +0 -1
- package/lib/module/TouchEventType.js +0 -8
- package/lib/module/TouchEventType.js.map +0 -1
- package/lib/module/components/DrawerLayout.js +0 -560
- package/lib/module/components/DrawerLayout.js.map +0 -1
- package/lib/module/components/GestureButtons.js +0 -237
- package/lib/module/components/GestureButtons.js.map +0 -1
- package/lib/module/components/GestureButtonsProps.js +0 -2
- package/lib/module/components/GestureButtonsProps.js.map +0 -1
- package/lib/module/components/GestureComponents.js +0 -90
- package/lib/module/components/GestureComponents.js.map +0 -1
- package/lib/module/components/GestureComponents.web.js +0 -28
- package/lib/module/components/GestureComponents.web.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.js +0 -3
- package/lib/module/components/GestureHandlerButton.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.web.js +0 -9
- package/lib/module/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.android.js +0 -27
- package/lib/module/components/GestureHandlerRootView.android.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.js +0 -26
- package/lib/module/components/GestureHandlerRootView.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.web.js +0 -21
- package/lib/module/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/components/Pressable/Pressable.js +0 -346
- package/lib/module/components/Pressable/Pressable.js.map +0 -1
- package/lib/module/components/Pressable/PressableProps.js +0 -2
- package/lib/module/components/Pressable/PressableProps.js.map +0 -1
- package/lib/module/components/Pressable/index.js +0 -2
- package/lib/module/components/Pressable/index.js.map +0 -1
- package/lib/module/components/Pressable/utils.js +0 -99
- package/lib/module/components/Pressable/utils.js.map +0 -1
- package/lib/module/components/ReanimatedDrawerLayout.js +0 -369
- package/lib/module/components/ReanimatedDrawerLayout.js.map +0 -1
- package/lib/module/components/ReanimatedSwipeable.js +0 -350
- package/lib/module/components/ReanimatedSwipeable.js.map +0 -1
- package/lib/module/components/Swipeable.js +0 -398
- package/lib/module/components/Swipeable.js.map +0 -1
- package/lib/module/components/Text.js +0 -53
- package/lib/module/components/Text.js.map +0 -1
- package/lib/module/components/gestureHandlerRootHOC.js +0 -22
- package/lib/module/components/gestureHandlerRootHOC.js.map +0 -1
- package/lib/module/components/touchables/ExtraButtonProps.js +0 -2
- package/lib/module/components/touchables/ExtraButtonProps.js.map +0 -1
- package/lib/module/components/touchables/GenericTouchable.js +0 -274
- package/lib/module/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/module/components/touchables/GenericTouchableProps.js +0 -2
- package/lib/module/components/touchables/GenericTouchableProps.js.map +0 -1
- package/lib/module/components/touchables/TouchableHighlight.js +0 -97
- package/lib/module/components/touchables/TouchableHighlight.js.map +0 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +0 -86
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +0 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.js +0 -8
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +0 -1
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js +0 -2
- package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +0 -1
- package/lib/module/components/touchables/TouchableOpacity.js +0 -68
- package/lib/module/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +0 -22
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/module/components/touchables/index.js +0 -5
- package/lib/module/components/touchables/index.js.map +0 -1
- package/lib/module/findNodeHandle.js +0 -3
- package/lib/module/findNodeHandle.js.map +0 -1
- package/lib/module/findNodeHandle.web.js +0 -39
- package/lib/module/findNodeHandle.web.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.js +0 -45
- package/lib/module/getShadowNodeFromRef.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.web.js +0 -8
- package/lib/module/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/module/ghQueueMicrotask.js +0 -4
- package/lib/module/ghQueueMicrotask.js.map +0 -1
- package/lib/module/handlers/FlingGestureHandler.js +0 -18
- package/lib/module/handlers/FlingGestureHandler.js.map +0 -1
- package/lib/module/handlers/ForceTouchGestureHandler.js +0 -35
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +0 -1
- package/lib/module/handlers/GestureHandlerEventPayload.js +0 -2
- package/lib/module/handlers/GestureHandlerEventPayload.js.map +0 -1
- package/lib/module/handlers/LongPressGestureHandler.js +0 -20
- package/lib/module/handlers/LongPressGestureHandler.js.map +0 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +0 -19
- package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/handlers/PanGestureHandler.js +0 -114
- package/lib/module/handlers/PanGestureHandler.js.map +0 -1
- package/lib/module/handlers/PinchGestureHandler.js +0 -21
- package/lib/module/handlers/PinchGestureHandler.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.js +0 -3
- package/lib/module/handlers/PressabilityDebugView.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +0 -5
- package/lib/module/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/module/handlers/RotationGestureHandler.js +0 -21
- package/lib/module/handlers/RotationGestureHandler.js.map +0 -1
- package/lib/module/handlers/TapGestureHandler.js +0 -20
- package/lib/module/handlers/TapGestureHandler.js.map +0 -1
- package/lib/module/handlers/createHandler.js +0 -460
- package/lib/module/handlers/createHandler.js.map +0 -1
- package/lib/module/handlers/createNativeWrapper.js +0 -75
- package/lib/module/handlers/createNativeWrapper.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.js +0 -3
- package/lib/module/handlers/customDirectEventTypes.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.web.js +0 -5
- package/lib/module/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/module/handlers/gestureHandlerCommon.js +0 -19
- package/lib/module/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/module/handlers/gestureHandlerTypesCompat.js +0 -2
- package/lib/module/handlers/gestureHandlerTypesCompat.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js +0 -26
- package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js +0 -32
- package/lib/module/handlers/gestures/GestureDetector/Wrap.web.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +0 -68
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +0 -14
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +0 -118
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +0 -18
- package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/types.js +0 -2
- package/lib/module/handlers/gestures/GestureDetector/types.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +0 -61
- package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +0 -165
- package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +0 -41
- package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +0 -39
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +0 -36
- package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector/utils.js +0 -139
- package/lib/module/handlers/gestures/GestureDetector/utils.js.map +0 -1
- package/lib/module/handlers/gestures/eventReceiver.js +0 -131
- package/lib/module/handlers/gestures/eventReceiver.js.map +0 -1
- package/lib/module/handlers/gestures/flingGesture.js +0 -37
- package/lib/module/handlers/gestures/flingGesture.js.map +0 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +0 -73
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +0 -1
- package/lib/module/handlers/gestures/gesture.js +0 -362
- package/lib/module/handlers/gestures/gesture.js.map +0 -1
- package/lib/module/handlers/gestures/gestureComposition.js +0 -92
- package/lib/module/handlers/gestures/gestureComposition.js.map +0 -1
- package/lib/module/handlers/gestures/gestureObjects.js +0 -138
- package/lib/module/handlers/gestures/gestureObjects.js.map +0 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +0 -64
- package/lib/module/handlers/gestures/gestureStateManager.js.map +0 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +0 -21
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +0 -1
- package/lib/module/handlers/gestures/hoverGesture.js +0 -62
- package/lib/module/handlers/gestures/hoverGesture.js.map +0 -1
- package/lib/module/handlers/gestures/longPressGesture.js +0 -47
- package/lib/module/handlers/gestures/longPressGesture.js.map +0 -1
- package/lib/module/handlers/gestures/manualGesture.js +0 -22
- package/lib/module/handlers/gestures/manualGesture.js.map +0 -1
- package/lib/module/handlers/gestures/nativeGesture.js +0 -34
- package/lib/module/handlers/gestures/nativeGesture.js.map +0 -1
- package/lib/module/handlers/gestures/panGesture.js +0 -216
- package/lib/module/handlers/gestures/panGesture.js.map +0 -1
- package/lib/module/handlers/gestures/pinchGesture.js +0 -36
- package/lib/module/handlers/gestures/pinchGesture.js.map +0 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +0 -30
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +0 -1
- package/lib/module/handlers/gestures/rotationGesture.js +0 -36
- package/lib/module/handlers/gestures/rotationGesture.js.map +0 -1
- package/lib/module/handlers/gestures/tapGesture.js +0 -92
- package/lib/module/handlers/gestures/tapGesture.js.map +0 -1
- package/lib/module/handlers/getNextHandlerTag.js +0 -5
- package/lib/module/handlers/getNextHandlerTag.js.map +0 -1
- package/lib/module/handlers/handlersRegistry.js +0 -43
- package/lib/module/handlers/handlersRegistry.js.map +0 -1
- package/lib/module/handlers/utils.js +0 -71
- package/lib/module/handlers/utils.js.map +0 -1
- package/lib/module/index.js +0 -29
- package/lib/module/index.js.map +0 -1
- package/lib/module/init.js +0 -16
- package/lib/module/init.js.map +0 -1
- package/lib/module/jestUtils/index.js +0 -2
- package/lib/module/jestUtils/index.js.map +0 -1
- package/lib/module/jestUtils/jestUtils.js +0 -358
- package/lib/module/jestUtils/jestUtils.js.map +0 -1
- package/lib/module/mocks.js +0 -68
- package/lib/module/mocks.js.map +0 -1
- package/lib/module/mountRegistry.js +0 -40
- package/lib/module/mountRegistry.js.map +0 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js +0 -3
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +0 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +0 -3
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +0 -1
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +0 -3
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +0 -1
- package/lib/module/typeUtils.js +0 -2
- package/lib/module/typeUtils.js.map +0 -1
- package/lib/module/utils.js +0 -87
- package/lib/module/utils.js.map +0 -1
- package/lib/module/web/Gestures.js +0 -39
- package/lib/module/web/Gestures.js.map +0 -1
- package/lib/module/web/constants.js +0 -3
- package/lib/module/web/constants.js.map +0 -1
- package/lib/module/web/detectors/RotationGestureDetector.js +0 -153
- package/lib/module/web/detectors/RotationGestureDetector.js.map +0 -1
- package/lib/module/web/detectors/ScaleGestureDetector.js +0 -144
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +0 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -173
- package/lib/module/web/handlers/FlingGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/GestureHandler.js +0 -801
- package/lib/module/web/handlers/GestureHandler.js.map +0 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +0 -50
- package/lib/module/web/handlers/HoverGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/IGestureHandler.js +0 -2
- package/lib/module/web/handlers/IGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +0 -180
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -36
- package/lib/module/web/handlers/ManualGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +0 -174
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/PanGestureHandler.js +0 -514
- package/lib/module/web/handlers/PanGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -150
- package/lib/module/web/handlers/PinchGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -158
- package/lib/module/web/handlers/RotationGestureHandler.js.map +0 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -271
- package/lib/module/web/handlers/TapGestureHandler.js.map +0 -1
- package/lib/module/web/interfaces.js +0 -31
- package/lib/module/web/interfaces.js.map +0 -1
- package/lib/module/web/tools/CircularBuffer.js +0 -50
- package/lib/module/web/tools/CircularBuffer.js.map +0 -1
- package/lib/module/web/tools/EventManager.js +0 -124
- package/lib/module/web/tools/EventManager.js.map +0 -1
- package/lib/module/web/tools/GestureHandlerDelegate.js +0 -2
- package/lib/module/web/tools/GestureHandlerDelegate.js.map +0 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +0 -326
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +0 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +0 -199
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +0 -1
- package/lib/module/web/tools/InteractionManager.js +0 -110
- package/lib/module/web/tools/InteractionManager.js.map +0 -1
- package/lib/module/web/tools/KeyboardEventManager.js +0 -96
- package/lib/module/web/tools/KeyboardEventManager.js.map +0 -1
- package/lib/module/web/tools/LeastSquareSolver.js +0 -195
- package/lib/module/web/tools/LeastSquareSolver.js.map +0 -1
- package/lib/module/web/tools/NodeManager.js +0 -40
- package/lib/module/web/tools/NodeManager.js.map +0 -1
- package/lib/module/web/tools/PointerEventManager.js +0 -212
- package/lib/module/web/tools/PointerEventManager.js.map +0 -1
- package/lib/module/web/tools/PointerTracker.js +0 -221
- package/lib/module/web/tools/PointerTracker.js.map +0 -1
- package/lib/module/web/tools/Vector.js +0 -50
- package/lib/module/web/tools/Vector.js.map +0 -1
- package/lib/module/web/tools/VelocityTracker.js +0 -98
- package/lib/module/web/tools/VelocityTracker.js.map +0 -1
- package/lib/module/web/tools/WheelEventManager.js +0 -60
- package/lib/module/web/tools/WheelEventManager.js.map +0 -1
- package/lib/module/web/utils.js +0 -243
- package/lib/module/web/utils.js.map +0 -1
- package/lib/module/web_hammer/DiscreteGestureHandler.js +0 -94
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/DraggingGestureHandler.js +0 -40
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/Errors.js +0 -7
- package/lib/module/web_hammer/Errors.js.map +0 -1
- package/lib/module/web_hammer/FlingGestureHandler.js +0 -156
- package/lib/module/web_hammer/FlingGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/GestureHandler.js +0 -563
- package/lib/module/web_hammer/GestureHandler.js.map +0 -1
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +0 -44
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/LongPressGestureHandler.js +0 -58
- package/lib/module/web_hammer/LongPressGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/NativeViewGestureHandler.js +0 -49
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/NodeManager.js +0 -33
- package/lib/module/web_hammer/NodeManager.js.map +0 -1
- package/lib/module/web_hammer/PanGestureHandler.js +0 -194
- package/lib/module/web_hammer/PanGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/PinchGestureHandler.js +0 -29
- package/lib/module/web_hammer/PinchGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/PressGestureHandler.js +0 -174
- package/lib/module/web_hammer/PressGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/RotationGestureHandler.js +0 -32
- package/lib/module/web_hammer/RotationGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/TapGestureHandler.js +0 -180
- package/lib/module/web_hammer/TapGestureHandler.js.map +0 -1
- package/lib/module/web_hammer/constants.js +0 -43
- package/lib/module/web_hammer/constants.js.map +0 -1
- package/lib/module/web_hammer/utils.js +0 -19
- package/lib/module/web_hammer/utils.js.map +0 -1
- package/lib/typescript/ActionType.d.ts +0 -7
- package/lib/typescript/Directions.d.ts +0 -14
- package/lib/typescript/EnableNewWebImplementation.d.ts +0 -9
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +0 -3
- package/lib/typescript/PlatformConstants.d.ts +0 -5
- package/lib/typescript/PlatformConstants.web.d.ts +0 -4
- package/lib/typescript/PointerType.d.ts +0 -7
- package/lib/typescript/RNGestureHandlerModule.d.ts +0 -2
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -15
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +0 -32
- package/lib/typescript/RNRenderer.d.ts +0 -1
- package/lib/typescript/RNRenderer.web.d.ts +0 -3
- package/lib/typescript/State.d.ts +0 -9
- package/lib/typescript/TouchEventType.d.ts +0 -8
- package/lib/typescript/components/DrawerLayout.d.ts +0 -185
- package/lib/typescript/components/GestureButtons.d.ts +0 -7
- package/lib/typescript/components/GestureButtonsProps.d.ts +0 -115
- package/lib/typescript/components/GestureComponents.d.ts +0 -22
- package/lib/typescript/components/GestureComponents.web.d.ts +0 -8
- package/lib/typescript/components/GestureHandlerButton.d.ts +0 -4
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -4
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +0 -6
- package/lib/typescript/components/GestureHandlerRootView.d.ts +0 -6
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +0 -6
- package/lib/typescript/components/Pressable/Pressable.d.ts +0 -5
- package/lib/typescript/components/Pressable/PressableProps.d.ts +0 -109
- package/lib/typescript/components/Pressable/index.d.ts +0 -2
- package/lib/typescript/components/Pressable/utils.d.ts +0 -13
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +0 -167
- package/lib/typescript/components/ReanimatedSwipeable.d.ts +0 -137
- package/lib/typescript/components/Swipeable.d.ts +0 -183
- package/lib/typescript/components/Text.d.ts +0 -4
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +0 -3
- package/lib/typescript/components/touchables/ExtraButtonProps.d.ts +0 -7
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -55
- package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +0 -16
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +0 -41
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +0 -40
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +0 -6
- package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +0 -8
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -30
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -14
- package/lib/typescript/components/touchables/index.d.ts +0 -7
- package/lib/typescript/findNodeHandle.d.ts +0 -2
- package/lib/typescript/findNodeHandle.web.d.ts +0 -2
- package/lib/typescript/getShadowNodeFromRef.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
- package/lib/typescript/ghQueueMicrotask.d.ts +0 -1
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +0 -39
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +0 -44
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +0 -194
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +0 -36
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -33
- package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -100
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +0 -17
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +0 -17
- package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -62
- package/lib/typescript/handlers/createHandler.d.ts +0 -11
- package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -3
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +0 -2
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -78
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +0 -43
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +0 -13
- package/lib/typescript/handlers/gestures/GestureDetector/Wrap.web.d.ts +0 -7
- package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +0 -13
- package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +0 -2
- package/lib/typescript/handlers/gestures/GestureDetector/index.d.ts +0 -49
- package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +0 -3
- package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +0 -21
- package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +0 -4
- package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +0 -2
- package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +0 -5
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +0 -2
- package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +0 -3
- package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +0 -13
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +0 -4
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +0 -21
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +0 -30
- package/lib/typescript/handlers/gestures/gesture.d.ts +0 -218
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +0 -21
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +0 -98
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +0 -11
- package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +0 -4
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +0 -27
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +0 -25
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +0 -7
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +0 -18
- package/lib/typescript/handlers/gestures/panGesture.d.ts +0 -90
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +0 -11
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +0 -14
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +0 -12
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +0 -50
- package/lib/typescript/handlers/getNextHandlerTag.d.ts +0 -1
- package/lib/typescript/handlers/handlersRegistry.d.ts +0 -14
- package/lib/typescript/handlers/utils.d.ts +0 -7
- package/lib/typescript/index.d.ts +0 -58
- package/lib/typescript/init.d.ts +0 -2
- package/lib/typescript/jestUtils/index.d.ts +0 -1
- package/lib/typescript/jestUtils/jestUtils.d.ts +0 -30
- package/lib/typescript/mocks.d.ts +0 -46
- package/lib/typescript/mountRegistry.d.ts +0 -17
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +0 -14
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +0 -17
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +0 -6
- package/lib/typescript/typeUtils.d.ts +0 -1
- package/lib/typescript/utils.d.ts +0 -20
- package/lib/typescript/web/Gestures.d.ts +0 -36
- package/lib/typescript/web/constants.d.ts +0 -2
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +0 -30
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +0 -29
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -26
- package/lib/typescript/web/handlers/GestureHandler.d.ts +0 -103
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +0 -10
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +0 -37
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +0 -31
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -10
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -26
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -61
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -28
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -28
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -38
- package/lib/typescript/web/interfaces.d.ts +0 -157
- package/lib/typescript/web/tools/CircularBuffer.d.ts +0 -11
- package/lib/typescript/web/tools/EventManager.d.ts +0 -39
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +0 -24
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +0 -31
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +0 -35
- package/lib/typescript/web/tools/InteractionManager.d.ts +0 -17
- package/lib/typescript/web/tools/KeyboardEventManager.d.ts +0 -13
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +0 -12
- package/lib/typescript/web/tools/NodeManager.d.ts +0 -12
- package/lib/typescript/web/tools/PointerEventManager.d.ts +0 -19
- package/lib/typescript/web/tools/PointerTracker.d.ts +0 -50
- package/lib/typescript/web/tools/Vector.d.ts +0 -15
- package/lib/typescript/web/tools/VelocityTracker.d.ts +0 -13
- package/lib/typescript/web/tools/WheelEventManager.d.ts +0 -11
- package/lib/typescript/web/utils.d.ts +0 -14
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +0 -20
- package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +0 -15
- package/lib/typescript/web_hammer/Errors.d.ts +0 -3
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +0 -43
- package/lib/typescript/web_hammer/GestureHandler.d.ts +0 -145
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +0 -40
- package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +0 -38
- package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +0 -7
- package/lib/typescript/web_hammer/NodeManager.d.ts +0 -7
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +0 -56
- package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +0 -13
- package/lib/typescript/web_hammer/PressGestureHandler.d.ts +0 -83
- package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +0 -13
- package/lib/typescript/web_hammer/TapGestureHandler.d.ts +0 -57
- package/lib/typescript/web_hammer/constants.d.ts +0 -39
- package/lib/typescript/web_hammer/utils.d.ts +0 -9
- /package/android/{common → noreanimated}/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +0 -0
@@ -1,199 +0,0 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
|
-
import findNodeHandle from '../../findNodeHandle';
|
4
|
-
import PointerEventManager from './PointerEventManager';
|
5
|
-
import { State } from '../../State';
|
6
|
-
import { isPointerInBounds } from '../utils';
|
7
|
-
import { MouseButton } from '../../handlers/gestureHandlerCommon';
|
8
|
-
import KeyboardEventManager from './KeyboardEventManager';
|
9
|
-
import WheelEventManager from './WheelEventManager';
|
10
|
-
export class GestureHandlerWebDelegate {
|
11
|
-
constructor() {
|
12
|
-
_defineProperty(this, "isInitialized", false);
|
13
|
-
|
14
|
-
_defineProperty(this, "_view", void 0);
|
15
|
-
|
16
|
-
_defineProperty(this, "gestureHandler", void 0);
|
17
|
-
|
18
|
-
_defineProperty(this, "eventManagers", []);
|
19
|
-
|
20
|
-
_defineProperty(this, "defaultViewStyles", {
|
21
|
-
userSelect: '',
|
22
|
-
touchAction: ''
|
23
|
-
});
|
24
|
-
}
|
25
|
-
|
26
|
-
init(viewRef, handler) {
|
27
|
-
if (!viewRef) {
|
28
|
-
throw new Error(`Cannot find HTML Element for handler ${handler.handlerTag}`);
|
29
|
-
}
|
30
|
-
|
31
|
-
this.isInitialized = true;
|
32
|
-
this.gestureHandler = handler;
|
33
|
-
this.view = findNodeHandle(viewRef);
|
34
|
-
this.defaultViewStyles = {
|
35
|
-
userSelect: this.view.style.userSelect,
|
36
|
-
touchAction: this.view.style.touchAction
|
37
|
-
};
|
38
|
-
const config = handler.config;
|
39
|
-
this.setUserSelect(config.enabled);
|
40
|
-
this.setTouchAction(config.enabled);
|
41
|
-
this.setContextMenu(config.enabled);
|
42
|
-
this.eventManagers.push(new PointerEventManager(this.view));
|
43
|
-
this.eventManagers.push(new KeyboardEventManager(this.view));
|
44
|
-
this.eventManagers.push(new WheelEventManager(this.view));
|
45
|
-
this.eventManagers.forEach(manager => this.gestureHandler.attachEventManager(manager));
|
46
|
-
}
|
47
|
-
|
48
|
-
isPointerInBounds({
|
49
|
-
x,
|
50
|
-
y
|
51
|
-
}) {
|
52
|
-
return isPointerInBounds(this.view, {
|
53
|
-
x,
|
54
|
-
y
|
55
|
-
});
|
56
|
-
}
|
57
|
-
|
58
|
-
measureView() {
|
59
|
-
const rect = this.view.getBoundingClientRect();
|
60
|
-
return {
|
61
|
-
pageX: rect.left,
|
62
|
-
pageY: rect.top,
|
63
|
-
width: rect.width,
|
64
|
-
height: rect.height
|
65
|
-
};
|
66
|
-
}
|
67
|
-
|
68
|
-
reset() {
|
69
|
-
this.eventManagers.forEach(manager => manager.resetManager());
|
70
|
-
}
|
71
|
-
|
72
|
-
tryResetCursor() {
|
73
|
-
const config = this.gestureHandler.config;
|
74
|
-
|
75
|
-
if (config.activeCursor && config.activeCursor !== 'auto' && this.gestureHandler.state === State.ACTIVE) {
|
76
|
-
this.view.style.cursor = 'auto';
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
shouldDisableContextMenu(config) {
|
81
|
-
return config.enableContextMenu === undefined && this.gestureHandler.isButtonInConfig(MouseButton.RIGHT) || config.enableContextMenu === false;
|
82
|
-
}
|
83
|
-
|
84
|
-
addContextMenuListeners(config) {
|
85
|
-
if (this.shouldDisableContextMenu(config)) {
|
86
|
-
this.view.addEventListener('contextmenu', this.disableContextMenu);
|
87
|
-
} else if (config.enableContextMenu) {
|
88
|
-
this.view.addEventListener('contextmenu', this.enableContextMenu);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
removeContextMenuListeners(config) {
|
93
|
-
if (this.shouldDisableContextMenu(config)) {
|
94
|
-
this.view.removeEventListener('contextmenu', this.disableContextMenu);
|
95
|
-
} else if (config.enableContextMenu) {
|
96
|
-
this.view.removeEventListener('contextmenu', this.enableContextMenu);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
disableContextMenu(e) {
|
101
|
-
e.preventDefault();
|
102
|
-
}
|
103
|
-
|
104
|
-
enableContextMenu(e) {
|
105
|
-
e.stopPropagation();
|
106
|
-
}
|
107
|
-
|
108
|
-
setUserSelect(isHandlerEnabled) {
|
109
|
-
const {
|
110
|
-
userSelect
|
111
|
-
} = this.gestureHandler.config;
|
112
|
-
this.view.style['userSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
113
|
-
this.view.style['webkitUserSelect'] = isHandlerEnabled ? userSelect !== null && userSelect !== void 0 ? userSelect : 'none' : this.defaultViewStyles.userSelect;
|
114
|
-
}
|
115
|
-
|
116
|
-
setTouchAction(isHandlerEnabled) {
|
117
|
-
const {
|
118
|
-
touchAction
|
119
|
-
} = this.gestureHandler.config;
|
120
|
-
this.view.style['touchAction'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction; // @ts-ignore This one disables default events on Safari
|
121
|
-
|
122
|
-
this.view.style['WebkitTouchCallout'] = isHandlerEnabled ? touchAction !== null && touchAction !== void 0 ? touchAction : 'none' : this.defaultViewStyles.touchAction;
|
123
|
-
}
|
124
|
-
|
125
|
-
setContextMenu(isHandlerEnabled) {
|
126
|
-
const config = this.gestureHandler.config;
|
127
|
-
|
128
|
-
if (isHandlerEnabled) {
|
129
|
-
this.addContextMenuListeners(config);
|
130
|
-
} else {
|
131
|
-
this.removeContextMenuListeners(config);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
onEnabledChange(enabled) {
|
136
|
-
if (!this.isInitialized) {
|
137
|
-
return;
|
138
|
-
}
|
139
|
-
|
140
|
-
this.setUserSelect(enabled);
|
141
|
-
this.setTouchAction(enabled);
|
142
|
-
this.setContextMenu(enabled);
|
143
|
-
|
144
|
-
if (enabled) {
|
145
|
-
this.eventManagers.forEach(manager => {
|
146
|
-
// It may look like managers will be registered twice when handler is mounted for the first time.
|
147
|
-
// However, `init` method is called AFTER `updateGestureConfig` - it means that delegate has not
|
148
|
-
// been initialized yet, so this code won't be executed.
|
149
|
-
//
|
150
|
-
// Also, because we use defined functions, not lambdas, they will not be registered multiple times.
|
151
|
-
manager.registerListeners();
|
152
|
-
});
|
153
|
-
} else {
|
154
|
-
this.eventManagers.forEach(manager => {
|
155
|
-
manager.unregisterListeners();
|
156
|
-
});
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
160
|
-
onBegin() {// no-op for now
|
161
|
-
}
|
162
|
-
|
163
|
-
onActivate() {
|
164
|
-
const config = this.gestureHandler.config;
|
165
|
-
|
166
|
-
if ((!this.view.style.cursor || this.view.style.cursor === 'auto') && config.activeCursor) {
|
167
|
-
this.view.style.cursor = config.activeCursor;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
|
171
|
-
onEnd() {
|
172
|
-
this.tryResetCursor();
|
173
|
-
}
|
174
|
-
|
175
|
-
onCancel() {
|
176
|
-
this.tryResetCursor();
|
177
|
-
}
|
178
|
-
|
179
|
-
onFail() {
|
180
|
-
this.tryResetCursor();
|
181
|
-
}
|
182
|
-
|
183
|
-
destroy(config) {
|
184
|
-
this.removeContextMenuListeners(config);
|
185
|
-
this.eventManagers.forEach(manager => {
|
186
|
-
manager.unregisterListeners();
|
187
|
-
});
|
188
|
-
}
|
189
|
-
|
190
|
-
get view() {
|
191
|
-
return this._view;
|
192
|
-
}
|
193
|
-
|
194
|
-
set view(value) {
|
195
|
-
this._view = value;
|
196
|
-
}
|
197
|
-
|
198
|
-
}
|
199
|
-
//# sourceMappingURL=GestureHandlerWebDelegate.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["GestureHandlerWebDelegate.ts"],"names":["findNodeHandle","PointerEventManager","State","isPointerInBounds","MouseButton","KeyboardEventManager","WheelEventManager","GestureHandlerWebDelegate","userSelect","touchAction","init","viewRef","handler","Error","handlerTag","isInitialized","gestureHandler","view","defaultViewStyles","style","config","setUserSelect","enabled","setTouchAction","setContextMenu","eventManagers","push","forEach","manager","attachEventManager","x","y","measureView","rect","getBoundingClientRect","pageX","left","pageY","top","width","height","reset","resetManager","tryResetCursor","activeCursor","state","ACTIVE","cursor","shouldDisableContextMenu","enableContextMenu","undefined","isButtonInConfig","RIGHT","addContextMenuListeners","addEventListener","disableContextMenu","removeContextMenuListeners","removeEventListener","e","preventDefault","stopPropagation","isHandlerEnabled","onEnabledChange","registerListeners","unregisterListeners","onBegin","onActivate","onEnd","onCancel","onFail","destroy","_view","value"],"mappings":";;AAAA,OAAOA,cAAP,MAA2B,sBAA3B;AAMA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAGA,SAASC,WAAT,QAA4B,qCAA5B;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AAOA,OAAO,MAAMC,yBAAN,CAEP;AAAA;AAAA,2CAC0B,KAD1B;;AAAA;;AAAA;;AAAA,2CAKmD,EALnD;;AAAA,+CAMiD;AAC7CC,MAAAA,UAAU,EAAE,EADiC;AAE7CC,MAAAA,WAAW,EAAE;AAFgC,KANjD;AAAA;;AAWEC,EAAAA,IAAI,CAACC,OAAD,EAAkBC,OAAlB,EAAkD;AACpD,QAAI,CAACD,OAAL,EAAc;AACZ,YAAM,IAAIE,KAAJ,CACH,wCAAuCD,OAAO,CAACE,UAAW,EADvD,CAAN;AAGD;;AAED,SAAKC,aAAL,GAAqB,IAArB;AAEA,SAAKC,cAAL,GAAsBJ,OAAtB;AACA,SAAKK,IAAL,GAAYjB,cAAc,CAACW,OAAD,CAA1B;AAEA,SAAKO,iBAAL,GAAyB;AACvBV,MAAAA,UAAU,EAAE,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AAJ/C,IAAI,GAAG;AAChB,WAAO,KAAKsD,KAAZ;AACD;;AACc,MAAJtD,IAAI,CAACuD,KAAD,EAAqB;AAClC,SAAKD,KAAL,GAAaC,KAAb;AACD;;AAhNH","sourcesContent":["import findNodeHandle from '../../findNodeHandle';\nimport type IGestureHandler from '../handlers/IGestureHandler';\nimport {\n GestureHandlerDelegate,\n MeasureResult,\n} from './GestureHandlerDelegate';\nimport PointerEventManager from './PointerEventManager';\nimport { State } from '../../State';\nimport { isPointerInBounds } from '../utils';\nimport EventManager from './EventManager';\nimport { Config } from '../interfaces';\nimport { MouseButton } from '../../handlers/gestureHandlerCommon';\nimport KeyboardEventManager from './KeyboardEventManager';\nimport WheelEventManager from './WheelEventManager';\n\ninterface DefaultViewStyles {\n userSelect: string;\n touchAction: string;\n}\n\nexport class GestureHandlerWebDelegate\n implements GestureHandlerDelegate<HTMLElement, IGestureHandler>\n{\n private isInitialized = false;\n private _view!: HTMLElement;\n\n private gestureHandler!: IGestureHandler;\n private eventManagers: EventManager<unknown>[] = [];\n private defaultViewStyles: DefaultViewStyles = {\n userSelect: '',\n touchAction: '',\n };\n\n init(viewRef: number, handler: IGestureHandler): void {\n if (!viewRef) {\n throw new Error(\n `Cannot find HTML Element for handler ${handler.handlerTag}`\n );\n }\n\n this.isInitialized = true;\n\n this.gestureHandler = handler;\n this.view = findNodeHandle(viewRef) as unknown as HTMLElement;\n\n this.defaultViewStyles = {\n userSelect: this.view.style.userSelect,\n touchAction: this.view.style.touchAction,\n };\n\n const config = handler.config;\n\n this.setUserSelect(config.enabled);\n this.setTouchAction(config.enabled);\n this.setContextMenu(config.enabled);\n\n this.eventManagers.push(new PointerEventManager(this.view));\n this.eventManagers.push(new KeyboardEventManager(this.view));\n this.eventManagers.push(new WheelEventManager(this.view));\n\n this.eventManagers.forEach((manager) =>\n this.gestureHandler.attachEventManager(manager)\n );\n }\n\n isPointerInBounds({ x, y }: { x: number; y: number }): boolean {\n return isPointerInBounds(this.view, { x, y });\n }\n\n measureView(): MeasureResult {\n const rect = this.view.getBoundingClientRect();\n\n return {\n pageX: rect.left,\n pageY: rect.top,\n width: rect.width,\n height: rect.height,\n };\n }\n\n reset(): void {\n this.eventManagers.forEach((manager: EventManager<unknown>) =>\n manager.resetManager()\n );\n }\n\n tryResetCursor() {\n const config = this.gestureHandler.config;\n\n if (\n config.activeCursor &&\n config.activeCursor !== 'auto' &&\n this.gestureHandler.state === State.ACTIVE\n ) {\n this.view.style.cursor = 'auto';\n }\n }\n\n private shouldDisableContextMenu(config: Config) {\n return (\n (config.enableContextMenu === undefined &&\n this.gestureHandler.isButtonInConfig(MouseButton.RIGHT)) ||\n config.enableContextMenu === false\n );\n }\n\n private addContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.addEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.addEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private removeContextMenuListeners(config: Config): void {\n if (this.shouldDisableContextMenu(config)) {\n this.view.removeEventListener('contextmenu', this.disableContextMenu);\n } else if (config.enableContextMenu) {\n this.view.removeEventListener('contextmenu', this.enableContextMenu);\n }\n }\n\n private disableContextMenu(this: void, e: MouseEvent): void {\n e.preventDefault();\n }\n\n private enableContextMenu(this: void, e: MouseEvent): void {\n e.stopPropagation();\n }\n\n private setUserSelect(isHandlerEnabled: boolean) {\n const { userSelect } = this.gestureHandler.config;\n\n this.view.style['userSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n\n this.view.style['webkitUserSelect'] = isHandlerEnabled\n ? (userSelect ?? 'none')\n : this.defaultViewStyles.userSelect;\n }\n\n private setTouchAction(isHandlerEnabled: boolean) {\n const { touchAction } = this.gestureHandler.config;\n\n this.view.style['touchAction'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n\n // @ts-ignore This one disables default events on Safari\n this.view.style['WebkitTouchCallout'] = isHandlerEnabled\n ? (touchAction ?? 'none')\n : this.defaultViewStyles.touchAction;\n }\n\n private setContextMenu(isHandlerEnabled: boolean) {\n const config = this.gestureHandler.config;\n\n if (isHandlerEnabled) {\n this.addContextMenuListeners(config);\n } else {\n this.removeContextMenuListeners(config);\n }\n }\n\n onEnabledChange(enabled: boolean): void {\n if (!this.isInitialized) {\n return;\n }\n\n this.setUserSelect(enabled);\n this.setTouchAction(enabled);\n this.setContextMenu(enabled);\n\n if (enabled) {\n this.eventManagers.forEach((manager) => {\n // It may look like managers will be registered twice when handler is mounted for the first time.\n // However, `init` method is called AFTER `updateGestureConfig` - it means that delegate has not\n // been initialized yet, so this code won't be executed.\n //\n // Also, because we use defined functions, not lambdas, they will not be registered multiple times.\n manager.registerListeners();\n });\n } else {\n this.eventManagers.forEach((manager) => {\n manager.unregisterListeners();\n });\n }\n }\n\n onBegin(): void {\n // no-op for now\n }\n\n onActivate(): void {\n const config = this.gestureHandler.config;\n\n if (\n (!this.view.style.cursor || this.view.style.cursor === 'auto') &&\n config.activeCursor\n ) {\n this.view.style.cursor = config.activeCursor;\n }\n }\n\n onEnd(): void {\n this.tryResetCursor();\n }\n\n onCancel(): void {\n this.tryResetCursor();\n }\n\n onFail(): void {\n this.tryResetCursor();\n }\n\n public destroy(config: Config): void {\n this.removeContextMenuListeners(config);\n\n this.eventManagers.forEach((manager) => {\n manager.unregisterListeners();\n });\n }\n\n public get view() {\n return this._view;\n }\n public set view(value: HTMLElement) {\n this._view = value;\n }\n}\n"]}
|
@@ -1,110 +0,0 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
|
-
export default class InteractionManager {
|
4
|
-
// Private becaues of singleton
|
5
|
-
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
6
|
-
constructor() {
|
7
|
-
_defineProperty(this, "waitForRelations", new Map());
|
8
|
-
|
9
|
-
_defineProperty(this, "simultaneousRelations", new Map());
|
10
|
-
|
11
|
-
_defineProperty(this, "blocksHandlersRelations", new Map());
|
12
|
-
}
|
13
|
-
|
14
|
-
configureInteractions(handler, config) {
|
15
|
-
this.dropRelationsForHandlerWithTag(handler.handlerTag);
|
16
|
-
|
17
|
-
if (config.waitFor) {
|
18
|
-
const waitFor = [];
|
19
|
-
config.waitFor.forEach(otherHandler => {
|
20
|
-
// New API reference
|
21
|
-
if (typeof otherHandler === 'number') {
|
22
|
-
waitFor.push(otherHandler);
|
23
|
-
} else {
|
24
|
-
// Old API reference
|
25
|
-
waitFor.push(otherHandler.handlerTag);
|
26
|
-
}
|
27
|
-
});
|
28
|
-
this.waitForRelations.set(handler.handlerTag, waitFor);
|
29
|
-
}
|
30
|
-
|
31
|
-
if (config.simultaneousHandlers) {
|
32
|
-
const simultaneousHandlers = [];
|
33
|
-
config.simultaneousHandlers.forEach(otherHandler => {
|
34
|
-
if (typeof otherHandler === 'number') {
|
35
|
-
simultaneousHandlers.push(otherHandler);
|
36
|
-
} else {
|
37
|
-
simultaneousHandlers.push(otherHandler.handlerTag);
|
38
|
-
}
|
39
|
-
});
|
40
|
-
this.simultaneousRelations.set(handler.handlerTag, simultaneousHandlers);
|
41
|
-
}
|
42
|
-
|
43
|
-
if (config.blocksHandlers) {
|
44
|
-
const blocksHandlers = [];
|
45
|
-
config.blocksHandlers.forEach(otherHandler => {
|
46
|
-
if (typeof otherHandler === 'number') {
|
47
|
-
blocksHandlers.push(otherHandler);
|
48
|
-
} else {
|
49
|
-
blocksHandlers.push(otherHandler.handlerTag);
|
50
|
-
}
|
51
|
-
});
|
52
|
-
this.blocksHandlersRelations.set(handler.handlerTag, blocksHandlers);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
shouldWaitForHandlerFailure(handler, otherHandler) {
|
57
|
-
const waitFor = this.waitForRelations.get(handler.handlerTag);
|
58
|
-
return (waitFor === null || waitFor === void 0 ? void 0 : waitFor.find(tag => {
|
59
|
-
return tag === otherHandler.handlerTag;
|
60
|
-
})) !== undefined;
|
61
|
-
}
|
62
|
-
|
63
|
-
shouldRecognizeSimultaneously(handler, otherHandler) {
|
64
|
-
const simultaneousHandlers = this.simultaneousRelations.get(handler.handlerTag);
|
65
|
-
return (simultaneousHandlers === null || simultaneousHandlers === void 0 ? void 0 : simultaneousHandlers.find(tag => {
|
66
|
-
return tag === otherHandler.handlerTag;
|
67
|
-
})) !== undefined;
|
68
|
-
}
|
69
|
-
|
70
|
-
shouldRequireHandlerToWaitForFailure(handler, otherHandler) {
|
71
|
-
const waitFor = this.blocksHandlersRelations.get(handler.handlerTag);
|
72
|
-
return (waitFor === null || waitFor === void 0 ? void 0 : waitFor.find(tag => {
|
73
|
-
return tag === otherHandler.handlerTag;
|
74
|
-
})) !== undefined;
|
75
|
-
}
|
76
|
-
|
77
|
-
shouldHandlerBeCancelledBy(_handler, otherHandler) {
|
78
|
-
var _otherHandler$isButto;
|
79
|
-
|
80
|
-
// We check constructor name instead of using `instanceof` in order do avoid circular dependencies
|
81
|
-
const isNativeHandler = otherHandler.constructor.name === 'NativeViewGestureHandler';
|
82
|
-
const isActive = otherHandler.active;
|
83
|
-
const isButton = ((_otherHandler$isButto = otherHandler.isButton) === null || _otherHandler$isButto === void 0 ? void 0 : _otherHandler$isButto.call(otherHandler)) === true;
|
84
|
-
return isNativeHandler && isActive && !isButton;
|
85
|
-
}
|
86
|
-
|
87
|
-
dropRelationsForHandlerWithTag(handlerTag) {
|
88
|
-
this.waitForRelations.delete(handlerTag);
|
89
|
-
this.simultaneousRelations.delete(handlerTag);
|
90
|
-
this.blocksHandlersRelations.delete(handlerTag);
|
91
|
-
}
|
92
|
-
|
93
|
-
reset() {
|
94
|
-
this.waitForRelations.clear();
|
95
|
-
this.simultaneousRelations.clear();
|
96
|
-
this.blocksHandlersRelations.clear();
|
97
|
-
}
|
98
|
-
|
99
|
-
static get instance() {
|
100
|
-
if (!this._instance) {
|
101
|
-
this._instance = new InteractionManager();
|
102
|
-
}
|
103
|
-
|
104
|
-
return this._instance;
|
105
|
-
}
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
_defineProperty(InteractionManager, "_instance", void 0);
|
110
|
-
//# sourceMappingURL=InteractionManager.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["InteractionManager.ts"],"names":["InteractionManager","constructor","Map","configureInteractions","handler","config","dropRelationsForHandlerWithTag","handlerTag","waitFor","forEach","otherHandler","push","waitForRelations","set","simultaneousHandlers","simultaneousRelations","blocksHandlers","blocksHandlersRelations","shouldWaitForHandlerFailure","get","find","tag","undefined","shouldRecognizeSimultaneously","shouldRequireHandlerToWaitForFailure","shouldHandlerBeCancelledBy","_handler","isNativeHandler","name","isActive","active","isButton","delete","reset","clear","instance","_instance"],"mappings":";;AAGA,eAAe,MAAMA,kBAAN,CAAyB;AAMtC;AACA;AACQC,EAAAA,WAAW,GAAG;AAAA,8CANqC,IAAIC,GAAJ,EAMrC;;AAAA,mDAL0C,IAAIA,GAAJ,EAK1C;;AAAA,qDAJ4C,IAAIA,GAAJ,EAI5C;AAAE;;AAEjBC,EAAAA,qBAAqB,CAACC,OAAD,EAA2BC,MAA3B,EAA2C;AACrE,SAAKC,8BAAL,CAAoCF,OAAO,CAACG,UAA5C;;AAEA,QAAIF,MAAM,CAACG,OAAX,EAAoB;AAClB,YAAMA,OAAiB,GAAG,EAA1B;AACAH,MAAAA,MAAM,CAACG,OAAP,CAAeC,OAAf,CAAwBC,YAAD,IAAiC;AACtD;AACA,YAAI,OAAOA,YAAP,KAAwB,QAA5B,EAAsC;AACpCF,UAAAA,OAAO,CAACG,IAAR,CAAaD,YAAb;AACD,SAFD,MAEO;AACL;AACAF,UAAAA,OAAO,CAACG,IAAR,CAAaD,YAAY,CAACH,UAA1B;AACD;AACF,OARD;AAUA,WAAKK,gBAAL,CAAsBC,GAAtB,CAA0BT,OAAO,CAACG,UAAlC,EAA8CC,OAA9C;AACD;;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KAA3B;AACA,SAAKjB,uBAAL,CAA6BiB,KAA7B;AACD;;AAEyB,aAARC,QAAQ,GAAuB;AAC/C,QAAI,CAAC,KAAKC,SAAV,EAAqB;AACnB,WAAKA,SAAL,GAAiB,IAAIpC,kBAAJ,EAAjB;AACD;;AAED,WAAO,KAAKoC,SAAZ;AACD;;AAlIqC;;gBAAnBpC,kB","sourcesContent":["import type IGestureHandler from '../handlers/IGestureHandler';\nimport { Config, Handler } from '../interfaces';\n\nexport default class InteractionManager {\n private static _instance: InteractionManager;\n private readonly waitForRelations: Map<number, number[]> = new Map();\n private readonly simultaneousRelations: Map<number, number[]> = new Map();\n private readonly blocksHandlersRelations: Map<number, number[]> = new Map();\n\n // Private becaues of singleton\n // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function\n private constructor() {}\n\n public configureInteractions(handler: IGestureHandler, config: Config) {\n this.dropRelationsForHandlerWithTag(handler.handlerTag);\n\n if (config.waitFor) {\n const waitFor: number[] = [];\n config.waitFor.forEach((otherHandler: Handler): void => {\n // New API reference\n if (typeof otherHandler === 'number') {\n waitFor.push(otherHandler);\n } else {\n // Old API reference\n waitFor.push(otherHandler.handlerTag);\n }\n });\n\n this.waitForRelations.set(handler.handlerTag, waitFor);\n }\n\n if (config.simultaneousHandlers) {\n const simultaneousHandlers: number[] = [];\n config.simultaneousHandlers.forEach((otherHandler: Handler): void => {\n if (typeof otherHandler === 'number') {\n simultaneousHandlers.push(otherHandler);\n } else {\n simultaneousHandlers.push(otherHandler.handlerTag);\n }\n });\n\n this.simultaneousRelations.set(handler.handlerTag, simultaneousHandlers);\n }\n\n if (config.blocksHandlers) {\n const blocksHandlers: number[] = [];\n config.blocksHandlers.forEach((otherHandler: Handler): void => {\n if (typeof otherHandler === 'number') {\n blocksHandlers.push(otherHandler);\n } else {\n blocksHandlers.push(otherHandler.handlerTag);\n }\n });\n\n this.blocksHandlersRelations.set(handler.handlerTag, blocksHandlers);\n }\n }\n\n public shouldWaitForHandlerFailure(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const waitFor: number[] | undefined = this.waitForRelations.get(\n handler.handlerTag\n );\n\n return (\n waitFor?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldRecognizeSimultaneously(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const simultaneousHandlers: number[] | undefined =\n this.simultaneousRelations.get(handler.handlerTag);\n\n return (\n simultaneousHandlers?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldRequireHandlerToWaitForFailure(\n handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n const waitFor: number[] | undefined = this.blocksHandlersRelations.get(\n handler.handlerTag\n );\n\n return (\n waitFor?.find((tag: number) => {\n return tag === otherHandler.handlerTag;\n }) !== undefined\n );\n }\n\n public shouldHandlerBeCancelledBy(\n _handler: IGestureHandler,\n otherHandler: IGestureHandler\n ): boolean {\n // We check constructor name instead of using `instanceof` in order do avoid circular dependencies\n const isNativeHandler =\n otherHandler.constructor.name === 'NativeViewGestureHandler';\n const isActive = otherHandler.active;\n const isButton = otherHandler.isButton?.() === true;\n\n return isNativeHandler && isActive && !isButton;\n }\n\n public dropRelationsForHandlerWithTag(handlerTag: number): void {\n this.waitForRelations.delete(handlerTag);\n this.simultaneousRelations.delete(handlerTag);\n this.blocksHandlersRelations.delete(handlerTag);\n }\n\n public reset() {\n this.waitForRelations.clear();\n this.simultaneousRelations.clear();\n this.blocksHandlersRelations.clear();\n }\n\n public static get instance(): InteractionManager {\n if (!this._instance) {\n this._instance = new InteractionManager();\n }\n\n return this._instance;\n }\n}\n"]}
|
@@ -1,96 +0,0 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
|
-
import { EventTypes } from '../interfaces';
|
4
|
-
import EventManager from './EventManager';
|
5
|
-
import { PointerType } from '../../PointerType';
|
6
|
-
export default class KeyboardEventManager extends EventManager {
|
7
|
-
constructor(...args) {
|
8
|
-
super(...args);
|
9
|
-
|
10
|
-
_defineProperty(this, "activationKeys", ['Enter', ' ']);
|
11
|
-
|
12
|
-
_defineProperty(this, "cancelationKeys", ['Tab']);
|
13
|
-
|
14
|
-
_defineProperty(this, "isPressed", false);
|
15
|
-
|
16
|
-
_defineProperty(this, "keyDownCallback", event => {
|
17
|
-
if (this.cancelationKeys.indexOf(event.key) !== -1 && this.isPressed) {
|
18
|
-
this.dispatchEvent(event, EventTypes.CANCEL);
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
|
22
|
-
if (this.activationKeys.indexOf(event.key) === -1) {
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
|
26
|
-
this.dispatchEvent(event, EventTypes.DOWN);
|
27
|
-
});
|
28
|
-
|
29
|
-
_defineProperty(this, "keyUpCallback", event => {
|
30
|
-
if (this.activationKeys.indexOf(event.key) === -1 || !this.isPressed) {
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
|
34
|
-
this.dispatchEvent(event, EventTypes.UP);
|
35
|
-
});
|
36
|
-
}
|
37
|
-
|
38
|
-
dispatchEvent(event, eventType) {
|
39
|
-
if (!(event.target instanceof HTMLElement)) {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
|
43
|
-
const adaptedEvent = this.mapEvent(event, eventType);
|
44
|
-
|
45
|
-
switch (eventType) {
|
46
|
-
case EventTypes.UP:
|
47
|
-
this.isPressed = false;
|
48
|
-
this.onPointerUp(adaptedEvent);
|
49
|
-
break;
|
50
|
-
|
51
|
-
case EventTypes.DOWN:
|
52
|
-
this.isPressed = true;
|
53
|
-
this.onPointerDown(adaptedEvent);
|
54
|
-
break;
|
55
|
-
|
56
|
-
case EventTypes.CANCEL:
|
57
|
-
this.isPressed = false;
|
58
|
-
this.onPointerCancel(adaptedEvent);
|
59
|
-
break;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
registerListeners() {
|
64
|
-
this.view.addEventListener('keydown', this.keyDownCallback);
|
65
|
-
this.view.addEventListener('keyup', this.keyUpCallback);
|
66
|
-
}
|
67
|
-
|
68
|
-
unregisterListeners() {
|
69
|
-
this.view.removeEventListener('keydown', this.keyDownCallback);
|
70
|
-
this.view.removeEventListener('keyup', this.keyUpCallback);
|
71
|
-
}
|
72
|
-
|
73
|
-
mapEvent(event, eventType) {
|
74
|
-
const viewRect = event.target.getBoundingClientRect();
|
75
|
-
const viewportPosition = {
|
76
|
-
x: (viewRect === null || viewRect === void 0 ? void 0 : viewRect.x) + (viewRect === null || viewRect === void 0 ? void 0 : viewRect.width) / 2,
|
77
|
-
y: (viewRect === null || viewRect === void 0 ? void 0 : viewRect.y) + (viewRect === null || viewRect === void 0 ? void 0 : viewRect.height) / 2
|
78
|
-
};
|
79
|
-
const relativePosition = {
|
80
|
-
x: (viewRect === null || viewRect === void 0 ? void 0 : viewRect.width) / 2,
|
81
|
-
y: (viewRect === null || viewRect === void 0 ? void 0 : viewRect.height) / 2
|
82
|
-
};
|
83
|
-
return {
|
84
|
-
x: viewportPosition.x,
|
85
|
-
y: viewportPosition.y,
|
86
|
-
offsetX: relativePosition.x,
|
87
|
-
offsetY: relativePosition.y,
|
88
|
-
pointerId: 0,
|
89
|
-
eventType: eventType,
|
90
|
-
pointerType: PointerType.KEY,
|
91
|
-
time: event.timeStamp
|
92
|
-
};
|
93
|
-
}
|
94
|
-
|
95
|
-
}
|
96
|
-
//# sourceMappingURL=KeyboardEventManager.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["KeyboardEventManager.ts"],"names":["EventTypes","EventManager","PointerType","KeyboardEventManager","event","cancelationKeys","indexOf","key","isPressed","dispatchEvent","CANCEL","activationKeys","DOWN","UP","eventType","target","HTMLElement","adaptedEvent","mapEvent","onPointerUp","onPointerDown","onPointerCancel","registerListeners","view","addEventListener","keyDownCallback","keyUpCallback","unregisterListeners","removeEventListener","viewRect","getBoundingClientRect","viewportPosition","x","width","y","height","relativePosition","offsetX","offsetY","pointerId","pointerType","KEY","time","timeStamp"],"mappings":";;AAAA,SAAuBA,UAAvB,QAAyC,eAAzC;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAEA,eAAe,MAAMC,oBAAN,SAAmCF,YAAnC,CAA6D;AAAA;AAAA;;AAAA,4CACjD,CAAC,OAAD,EAAU,GAAV,CADiD;;AAAA,6CAEhD,CAAC,KAAD,CAFgD;;AAAA,uCAGtD,KAHsD;;AAAA,6CAK/CG,KAAD,IAAgC;AACxD,UAAI,KAAKC,eAAL,CAAqBC,OAArB,CAA6BF,KAAK,CAACG,GAAnC,MAA4C,CAAC,CAA7C,IAAkD,KAAKC,SAA3D,EAAsE;AACpE,aAAKC,aAAL,CAAmBL,KAAnB,EAA0BJ,UAAU,CAACU,MAArC;AACA;AACD;;AAED,UAAI,KAAKC,cAAL,CAAoBL,OAApB,CAA4BF,KAAK,CAACG,GAAlC,MAA2C,CAAC,CAAhD,EAAmD;AACjD;AACD;;AAED,WAAKE,aAAL,CAAmBL,KAAnB,EAA0BJ,UAAU,CAACY,IAArC;AACD,KAhByE;;AAAA,2CAkBjDR,KAAD,IAAgC;AACtD,UAAI,KAAKO,cAAL,CAAoBL,OAApB,CAA4BF,KAAK,CAACG,GAAlC,MAA2C,CAAC,CAA5C,IAAiD,CAAC,KAAKC,SAA3D,EAAsE;AACpE;AACD;;AAED,WAAKC,aAAL,CAAmBL,KAAnB,EAA0BJ,UAAU,CAACa,EAArC;AACD,KAxByE;AAAA;;AA0BlEJ,EAAAA,aAAa,CAACL,KAAD,EAAuBU,SAAvB,EAA8C;AACjE,QAAI,EAAEV,KAAK,CAACW,MAAN,YAAwBC,WAA1B,CAAJ,EAA4C;AAC1C;AACD;;AAED,UAAMC,YAAY,GAAG,KAAKC,QAAL,CAAcd,KAAd,EAAqBU,SAArB,CAArB;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AMC,gBAAgB,GAAG;AACvBJ,MAAAA,CAAC,EAAE,CAAAH,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEI,KAAV,IAAkB,CADE;AAEvBC,MAAAA,CAAC,EAAE,CAAAL,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEM,MAAV,IAAmB;AAFC,KAAzB;AAKA,WAAO;AACLH,MAAAA,CAAC,EAAED,gBAAgB,CAACC,CADf;AAELE,MAAAA,CAAC,EAAEH,gBAAgB,CAACG,CAFf;AAGLG,MAAAA,OAAO,EAAED,gBAAgB,CAACJ,CAHrB;AAILM,MAAAA,OAAO,EAAEF,gBAAgB,CAACF,CAJrB;AAKLK,MAAAA,SAAS,EAAE,CALN;AAMLzB,MAAAA,SAAS,EAAEA,SANN;AAOL0B,MAAAA,WAAW,EAAEtC,WAAW,CAACuC,GAPpB;AAQLC,MAAAA,IAAI,EAAEtC,KAAK,CAACuC;AARP,KAAP;AAUD;;AArFyE","sourcesContent":["import { AdaptedEvent, EventTypes } from '../interfaces';\nimport EventManager from './EventManager';\nimport { PointerType } from '../../PointerType';\n\nexport default class KeyboardEventManager extends EventManager<HTMLElement> {\n private activationKeys = ['Enter', ' '];\n private cancelationKeys = ['Tab'];\n private isPressed = false;\n\n private keyDownCallback = (event: KeyboardEvent): void => {\n if (this.cancelationKeys.indexOf(event.key) !== -1 && this.isPressed) {\n this.dispatchEvent(event, EventTypes.CANCEL);\n return;\n }\n\n if (this.activationKeys.indexOf(event.key) === -1) {\n return;\n }\n\n this.dispatchEvent(event, EventTypes.DOWN);\n };\n\n private keyUpCallback = (event: KeyboardEvent): void => {\n if (this.activationKeys.indexOf(event.key) === -1 || !this.isPressed) {\n return;\n }\n\n this.dispatchEvent(event, EventTypes.UP);\n };\n\n private dispatchEvent(event: KeyboardEvent, eventType: EventTypes) {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n const adaptedEvent = this.mapEvent(event, eventType);\n\n switch (eventType) {\n case EventTypes.UP:\n this.isPressed = false;\n this.onPointerUp(adaptedEvent);\n break;\n case EventTypes.DOWN:\n this.isPressed = true;\n this.onPointerDown(adaptedEvent);\n break;\n case EventTypes.CANCEL:\n this.isPressed = false;\n this.onPointerCancel(adaptedEvent);\n break;\n }\n }\n\n public registerListeners(): void {\n this.view.addEventListener('keydown', this.keyDownCallback);\n this.view.addEventListener('keyup', this.keyUpCallback);\n }\n\n public unregisterListeners(): void {\n this.view.removeEventListener('keydown', this.keyDownCallback);\n this.view.removeEventListener('keyup', this.keyUpCallback);\n }\n\n protected mapEvent(\n event: KeyboardEvent,\n eventType: EventTypes\n ): AdaptedEvent {\n const viewRect = (event.target as HTMLElement).getBoundingClientRect();\n\n const viewportPosition = {\n x: viewRect?.x + viewRect?.width / 2,\n y: viewRect?.y + viewRect?.height / 2,\n };\n\n const relativePosition = {\n x: viewRect?.width / 2,\n y: viewRect?.height / 2,\n };\n\n return {\n x: viewportPosition.x,\n y: viewportPosition.y,\n offsetX: relativePosition.x,\n offsetY: relativePosition.y,\n pointerId: 0,\n eventType: eventType,\n pointerType: PointerType.KEY,\n time: event.timeStamp,\n };\n }\n}\n"]}
|
@@ -1,195 +0,0 @@
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
-
|
3
|
-
// Implementation taken from Flutter's LeastSquareSolver
|
4
|
-
// https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/gestures/lsq_solver.dart
|
5
|
-
class Vector {
|
6
|
-
constructor(length) {
|
7
|
-
_defineProperty(this, "offset", void 0);
|
8
|
-
|
9
|
-
_defineProperty(this, "length", void 0);
|
10
|
-
|
11
|
-
_defineProperty(this, "elements", void 0);
|
12
|
-
|
13
|
-
this.offset = 0;
|
14
|
-
this.length = length;
|
15
|
-
this.elements = new Array(length);
|
16
|
-
}
|
17
|
-
|
18
|
-
static fromVOL(values, offset, length) {
|
19
|
-
const result = new Vector(0);
|
20
|
-
result.offset = offset;
|
21
|
-
result.length = length;
|
22
|
-
result.elements = values;
|
23
|
-
return result;
|
24
|
-
}
|
25
|
-
|
26
|
-
get(index) {
|
27
|
-
return this.elements[this.offset + index];
|
28
|
-
}
|
29
|
-
|
30
|
-
set(index, value) {
|
31
|
-
this.elements[this.offset + index] = value;
|
32
|
-
}
|
33
|
-
|
34
|
-
dot(other) {
|
35
|
-
let result = 0;
|
36
|
-
|
37
|
-
for (let i = 0; i < this.length; i++) {
|
38
|
-
result += this.get(i) * other.get(i);
|
39
|
-
}
|
40
|
-
|
41
|
-
return result;
|
42
|
-
}
|
43
|
-
|
44
|
-
norm() {
|
45
|
-
return Math.sqrt(this.dot(this));
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
class Matrix {
|
51
|
-
constructor(rows, columns) {
|
52
|
-
_defineProperty(this, "columns", void 0);
|
53
|
-
|
54
|
-
_defineProperty(this, "elements", void 0);
|
55
|
-
|
56
|
-
this.columns = columns;
|
57
|
-
this.elements = new Array(rows * columns);
|
58
|
-
}
|
59
|
-
|
60
|
-
get(row, column) {
|
61
|
-
return this.elements[row * this.columns + column];
|
62
|
-
}
|
63
|
-
|
64
|
-
set(row, column, value) {
|
65
|
-
this.elements[row * this.columns + column] = value;
|
66
|
-
}
|
67
|
-
|
68
|
-
getRow(row) {
|
69
|
-
return Vector.fromVOL(this.elements, row * this.columns, this.columns);
|
70
|
-
}
|
71
|
-
|
72
|
-
} // An nth degree polynomial fit to a dataset.
|
73
|
-
|
74
|
-
|
75
|
-
class PolynomialFit {
|
76
|
-
// The polynomial coefficients of the fit.
|
77
|
-
//
|
78
|
-
// For each `i`, the element `coefficients[i]` is the coefficient of
|
79
|
-
// the `i`-th power of the variable.
|
80
|
-
// Creates a polynomial fit of the given degree.
|
81
|
-
//
|
82
|
-
// There are n + 1 coefficients in a fit of degree n.
|
83
|
-
constructor(degree) {
|
84
|
-
_defineProperty(this, "coefficients", void 0);
|
85
|
-
|
86
|
-
this.coefficients = new Array(degree + 1);
|
87
|
-
}
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
const precisionErrorTolerance = 1e-10; // Uses the least-squares algorithm to fit a polynomial to a set of data.
|
92
|
-
|
93
|
-
export default class LeastSquareSolver {
|
94
|
-
// The x-coordinates of each data point.
|
95
|
-
// The y-coordinates of each data point.
|
96
|
-
// The weight to use for each data point.
|
97
|
-
// Creates a least-squares solver.
|
98
|
-
//
|
99
|
-
// The [x], [y], and [w] arguments must not be null.
|
100
|
-
constructor(x, y, w) {
|
101
|
-
_defineProperty(this, "x", void 0);
|
102
|
-
|
103
|
-
_defineProperty(this, "y", void 0);
|
104
|
-
|
105
|
-
_defineProperty(this, "w", void 0);
|
106
|
-
|
107
|
-
this.x = x;
|
108
|
-
this.y = y;
|
109
|
-
this.w = w;
|
110
|
-
} // Fits a polynomial of the given degree to the data points.
|
111
|
-
//
|
112
|
-
// When there is not enough data to fit a curve null is returned.
|
113
|
-
|
114
|
-
|
115
|
-
solve(degree) {
|
116
|
-
if (degree > this.x.length) {
|
117
|
-
// Not enough data to fit a curve.
|
118
|
-
return null;
|
119
|
-
}
|
120
|
-
|
121
|
-
const result = new PolynomialFit(degree); // Shorthands for the purpose of notation equivalence to original C++ code.
|
122
|
-
|
123
|
-
const m = this.x.length;
|
124
|
-
const n = degree + 1; // Expand the X vector to a matrix A, pre-multiplied by the weights.
|
125
|
-
|
126
|
-
const a = new Matrix(n, m);
|
127
|
-
|
128
|
-
for (let h = 0; h < m; h++) {
|
129
|
-
a.set(0, h, this.w[h]);
|
130
|
-
|
131
|
-
for (let i = 1; i < n; i++) {
|
132
|
-
a.set(i, h, a.get(i - 1, h) * this.x[h]);
|
133
|
-
}
|
134
|
-
} // Apply the Gram-Schmidt process to A to obtain its QR decomposition.
|
135
|
-
// Orthonormal basis, column-major ordVectorer.
|
136
|
-
|
137
|
-
|
138
|
-
const q = new Matrix(n, m); // Upper triangular matrix, row-major order.
|
139
|
-
|
140
|
-
const r = new Matrix(n, m);
|
141
|
-
|
142
|
-
for (let j = 0; j < n; j += 1) {
|
143
|
-
for (let h = 0; h < m; h += 1) {
|
144
|
-
q.set(j, h, a.get(j, h));
|
145
|
-
}
|
146
|
-
|
147
|
-
for (let i = 0; i < j; i += 1) {
|
148
|
-
const dot = q.getRow(j).dot(q.getRow(i));
|
149
|
-
|
150
|
-
for (let h = 0; h < m; h += 1) {
|
151
|
-
q.set(j, h, q.get(j, h) - dot * q.get(i, h));
|
152
|
-
}
|
153
|
-
}
|
154
|
-
|
155
|
-
const norm = q.getRow(j).norm();
|
156
|
-
|
157
|
-
if (norm < precisionErrorTolerance) {
|
158
|
-
// Vectors are linearly dependent or zero so no solution.
|
159
|
-
return null;
|
160
|
-
}
|
161
|
-
|
162
|
-
const inverseNorm = 1.0 / norm;
|
163
|
-
|
164
|
-
for (let h = 0; h < m; h += 1) {
|
165
|
-
q.set(j, h, q.get(j, h) * inverseNorm);
|
166
|
-
}
|
167
|
-
|
168
|
-
for (let i = 0; i < n; i += 1) {
|
169
|
-
r.set(j, i, i < j ? 0.0 : q.getRow(j).dot(a.getRow(i)));
|
170
|
-
}
|
171
|
-
} // Solve R B = Qt W Y to find B. This is easy because R is upper triangular.
|
172
|
-
// We just work from bottom-right to top-left calculating B's coefficients.
|
173
|
-
|
174
|
-
|
175
|
-
const wy = new Vector(m);
|
176
|
-
|
177
|
-
for (let h = 0; h < m; h += 1) {
|
178
|
-
wy.set(h, this.y[h] * this.w[h]);
|
179
|
-
}
|
180
|
-
|
181
|
-
for (let i = n - 1; i >= 0; i -= 1) {
|
182
|
-
result.coefficients[i] = q.getRow(i).dot(wy);
|
183
|
-
|
184
|
-
for (let j = n - 1; j > i; j -= 1) {
|
185
|
-
result.coefficients[i] -= r.get(i, j) * result.coefficients[j];
|
186
|
-
}
|
187
|
-
|
188
|
-
result.coefficients[i] /= r.get(i, i);
|
189
|
-
}
|
190
|
-
|
191
|
-
return result;
|
192
|
-
}
|
193
|
-
|
194
|
-
}
|
195
|
-
//# sourceMappingURL=LeastSquareSolver.js.map
|