@amazon-devices/react-native-gesture-handler 2.0.1758683737
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/DrawerLayout/package.json +6 -0
- package/LICENSE +7 -0
- package/README.kepler.md +167 -0
- package/RNGestureHandler.podspec +41 -0
- package/Swipeable/package.json +6 -0
- package/SystemBundles/88ca607de4fbd504c736d8d5ce354ea9743ea4ae485d956b5af49e9af508e705.bundle +67466 -0
- package/SystemBundles/88ca607de4fbd504c736d8d5ce354ea9743ea4ae485d956b5af49e9af508e705.map +1 -0
- package/SystemModules/amzn__react-native-gesture-handler-2.modules.txt +338 -0
- package/SystemModules/amzn__react-native-gesture-handler-2.private.modules.txt +96 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/THIRD_PARTY_NOTICES.txt +578 -0
- package/android/build.gradle +205 -0
- package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
- package/android/gradle.properties +19 -0
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +10 -0
- package/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +17 -0
- package/android/src/fabric/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +29 -0
- package/android/src/fabric/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +12 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +21 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +807 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerInteractionController.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +707 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerRegistry.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +47 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +120 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +11 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +257 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/OnTouchEventListener.kt +9 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +322 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +103 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/PointerEventsConfig.kt +23 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +125 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +93 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ScaleGestureDetector.java +558 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt +168 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/ViewConfigurationHelper.kt +10 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +419 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +15 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +77 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +67 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +756 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +100 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +142 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +78 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +51 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +72 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
- package/android/src/main/jni/CMakeLists.txt +25 -0
- package/android/src/main/jni/cpp-adapter.cpp +44 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +50 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +23 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +25 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +16 -0
- package/android/src/paper/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +13 -0
- package/ios/Handlers/RNFlingHandler.h +4 -0
- package/ios/Handlers/RNFlingHandler.m +152 -0
- package/ios/Handlers/RNForceTouchHandler.h +4 -0
- package/ios/Handlers/RNForceTouchHandler.m +175 -0
- package/ios/Handlers/RNHoverHandler.h +12 -0
- package/ios/Handlers/RNHoverHandler.m +152 -0
- package/ios/Handlers/RNLongPressHandler.h +12 -0
- package/ios/Handlers/RNLongPressHandler.m +183 -0
- package/ios/Handlers/RNManualHandler.h +4 -0
- package/ios/Handlers/RNManualHandler.m +88 -0
- package/ios/Handlers/RNNativeViewHandler.h +15 -0
- package/ios/Handlers/RNNativeViewHandler.mm +193 -0
- package/ios/Handlers/RNPanHandler.h +12 -0
- package/ios/Handlers/RNPanHandler.m +331 -0
- package/ios/Handlers/RNPinchHandler.h +12 -0
- package/ios/Handlers/RNPinchHandler.m +95 -0
- package/ios/Handlers/RNRotationHandler.h +12 -0
- package/ios/Handlers/RNRotationHandler.m +93 -0
- package/ios/Handlers/RNTapHandler.h +12 -0
- package/ios/Handlers/RNTapHandler.m +265 -0
- package/ios/RNGHTouchEventType.h +9 -0
- package/ios/RNGestureHandler.h +90 -0
- package/ios/RNGestureHandler.m +482 -0
- package/ios/RNGestureHandler.xcodeproj/project.pbxproj +690 -0
- package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNGestureHandlerActionType.h +10 -0
- package/ios/RNGestureHandlerButton.h +19 -0
- package/ios/RNGestureHandlerButton.m +77 -0
- package/ios/RNGestureHandlerButtonComponentView.h +17 -0
- package/ios/RNGestureHandlerButtonComponentView.mm +62 -0
- package/ios/RNGestureHandlerButtonManager.h +5 -0
- package/ios/RNGestureHandlerButtonManager.m +34 -0
- package/ios/RNGestureHandlerDirection.h +8 -0
- package/ios/RNGestureHandlerEvents.h +65 -0
- package/ios/RNGestureHandlerEvents.m +260 -0
- package/ios/RNGestureHandlerManager.h +35 -0
- package/ios/RNGestureHandlerManager.mm +367 -0
- package/ios/RNGestureHandlerModule.h +7 -0
- package/ios/RNGestureHandlerModule.mm +320 -0
- package/ios/RNGestureHandlerPointerTracker.h +25 -0
- package/ios/RNGestureHandlerPointerTracker.m +243 -0
- package/ios/RNGestureHandlerRegistry.h +21 -0
- package/ios/RNGestureHandlerRegistry.m +63 -0
- package/ios/RNGestureHandlerRootViewComponentView.mm +21 -0
- package/ios/RNGestureHandlerState.h +10 -0
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/RNManualActivationRecognizer.h +10 -0
- package/ios/RNManualActivationRecognizer.m +88 -0
- package/ios/RNRootViewGestureRecognizer.h +17 -0
- package/ios/RNRootViewGestureRecognizer.m +106 -0
- package/jest-utils/package.json +6 -0
- package/jestSetup.js +7 -0
- package/kepler-compatibility.json +8 -0
- package/kepler-transformed-package-info.json +3 -0
- package/lib/commonjs/ActionType.js +15 -0
- package/lib/commonjs/ActionType.js.map +1 -0
- package/lib/commonjs/Directions.js +15 -0
- package/lib/commonjs/Directions.js.map +1 -0
- package/lib/commonjs/EnableNewWebImplementation.js +29 -0
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js +10 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/commonjs/PlatformConstants.js +10 -0
- package/lib/commonjs/PlatformConstants.js.map +1 -0
- package/lib/commonjs/PlatformConstants.web.js +12 -0
- package/lib/commonjs/PlatformConstants.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +23 -0
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.kepler.js +33 -0
- package/lib/commonjs/RNGestureHandlerModule.kepler.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +113 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +123 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js +121 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +14 -0
- package/lib/commonjs/RNRenderer.js.map +1 -0
- package/lib/commonjs/RNRenderer.web.js +10 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/State.js +19 -0
- package/lib/commonjs/State.js.map +1 -0
- package/lib/commonjs/TouchEventType.js +16 -0
- package/lib/commonjs/TouchEventType.js.map +1 -0
- package/lib/commonjs/components/DrawerLayout.js +512 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +194 -0
- package/lib/commonjs/components/GestureButtons.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +104 -0
- package/lib/commonjs/components/GestureComponents.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.web.js +38 -0
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +10 -0
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js +16 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.android.js +23 -0
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +23 -0
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.kepler.js +18 -0
- package/lib/commonjs/components/GestureHandlerRootView.kepler.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js +18 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +345 -0
- package/lib/commonjs/components/Swipeable.js.map +1 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js +31 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js +253 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js +90 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +84 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +9 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js +64 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +18 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/index.js +35 -0
- package/lib/commonjs/components/touchables/index.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +27 -0
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js +14 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js +18 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +37 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +20 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +19 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js +99 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js +17 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js +13 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +11 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js +17 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/TapGestureHandler.js +20 -0
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +402 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -0
- package/lib/commonjs/handlers/createNativeWrapper.js +63 -0
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +86 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +6 -0
- package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +548 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js +125 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js +27 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +54 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js +196 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +90 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js +73 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +60 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +27 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js +60 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js +28 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js +25 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js +27 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/panGesture.js +124 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js +38 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +30 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js +38 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js +48 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/commonjs/handlers/handlersRegistry.js +52 -0
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
- package/lib/commonjs/index.js +241 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/init.js +25 -0
- package/lib/commonjs/init.js.map +1 -0
- package/lib/commonjs/jestUtils/index.js +19 -0
- package/lib/commonjs/jestUtils/index.js.map +1 -0
- package/lib/commonjs/jestUtils/jestUtils.js +312 -0
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -0
- package/lib/commonjs/mocks.js +61 -0
- package/lib/commonjs/mocks.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.kepler.js +20 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.kepler.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/commonjs/typeUtils.js +2 -0
- package/lib/commonjs/typeUtils.js.map +1 -0
- package/lib/commonjs/utils.js +64 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/constants.js +14 -0
- package/lib/commonjs/web/constants.js.map +1 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +129 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +127 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +127 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/GestureHandler.js +668 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +48 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +119 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +49 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +140 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js +347 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +136 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +146 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js +219 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web/interfaces.js +44 -0
- package/lib/commonjs/web/interfaces.js.map +1 -0
- package/lib/commonjs/web/tools/CircularBuffer.js +47 -0
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
- package/lib/commonjs/web/tools/EventManager.js +95 -0
- package/lib/commonjs/web/tools/EventManager.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js +6 -0
- package/lib/commonjs/web/tools/GestureHandlerDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +305 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +93 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/InteractionManager.js +99 -0
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js +167 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/commonjs/web/tools/NodeManager.js +41 -0
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +171 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerTracker.js +202 -0
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -0
- package/lib/commonjs/web/tools/TouchEventManager.js +126 -0
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/VelocityTracker.js +89 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web/utils.js +14 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +93 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +43 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/Errors.js +13 -0
- package/lib/commonjs/web_hammer/Errors.js.map +1 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +139 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +491 -0
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +45 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +57 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +58 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NodeManager.js +40 -0
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js +167 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +31 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js +160 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +33 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js +173 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/constants.js +51 -0
- package/lib/commonjs/web_hammer/constants.js.map +1 -0
- package/lib/commonjs/web_hammer/utils.js +32 -0
- package/lib/commonjs/web_hammer/utils.js.map +1 -0
- package/lib/module/ActionType.js +9 -0
- package/lib/module/ActionType.js.map +1 -0
- package/lib/module/Directions.js +9 -0
- package/lib/module/Directions.js.map +1 -0
- package/lib/module/EnableNewWebImplementation.js +21 -0
- package/lib/module/EnableNewWebImplementation.js.map +1 -0
- package/lib/module/GestureHandlerRootViewContext.js +3 -0
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/module/PlatformConstants.js +4 -0
- package/lib/module/PlatformConstants.js.map +1 -0
- package/lib/module/PlatformConstants.web.js +6 -0
- package/lib/module/PlatformConstants.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +17 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.kepler.js +24 -0
- package/lib/module/RNGestureHandlerModule.kepler.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +104 -0
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +114 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.windows.js +112 -0
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -0
- package/lib/module/RNRenderer.js +4 -0
- package/lib/module/RNRenderer.js.map +1 -0
- package/lib/module/RNRenderer.web.js +4 -0
- package/lib/module/RNRenderer.web.js.map +1 -0
- package/lib/module/State.js +13 -0
- package/lib/module/State.js.map +1 -0
- package/lib/module/TouchEventType.js +10 -0
- package/lib/module/TouchEventType.js.map +1 -0
- package/lib/module/components/DrawerLayout.js +504 -0
- package/lib/module/components/DrawerLayout.js.map +1 -0
- package/lib/module/components/GestureButtons.js +176 -0
- package/lib/module/components/GestureButtons.js.map +1 -0
- package/lib/module/components/GestureComponents.js +95 -0
- package/lib/module/components/GestureComponents.js.map +1 -0
- package/lib/module/components/GestureComponents.web.js +28 -0
- package/lib/module/components/GestureComponents.web.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +3 -0
- package/lib/module/components/GestureHandlerButton.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.web.js +8 -0
- package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.android.js +14 -0
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +14 -0
- package/lib/module/components/GestureHandlerRootView.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.kepler.js +9 -0
- package/lib/module/components/GestureHandlerRootView.kepler.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.web.js +9 -0
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +338 -0
- package/lib/module/components/Swipeable.js.map +1 -0
- package/lib/module/components/gestureHandlerRootHOC.js +22 -0
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js +244 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/module/components/touchables/TouchableHighlight.js +81 -0
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +74 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.js +3 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/module/components/touchables/TouchableOpacity.js +55 -0
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +9 -0
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -0
- package/lib/module/components/touchables/index.js +5 -0
- package/lib/module/components/touchables/index.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +21 -0
- package/lib/module/getShadowNodeFromRef.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.web.js +8 -0
- package/lib/module/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/module/handlers/FlingGestureHandler.js +11 -0
- package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js +30 -0
- package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +13 -0
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/handlers/NativeViewGestureHandler.js +12 -0
- package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js +90 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/handlers/PinchGestureHandler.js +10 -0
- package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
- package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/module/handlers/RotationGestureHandler.js +10 -0
- package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/handlers/TapGestureHandler.js +13 -0
- package/lib/module/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/handlers/createHandler.js +395 -0
- package/lib/module/handlers/createHandler.js.map +1 -0
- package/lib/module/handlers/createNativeWrapper.js +56 -0
- package/lib/module/handlers/createNativeWrapper.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +76 -0
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
- package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
- package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector.js +538 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/module/handlers/gestures/eventReceiver.js +116 -0
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/module/handlers/gestures/flingGesture.js +20 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js +47 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js +188 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +81 -0
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/module/handlers/gestures/gestureObjects.js +67 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.js +54 -0
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js +20 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/module/handlers/gestures/hoverGesture.js +53 -0
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js +21 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/module/handlers/gestures/manualGesture.js +18 -0
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/module/handlers/gestures/nativeGesture.js +20 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/module/handlers/gestures/panGesture.js +117 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -0
- package/lib/module/handlers/gestures/pinchGesture.js +31 -0
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js +25 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/module/handlers/gestures/rotationGesture.js +31 -0
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/module/handlers/gestures/tapGesture.js +41 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/module/handlers/handlersRegistry.js +39 -0
- package/lib/module/handlers/handlersRegistry.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/init.js +17 -0
- package/lib/module/init.js.map +1 -0
- package/lib/module/jestUtils/index.js +2 -0
- package/lib/module/jestUtils/index.js.map +1 -0
- package/lib/module/jestUtils/jestUtils.js +305 -0
- package/lib/module/jestUtils/jestUtils.js.map +1 -0
- package/lib/module/mocks.js +55 -0
- package/lib/module/mocks.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +4 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.kepler.js +12 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.kepler.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +4 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/module/typeUtils.js +2 -0
- package/lib/module/typeUtils.js.map +1 -0
- package/lib/module/utils.js +50 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/constants.js +8 -0
- package/lib/module/web/constants.js.map +1 -0
- package/lib/module/web/detectors/RotationGestureDetector.js +122 -0
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js +120 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +119 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/GestureHandler.js +661 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -0
- package/lib/module/web/handlers/HoverGestureHandler.js +40 -0
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js +111 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js +41 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +132 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PanGestureHandler.js +339 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js +128 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js +138 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/TapGestureHandler.js +211 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/web/interfaces.js +38 -0
- package/lib/module/web/interfaces.js.map +1 -0
- package/lib/module/web/tools/CircularBuffer.js +40 -0
- package/lib/module/web/tools/CircularBuffer.js.map +1 -0
- package/lib/module/web/tools/EventManager.js +88 -0
- package/lib/module/web/tools/EventManager.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerDelegate.js +2 -0
- package/lib/module/web/tools/GestureHandlerDelegate.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +297 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +85 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/module/web/tools/InteractionManager.js +92 -0
- package/lib/module/web/tools/InteractionManager.js.map +1 -0
- package/lib/module/web/tools/LeastSquareSolver.js +160 -0
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/module/web/tools/NodeManager.js +34 -0
- package/lib/module/web/tools/NodeManager.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +163 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -0
- package/lib/module/web/tools/PointerTracker.js +194 -0
- package/lib/module/web/tools/PointerTracker.js.map +1 -0
- package/lib/module/web/tools/TouchEventManager.js +118 -0
- package/lib/module/web/tools/TouchEventManager.js.map +1 -0
- package/lib/module/web/tools/VelocityTracker.js +81 -0
- package/lib/module/web/tools/VelocityTracker.js.map +1 -0
- package/lib/module/web/utils.js +8 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web_hammer/DiscreteGestureHandler.js +85 -0
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js +35 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/Errors.js +6 -0
- package/lib/module/web_hammer/Errors.js.map +1 -0
- package/lib/module/web_hammer/FlingGestureHandler.js +131 -0
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +485 -0
- package/lib/module/web_hammer/GestureHandler.js.map +1 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +39 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/LongPressGestureHandler.js +49 -0
- package/lib/module/web_hammer/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/NativeViewGestureHandler.js +49 -0
- package/lib/module/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/NodeManager.js +31 -0
- package/lib/module/web_hammer/NodeManager.js.map +1 -0
- package/lib/module/web_hammer/PanGestureHandler.js +160 -0
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PinchGestureHandler.js +24 -0
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PressGestureHandler.js +153 -0
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/RotationGestureHandler.js +26 -0
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/TapGestureHandler.js +166 -0
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/constants.js +44 -0
- package/lib/module/web_hammer/constants.js.map +1 -0
- package/lib/module/web_hammer/utils.js +19 -0
- package/lib/module/web_hammer/utils.js.map +1 -0
- package/lib/typescript/ActionType.d.ts +7 -0
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
- package/lib/typescript/PlatformConstants.d.ts +5 -0
- package/lib/typescript/PlatformConstants.web.d.ts +4 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +13 -0
- package/lib/typescript/RNGestureHandlerModule.kepler.d.ts +17 -0
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +47 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +50 -0
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +48 -0
- package/lib/typescript/RNRenderer.d.ts +1 -0
- package/lib/typescript/RNRenderer.web.d.ts +3 -0
- package/lib/typescript/State.d.ts +9 -0
- package/lib/typescript/TouchEventType.d.ts +8 -0
- package/lib/typescript/components/DrawerLayout.d.ts +148 -0
- package/lib/typescript/components/GestureButtons.d.ts +121 -0
- package/lib/typescript/components/GestureComponents.d.ts +22 -0
- package/lib/typescript/components/GestureComponents.web.d.ts +8 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +4 -0
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +4 -0
- package/lib/typescript/components/GestureHandlerRootView.android.d.ts +6 -0
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -0
- package/lib/typescript/components/GestureHandlerRootView.kepler.d.ts +6 -0
- package/lib/typescript/components/GestureHandlerRootView.web.d.ts +6 -0
- package/lib/typescript/components/Swipeable.d.ts +170 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +68 -0
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +36 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +45 -0
- package/lib/typescript/components/touchables/TouchableNativeFeedback.d.ts +2 -0
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +25 -0
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +7 -0
- package/lib/typescript/components/touchables/index.d.ts +7 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/handlers/FlingGestureHandler.d.ts +34 -0
- package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +44 -0
- package/lib/typescript/handlers/LongPressGestureHandler.d.ts +56 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +28 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +139 -0
- package/lib/typescript/handlers/PinchGestureHandler.d.ts +29 -0
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
- package/lib/typescript/handlers/RotationGestureHandler.d.ts +29 -0
- package/lib/typescript/handlers/TapGestureHandler.d.ts +57 -0
- package/lib/typescript/handlers/createHandler.d.ts +11 -0
- package/lib/typescript/handlers/createNativeWrapper.d.ts +3 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +67 -0
- package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +42 -0
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +19 -0
- package/lib/typescript/handlers/gestures/eventReceiver.d.ts +4 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +15 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +108 -0
- package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +41 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.web.d.ts +4 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +32 -0
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/manualGesture.d.ts +7 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +26 -0
- package/lib/typescript/handlers/gestures/pinchGesture.d.ts +11 -0
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
- package/lib/typescript/handlers/gestures/rotationGesture.d.ts +12 -0
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
- package/lib/typescript/handlers/handlersRegistry.d.ts +14 -0
- package/lib/typescript/index.d.ts +52 -0
- package/lib/typescript/init.d.ts +2 -0
- package/lib/typescript/jestUtils/index.d.ts +1 -0
- package/lib/typescript/jestUtils/jestUtils.d.ts +28 -0
- package/lib/typescript/mocks.d.ts +44 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +14 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.kepler.d.ts +7 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +6 -0
- package/lib/typescript/typeUtils.d.ts +1 -0
- package/lib/typescript/utils.d.ts +12 -0
- package/lib/typescript/web/constants.d.ts +7 -0
- package/lib/typescript/web/detectors/RotationGestureDetector.d.ts +30 -0
- package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts +29 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +27 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +90 -0
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +10 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +26 -0
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +12 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +24 -0
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +55 -0
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +28 -0
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +29 -0
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +39 -0
- package/lib/typescript/web/interfaces.d.ts +140 -0
- package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
- package/lib/typescript/web/tools/EventManager.d.ts +34 -0
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +22 -0
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +30 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +21 -0
- package/lib/typescript/web/tools/InteractionManager.d.ts +16 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +11 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +8 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +53 -0
- package/lib/typescript/web/tools/TouchEventManager.d.ts +6 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
- package/lib/typescript/web/utils.d.ts +4 -0
- package/lib/typescript/web_hammer/DiscreteGestureHandler.d.ts +20 -0
- package/lib/typescript/web_hammer/DraggingGestureHandler.d.ts +15 -0
- package/lib/typescript/web_hammer/Errors.d.ts +3 -0
- package/lib/typescript/web_hammer/FlingGestureHandler.d.ts +43 -0
- package/lib/typescript/web_hammer/GestureHandler.d.ts +145 -0
- package/lib/typescript/web_hammer/IndiscreteGestureHandler.d.ts +40 -0
- package/lib/typescript/web_hammer/LongPressGestureHandler.d.ts +38 -0
- package/lib/typescript/web_hammer/NativeViewGestureHandler.d.ts +7 -0
- package/lib/typescript/web_hammer/NodeManager.d.ts +8 -0
- package/lib/typescript/web_hammer/PanGestureHandler.d.ts +56 -0
- package/lib/typescript/web_hammer/PinchGestureHandler.d.ts +13 -0
- package/lib/typescript/web_hammer/PressGestureHandler.d.ts +83 -0
- package/lib/typescript/web_hammer/RotationGestureHandler.d.ts +13 -0
- package/lib/typescript/web_hammer/TapGestureHandler.d.ts +57 -0
- package/lib/typescript/web_hammer/constants.d.ts +39 -0
- package/lib/typescript/web_hammer/utils.d.ts +9 -0
- package/package.json +1 -0
- package/src/ActionType.ts +9 -0
- package/src/Directions.ts +9 -0
- package/src/EnableNewWebImplementation.ts +35 -0
- package/src/GestureHandlerRootViewContext.ts +3 -0
- package/src/PlatformConstants.ts +8 -0
- package/src/PlatformConstants.web.ts +5 -0
- package/src/RNGestureHandlerModule.kepler.ts +64 -0
- package/src/RNGestureHandlerModule.macos.ts +133 -0
- package/src/RNGestureHandlerModule.ts +50 -0
- package/src/RNGestureHandlerModule.web.ts +146 -0
- package/src/RNGestureHandlerModule.windows.ts +144 -0
- package/src/RNRenderer.ts +3 -0
- package/src/RNRenderer.web.ts +3 -0
- package/src/State.ts +13 -0
- package/src/TouchEventType.ts +10 -0
- package/src/components/DrawerLayout.tsx +743 -0
- package/src/components/GestureButtons.tsx +334 -0
- package/src/components/GestureComponents.tsx +148 -0
- package/src/components/GestureComponents.web.tsx +41 -0
- package/src/components/GestureHandlerButton.tsx +5 -0
- package/src/components/GestureHandlerButton.web.tsx +6 -0
- package/src/components/GestureHandlerRootView.android.tsx +24 -0
- package/src/components/GestureHandlerRootView.kepler.tsx +17 -0
- package/src/components/GestureHandlerRootView.tsx +23 -0
- package/src/components/GestureHandlerRootView.web.tsx +17 -0
- package/src/components/Swipeable.tsx +551 -0
- package/src/components/gestureHandlerRootHOC.tsx +32 -0
- package/src/components/touchables/GenericTouchable.tsx +301 -0
- package/src/components/touchables/TouchableHighlight.tsx +115 -0
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +91 -0
- package/src/components/touchables/TouchableNativeFeedback.tsx +3 -0
- package/src/components/touchables/TouchableOpacity.tsx +75 -0
- package/src/components/touchables/TouchableWithoutFeedback.tsx +14 -0
- package/src/components/touchables/index.ts +7 -0
- package/src/getShadowNodeFromRef.ts +22 -0
- package/src/getShadowNodeFromRef.web.ts +7 -0
- package/src/handlers/FlingGestureHandler.ts +59 -0
- package/src/handlers/ForceTouchGestureHandler.ts +90 -0
- package/src/handlers/LongPressGestureHandler.ts +88 -0
- package/src/handlers/NativeViewGestureHandler.ts +55 -0
- package/src/handlers/PanGestureHandler.ts +325 -0
- package/src/handlers/PinchGestureHandler.ts +48 -0
- package/src/handlers/PressabilityDebugView.tsx +2 -0
- package/src/handlers/PressabilityDebugView.web.tsx +4 -0
- package/src/handlers/RotationGestureHandler.ts +48 -0
- package/src/handlers/TapGestureHandler.ts +94 -0
- package/src/handlers/createHandler.tsx +547 -0
- package/src/handlers/createNativeWrapper.tsx +80 -0
- package/src/handlers/gestureHandlerCommon.ts +244 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +106 -0
- package/src/handlers/gestures/GestureDetector.tsx +818 -0
- package/src/handlers/gestures/eventReceiver.ts +172 -0
- package/src/handlers/gestures/flingGesture.ts +27 -0
- package/src/handlers/gestures/forceTouchGesture.ts +74 -0
- package/src/handlers/gestures/gesture.ts +341 -0
- package/src/handlers/gestures/gestureComposition.ts +122 -0
- package/src/handlers/gestures/gestureObjects.ts +84 -0
- package/src/handlers/gestures/gestureStateManager.ts +62 -0
- package/src/handlers/gestures/gestureStateManager.web.ts +24 -0
- package/src/handlers/gestures/hoverGesture.ts +83 -0
- package/src/handlers/gestures/longPressGesture.ts +28 -0
- package/src/handlers/gestures/manualGesture.ts +31 -0
- package/src/handlers/gestures/nativeGesture.ts +27 -0
- package/src/handlers/gestures/panGesture.ts +152 -0
- package/src/handlers/gestures/pinchGesture.ts +51 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +56 -0
- package/src/handlers/gestures/rotationGesture.ts +51 -0
- package/src/handlers/gestures/tapGesture.ts +53 -0
- package/src/handlers/handlersRegistry.ts +60 -0
- package/src/index.ts +174 -0
- package/src/init.ts +18 -0
- package/src/jestUtils/index.ts +1 -0
- package/src/jestUtils/jestUtils.ts +505 -0
- package/src/mocks.ts +67 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.kepler.ts +27 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +20 -0
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +7 -0
- package/src/typeUtils.ts +1 -0
- package/src/utils.ts +62 -0
- package/src/web/constants.ts +8 -0
- package/src/web/detectors/RotationGestureDetector.ts +168 -0
- package/src/web/detectors/ScaleGestureDetector.ts +172 -0
- package/src/web/handlers/FlingGestureHandler.ts +161 -0
- package/src/web/handlers/GestureHandler.ts +850 -0
- package/src/web/handlers/HoverGestureHandler.ts +43 -0
- package/src/web/handlers/LongPressGestureHandler.ts +125 -0
- package/src/web/handlers/ManualGestureHandler.ts +43 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +167 -0
- package/src/web/handlers/PanGestureHandler.ts +485 -0
- package/src/web/handlers/PinchGestureHandler.ts +158 -0
- package/src/web/handlers/RotationGestureHandler.ts +172 -0
- package/src/web/handlers/TapGestureHandler.ts +273 -0
- package/src/web/interfaces.ts +166 -0
- package/src/web/tools/CircularBuffer.ts +42 -0
- package/src/web/tools/EventManager.ts +104 -0
- package/src/web/tools/GestureHandlerDelegate.ts +23 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +398 -0
- package/src/web/tools/GestureHandlerWebDelegate.ts +115 -0
- package/src/web/tools/InteractionManager.ts +123 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/NodeManager.ts +43 -0
- package/src/web/tools/PointerEventManager.ts +193 -0
- package/src/web/tools/PointerTracker.ts +240 -0
- package/src/web/tools/TouchEventManager.ts +167 -0
- package/src/web/tools/VelocityTracker.ts +98 -0
- package/src/web/utils.ts +8 -0
- package/src/web_hammer/DiscreteGestureHandler.ts +82 -0
- package/src/web_hammer/DraggingGestureHandler.ts +34 -0
- package/src/web_hammer/Errors.ts +7 -0
- package/src/web_hammer/FlingGestureHandler.ts +134 -0
- package/src/web_hammer/GestureHandler.ts +598 -0
- package/src/web_hammer/IndiscreteGestureHandler.ts +33 -0
- package/src/web_hammer/LongPressGestureHandler.ts +56 -0
- package/src/web_hammer/NativeViewGestureHandler.ts +47 -0
- package/src/web_hammer/NodeManager.ts +42 -0
- package/src/web_hammer/PanGestureHandler.ts +226 -0
- package/src/web_hammer/PinchGestureHandler.ts +25 -0
- package/src/web_hammer/PressGestureHandler.ts +167 -0
- package/src/web_hammer/RotationGestureHandler.ts +25 -0
- package/src/web_hammer/TapGestureHandler.ts +172 -0
- package/src/web_hammer/constants.ts +48 -0
- package/src/web_hammer/utils.ts +24 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { EventTypes, MouseButtons, PointerType, TouchEventType } from '../interfaces';
|
|
2
|
+
import EventManager from './EventManager';
|
|
3
|
+
import { isPointerInBounds } from '../utils';
|
|
4
|
+
export default class TouchEventManager extends EventManager {
|
|
5
|
+
setListeners() {
|
|
6
|
+
this.view.addEventListener('touchstart', event => {
|
|
7
|
+
for (let i = 0; i < event.changedTouches.length; ++i) {
|
|
8
|
+
const adaptedEvent = this.mapEvent(event, EventTypes.DOWN, i, TouchEventType.DOWN);
|
|
9
|
+
|
|
10
|
+
// Here we skip stylus, because in case of anything different than touch we want to handle it by using PointerEvents
|
|
11
|
+
// If we leave stylus to send touch events, handlers will receive every action twice
|
|
12
|
+
if (!isPointerInBounds(this.view, {
|
|
13
|
+
x: adaptedEvent.x,
|
|
14
|
+
y: adaptedEvent.y
|
|
15
|
+
}) ||
|
|
16
|
+
//@ts-ignore touchType field does exist
|
|
17
|
+
event.changedTouches[i].touchType === 'stylus') {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
this.markAsInBounds(adaptedEvent.pointerId);
|
|
21
|
+
if (++this.activePointersCounter > 1) {
|
|
22
|
+
adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_DOWN;
|
|
23
|
+
this.onPointerAdd(adaptedEvent);
|
|
24
|
+
} else {
|
|
25
|
+
this.onPointerDown(adaptedEvent);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.view.addEventListener('touchmove', event => {
|
|
30
|
+
for (let i = 0; i < event.changedTouches.length; ++i) {
|
|
31
|
+
const adaptedEvent = this.mapEvent(event, EventTypes.MOVE, i, TouchEventType.MOVE);
|
|
32
|
+
//@ts-ignore touchType field does exist
|
|
33
|
+
if (event.changedTouches[i].touchType === 'stylus') {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const inBounds = isPointerInBounds(this.view, {
|
|
37
|
+
x: adaptedEvent.x,
|
|
38
|
+
y: adaptedEvent.y
|
|
39
|
+
});
|
|
40
|
+
const pointerIndex = this.pointersInBounds.indexOf(adaptedEvent.pointerId);
|
|
41
|
+
if (inBounds) {
|
|
42
|
+
if (pointerIndex < 0) {
|
|
43
|
+
adaptedEvent.eventType = EventTypes.ENTER;
|
|
44
|
+
this.onPointerEnter(adaptedEvent);
|
|
45
|
+
this.markAsInBounds(adaptedEvent.pointerId);
|
|
46
|
+
} else {
|
|
47
|
+
this.onPointerMove(adaptedEvent);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
if (pointerIndex >= 0) {
|
|
51
|
+
adaptedEvent.eventType = EventTypes.LEAVE;
|
|
52
|
+
this.onPointerLeave(adaptedEvent);
|
|
53
|
+
this.markAsOutOfBounds(adaptedEvent.pointerId);
|
|
54
|
+
} else {
|
|
55
|
+
this.onPointerOutOfBounds(adaptedEvent);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.view.addEventListener('touchend', event => {
|
|
61
|
+
for (let i = 0; i < event.changedTouches.length; ++i) {
|
|
62
|
+
// When we call reset on gesture handlers, it also resets their event managers
|
|
63
|
+
// In some handlers (like RotationGestureHandler) reset is called before all pointers leave view
|
|
64
|
+
// This means, that activePointersCounter will be set to 0, while there are still remaining pointers on view
|
|
65
|
+
// Removing them will end in activePointersCounter going below 0, therefore handlers won't behave properly
|
|
66
|
+
if (this.activePointersCounter === 0) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//@ts-ignore touchType field does exist
|
|
71
|
+
if (event.changedTouches[i].touchType === 'stylus') {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const adaptedEvent = this.mapEvent(event, EventTypes.UP, i, TouchEventType.UP);
|
|
75
|
+
this.markAsOutOfBounds(adaptedEvent.pointerId);
|
|
76
|
+
if (--this.activePointersCounter > 0) {
|
|
77
|
+
adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_UP;
|
|
78
|
+
this.onPointerRemove(adaptedEvent);
|
|
79
|
+
} else {
|
|
80
|
+
this.onPointerUp(adaptedEvent);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
this.view.addEventListener('touchcancel', event => {
|
|
85
|
+
for (let i = 0; i < event.changedTouches.length; ++i) {
|
|
86
|
+
const adaptedEvent = this.mapEvent(event, EventTypes.CANCEL, i, TouchEventType.CANCELLED);
|
|
87
|
+
|
|
88
|
+
//@ts-ignore touchType field does exist
|
|
89
|
+
if (event.changedTouches[i].touchType === 'stylus') {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
this.onPointerCancel(adaptedEvent);
|
|
93
|
+
this.markAsOutOfBounds(adaptedEvent.pointerId);
|
|
94
|
+
this.activePointersCounter = 0;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
mapEvent(event, eventType, index, touchEventType) {
|
|
99
|
+
const rect = this.view.getBoundingClientRect();
|
|
100
|
+
const clientX = event.changedTouches[index].clientX;
|
|
101
|
+
const clientY = event.changedTouches[index].clientY;
|
|
102
|
+
return {
|
|
103
|
+
x: clientX,
|
|
104
|
+
y: clientY,
|
|
105
|
+
offsetX: clientX - rect.left,
|
|
106
|
+
offsetY: clientY - rect.top,
|
|
107
|
+
pointerId: event.changedTouches[index].identifier,
|
|
108
|
+
eventType: eventType,
|
|
109
|
+
pointerType: PointerType.TOUCH,
|
|
110
|
+
buttons: MouseButtons.NONE,
|
|
111
|
+
time: event.timeStamp,
|
|
112
|
+
allTouches: event.touches,
|
|
113
|
+
changedTouches: event.changedTouches,
|
|
114
|
+
touchEventType: touchEventType
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=TouchEventManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EventTypes","MouseButtons","PointerType","TouchEventType","EventManager","isPointerInBounds","TouchEventManager","setListeners","view","addEventListener","event","i","changedTouches","length","adaptedEvent","mapEvent","DOWN","x","y","touchType","markAsInBounds","pointerId","activePointersCounter","eventType","ADDITIONAL_POINTER_DOWN","onPointerAdd","onPointerDown","MOVE","inBounds","pointerIndex","pointersInBounds","indexOf","ENTER","onPointerEnter","onPointerMove","LEAVE","onPointerLeave","markAsOutOfBounds","onPointerOutOfBounds","UP","ADDITIONAL_POINTER_UP","onPointerRemove","onPointerUp","CANCEL","CANCELLED","onPointerCancel","index","touchEventType","rect","getBoundingClientRect","clientX","clientY","offsetX","left","offsetY","top","identifier","pointerType","TOUCH","buttons","NONE","time","timeStamp","allTouches","touches"],"sources":["TouchEventManager.ts"],"sourcesContent":["import {\n AdaptedEvent,\n EventTypes,\n MouseButtons,\n PointerType,\n TouchEventType,\n} from '../interfaces';\nimport EventManager from './EventManager';\nimport { isPointerInBounds } from '../utils';\n\nexport default class TouchEventManager extends EventManager<HTMLElement> {\n public setListeners(): void {\n this.view.addEventListener('touchstart', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.DOWN,\n i,\n TouchEventType.DOWN\n );\n\n // Here we skip stylus, because in case of anything different than touch we want to handle it by using PointerEvents\n // If we leave stylus to send touch events, handlers will receive every action twice\n if (\n !isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n }) ||\n //@ts-ignore touchType field does exist\n event.changedTouches[i].touchType === 'stylus'\n ) {\n continue;\n }\n\n this.markAsInBounds(adaptedEvent.pointerId);\n\n if (++this.activePointersCounter > 1) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_DOWN;\n this.onPointerAdd(adaptedEvent);\n } else {\n this.onPointerDown(adaptedEvent);\n }\n }\n });\n\n this.view.addEventListener('touchmove', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.MOVE,\n i,\n TouchEventType.MOVE\n );\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const inBounds: boolean = isPointerInBounds(this.view, {\n x: adaptedEvent.x,\n y: adaptedEvent.y,\n });\n\n const pointerIndex: number = this.pointersInBounds.indexOf(\n adaptedEvent.pointerId\n );\n\n if (inBounds) {\n if (pointerIndex < 0) {\n adaptedEvent.eventType = EventTypes.ENTER;\n this.onPointerEnter(adaptedEvent);\n this.markAsInBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerMove(adaptedEvent);\n }\n } else {\n if (pointerIndex >= 0) {\n adaptedEvent.eventType = EventTypes.LEAVE;\n this.onPointerLeave(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n } else {\n this.onPointerOutOfBounds(adaptedEvent);\n }\n }\n }\n });\n\n this.view.addEventListener('touchend', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n // When we call reset on gesture handlers, it also resets their event managers\n // In some handlers (like RotationGestureHandler) reset is called before all pointers leave view\n // This means, that activePointersCounter will be set to 0, while there are still remaining pointers on view\n // Removing them will end in activePointersCounter going below 0, therefore handlers won't behave properly\n if (this.activePointersCounter === 0) {\n break;\n }\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.UP,\n i,\n TouchEventType.UP\n );\n\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n\n if (--this.activePointersCounter > 0) {\n adaptedEvent.eventType = EventTypes.ADDITIONAL_POINTER_UP;\n this.onPointerRemove(adaptedEvent);\n } else {\n this.onPointerUp(adaptedEvent);\n }\n }\n });\n\n this.view.addEventListener('touchcancel', (event: TouchEvent) => {\n for (let i = 0; i < event.changedTouches.length; ++i) {\n const adaptedEvent: AdaptedEvent = this.mapEvent(\n event,\n EventTypes.CANCEL,\n i,\n TouchEventType.CANCELLED\n );\n\n //@ts-ignore touchType field does exist\n if (event.changedTouches[i].touchType === 'stylus') {\n continue;\n }\n\n this.onPointerCancel(adaptedEvent);\n this.markAsOutOfBounds(adaptedEvent.pointerId);\n this.activePointersCounter = 0;\n }\n });\n }\n\n protected mapEvent(\n event: TouchEvent,\n eventType: EventTypes,\n index: number,\n touchEventType: TouchEventType\n ): AdaptedEvent {\n const rect = this.view.getBoundingClientRect();\n const clientX = event.changedTouches[index].clientX;\n const clientY = event.changedTouches[index].clientY;\n\n return {\n x: clientX,\n y: clientY,\n offsetX: clientX - rect.left,\n offsetY: clientY - rect.top,\n pointerId: event.changedTouches[index].identifier,\n eventType: eventType,\n pointerType: PointerType.TOUCH,\n buttons: MouseButtons.NONE,\n time: event.timeStamp,\n allTouches: event.touches,\n changedTouches: event.changedTouches,\n touchEventType: touchEventType,\n };\n }\n}\n"],"mappings":"AAAA,SAEEA,UAAU,EACVC,YAAY,EACZC,WAAW,EACXC,cAAc,QACT,eAAe;AACtB,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,iBAAiB,QAAQ,UAAU;AAE5C,eAAe,MAAMC,iBAAiB,SAASF,YAAY,CAAc;EAChEG,YAAYA,CAAA,EAAS;IAC1B,IAAI,CAACC,IAAI,CAACC,gBAAgB,CAAC,YAAY,EAAGC,KAAiB,IAAK;MAC9D,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,KAAK,CAACE,cAAc,CAACC,MAAM,EAAE,EAAEF,CAAC,EAAE;QACpD,MAAMG,YAA0B,GAAG,IAAI,CAACC,QAAQ,CAC9CL,KAAK,EACLV,UAAU,CAACgB,IAAI,EACfL,CAAC,EACDR,cAAc,CAACa,IACjB,CAAC;;QAED;QACA;QACA,IACE,CAACX,iBAAiB,CAAC,IAAI,CAACG,IAAI,EAAE;UAC5BS,CAAC,EAAEH,YAAY,CAACG,CAAC;UACjBC,CAAC,EAAEJ,YAAY,CAACI;QAClB,CAAC,CAAC;QACF;QACAR,KAAK,CAACE,cAAc,CAACD,CAAC,CAAC,CAACQ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,KAAK,CAACsD,OAAO;MACzBpD,cAAc,EAAEF,KAAK,CAACE,cAAc;MACpCmC,cAAc,EAAEA;IAClB,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import CircularBuffer from './CircularBuffer';
|
|
5
|
+
import LeastSquareSolver from './LeastSquareSolver';
|
|
6
|
+
export default class VelocityTracker {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "assumePointerMoveStoppedMilliseconds", 40);
|
|
9
|
+
_defineProperty(this, "historySize", 20);
|
|
10
|
+
_defineProperty(this, "horizonMilliseconds", 300);
|
|
11
|
+
_defineProperty(this, "minSampleSize", 3);
|
|
12
|
+
_defineProperty(this, "samples", void 0);
|
|
13
|
+
this.samples = new CircularBuffer(this.historySize);
|
|
14
|
+
}
|
|
15
|
+
add(event) {
|
|
16
|
+
this.samples.push(event);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/// Returns an estimate of the velocity of the object being tracked by the
|
|
20
|
+
/// tracker given the current information available to the tracker.
|
|
21
|
+
///
|
|
22
|
+
/// Information is added using [addPosition].
|
|
23
|
+
///
|
|
24
|
+
/// Returns null if there is no data on which to base an estimate.
|
|
25
|
+
getVelocityEstimate() {
|
|
26
|
+
const x = [];
|
|
27
|
+
const y = [];
|
|
28
|
+
const w = [];
|
|
29
|
+
const time = [];
|
|
30
|
+
let sampleCount = 0;
|
|
31
|
+
let index = this.samples.size - 1;
|
|
32
|
+
const newestSample = this.samples.get(index);
|
|
33
|
+
if (!newestSample) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
let previousSample = newestSample;
|
|
37
|
+
|
|
38
|
+
// Starting with the most recent PointAtTime sample, iterate backwards while
|
|
39
|
+
// the samples represent continuous motion.
|
|
40
|
+
while (sampleCount < this.samples.size) {
|
|
41
|
+
const sample = this.samples.get(index);
|
|
42
|
+
const age = newestSample.time - sample.time;
|
|
43
|
+
const delta = Math.abs(sample.time - previousSample.time);
|
|
44
|
+
previousSample = sample;
|
|
45
|
+
if (age > this.horizonMilliseconds || delta > this.assumePointerMoveStoppedMilliseconds) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
x.push(sample.x);
|
|
49
|
+
y.push(sample.y);
|
|
50
|
+
w.push(1);
|
|
51
|
+
time.push(-age);
|
|
52
|
+
sampleCount++;
|
|
53
|
+
index--;
|
|
54
|
+
}
|
|
55
|
+
if (sampleCount >= this.minSampleSize) {
|
|
56
|
+
const xSolver = new LeastSquareSolver(time, x, w);
|
|
57
|
+
const xFit = xSolver.solve(2);
|
|
58
|
+
if (xFit !== null) {
|
|
59
|
+
const ySolver = new LeastSquareSolver(time, y, w);
|
|
60
|
+
const yFit = ySolver.solve(2);
|
|
61
|
+
if (yFit !== null) {
|
|
62
|
+
const xVelocity = xFit.coefficients[1] * 1000;
|
|
63
|
+
const yVelocity = yFit.coefficients[1] * 1000;
|
|
64
|
+
return [xVelocity, yVelocity];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
getVelocity() {
|
|
71
|
+
const estimate = this.getVelocityEstimate();
|
|
72
|
+
if (estimate !== null) {
|
|
73
|
+
return estimate;
|
|
74
|
+
}
|
|
75
|
+
return [0, 0];
|
|
76
|
+
}
|
|
77
|
+
reset() {
|
|
78
|
+
this.samples.clear();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=VelocityTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CircularBuffer","LeastSquareSolver","VelocityTracker","constructor","_defineProperty","samples","historySize","add","event","push","getVelocityEstimate","x","y","w","time","sampleCount","index","size","newestSample","get","previousSample","sample","age","delta","Math","abs","horizonMilliseconds","assumePointerMoveStoppedMilliseconds","minSampleSize","xSolver","xFit","solve","ySolver","yFit","xVelocity","coefficients","yVelocity","getVelocity","estimate","reset","clear"],"sources":["VelocityTracker.ts"],"sourcesContent":["import { AdaptedEvent } from '../interfaces';\nimport CircularBuffer from './CircularBuffer';\nimport LeastSquareSolver from './LeastSquareSolver';\n\nexport default class VelocityTracker {\n private assumePointerMoveStoppedMilliseconds = 40;\n private historySize = 20;\n private horizonMilliseconds = 300;\n private minSampleSize = 3;\n\n private samples: CircularBuffer<AdaptedEvent>;\n\n constructor() {\n this.samples = new CircularBuffer<AdaptedEvent>(this.historySize);\n }\n\n public add(event: AdaptedEvent): void {\n this.samples.push(event);\n }\n\n /// Returns an estimate of the velocity of the object being tracked by the\n /// tracker given the current information available to the tracker.\n ///\n /// Information is added using [addPosition].\n ///\n /// Returns null if there is no data on which to base an estimate.\n private getVelocityEstimate(): [number, number] | null {\n const x = [];\n const y = [];\n const w = [];\n const time = [];\n\n let sampleCount = 0;\n let index = this.samples.size - 1;\n const newestSample = this.samples.get(index);\n if (!newestSample) {\n return null;\n }\n\n let previousSample = newestSample;\n\n // Starting with the most recent PointAtTime sample, iterate backwards while\n // the samples represent continuous motion.\n while (sampleCount < this.samples.size) {\n const sample = this.samples.get(index);\n\n const age = newestSample.time - sample.time;\n const delta = Math.abs(sample.time - previousSample.time);\n previousSample = sample;\n\n if (\n age > this.horizonMilliseconds ||\n delta > this.assumePointerMoveStoppedMilliseconds\n ) {\n break;\n }\n\n x.push(sample.x);\n y.push(sample.y);\n w.push(1);\n time.push(-age);\n\n sampleCount++;\n index--;\n }\n\n if (sampleCount >= this.minSampleSize) {\n const xSolver = new LeastSquareSolver(time, x, w);\n const xFit = xSolver.solve(2);\n\n if (xFit !== null) {\n const ySolver = new LeastSquareSolver(time, y, w);\n const yFit = ySolver.solve(2);\n\n if (yFit !== null) {\n const xVelocity = xFit.coefficients[1] * 1000;\n const yVelocity = yFit.coefficients[1] * 1000;\n\n return [xVelocity, yVelocity];\n }\n }\n }\n\n return null;\n }\n\n public getVelocity(): [number, number] {\n const estimate = this.getVelocityEstimate();\n if (estimate !== null) {\n return estimate;\n }\n return [0, 0];\n }\n\n public reset(): void {\n this.samples.clear();\n }\n}\n"],"mappings":";;;AACA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,iBAAiB,MAAM,qBAAqB;AAEnD,eAAe,MAAMC,eAAe,CAAC;EAQnCC,WAAWA,CAAA,EAAG;IAAAC,eAAA,+CAPiC,EAAE;IAAAA,eAAA,sBAC3B,EAAE;IAAAA,eAAA,8BACM,GAAG;IAAAA,eAAA,wBACT,CAAC;IAAAA,eAAA;IAKvB,IAAI,CAACC,OAAO,GAAG,IAAIL,cAAc,CAAe,IAAI,CAACM,WAAW,CAAC;EACnE;EAEOC,GAAGA,CAACC,KAAmB,EAAQ;IACpC,IAAI,CAACH,OAAO,CAACI,IAAI,CAACD,KAAK,CAAC;EAC1B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACQE,mBAAmBA,CAAA,EAA4B;IACrD,MAAMC,CAAC,GAAG,EAAE;IACZ,MAAMC,CAAC,GAAG,EAAE;IACZ,MAAMC,CAAC,GAAG,EAAE;IACZ,MAAMC,IAAI,GAAG,EAAE;IAEf,IAAIC,WAAW,GAAG,CAAC;IACnB,IAAIC,KAAK,GAAG,IAAI,CAACX,OAAO,CAACY,IAAI,GAAG,CAAC;IACjC,MAAMC,YAAY,GAAG,IAAI,CAACb,OAAO,CAACc,GAAG,CAACH,KAAK,CAAC;IAC5C,IAAI,CAACE,YAAY,EAAE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AAC,CAAC,GAAG,IAAI;UAC7C,MAAMC,SAAS,GAAGH,IAAI,CAACE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI;UAE7C,OAAO,CAACD,SAAS,EAAEE,SAAS,CAAC;QAC/B;MACF;IACF;IAEA,OAAO,IAAI;EACb;EAEOC,WAAWA,CAAA,EAAqB;IACrC,MAAMC,QAAQ,GAAG,IAAI,CAAC5B,mBAAmB,CAAC,CAAC;IAC3C,IAAI4B,QAAQ,KAAK,IAAI,EAAE;MACrB,OAAOA,QAAQ;IACjB;IACA,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;EACf;EAEOC,KAAKA,CAAA,EAAS;IACnB,IAAI,CAAClC,OAAO,CAACmC,KAAK,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isPointerInBounds","view","x","y","rect","getBoundingClientRect","left","right","top","bottom"],"sources":["utils.ts"],"sourcesContent":["export function isPointerInBounds(\n view: HTMLElement,\n { x, y }: { x: number; y: number }\n): boolean {\n const rect: DOMRect = view.getBoundingClientRect();\n\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n}\n"],"mappings":"AAAA,OAAO,SAASA,iBAAiBA,CAC/BC,IAAiB,EACjB;EAAEC,CAAC;EAAEC;AAA4B,CAAC,EACzB;EACT,MAAMC,IAAa,GAAGH,IAAI,CAACI,qBAAqB,CAAC,CAAC;EAElD,OAAOH,CAAC,IAAIE,IAAI,CAACE,IAAI,IAAIJ,CAAC,IAAIE,IAAI,CAACG,KAAK,IAAIJ,CAAC,IAAIC,IAAI,CAACI,GAAG,IAAIL,CAAC,IAAIC,IAAI,CAACK,MAAM;AAC/E","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* eslint-disable eslint-comments/no-unlimited-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import GestureHandler from './GestureHandler';
|
|
4
|
+
import { TEST_MAX_IF_NOT_NAN } from './utils';
|
|
5
|
+
class DiscreteGestureHandler extends GestureHandler {
|
|
6
|
+
get isDiscrete() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
get shouldEnableGestureOnSetup() {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
shouldFailUnderCustomCriteria({
|
|
13
|
+
x,
|
|
14
|
+
y,
|
|
15
|
+
deltaX,
|
|
16
|
+
deltaY
|
|
17
|
+
}, {
|
|
18
|
+
maxDeltaX,
|
|
19
|
+
maxDeltaY,
|
|
20
|
+
maxDistSq,
|
|
21
|
+
shouldCancelWhenOutside
|
|
22
|
+
}) {
|
|
23
|
+
if (shouldCancelWhenOutside) {
|
|
24
|
+
if (!this.isPointInView({
|
|
25
|
+
x,
|
|
26
|
+
y
|
|
27
|
+
})) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return TEST_MAX_IF_NOT_NAN(Math.abs(deltaX), maxDeltaX) || TEST_MAX_IF_NOT_NAN(Math.abs(deltaY), maxDeltaY) || TEST_MAX_IF_NOT_NAN(Math.abs(deltaY * deltaY + deltaX * deltaX), maxDistSq);
|
|
32
|
+
}
|
|
33
|
+
transformNativeEvent({
|
|
34
|
+
center: {
|
|
35
|
+
x,
|
|
36
|
+
y
|
|
37
|
+
}
|
|
38
|
+
}) {
|
|
39
|
+
// @ts-ignore FIXME(TS)
|
|
40
|
+
const rect = this.view.getBoundingClientRect();
|
|
41
|
+
return {
|
|
42
|
+
absoluteX: x,
|
|
43
|
+
absoluteY: y,
|
|
44
|
+
x: x - rect.left,
|
|
45
|
+
y: y - rect.top
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
isGestureEnabledForEvent({
|
|
49
|
+
minPointers,
|
|
50
|
+
maxPointers,
|
|
51
|
+
maxDeltaX,
|
|
52
|
+
maxDeltaY,
|
|
53
|
+
maxDistSq,
|
|
54
|
+
shouldCancelWhenOutside
|
|
55
|
+
}, _recognizer, {
|
|
56
|
+
maxPointers: pointerLength,
|
|
57
|
+
center,
|
|
58
|
+
deltaX,
|
|
59
|
+
deltaY
|
|
60
|
+
}) {
|
|
61
|
+
const validPointerCount = pointerLength >= minPointers && pointerLength <= maxPointers;
|
|
62
|
+
if (this.shouldFailUnderCustomCriteria({
|
|
63
|
+
...center,
|
|
64
|
+
deltaX,
|
|
65
|
+
deltaY
|
|
66
|
+
}, {
|
|
67
|
+
maxDeltaX,
|
|
68
|
+
maxDeltaY,
|
|
69
|
+
maxDistSq,
|
|
70
|
+
shouldCancelWhenOutside
|
|
71
|
+
}) ||
|
|
72
|
+
// A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)
|
|
73
|
+
// but if the gesture is running and the user adds or subtracts another pointer then it should fail.
|
|
74
|
+
!validPointerCount && this.isGestureRunning) {
|
|
75
|
+
return {
|
|
76
|
+
failed: true
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
success: validPointerCount
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export default DiscreteGestureHandler;
|
|
85
|
+
//# sourceMappingURL=DiscreteGestureHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GestureHandler","TEST_MAX_IF_NOT_NAN","DiscreteGestureHandler","isDiscrete","shouldEnableGestureOnSetup","shouldFailUnderCustomCriteria","x","y","deltaX","deltaY","maxDeltaX","maxDeltaY","maxDistSq","shouldCancelWhenOutside","isPointInView","Math","abs","transformNativeEvent","center","rect","view","getBoundingClientRect","absoluteX","absoluteY","left","top","isGestureEnabledForEvent","minPointers","maxPointers","_recognizer","pointerLength","validPointerCount","isGestureRunning","failed","success"],"sources":["DiscreteGestureHandler.ts"],"sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler from './GestureHandler';\nimport { TEST_MAX_IF_NOT_NAN } from './utils';\n\nabstract class DiscreteGestureHandler extends GestureHandler {\n get isDiscrete() {\n return true;\n }\n\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n shouldFailUnderCustomCriteria(\n { x, y, deltaX, deltaY }: any,\n { maxDeltaX, maxDeltaY, maxDistSq, shouldCancelWhenOutside }: any\n ) {\n if (shouldCancelWhenOutside) {\n if (!this.isPointInView({ x, y })) {\n return true;\n }\n }\n return (\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaX), maxDeltaX) ||\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaY), maxDeltaY) ||\n TEST_MAX_IF_NOT_NAN(\n Math.abs(deltaY * deltaY + deltaX * deltaX),\n maxDistSq\n )\n );\n }\n\n transformNativeEvent({ center: { x, y } }: any) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n\n return {\n absoluteX: x,\n absoluteY: y,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n\n isGestureEnabledForEvent(\n {\n minPointers,\n maxPointers,\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }: any,\n _recognizer: any,\n { maxPointers: pointerLength, center, deltaX, deltaY }: any\n ) {\n const validPointerCount =\n pointerLength >= minPointers && pointerLength <= maxPointers;\n\n if (\n this.shouldFailUnderCustomCriteria(\n { ...center, deltaX, deltaY },\n {\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }\n ) ||\n // A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)\n // but if the gesture is running and the user adds or subtracts another pointer then it should fail.\n (!validPointerCount && this.isGestureRunning)\n ) {\n return { failed: true };\n }\n\n return { success: validPointerCount };\n }\n}\n\nexport default DiscreteGestureHandler;\n"],"mappings":"AAAA;AACA;AACA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,SAAS;AAE7C,MAAeC,sBAAsB,SAASF,cAAc,CAAC;EAC3D,IAAIG,UAAUA,CAAA,EAAG;IACf,OAAO,IAA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,WAAW,IAAIG,aAAa,IAAIF,WAAW;IAE9D,IACE,IAAI,CAACvB,6BAA6B,CAChC;MAAE,GAAGa,MAAM;MAAEV,MAAM;MAAEC;IAAO,CAAC,EAC7B;MACEC,SAAS;MACTC,SAAS;MACTC,SAAS;MACTC;IACF,CACF,CAAC;IACD;IACA;IACC,CAACkB,iBAAiB,IAAI,IAAI,CAACC,gBAAiB,EAC7C;MACA,OAAO;QAAEC,MAAM,EAAE;MAAK,CAAC;IACzB;IAEA,OAAO;MAAEC,OAAO,EAAEH;IAAkB,CAAC;EACvC;AACF;AAEA,eAAe7B,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable eslint-comments/no-unlimited-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import GestureHandler from './GestureHandler';
|
|
4
|
+
import { PixelRatio } from 'react-native';
|
|
5
|
+
class DraggingGestureHandler extends GestureHandler {
|
|
6
|
+
get shouldEnableGestureOnSetup() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
transformNativeEvent({
|
|
10
|
+
deltaX,
|
|
11
|
+
deltaY,
|
|
12
|
+
velocityX,
|
|
13
|
+
velocityY,
|
|
14
|
+
center: {
|
|
15
|
+
x,
|
|
16
|
+
y
|
|
17
|
+
}
|
|
18
|
+
}) {
|
|
19
|
+
// @ts-ignore FIXME(TS)
|
|
20
|
+
const rect = this.view.getBoundingClientRect();
|
|
21
|
+
const ratio = PixelRatio.get();
|
|
22
|
+
return {
|
|
23
|
+
translationX: deltaX - (this.__initialX || 0),
|
|
24
|
+
translationY: deltaY - (this.__initialY || 0),
|
|
25
|
+
absoluteX: x,
|
|
26
|
+
absoluteY: y,
|
|
27
|
+
velocityX: velocityX * ratio,
|
|
28
|
+
velocityY: velocityY * ratio,
|
|
29
|
+
x: x - rect.left,
|
|
30
|
+
y: y - rect.top
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default DraggingGestureHandler;
|
|
35
|
+
//# sourceMappingURL=DraggingGestureHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GestureHandler","PixelRatio","DraggingGestureHandler","shouldEnableGestureOnSetup","transformNativeEvent","deltaX","deltaY","velocityX","velocityY","center","x","y","rect","view","getBoundingClientRect","ratio","get","translationX","__initialX","translationY","__initialY","absoluteX","absoluteY","left","top"],"sources":["DraggingGestureHandler.ts"],"sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler, { HammerInputExt } from './GestureHandler';\nimport { PixelRatio } from 'react-native';\n\nabstract class DraggingGestureHandler extends GestureHandler {\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n transformNativeEvent({\n deltaX,\n deltaY,\n velocityX,\n velocityY,\n center: { x, y },\n }: HammerInputExt) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n const ratio = PixelRatio.get();\n return {\n translationX: deltaX - (this.__initialX || 0),\n translationY: deltaY - (this.__initialY || 0),\n absoluteX: x,\n absoluteY: y,\n velocityX: velocityX * ratio,\n velocityY: velocityY * ratio,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n}\n\nexport default DraggingGestureHandler;\n"],"mappings":"AAAA;AACA;AACA,OAAOA,cAAc,MAA0B,kBAAkB;AACjE,SAASC,UAAU,QAAQ,cAAc;AAEzC,MAAeC,sBAAsB,SAASF,cAAc,CAAC;EAC3D,IAAIG,0BAA0BA,CAAA,EAAG;IAC/B,OAAO,IAAI;EACb;EAEAC,oBAAoBA,CAAC;IACnBC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,SAAS;IACTC,MAAM,EAAE;MAAEC,CAAC;MAAEC;IAAE;EACD,CAAC,EAAE;IACjB;IACA,MAAMC,IAAI,GAAG,IAAI,CAACC,IAAI,CAAEC,qBAAqB,CAAC,CAAC;IAC/C,MAAMC,KAAK,GAAGd,UAAU,CAACe,GAAG,CAAC,CAAC;IAC9B,OAAO;MACLC,YAAY,EAAEZ,MAAM,IAAI,IAAI,CAACa,UAAU,IAAI,CAAC,CAAC;MAC7CC,YAAY,EAAEb,MAAM,IAAI,IAAI,CAACc,UAAU,IAAI,CAAC,CAAC;MAC7CC,SAAS,EAAEX,CAAC;MACZY,SAAS,EAAEX,CAAC;MACZJ,SAAS,EAAEA,SAAS,GAAGQ,KAAK;MAC5BP,SAAS,EAAEA,SAAS,GAAGO,KAAK;MAC5BL,CAAC,EAAEA,CAAC,GAAGE,IAAI,CAACW,IAAI;MAChBZ,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACY;IACd,CAAC;EACH;AACF;AAEA,eAAetB,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GesturePropError","Error","constructor","name","value","expectedType"],"sources":["Errors.ts"],"sourcesContent":["export class GesturePropError extends Error {\n constructor(name: string, value: unknown, expectedType: string) {\n super(\n `Invalid property \\`${name}: ${value}\\` expected \\`${expectedType}\\``\n );\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,SAASC,KAAK,CAAC;EAC1CC,WAAWA,CAACC,IAAY,EAAEC,KAAc,EAAEC,YAAoB,EAAE;IAC9D,KAAK,CACH,sBAAsBF,IAAI,KAAKC,KAAK,iBAAiBC,YAAY,IACnE,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* eslint-disable eslint-comments/no-unlimited-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import Hammer from '@egjs/hammerjs';
|
|
4
|
+
import { Direction } from './constants';
|
|
5
|
+
import { GesturePropError } from './Errors';
|
|
6
|
+
import DraggingGestureHandler from './DraggingGestureHandler';
|
|
7
|
+
import { isnan } from './utils';
|
|
8
|
+
class FlingGestureHandler extends DraggingGestureHandler {
|
|
9
|
+
get name() {
|
|
10
|
+
return 'swipe';
|
|
11
|
+
}
|
|
12
|
+
get NativeGestureClass() {
|
|
13
|
+
return Hammer.Swipe;
|
|
14
|
+
}
|
|
15
|
+
onGestureActivated(event) {
|
|
16
|
+
this.sendEvent({
|
|
17
|
+
...event,
|
|
18
|
+
eventType: Hammer.INPUT_MOVE,
|
|
19
|
+
isFinal: false,
|
|
20
|
+
isFirst: true
|
|
21
|
+
});
|
|
22
|
+
this.isGestureRunning = false;
|
|
23
|
+
this.hasGestureFailed = false;
|
|
24
|
+
this.sendEvent({
|
|
25
|
+
...event,
|
|
26
|
+
eventType: Hammer.INPUT_END,
|
|
27
|
+
isFinal: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
onRawEvent(ev) {
|
|
31
|
+
super.onRawEvent(ev);
|
|
32
|
+
if (this.hasGestureFailed) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Hammer doesn't send a `cancel` event for taps.
|
|
36
|
+
// Manually fail the event.
|
|
37
|
+
if (ev.isFinal) {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
if (this.isGestureRunning) {
|
|
40
|
+
this.cancelEvent(ev);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
} else if (!this.hasGestureFailed && !this.isGestureRunning) {
|
|
44
|
+
// Tap Gesture start event
|
|
45
|
+
const gesture = this.hammer.get(this.name);
|
|
46
|
+
// @ts-ignore FIXME(TS)
|
|
47
|
+
if (gesture.options.enable(gesture, ev)) {
|
|
48
|
+
this.onStart(ev);
|
|
49
|
+
this.sendEvent(ev);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getHammerConfig() {
|
|
54
|
+
return {
|
|
55
|
+
// @ts-ignore FIXME(TS)
|
|
56
|
+
pointers: this.config.numberOfPointers,
|
|
57
|
+
direction: this.getDirection()
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
getTargetDirections(direction) {
|
|
61
|
+
const directions = [];
|
|
62
|
+
if (direction & Direction.RIGHT) {
|
|
63
|
+
directions.push(Hammer.DIRECTION_RIGHT);
|
|
64
|
+
}
|
|
65
|
+
if (direction & Direction.LEFT) {
|
|
66
|
+
directions.push(Hammer.DIRECTION_LEFT);
|
|
67
|
+
}
|
|
68
|
+
if (direction & Direction.UP) {
|
|
69
|
+
directions.push(Hammer.DIRECTION_UP);
|
|
70
|
+
}
|
|
71
|
+
if (direction & Direction.DOWN) {
|
|
72
|
+
directions.push(Hammer.DIRECTION_DOWN);
|
|
73
|
+
}
|
|
74
|
+
// const hammerDirection = directions.reduce((a, b) => a | b, 0);
|
|
75
|
+
return directions;
|
|
76
|
+
}
|
|
77
|
+
getDirection() {
|
|
78
|
+
// @ts-ignore FIXME(TS)
|
|
79
|
+
const {
|
|
80
|
+
direction
|
|
81
|
+
} = this.getConfig();
|
|
82
|
+
let directions = [];
|
|
83
|
+
if (direction & Direction.RIGHT) {
|
|
84
|
+
directions.push(Hammer.DIRECTION_HORIZONTAL);
|
|
85
|
+
}
|
|
86
|
+
if (direction & Direction.LEFT) {
|
|
87
|
+
directions.push(Hammer.DIRECTION_HORIZONTAL);
|
|
88
|
+
}
|
|
89
|
+
if (direction & Direction.UP) {
|
|
90
|
+
directions.push(Hammer.DIRECTION_VERTICAL);
|
|
91
|
+
}
|
|
92
|
+
if (direction & Direction.DOWN) {
|
|
93
|
+
directions.push(Hammer.DIRECTION_VERTICAL);
|
|
94
|
+
}
|
|
95
|
+
directions = [...new Set(directions)];
|
|
96
|
+
if (directions.length === 0) return Hammer.DIRECTION_NONE;
|
|
97
|
+
if (directions.length === 1) return directions[0];
|
|
98
|
+
return Hammer.DIRECTION_ALL;
|
|
99
|
+
}
|
|
100
|
+
isGestureEnabledForEvent({
|
|
101
|
+
numberOfPointers
|
|
102
|
+
}, _recognizer, {
|
|
103
|
+
maxPointers: pointerLength
|
|
104
|
+
}) {
|
|
105
|
+
const validPointerCount = pointerLength === numberOfPointers;
|
|
106
|
+
if (!validPointerCount && this.isGestureRunning) {
|
|
107
|
+
return {
|
|
108
|
+
failed: true
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
success: validPointerCount
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
updateGestureConfig({
|
|
116
|
+
numberOfPointers = 1,
|
|
117
|
+
direction,
|
|
118
|
+
...props
|
|
119
|
+
}) {
|
|
120
|
+
if (isnan(direction) || typeof direction !== 'number') {
|
|
121
|
+
throw new GesturePropError('direction', direction, 'number');
|
|
122
|
+
}
|
|
123
|
+
return super.updateGestureConfig({
|
|
124
|
+
numberOfPointers,
|
|
125
|
+
direction,
|
|
126
|
+
...props
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export default FlingGestureHandler;
|
|
131
|
+
//# sourceMappingURL=FlingGestureHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Hammer","Direction","GesturePropError","DraggingGestureHandler","isnan","FlingGestureHandler","name","NativeGestureClass","Swipe","onGestureActivated","event","sendEvent","eventType","INPUT_MOVE","isFinal","isFirst","isGestureRunning","hasGestureFailed","INPUT_END","onRawEvent","ev","setTimeout","cancelEvent","gesture","hammer","get","options","enable","onStart","getHammerConfig","pointers","config","numberOfPointers","direction","getDirection","getTargetDirections","directions","RIGHT","push","DIRECTION_RIGHT","LEFT","DIRECTION_LEFT","UP","DIRECTION_UP","DOWN","DIRECTION_DOWN","getConfig","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","Set","length","DIRECTION_NONE","DIRECTION_ALL","isGestureEnabledForEvent","_recognizer","maxPointers","pointerLength","validPointerCount","failed","success","updateGestureConfig","props"],"sources":["FlingGestureHandler.ts"],"sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport Hammer from '@egjs/hammerjs';\n\nimport { Direction } from './constants';\nimport { GesturePropError } from './Errors';\nimport DraggingGestureHandler from './DraggingGestureHandler';\nimport { isnan } from './utils';\nimport { HammerInputExt } from './GestureHandler';\n\nclass FlingGestureHandler extends DraggingGestureHandler {\n get name() {\n return 'swipe';\n }\n\n get NativeGestureClass() {\n return Hammer.Swipe;\n }\n\n onGestureActivated(event: HammerInputExt) {\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_MOVE,\n isFinal: false,\n isFirst: true,\n });\n this.isGestureRunning = false;\n this.hasGestureFailed = false;\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_END,\n isFinal: true,\n });\n }\n\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (this.hasGestureFailed) {\n return;\n }\n // Hammer doesn't send a `cancel` event for taps.\n // Manually fail the event.\n if (ev.isFinal) {\n setTimeout(() => {\n if (this.isGestureRunning) {\n this.cancelEvent(ev);\n }\n });\n } else if (!this.hasGestureFailed && !this.isGestureRunning) {\n // Tap Gesture start event\n const gesture = this.hammer!.get(this.name);\n // @ts-ignore FIXME(TS)\n if (gesture.options.enable(gesture, ev)) {\n this.onStart(ev);\n this.sendEvent(ev);\n }\n }\n }\n\n getHammerConfig() {\n return {\n // @ts-ignore FIXME(TS)\n pointers: this.config.numberOfPointers,\n direction: this.getDirection(),\n };\n }\n\n getTargetDirections(direction: number) {\n const directions = [];\n if (direction & Direction.RIGHT) {\n directions.push(Hammer.DIRECTION_RIGHT);\n }\n if (direction & Direction.LEFT) {\n directions.push(Hammer.DIRECTION_LEFT);\n }\n if (direction & Direction.UP) {\n directions.push(Hammer.DIRECTION_UP);\n }\n if (direction & Direction.DOWN) {\n directions.push(Hammer.DIRECTION_DOWN);\n }\n // const hammerDirection = directions.reduce((a, b) => a | b, 0);\n return directions;\n }\n\n getDirection() {\n // @ts-ignore FIXME(TS)\n const { direction } = this.getConfig();\n\n let directions = [];\n if (direction & Direction.RIGHT) {\n directions.push(Hammer.DIRECTION_HORIZONTAL);\n }\n if (direction & Direction.LEFT) {\n directions.push(Hammer.DIRECTION_HORIZONTAL);\n }\n if (direction & Direction.UP) {\n directions.push(Hammer.DIRECTION_VERTICAL);\n }\n if (direction & Direction.DOWN) {\n directions.push(Hammer.DIRECTION_VERTICAL);\n }\n directions = [...new Set(directions)];\n\n if (directions.length === 0) return Hammer.DIRECTION_NONE;\n if (directions.length === 1) return directions[0];\n return Hammer.DIRECTION_ALL;\n }\n\n isGestureEnabledForEvent(\n { numberOfPointers }: any,\n _recognizer: any,\n { maxPointers: pointerLength }: any\n ) {\n const validPointerCount = pointerLength === numberOfPointers;\n if (!validPointerCount && this.isGestureRunning) {\n return { failed: true };\n }\n return { success: validPointerCount };\n }\n\n updateGestureConfig({ numberOfPointers = 1, direction, ...props }: any) {\n if (isnan(direction) || typeof direction !== 'number') {\n throw new GesturePropError('direction', direction, 'number');\n }\n return super.updateGestureConfig({\n numberOfPointers,\n direction,\n ...props,\n });\n }\n}\n\nexport default FlingGestureHandler;\n"],"mappings":"AAAA;AACA;AACA,OAAOA,MAAM,MAAM,gBAAgB;AAEnC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,SAASC,KAAK,QAAQ,SAAS;AAG/B,MAAMC,mBAAmB,SAASF,sBAAsB,CAAC;EACvD,IAAIG,IAAIA,CAAA,EAAG;IACT,OAAO,OAAO;EAChB;EAEA,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAOP,MAAM,CAACQ,KAAK;EACrB;EAEAC,kBAAkBA,CAACC,KAAqB,EAAE;IACxC,IAAI,CAACC,SAAS,CAAC;MACb,GAAGD,KAAK;MACRE,SAAS,EAAEZ,MAAM,CAACa,UAAU;MAC5BC,OAAO,EAAE,KAAK;MACdC,OAAO,EAAE;IACX,CAAC,CAAC;IACF,IAAI,CAACC,gBAAgB,GAAG,KAAK;IAC7B,IAAI,CAACC,gBAAgB,GAAG,KAAK;IAC7B,IAAI,CAACN,SAAS,CAAC;MACb,GAAGD,KAAK;MACRE,SAAS,EAAEZ,MAAM,CAACkB,SAAS;MAC3BJ,OAAO,EA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