@react-native-oh-tpl/react-native-gesture-handler 2.12.1-0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/DrawerLayout/package.json +6 -0
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/RNGestureHandler.podspec +44 -0
- package/Swipeable/package.json +6 -0
- package/android/build.gradle +209 -0
- package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
- package/android/fabric/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +29 -0
- package/android/fabric/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +12 -0
- package/android/gradle.properties +19 -0
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +10 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +50 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +23 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +25 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +16 -0
- package/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +13 -0
- package/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +17 -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 +671 -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 +423 -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 +75 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +74 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +702 -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 +78 -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/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +22 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +33 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +18 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +42 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +30 -0
- package/android/src/main/jni/CMakeLists.txt +37 -0
- package/android/src/main/jni/cpp-adapter.cpp +44 -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 +153 -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 +493 -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 +64 -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/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 +35 -0
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js +15 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/commonjs/PlatformConstants.js +15 -0
- package/lib/commonjs/PlatformConstants.js.map +1 -0
- package/lib/commonjs/PlatformConstants.web.js +14 -0
- package/lib/commonjs/PlatformConstants.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +29 -0
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +149 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +163 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js +158 -0
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +16 -0
- package/lib/commonjs/RNRenderer.js.map +1 -0
- package/lib/commonjs/RNRenderer.web.js +11 -0
- package/lib/commonjs/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/State.js +18 -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 +566 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -0
- package/lib/commonjs/components/GestureButtons.js +240 -0
- package/lib/commonjs/components/GestureButtons.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +115 -0
- package/lib/commonjs/components/GestureComponents.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.web.js +52 -0
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +14 -0
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.android.js +31 -0
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +31 -0
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js +25 -0
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +408 -0
- package/lib/commonjs/components/Swipeable.js.map +1 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js +40 -0
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js +289 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js +109 -0
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +100 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +12 -0
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js +77 -0
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +26 -0
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
- package/lib/commonjs/components/touchables/index.js +40 -0
- package/lib/commonjs/components/touchables/index.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.js +22 -0
- package/lib/commonjs/getReactNativeVersion.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.web.js +11 -0
- package/lib/commonjs/getReactNativeVersion.web.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 +15 -0
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
- package/lib/commonjs/ghQueueMicrotask.js +12 -0
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js +25 -0
- package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js +49 -0
- package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +27 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +27 -0
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js +123 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js +23 -0
- package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js +23 -0
- package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/TapGestureHandler.js +27 -0
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +464 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -0
- package/lib/commonjs/handlers/createNativeWrapper.js +74 -0
- package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +103 -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 +669 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js +147 -0
- package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +65 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js +241 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js +105 -0
- package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js +90 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +65 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +32 -0
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js +74 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js +35 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js +31 -0
- package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/panGesture.js +149 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js +45 -0
- package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +37 -0
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js +45 -0
- package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js +60 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/commonjs/handlers/handlersRegistry.js +67 -0
- package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
- package/lib/commonjs/index.js +266 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/init.js +32 -0
- package/lib/commonjs/init.js.map +1 -0
- package/lib/commonjs/jestUtils/index.js +20 -0
- package/lib/commonjs/jestUtils/index.js.map +1 -0
- package/lib/commonjs/jestUtils/jestUtils.js +375 -0
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -0
- package/lib/commonjs/mocks.js +66 -0
- package/lib/commonjs/mocks.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +15 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +15 -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 +63 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/constants.js +16 -0
- package/lib/commonjs/web/constants.js.map +1 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js +165 -0
- package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js +156 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +167 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/GestureHandler.js +794 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +62 -0
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +151 -0
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +61 -0
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +178 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js +448 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +174 -0
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +186 -0
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js +280 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web/interfaces.js +55 -0
- package/lib/commonjs/web/interfaces.js.map +1 -0
- package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
- package/lib/commonjs/web/tools/EventManager.js +127 -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 +349 -0
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +118 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/InteractionManager.js +114 -0
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js +204 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/commonjs/web/tools/NodeManager.js +48 -0
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +198 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/PointerTracker.js +226 -0
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -0
- package/lib/commonjs/web/tools/TouchEventManager.js +138 -0
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -0
- package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web/utils.js +15 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js +105 -0
- package/lib/commonjs/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js +53 -0
- package/lib/commonjs/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/Errors.js +16 -0
- package/lib/commonjs/web_hammer/Errors.js.map +1 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js +170 -0
- package/lib/commonjs/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +579 -0
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js +54 -0
- package/lib/commonjs/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js +71 -0
- package/lib/commonjs/web_hammer/LongPressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js +66 -0
- package/lib/commonjs/web_hammer/NativeViewGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/NodeManager.js +46 -0
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js +208 -0
- package/lib/commonjs/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js +40 -0
- package/lib/commonjs/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js +188 -0
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js +44 -0
- package/lib/commonjs/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js +192 -0
- package/lib/commonjs/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/commonjs/web_hammer/constants.js +64 -0
- package/lib/commonjs/web_hammer/constants.js.map +1 -0
- package/lib/commonjs/web_hammer/utils.js +42 -0
- package/lib/commonjs/web_hammer/utils.js.map +1 -0
- package/lib/module/ActionType.js +7 -0
- package/lib/module/ActionType.js.map +1 -0
- package/lib/module/Directions.js +7 -0
- package/lib/module/Directions.js.map +1 -0
- package/lib/module/EnableNewWebImplementation.js +22 -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 +5 -0
- package/lib/module/PlatformConstants.js.map +1 -0
- package/lib/module/PlatformConstants.web.js +7 -0
- package/lib/module/PlatformConstants.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +19 -0
- package/lib/module/RNGestureHandlerModule.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +110 -0
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.web.js +122 -0
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.windows.js +118 -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 +10 -0
- package/lib/module/State.js.map +1 -0
- package/lib/module/TouchEventType.js +8 -0
- package/lib/module/TouchEventType.js.map +1 -0
- package/lib/module/components/DrawerLayout.js +551 -0
- package/lib/module/components/DrawerLayout.js.map +1 -0
- package/lib/module/components/GestureButtons.js +206 -0
- package/lib/module/components/GestureButtons.js.map +1 -0
- package/lib/module/components/GestureComponents.js +90 -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 +9 -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.web.js +9 -0
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +390 -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 +273 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
- package/lib/module/components/touchables/TouchableHighlight.js +95 -0
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js +84 -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 +63 -0
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +10 -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/getReactNativeVersion.js +10 -0
- package/lib/module/getReactNativeVersion.js.map +1 -0
- package/lib/module/getReactNativeVersion.web.js +4 -0
- package/lib/module/getReactNativeVersion.web.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +20 -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/ghQueueMicrotask.js +5 -0
- package/lib/module/ghQueueMicrotask.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 +31 -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 +107 -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 +433 -0
- package/lib/module/handlers/createHandler.js.map +1 -0
- package/lib/module/handlers/createNativeWrapper.js +62 -0
- package/lib/module/handlers/createNativeWrapper.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +81 -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 +619 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
- package/lib/module/handlers/gestures/eventReceiver.js +131 -0
- package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
- package/lib/module/handlers/gestures/flingGesture.js +24 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js +56 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js +222 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -0
- package/lib/module/handlers/gestures/gestureComposition.js +90 -0
- package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
- package/lib/module/handlers/gestures/gestureObjects.js +71 -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 +21 -0
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -0
- package/lib/module/handlers/gestures/hoverGesture.js +62 -0
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js +25 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
- package/lib/module/handlers/gestures/manualGesture.js +22 -0
- package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
- package/lib/module/handlers/gestures/nativeGesture.js +24 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
- package/lib/module/handlers/gestures/panGesture.js +140 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -0
- package/lib/module/handlers/gestures/pinchGesture.js +36 -0
- package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js +30 -0
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
- package/lib/module/handlers/gestures/rotationGesture.js +36 -0
- package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
- package/lib/module/handlers/gestures/tapGesture.js +50 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
- package/lib/module/handlers/handlersRegistry.js +44 -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 +16 -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 +350 -0
- package/lib/module/jestUtils/jestUtils.js.map +1 -0
- package/lib/module/mocks.js +56 -0
- package/lib/module/mocks.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -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 +44 -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 +155 -0
- package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js +145 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +152 -0
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/GestureHandler.js +776 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -0
- package/lib/module/web/handlers/HoverGestureHandler.js +47 -0
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js +136 -0
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/ManualGestureHandler.js +49 -0
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +163 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PanGestureHandler.js +433 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/PinchGestureHandler.js +159 -0
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/RotationGestureHandler.js +171 -0
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/TapGestureHandler.js +265 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -0
- package/lib/module/web/interfaces.js +45 -0
- package/lib/module/web/interfaces.js.map +1 -0
- package/lib/module/web/tools/CircularBuffer.js +50 -0
- package/lib/module/web/tools/CircularBuffer.js.map +1 -0
- package/lib/module/web/tools/EventManager.js +118 -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 +335 -0
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +102 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/module/web/tools/InteractionManager.js +105 -0
- package/lib/module/web/tools/InteractionManager.js.map +1 -0
- package/lib/module/web/tools/LeastSquareSolver.js +195 -0
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/module/web/tools/NodeManager.js +39 -0
- package/lib/module/web/tools/NodeManager.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +184 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -0
- package/lib/module/web/tools/PointerTracker.js +213 -0
- package/lib/module/web/tools/PointerTracker.js.map +1 -0
- package/lib/module/web/tools/TouchEventManager.js +124 -0
- package/lib/module/web/tools/TouchEventManager.js.map +1 -0
- package/lib/module/web/tools/VelocityTracker.js +98 -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 +94 -0
- package/lib/module/web_hammer/DiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js +40 -0
- package/lib/module/web_hammer/DraggingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/Errors.js +7 -0
- package/lib/module/web_hammer/Errors.js.map +1 -0
- package/lib/module/web_hammer/FlingGestureHandler.js +156 -0
- package/lib/module/web_hammer/FlingGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +563 -0
- package/lib/module/web_hammer/GestureHandler.js.map +1 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js +44 -0
- package/lib/module/web_hammer/IndiscreteGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/LongPressGestureHandler.js +58 -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 +33 -0
- package/lib/module/web_hammer/NodeManager.js.map +1 -0
- package/lib/module/web_hammer/PanGestureHandler.js +194 -0
- package/lib/module/web_hammer/PanGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PinchGestureHandler.js +29 -0
- package/lib/module/web_hammer/PinchGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/PressGestureHandler.js +174 -0
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/RotationGestureHandler.js +32 -0
- package/lib/module/web_hammer/RotationGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/TapGestureHandler.js +180 -0
- package/lib/module/web_hammer/TapGestureHandler.js.map +1 -0
- package/lib/module/web_hammer/constants.js +43 -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.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.web.d.ts +6 -0
- package/lib/typescript/components/Swipeable.d.ts +178 -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/getReactNativeVersion.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -0
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
- package/lib/typescript/ghQueueMicrotask.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 +68 -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 +110 -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/RNGestureHandlerRootViewNativeComponent.d.ts +6 -0
- package/lib/typescript/typeUtils.d.ts +1 -0
- package/lib/typescript/utils.d.ts +8 -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 +141 -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 +29 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +21 -0
- package/lib/typescript/web/tools/InteractionManager.d.ts +17 -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 +156 -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.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 +332 -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.tsx +23 -0
- package/src/components/GestureHandlerRootView.web.tsx +17 -0
- package/src/components/Swipeable.tsx +584 -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/getReactNativeVersion.ts +11 -0
- package/src/getReactNativeVersion.web.ts +3 -0
- package/src/getShadowNodeFromRef.ts +22 -0
- package/src/getShadowNodeFromRef.web.ts +7 -0
- package/src/ghQueueMicrotask.ts +5 -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 +533 -0
- package/src/handlers/createNativeWrapper.tsx +80 -0
- package/src/handlers/gestureHandlerCommon.ts +250 -0
- package/src/handlers/gestureHandlerTypesCompat.ts +106 -0
- package/src/handlers/gestures/GestureDetector.tsx +822 -0
- package/src/handlers/gestures/eventReceiver.ts +155 -0
- package/src/handlers/gestures/flingGesture.ts +27 -0
- package/src/handlers/gestures/forceTouchGesture.ts +74 -0
- package/src/handlers/gestures/gesture.ts +349 -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.ts +18 -0
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
- package/src/typeUtils.ts +1 -0
- package/src/utils.ts +54 -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 +849 -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 +167 -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 +389 -0
- package/src/web/tools/GestureHandlerWebDelegate.ts +115 -0
- package/src/web/tools/InteractionManager.ts +130 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/NodeManager.ts +43 -0
- package/src/web/tools/PointerEventManager.ts +202 -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 +599 -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,558 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2010 The Android Open Source Project
|
3
|
+
*
|
4
|
+
* Copied from https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ScaleGestureDetector.java
|
5
|
+
* Modified line 189 to set initial min span to 0 instead of copying it from the system configuration
|
6
|
+
*/
|
7
|
+
|
8
|
+
package com.swmansion.gesturehandler.core;
|
9
|
+
|
10
|
+
import android.content.Context;
|
11
|
+
import android.os.Build;
|
12
|
+
import android.os.Handler;
|
13
|
+
import android.view.GestureDetector;
|
14
|
+
import android.view.MotionEvent;
|
15
|
+
import android.view.View;
|
16
|
+
import android.view.ViewConfiguration;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Detects scaling transformation gestures using the supplied {@link MotionEvent}s.
|
20
|
+
* The {@link OnScaleGestureListener} callback will notify users when a particular
|
21
|
+
* gesture event has occurred.
|
22
|
+
*
|
23
|
+
* This class should only be used with {@link MotionEvent}s reported via touch.
|
24
|
+
*
|
25
|
+
* To use this class:
|
26
|
+
* <ul>
|
27
|
+
* <li>Create an instance of the {@code ScaleGestureDetector} for your
|
28
|
+
* {@link View}
|
29
|
+
* <li>In the {@link View#onTouchEvent(MotionEvent)} method ensure you call
|
30
|
+
* {@link #onTouchEvent(MotionEvent)}. The methods defined in your
|
31
|
+
* callback will be executed when the events occur.
|
32
|
+
* </ul>
|
33
|
+
*/
|
34
|
+
public class ScaleGestureDetector {
|
35
|
+
private static final String TAG = "ScaleGestureDetector";
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The listener for receiving notifications when gestures occur.
|
39
|
+
* If you want to listen for all the different gestures then implement
|
40
|
+
* this interface. If you only want to listen for a subset it might
|
41
|
+
* be easier to extend {@link SimpleOnScaleGestureListener}.
|
42
|
+
*
|
43
|
+
* An application will receive events in the following order:
|
44
|
+
* <ul>
|
45
|
+
* <li>One {@link OnScaleGestureListener#onScaleBegin(ScaleGestureDetector)}
|
46
|
+
* <li>Zero or more {@link OnScaleGestureListener#onScale(ScaleGestureDetector)}
|
47
|
+
* <li>One {@link OnScaleGestureListener#onScaleEnd(ScaleGestureDetector)}
|
48
|
+
* </ul>
|
49
|
+
*/
|
50
|
+
public interface OnScaleGestureListener {
|
51
|
+
/**
|
52
|
+
* Responds to scaling events for a gesture in progress.
|
53
|
+
* Reported by pointer motion.
|
54
|
+
*
|
55
|
+
* @param detector The detector reporting the event - use this to
|
56
|
+
* retrieve extended info about event state.
|
57
|
+
* @return Whether or not the detector should consider this event
|
58
|
+
* as handled. If an event was not handled, the detector
|
59
|
+
* will continue to accumulate movement until an event is
|
60
|
+
* handled. This can be useful if an application, for example,
|
61
|
+
* only wants to update scaling factors if the change is
|
62
|
+
* greater than 0.01.
|
63
|
+
*/
|
64
|
+
public boolean onScale(ScaleGestureDetector detector);
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Responds to the beginning of a scaling gesture. Reported by
|
68
|
+
* new pointers going down.
|
69
|
+
*
|
70
|
+
* @param detector The detector reporting the event - use this to
|
71
|
+
* retrieve extended info about event state.
|
72
|
+
* @return Whether or not the detector should continue recognizing
|
73
|
+
* this gesture. For example, if a gesture is beginning
|
74
|
+
* with a focal point outside of a region where it makes
|
75
|
+
* sense, onScaleBegin() may return false to ignore the
|
76
|
+
* rest of the gesture.
|
77
|
+
*/
|
78
|
+
public boolean onScaleBegin(ScaleGestureDetector detector);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Responds to the end of a scale gesture. Reported by existing
|
82
|
+
* pointers going up.
|
83
|
+
*
|
84
|
+
* Once a scale has ended, {@link ScaleGestureDetector#getFocusX()}
|
85
|
+
* and {@link ScaleGestureDetector#getFocusY()} will return focal point
|
86
|
+
* of the pointers remaining on the screen.
|
87
|
+
*
|
88
|
+
* @param detector The detector reporting the event - use this to
|
89
|
+
* retrieve extended info about event state.
|
90
|
+
*/
|
91
|
+
public void onScaleEnd(ScaleGestureDetector detector);
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* A convenience class to extend when you only want to listen for a subset
|
96
|
+
* of scaling-related events. This implements all methods in
|
97
|
+
* {@link OnScaleGestureListener} but does nothing.
|
98
|
+
* {@link OnScaleGestureListener#onScale(ScaleGestureDetector)} returns
|
99
|
+
* {@code false} so that a subclass can retrieve the accumulated scale
|
100
|
+
* factor in an overridden onScaleEnd.
|
101
|
+
* {@link OnScaleGestureListener#onScaleBegin(ScaleGestureDetector)} returns
|
102
|
+
* {@code true}.
|
103
|
+
*/
|
104
|
+
public static class SimpleOnScaleGestureListener implements OnScaleGestureListener {
|
105
|
+
|
106
|
+
public boolean onScale(ScaleGestureDetector detector) {
|
107
|
+
return false;
|
108
|
+
}
|
109
|
+
|
110
|
+
public boolean onScaleBegin(ScaleGestureDetector detector) {
|
111
|
+
return true;
|
112
|
+
}
|
113
|
+
|
114
|
+
public void onScaleEnd(ScaleGestureDetector detector) {
|
115
|
+
// Intentionally empty
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
private final Context mContext;
|
120
|
+
private final OnScaleGestureListener mListener;
|
121
|
+
|
122
|
+
private float mFocusX;
|
123
|
+
private float mFocusY;
|
124
|
+
|
125
|
+
private boolean mQuickScaleEnabled;
|
126
|
+
private boolean mStylusScaleEnabled;
|
127
|
+
|
128
|
+
private float mCurrSpan;
|
129
|
+
private float mPrevSpan;
|
130
|
+
private float mInitialSpan;
|
131
|
+
private float mCurrSpanX;
|
132
|
+
private float mCurrSpanY;
|
133
|
+
private float mPrevSpanX;
|
134
|
+
private float mPrevSpanY;
|
135
|
+
private long mCurrTime;
|
136
|
+
private long mPrevTime;
|
137
|
+
private boolean mInProgress;
|
138
|
+
private int mSpanSlop;
|
139
|
+
private int mMinSpan;
|
140
|
+
|
141
|
+
private final Handler mHandler;
|
142
|
+
|
143
|
+
private float mAnchoredScaleStartX;
|
144
|
+
private float mAnchoredScaleStartY;
|
145
|
+
private int mAnchoredScaleMode = ANCHORED_SCALE_MODE_NONE;
|
146
|
+
|
147
|
+
private static final long TOUCH_STABILIZE_TIME = 128; // ms
|
148
|
+
private static final float SCALE_FACTOR = .5f;
|
149
|
+
private static final int ANCHORED_SCALE_MODE_NONE = 0;
|
150
|
+
private static final int ANCHORED_SCALE_MODE_DOUBLE_TAP = 1;
|
151
|
+
private static final int ANCHORED_SCALE_MODE_STYLUS = 2;
|
152
|
+
|
153
|
+
|
154
|
+
private GestureDetector mGestureDetector;
|
155
|
+
|
156
|
+
private boolean mEventBeforeOrAboveStartingGestureEvent;
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Creates a ScaleGestureDetector with the supplied listener.
|
160
|
+
* You may only use this constructor from a {@link android.os.Looper Looper} thread.
|
161
|
+
*
|
162
|
+
* @param context the application's context
|
163
|
+
* @param listener the listener invoked for all the callbacks, this must
|
164
|
+
* not be null.
|
165
|
+
*
|
166
|
+
* @throws NullPointerException if {@code listener} is null.
|
167
|
+
*/
|
168
|
+
public ScaleGestureDetector(Context context, OnScaleGestureListener listener) {
|
169
|
+
this(context, listener, null);
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Creates a ScaleGestureDetector with the supplied listener.
|
174
|
+
* @see android.os.Handler#Handler()
|
175
|
+
*
|
176
|
+
* @param context the application's context
|
177
|
+
* @param listener the listener invoked for all the callbacks, this must
|
178
|
+
* not be null.
|
179
|
+
* @param handler the handler to use for running deferred listener events.
|
180
|
+
*
|
181
|
+
* @throws NullPointerException if {@code listener} is null.
|
182
|
+
*/
|
183
|
+
public ScaleGestureDetector(Context context, OnScaleGestureListener listener,
|
184
|
+
Handler handler) {
|
185
|
+
mContext = context;
|
186
|
+
mListener = listener;
|
187
|
+
final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
|
188
|
+
mSpanSlop = viewConfiguration.getScaledTouchSlop() * 2;
|
189
|
+
mMinSpan = 0; // set to zero, to allow for scaling when distance between fingers is small
|
190
|
+
mHandler = handler;
|
191
|
+
// Quick scale is enabled by default after JB_MR2
|
192
|
+
final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion;
|
193
|
+
if (targetSdkVersion > Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
194
|
+
setQuickScaleEnabled(true);
|
195
|
+
}
|
196
|
+
// Stylus scale is enabled by default after LOLLIPOP_MR1
|
197
|
+
if (targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) {
|
198
|
+
setStylusScaleEnabled(true);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* Accepts MotionEvents and dispatches events to a {@link OnScaleGestureListener}
|
204
|
+
* when appropriate.
|
205
|
+
*
|
206
|
+
* <p>Applications should pass a complete and consistent event stream to this method.
|
207
|
+
* A complete and consistent event stream involves all MotionEvents from the initial
|
208
|
+
* ACTION_DOWN to the final ACTION_UP or ACTION_CANCEL.</p>
|
209
|
+
*
|
210
|
+
* @param event The event to process
|
211
|
+
* @return true if the event was processed and the detector wants to receive the
|
212
|
+
* rest of the MotionEvents in this event stream.
|
213
|
+
*/
|
214
|
+
public boolean onTouchEvent(MotionEvent event) {
|
215
|
+
mCurrTime = event.getEventTime();
|
216
|
+
|
217
|
+
final int action = event.getActionMasked();
|
218
|
+
|
219
|
+
// Forward the event to check for double tap gesture
|
220
|
+
if (mQuickScaleEnabled) {
|
221
|
+
mGestureDetector.onTouchEvent(event);
|
222
|
+
}
|
223
|
+
|
224
|
+
final int count = event.getPointerCount();
|
225
|
+
final boolean isStylusButtonDown =
|
226
|
+
(event.getButtonState() & MotionEvent.BUTTON_STYLUS_PRIMARY) != 0;
|
227
|
+
|
228
|
+
final boolean anchoredScaleCancelled =
|
229
|
+
mAnchoredScaleMode == ANCHORED_SCALE_MODE_STYLUS && !isStylusButtonDown;
|
230
|
+
final boolean streamComplete = action == MotionEvent.ACTION_UP ||
|
231
|
+
action == MotionEvent.ACTION_CANCEL || anchoredScaleCancelled;
|
232
|
+
|
233
|
+
if (action == MotionEvent.ACTION_DOWN || streamComplete) {
|
234
|
+
// Reset any scale in progress with the listener.
|
235
|
+
// If it's an ACTION_DOWN we're beginning a new event stream.
|
236
|
+
// This means the app probably didn't give us all the events. Shame on it.
|
237
|
+
if (mInProgress) {
|
238
|
+
mListener.onScaleEnd(this);
|
239
|
+
mInProgress = false;
|
240
|
+
mInitialSpan = 0;
|
241
|
+
mAnchoredScaleMode = ANCHORED_SCALE_MODE_NONE;
|
242
|
+
} else if (inAnchoredScaleMode() && streamComplete) {
|
243
|
+
mInProgress = false;
|
244
|
+
mInitialSpan = 0;
|
245
|
+
mAnchoredScaleMode = ANCHORED_SCALE_MODE_NONE;
|
246
|
+
}
|
247
|
+
|
248
|
+
if (streamComplete) {
|
249
|
+
return true;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
if (!mInProgress && mStylusScaleEnabled && !inAnchoredScaleMode()
|
254
|
+
&& !streamComplete && isStylusButtonDown) {
|
255
|
+
// Start of a button scale gesture
|
256
|
+
mAnchoredScaleStartX = event.getX();
|
257
|
+
mAnchoredScaleStartY = event.getY();
|
258
|
+
mAnchoredScaleMode = ANCHORED_SCALE_MODE_STYLUS;
|
259
|
+
mInitialSpan = 0;
|
260
|
+
}
|
261
|
+
|
262
|
+
final boolean configChanged = action == MotionEvent.ACTION_DOWN ||
|
263
|
+
action == MotionEvent.ACTION_POINTER_UP ||
|
264
|
+
action == MotionEvent.ACTION_POINTER_DOWN || anchoredScaleCancelled;
|
265
|
+
|
266
|
+
final boolean pointerUp = action == MotionEvent.ACTION_POINTER_UP;
|
267
|
+
final int skipIndex = pointerUp ? event.getActionIndex() : -1;
|
268
|
+
|
269
|
+
// Determine focal point
|
270
|
+
float sumX = 0, sumY = 0;
|
271
|
+
final int div = pointerUp ? count - 1 : count;
|
272
|
+
final float focusX;
|
273
|
+
final float focusY;
|
274
|
+
if (inAnchoredScaleMode()) {
|
275
|
+
// In anchored scale mode, the focal pt is always where the double tap
|
276
|
+
// or button down gesture started
|
277
|
+
focusX = mAnchoredScaleStartX;
|
278
|
+
focusY = mAnchoredScaleStartY;
|
279
|
+
if (event.getY() < focusY) {
|
280
|
+
mEventBeforeOrAboveStartingGestureEvent = true;
|
281
|
+
} else {
|
282
|
+
mEventBeforeOrAboveStartingGestureEvent = false;
|
283
|
+
}
|
284
|
+
} else {
|
285
|
+
for (int i = 0; i < count; i++) {
|
286
|
+
if (skipIndex == i) continue;
|
287
|
+
sumX += event.getX(i);
|
288
|
+
sumY += event.getY(i);
|
289
|
+
}
|
290
|
+
|
291
|
+
focusX = sumX / div;
|
292
|
+
focusY = sumY / div;
|
293
|
+
}
|
294
|
+
|
295
|
+
// Determine average deviation from focal point
|
296
|
+
float devSumX = 0, devSumY = 0;
|
297
|
+
for (int i = 0; i < count; i++) {
|
298
|
+
if (skipIndex == i) continue;
|
299
|
+
|
300
|
+
// Convert the resulting diameter into a radius.
|
301
|
+
devSumX += Math.abs(event.getX(i) - focusX);
|
302
|
+
devSumY += Math.abs(event.getY(i) - focusY);
|
303
|
+
}
|
304
|
+
final float devX = devSumX / div;
|
305
|
+
final float devY = devSumY / div;
|
306
|
+
|
307
|
+
// Span is the average distance between touch points through the focal point;
|
308
|
+
// i.e. the diameter of the circle with a radius of the average deviation from
|
309
|
+
// the focal point.
|
310
|
+
final float spanX = devX * 2;
|
311
|
+
final float spanY = devY * 2;
|
312
|
+
final float span;
|
313
|
+
if (inAnchoredScaleMode()) {
|
314
|
+
span = spanY;
|
315
|
+
} else {
|
316
|
+
span = (float) Math.hypot(spanX, spanY);
|
317
|
+
}
|
318
|
+
|
319
|
+
// Dispatch begin/end events as needed.
|
320
|
+
// If the configuration changes, notify the app to reset its current state by beginning
|
321
|
+
// a fresh scale event stream.
|
322
|
+
final boolean wasInProgress = mInProgress;
|
323
|
+
mFocusX = focusX;
|
324
|
+
mFocusY = focusY;
|
325
|
+
if (!inAnchoredScaleMode() && mInProgress && (span < mMinSpan || configChanged)) {
|
326
|
+
mListener.onScaleEnd(this);
|
327
|
+
mInProgress = false;
|
328
|
+
mInitialSpan = span;
|
329
|
+
}
|
330
|
+
if (configChanged) {
|
331
|
+
mPrevSpanX = mCurrSpanX = spanX;
|
332
|
+
mPrevSpanY = mCurrSpanY = spanY;
|
333
|
+
mInitialSpan = mPrevSpan = mCurrSpan = span;
|
334
|
+
}
|
335
|
+
|
336
|
+
final int minSpan = inAnchoredScaleMode() ? mSpanSlop : mMinSpan;
|
337
|
+
if (!mInProgress && span >= minSpan &&
|
338
|
+
(wasInProgress || Math.abs(span - mInitialSpan) > mSpanSlop)) {
|
339
|
+
mPrevSpanX = mCurrSpanX = spanX;
|
340
|
+
mPrevSpanY = mCurrSpanY = spanY;
|
341
|
+
mPrevSpan = mCurrSpan = span;
|
342
|
+
mPrevTime = mCurrTime;
|
343
|
+
mInProgress = mListener.onScaleBegin(this);
|
344
|
+
}
|
345
|
+
|
346
|
+
// Handle motion; focal point and span/scale factor are changing.
|
347
|
+
if (action == MotionEvent.ACTION_MOVE) {
|
348
|
+
mCurrSpanX = spanX;
|
349
|
+
mCurrSpanY = spanY;
|
350
|
+
mCurrSpan = span;
|
351
|
+
|
352
|
+
boolean updatePrev = true;
|
353
|
+
|
354
|
+
if (mInProgress) {
|
355
|
+
updatePrev = mListener.onScale(this);
|
356
|
+
}
|
357
|
+
|
358
|
+
if (updatePrev) {
|
359
|
+
mPrevSpanX = mCurrSpanX;
|
360
|
+
mPrevSpanY = mCurrSpanY;
|
361
|
+
mPrevSpan = mCurrSpan;
|
362
|
+
mPrevTime = mCurrTime;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
return true;
|
367
|
+
}
|
368
|
+
|
369
|
+
private boolean inAnchoredScaleMode() {
|
370
|
+
return mAnchoredScaleMode != ANCHORED_SCALE_MODE_NONE;
|
371
|
+
}
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Set whether the associated {@link OnScaleGestureListener} should receive onScale callbacks
|
375
|
+
* when the user performs a doubleTap followed by a swipe. Note that this is enabled by default
|
376
|
+
* if the app targets API 19 and newer.
|
377
|
+
* @param scales true to enable quick scaling, false to disable
|
378
|
+
*/
|
379
|
+
public void setQuickScaleEnabled(boolean scales) {
|
380
|
+
mQuickScaleEnabled = scales;
|
381
|
+
if (mQuickScaleEnabled && mGestureDetector == null) {
|
382
|
+
GestureDetector.SimpleOnGestureListener gestureListener =
|
383
|
+
new GestureDetector.SimpleOnGestureListener() {
|
384
|
+
@Override
|
385
|
+
public boolean onDoubleTap(MotionEvent e) {
|
386
|
+
// Double tap: start watching for a swipe
|
387
|
+
mAnchoredScaleStartX = e.getX();
|
388
|
+
mAnchoredScaleStartY = e.getY();
|
389
|
+
mAnchoredScaleMode = ANCHORED_SCALE_MODE_DOUBLE_TAP;
|
390
|
+
return true;
|
391
|
+
}
|
392
|
+
};
|
393
|
+
mGestureDetector = new GestureDetector(mContext, gestureListener, mHandler);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
/**
|
398
|
+
* Return whether the quick scale gesture, in which the user performs a double tap followed by a
|
399
|
+
* swipe, should perform scaling. {@see #setQuickScaleEnabled(boolean)}.
|
400
|
+
*/
|
401
|
+
public boolean isQuickScaleEnabled() {
|
402
|
+
return mQuickScaleEnabled;
|
403
|
+
}
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Sets whether the associates {@link OnScaleGestureListener} should receive
|
407
|
+
* onScale callbacks when the user uses a stylus and presses the button.
|
408
|
+
* Note that this is enabled by default if the app targets API 23 and newer.
|
409
|
+
*
|
410
|
+
* @param scales true to enable stylus scaling, false to disable.
|
411
|
+
*/
|
412
|
+
public void setStylusScaleEnabled(boolean scales) {
|
413
|
+
mStylusScaleEnabled = scales;
|
414
|
+
}
|
415
|
+
|
416
|
+
/**
|
417
|
+
* Return whether the stylus scale gesture, in which the user uses a stylus and presses the
|
418
|
+
* button, should perform scaling. {@see #setStylusScaleEnabled(boolean)}
|
419
|
+
*/
|
420
|
+
public boolean isStylusScaleEnabled() {
|
421
|
+
return mStylusScaleEnabled;
|
422
|
+
}
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Returns {@code true} if a scale gesture is in progress.
|
426
|
+
*/
|
427
|
+
public boolean isInProgress() {
|
428
|
+
return mInProgress;
|
429
|
+
}
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Get the X coordinate of the current gesture's focal point.
|
433
|
+
* If a gesture is in progress, the focal point is between
|
434
|
+
* each of the pointers forming the gesture.
|
435
|
+
*
|
436
|
+
* If {@link #isInProgress()} would return false, the result of this
|
437
|
+
* function is undefined.
|
438
|
+
*
|
439
|
+
* @return X coordinate of the focal point in pixels.
|
440
|
+
*/
|
441
|
+
public float getFocusX() {
|
442
|
+
return mFocusX;
|
443
|
+
}
|
444
|
+
|
445
|
+
/**
|
446
|
+
* Get the Y coordinate of the current gesture's focal point.
|
447
|
+
* If a gesture is in progress, the focal point is between
|
448
|
+
* each of the pointers forming the gesture.
|
449
|
+
*
|
450
|
+
* If {@link #isInProgress()} would return false, the result of this
|
451
|
+
* function is undefined.
|
452
|
+
*
|
453
|
+
* @return Y coordinate of the focal point in pixels.
|
454
|
+
*/
|
455
|
+
public float getFocusY() {
|
456
|
+
return mFocusY;
|
457
|
+
}
|
458
|
+
|
459
|
+
/**
|
460
|
+
* Return the average distance between each of the pointers forming the
|
461
|
+
* gesture in progress through the focal point.
|
462
|
+
*
|
463
|
+
* @return Distance between pointers in pixels.
|
464
|
+
*/
|
465
|
+
public float getCurrentSpan() {
|
466
|
+
return mCurrSpan;
|
467
|
+
}
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Return the average X distance between each of the pointers forming the
|
471
|
+
* gesture in progress through the focal point.
|
472
|
+
*
|
473
|
+
* @return Distance between pointers in pixels.
|
474
|
+
*/
|
475
|
+
public float getCurrentSpanX() {
|
476
|
+
return mCurrSpanX;
|
477
|
+
}
|
478
|
+
|
479
|
+
/**
|
480
|
+
* Return the average Y distance between each of the pointers forming the
|
481
|
+
* gesture in progress through the focal point.
|
482
|
+
*
|
483
|
+
* @return Distance between pointers in pixels.
|
484
|
+
*/
|
485
|
+
public float getCurrentSpanY() {
|
486
|
+
return mCurrSpanY;
|
487
|
+
}
|
488
|
+
|
489
|
+
/**
|
490
|
+
* Return the previous average distance between each of the pointers forming the
|
491
|
+
* gesture in progress through the focal point.
|
492
|
+
*
|
493
|
+
* @return Previous distance between pointers in pixels.
|
494
|
+
*/
|
495
|
+
public float getPreviousSpan() {
|
496
|
+
return mPrevSpan;
|
497
|
+
}
|
498
|
+
|
499
|
+
/**
|
500
|
+
* Return the previous average X distance between each of the pointers forming the
|
501
|
+
* gesture in progress through the focal point.
|
502
|
+
*
|
503
|
+
* @return Previous distance between pointers in pixels.
|
504
|
+
*/
|
505
|
+
public float getPreviousSpanX() {
|
506
|
+
return mPrevSpanX;
|
507
|
+
}
|
508
|
+
|
509
|
+
/**
|
510
|
+
* Return the previous average Y distance between each of the pointers forming the
|
511
|
+
* gesture in progress through the focal point.
|
512
|
+
*
|
513
|
+
* @return Previous distance between pointers in pixels.
|
514
|
+
*/
|
515
|
+
public float getPreviousSpanY() {
|
516
|
+
return mPrevSpanY;
|
517
|
+
}
|
518
|
+
|
519
|
+
/**
|
520
|
+
* Return the scaling factor from the previous scale event to the current
|
521
|
+
* event. This value is defined as
|
522
|
+
* ({@link #getCurrentSpan()} / {@link #getPreviousSpan()}).
|
523
|
+
*
|
524
|
+
* @return The current scaling factor.
|
525
|
+
*/
|
526
|
+
public float getScaleFactor() {
|
527
|
+
if (inAnchoredScaleMode()) {
|
528
|
+
// Drag is moving up; the further away from the gesture
|
529
|
+
// start, the smaller the span should be, the closer,
|
530
|
+
// the larger the span, and therefore the larger the scale
|
531
|
+
final boolean scaleUp =
|
532
|
+
(mEventBeforeOrAboveStartingGestureEvent && (mCurrSpan < mPrevSpan)) ||
|
533
|
+
(!mEventBeforeOrAboveStartingGestureEvent && (mCurrSpan > mPrevSpan));
|
534
|
+
final float spanDiff = (Math.abs(1 - (mCurrSpan / mPrevSpan)) * SCALE_FACTOR);
|
535
|
+
return mPrevSpan <= mSpanSlop ? 1 : scaleUp ? (1 + spanDiff) : (1 - spanDiff);
|
536
|
+
}
|
537
|
+
return mPrevSpan > 0 ? mCurrSpan / mPrevSpan : 1;
|
538
|
+
}
|
539
|
+
|
540
|
+
/**
|
541
|
+
* Return the time difference in milliseconds between the previous
|
542
|
+
* accepted scaling event and the current scaling event.
|
543
|
+
*
|
544
|
+
* @return Time difference since the last scaling event in milliseconds.
|
545
|
+
*/
|
546
|
+
public long getTimeDelta() {
|
547
|
+
return mCurrTime - mPrevTime;
|
548
|
+
}
|
549
|
+
|
550
|
+
/**
|
551
|
+
* Return the event time of the current event being processed.
|
552
|
+
*
|
553
|
+
* @return Current event time in milliseconds.
|
554
|
+
*/
|
555
|
+
public long getEventTime() {
|
556
|
+
return mCurrTime;
|
557
|
+
}
|
558
|
+
}
|