react-native-gesture-handler 2.12.1 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNGestureHandler.podspec +0 -15
- package/android/build.gradle +5 -76
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +43 -18
- package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +120 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +7 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +5 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +43 -16
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +21 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +9 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +10 -0
- package/ios/Handlers/RNHoverHandler.h +12 -0
- package/ios/Handlers/RNHoverHandler.m +152 -0
- package/ios/RNGestureHandlerButtonComponentView.mm +2 -0
- package/ios/RNGestureHandlerEvents.h +1 -0
- package/ios/RNGestureHandlerEvents.m +10 -0
- package/ios/RNGestureHandlerManager.mm +2 -0
- package/ios/RNManualActivationRecognizer.m +2 -1
- package/ios/RNRootViewGestureRecognizer.m +7 -2
- package/lib/commonjs/RNGestureHandlerModule.macos.js +3 -1
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +7 -2
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +3 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +1 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +1 -2
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/components/touchables/index.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +3 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +3 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +5 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +5 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +74 -0
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -10
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +61 -88
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- 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 +6 -7
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +12 -4
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +2 -7
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -10
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js +18 -4
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- 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 +5 -7
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +118 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +38 -5
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +2 -2
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.macos.js +2 -1
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +6 -3
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +2 -1
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +1 -0
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +1 -2
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/module/components/touchables/index.js.map +1 -1
- package/lib/module/handlers/createHandler.js +3 -3
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +2 -1
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +5 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +4 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +62 -0
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -10
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +61 -84
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- 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 +5 -7
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +11 -4
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +2 -7
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -10
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/EventManager.js +18 -4
- package/lib/module/web/tools/EventManager.js.map +1 -1
- 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 +5 -6
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +102 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +39 -6
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +2 -2
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +1 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +3 -1
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +1 -1
- package/lib/typescript/components/DrawerLayout.d.ts +7 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +3 -2
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts +4 -3
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +3 -2
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +4 -5
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -0
- package/lib/typescript/components/touchables/index.d.ts +3 -0
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +3 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +2 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +32 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -6
- package/lib/typescript/web/handlers/GestureHandler.d.ts +12 -17
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +10 -0
- package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +0 -4
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -4
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -6
- package/lib/typescript/web/interfaces.d.ts +4 -3
- package/lib/typescript/web/tools/EventManager.d.ts +9 -5
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +22 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +21 -0
- package/lib/typescript/web/tools/NodeManager.d.ts +2 -2
- package/lib/typescript/web/tools/PointerEventManager.d.ts +1 -1
- package/lib/typescript/web/tools/TouchEventManager.d.ts +1 -1
- package/package.json +2 -2
- package/src/RNGestureHandlerModule.macos.ts +5 -1
- package/src/RNGestureHandlerModule.web.ts +7 -1
- package/src/RNGestureHandlerModule.windows.ts +5 -1
- package/src/components/DrawerLayout.tsx +9 -0
- package/src/components/touchables/GenericTouchable.tsx +4 -4
- package/src/components/touchables/TouchableHighlight.tsx +6 -3
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +5 -4
- package/src/components/touchables/TouchableOpacity.tsx +6 -7
- package/src/components/touchables/TouchableWithoutFeedback.tsx +3 -1
- package/src/components/touchables/index.ts +3 -0
- package/src/handlers/createHandler.tsx +4 -2
- package/src/handlers/gestureHandlerCommon.ts +39 -0
- package/src/handlers/gestures/GestureDetector.tsx +2 -0
- package/src/handlers/gestures/gesture.ts +6 -0
- package/src/handlers/gestures/gestureObjects.ts +5 -0
- package/src/handlers/gestures/hoverGesture.ts +83 -0
- package/src/index.ts +8 -0
- package/src/web/handlers/FlingGestureHandler.ts +0 -11
- package/src/web/handlers/GestureHandler.ts +68 -88
- package/src/web/handlers/HoverGestureHandler.ts +43 -0
- package/src/web/handlers/LongPressGestureHandler.ts +5 -7
- package/src/web/handlers/NativeViewGestureHandler.ts +11 -4
- package/src/web/handlers/PanGestureHandler.ts +1 -6
- package/src/web/handlers/TapGestureHandler.ts +0 -11
- package/src/web/interfaces.ts +4 -2
- package/src/web/tools/EventManager.ts +15 -7
- package/src/web/tools/GestureHandlerDelegate.ts +23 -0
- package/src/web/tools/GestureHandlerOrchestrator.ts +7 -6
- package/src/web/tools/GestureHandlerWebDelegate.ts +115 -0
- package/src/web/tools/PointerEventManager.ts +46 -16
- package/src/web/tools/TouchEventManager.ts +3 -3
|
@@ -8,6 +8,7 @@ import { RotationGesture } from './rotationGesture';
|
|
|
8
8
|
import { TapGesture } from './tapGesture';
|
|
9
9
|
import { NativeGesture } from './nativeGesture';
|
|
10
10
|
import { ManualGesture } from './manualGesture';
|
|
11
|
+
import { HoverGesture } from './hoverGesture';
|
|
11
12
|
export const GestureObjects = {
|
|
12
13
|
Tap: () => {
|
|
13
14
|
return new TapGesture();
|
|
@@ -36,6 +37,9 @@ export const GestureObjects = {
|
|
|
36
37
|
Manual: () => {
|
|
37
38
|
return new ManualGesture();
|
|
38
39
|
},
|
|
40
|
+
Hover: () => {
|
|
41
|
+
return new HoverGesture();
|
|
42
|
+
},
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Builds a composed gesture consisting of gestures provided as parameters.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["gestureObjects.ts"],"names":["FlingGesture","ForceTouchGesture","ComposedGesture","ExclusiveGesture","SimultaneousGesture","LongPressGesture","PanGesture","PinchGesture","RotationGesture","TapGesture","NativeGesture","ManualGesture","GestureObjects","Tap","Pan","Pinch","Rotation","Fling","LongPress","ForceTouch","Native","Manual","Race","gestures","Simultaneous","Exclusive"],"mappings":"AAAA,SAASA,YAAT,QAA6B,gBAA7B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,SACEC,eADF,EAEEC,gBAFF,EAGEC,mBAHF,QAIO,sBAJP;AAKA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,GAAG,EAAE,MAAM;AACT,WAAO,
|
|
1
|
+
{"version":3,"sources":["gestureObjects.ts"],"names":["FlingGesture","ForceTouchGesture","ComposedGesture","ExclusiveGesture","SimultaneousGesture","LongPressGesture","PanGesture","PinchGesture","RotationGesture","TapGesture","NativeGesture","ManualGesture","HoverGesture","GestureObjects","Tap","Pan","Pinch","Rotation","Fling","LongPress","ForceTouch","Native","Manual","Hover","Race","gestures","Simultaneous","Exclusive"],"mappings":"AAAA,SAASA,YAAT,QAA6B,gBAA7B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,SACEC,eADF,EAEEC,gBAFF,EAGEC,mBAHF,QAIO,sBAJP;AAKA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,GAAG,EAAE,MAAM;AACT,WAAO,IAAIL,UAAJ,EAAP;AACD,GAH2B;AAK5BM,EAAAA,GAAG,EAAE,MAAM;AACT,WAAO,IAAIT,UAAJ,EAAP;AACD,GAP2B;AAS5BU,EAAAA,KAAK,EAAE,MAAM;AACX,WAAO,IAAIT,YAAJ,EAAP;AACD,GAX2B;AAa5BU,EAAAA,QAAQ,EAAE,MAAM;AACd,WAAO,IAAIT,eAAJ,EAAP;AACD,GAf2B;AAiB5BU,EAAAA,KAAK,EAAE,MAAM;AACX,WAAO,IAAIlB,YAAJ,EAAP;AACD,GAnB2B;AAqB5BmB,EAAAA,SAAS,EAAE,MAAM;AACf,WAAO,IAAId,gBAAJ,EAAP;AACD,GAvB2B;AAyB5Be,EAAAA,UAAU,EAAE,MAAM;AAChB,WAAO,IAAInB,iBAAJ,EAAP;AACD,GA3B2B;AA6B5BoB,EAAAA,MAAM,EAAE,MAAM;AACZ,WAAO,IAAIX,aAAJ,EAAP;AACD,GA/B2B;AAiC5BY,EAAAA,MAAM,EAAE,MAAM;AACZ,WAAO,IAAIX,aAAJ,EAAP;AACD,GAnC2B;AAqC5BY,EAAAA,KAAK,EAAE,MAAM;AACX,WAAO,IAAIX,YAAJ,EAAP;AACD,GAvC2B;;AAyC5B;AACF;AACA;AACA;AACEY,EAAAA,IAAI,EAAE,CAAC,GAAGC,QAAJ,KAA4B;AAChC,WAAO,IAAIvB,eAAJ,CAAoB,GAAGuB,QAAvB,CAAP;AACD,GA/C2B;;AAiD5B;AACF;AACA;AACEC,EAAAA,YAAY,CAAC,GAAGD,QAAJ,EAAyB;AACnC,WAAO,IAAIrB,mBAAJ,CAAwB,GAAGqB,QAA3B,CAAP;AACD,GAtD2B;;AAwD5B;AACF;AACA;AACA;AACA;AACA;AACA;AACEE,EAAAA,SAAS,CAAC,GAAGF,QAAJ,EAAyB;AAChC,WAAO,IAAItB,gBAAJ,CAAqB,GAAGsB,QAAxB,CAAP;AACD;;AAjE2B,CAAvB","sourcesContent":["import { FlingGesture } from './flingGesture';\nimport { ForceTouchGesture } from './forceTouchGesture';\nimport { Gesture } from './gesture';\nimport {\n ComposedGesture,\n ExclusiveGesture,\n SimultaneousGesture,\n} from './gestureComposition';\nimport { LongPressGesture } from './longPressGesture';\nimport { PanGesture } from './panGesture';\nimport { PinchGesture } from './pinchGesture';\nimport { RotationGesture } from './rotationGesture';\nimport { TapGesture } from './tapGesture';\nimport { NativeGesture } from './nativeGesture';\nimport { ManualGesture } from './manualGesture';\nimport { HoverGesture } from './hoverGesture';\n\nexport const GestureObjects = {\n Tap: () => {\n return new TapGesture();\n },\n\n Pan: () => {\n return new PanGesture();\n },\n\n Pinch: () => {\n return new PinchGesture();\n },\n\n Rotation: () => {\n return new RotationGesture();\n },\n\n Fling: () => {\n return new FlingGesture();\n },\n\n LongPress: () => {\n return new LongPressGesture();\n },\n\n ForceTouch: () => {\n return new ForceTouchGesture();\n },\n\n Native: () => {\n return new NativeGesture();\n },\n\n Manual: () => {\n return new ManualGesture();\n },\n\n Hover: () => {\n return new HoverGesture();\n },\n\n /**\n * Builds a composed gesture consisting of gestures provided as parameters.\n * The first one that becomes active cancels the rest of gestures.\n */\n Race: (...gestures: Gesture[]) => {\n return new ComposedGesture(...gestures);\n },\n\n /**\n * Builds a composed gesture that allows all base gestures to run simultaneously.\n */\n Simultaneous(...gestures: Gesture[]) {\n return new SimultaneousGesture(...gestures);\n },\n\n /**\n * Builds a composed gesture where only one of the provided gestures can become active.\n * Priority is decided through the order of gestures: the first one has higher priority\n * than the second one, second one has higher priority than the third one, and so on.\n * For example, to make a gesture that recognizes both single and double tap you need\n * to call Exclusive(doubleTap, singleTap).\n */\n Exclusive(...gestures: Gesture[]) {\n return new ExclusiveGesture(...gestures);\n },\n};\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { ContinousBaseGesture } from './gesture';
|
|
4
|
+
export let HoverEffect;
|
|
5
|
+
|
|
6
|
+
(function (HoverEffect) {
|
|
7
|
+
HoverEffect[HoverEffect["NONE"] = 0] = "NONE";
|
|
8
|
+
HoverEffect[HoverEffect["LIFT"] = 1] = "LIFT";
|
|
9
|
+
HoverEffect[HoverEffect["HIGHLIGHT"] = 2] = "HIGHLIGHT";
|
|
10
|
+
})(HoverEffect || (HoverEffect = {}));
|
|
11
|
+
|
|
12
|
+
export const hoverGestureHandlerProps = ['hoverEffect'];
|
|
13
|
+
|
|
14
|
+
function changeEventCalculator(current, previous) {
|
|
15
|
+
'worklet';
|
|
16
|
+
|
|
17
|
+
let changePayload;
|
|
18
|
+
|
|
19
|
+
if (previous === undefined) {
|
|
20
|
+
changePayload = {
|
|
21
|
+
changeX: current.x,
|
|
22
|
+
changeY: current.y
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
changePayload = {
|
|
26
|
+
changeX: current.x - previous.x,
|
|
27
|
+
changeY: current.y - previous.y
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { ...current,
|
|
32
|
+
...changePayload
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class HoverGesture extends ContinousBaseGesture {
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
|
|
40
|
+
_defineProperty(this, "config", {});
|
|
41
|
+
|
|
42
|
+
this.handlerName = 'HoverGestureHandler';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets the visual hover effect.
|
|
46
|
+
* iOS only
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
effect(effect) {
|
|
51
|
+
this.config.hoverEffect = effect;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onChange(callback) {
|
|
56
|
+
// @ts-ignore TS being overprotective, HoverGestureHandlerEventPayload is Record
|
|
57
|
+
this.handlers.changeEventCalculator = changeEventCalculator;
|
|
58
|
+
return super.onChange(callback);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=hoverGesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["hoverGesture.ts"],"names":["ContinousBaseGesture","HoverEffect","hoverGestureHandlerProps","changeEventCalculator","current","previous","changePayload","undefined","changeX","x","changeY","y","HoverGesture","constructor","handlerName","effect","config","hoverEffect","onChange","callback","handlers"],"mappings":";;AAAA,SAA4BA,oBAA5B,QAAwD,WAAxD;AAeA,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W;;AAUZ,OAAO,MAAMC,wBAAwB,GAAG,CAAC,aAAD,CAAjC;;AAEP,SAASC,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,CADH;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO;AAFH,KAAhB;AAID,GALD,MAKO;AACLL,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,CAAR,GAAYJ,QAAQ,CAACI,CADhB;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO,CAAR,GAAYN,QAAQ,CAACM;AAFhB,KAAhB;AAID;;AAED,SAAO,EAAE,GAAGP,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAED,OAAO,MAAMM,YAAN,SAA2BZ,oBAA3B,CAGL;AAGAa,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;AAED;AACF;AACA;AACA;;;AACEC,EAAAA,MAAM,CAACA,MAAD,EAAsB;AAC1B,SAAKC,MAAL,CAAYC,WAAZ,GAA0BF,MAA1B;AACA,WAAO,IAAP;AACD;;AAEDG,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcjB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMe,QAAN,CAAeC,QAAf,CAAP;AACD;;AA5BD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\nexport type HoverGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type HoverGestureChangeEventPayload = {\n changeX: number;\n changeY: number;\n};\n\nexport enum HoverEffect {\n NONE = 0,\n LIFT = 1,\n HIGHLIGHT = 2,\n}\n\nexport interface HoverGestureConfig {\n hoverEffect?: HoverEffect;\n}\n\nexport const hoverGestureHandlerProps = ['hoverEffect'] as const;\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent<HoverGestureHandlerEventPayload>,\n previous?: GestureUpdateEvent<HoverGestureHandlerEventPayload>\n) {\n 'worklet';\n let changePayload: HoverGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n changeX: current.x,\n changeY: current.y,\n };\n } else {\n changePayload = {\n changeX: current.x - previous.x,\n changeY: current.y - previous.y,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class HoverGesture extends ContinousBaseGesture<\n HoverGestureHandlerEventPayload,\n HoverGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & HoverGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'HoverGestureHandler';\n }\n\n /**\n * Sets the visual hover effect.\n * iOS only\n */\n effect(effect: HoverEffect) {\n this.config.hoverEffect = effect;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n HoverGestureHandlerEventPayload & HoverGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, HoverGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type HoverGestureType = InstanceType<typeof HoverGesture>;\n"]}
|
package/lib/module/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';
|
|
|
17
17
|
export { RawButton, BaseButton, RectButton, BorderlessButton, PureNativeButton } from './components/GestureButtons';
|
|
18
18
|
export { TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback } from './components/touchables';
|
|
19
19
|
export { ScrollView, Switch, TextInput, DrawerLayoutAndroid, FlatList, RefreshControl } from './components/GestureComponents';
|
|
20
|
+
export { HoverEffect } from './handlers/gestures/hoverGesture';
|
|
20
21
|
export { default as Swipeable } from './components/Swipeable';
|
|
21
22
|
export { default as DrawerLayout } from './components/DrawerLayout';
|
|
22
23
|
export { enableExperimentalWebImplementation, enableLegacyWebImplementation } from './EnableNewWebImplementation';
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["initialize","Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","GestureDetector","GestureObjects","Gesture","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","PureNativeButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","RefreshControl","Swipeable","DrawerLayout","enableExperimentalWebImplementation","enableLegacyWebImplementation"],"mappings":"AAAA,SAASA,UAAT,QAA2B,QAA3B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,oCAAjD;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,qCAAlD;AA+CA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,wBAAT,QAAyC,qCAAzC;AACA,SAASC,uBAAT,QAAwC,oCAAxC;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAASC,sBAAT,QAAuC,mCAAvC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAAST,OAAO,IAAIU,mBAApB,QAA+C,gCAA/C;AAKA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,cAAc,IAAIC,OAA3B,QAA0C,oCAA1C;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["initialize","Directions","State","default","gestureHandlerRootHOC","GestureHandlerRootView","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","createNativeWrapper","GestureDetector","GestureObjects","Gesture","NativeViewGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton","PureNativeButton","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","Switch","TextInput","DrawerLayoutAndroid","FlatList","RefreshControl","HoverEffect","Swipeable","DrawerLayout","enableExperimentalWebImplementation","enableLegacyWebImplementation"],"mappings":"AAAA,SAASA,UAAT,QAA2B,QAA3B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,OAAO,IAAIC,qBAApB,QAAiD,oCAAjD;AACA,SAASD,OAAO,IAAIE,sBAApB,QAAkD,qCAAlD;AA+CA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,wBAAT,QAAyC,qCAAzC;AACA,SAASC,uBAAT,QAAwC,oCAAxC;AACA,SAASC,iBAAT,QAAkC,8BAAlC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAASC,sBAAT,QAAuC,mCAAvC;AACA,SAASC,mBAAT,QAAoC,gCAApC;AACA,SAAST,OAAO,IAAIU,mBAApB,QAA+C,gCAA/C;AAKA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,cAAc,IAAIC,OAA3B,QAA0C,oCAA1C;AAkBA,SAASC,wBAAT,QAAyC,qCAAzC;AAOA,SACEC,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,gBAJF,EAKEC,gBALF,QAMO,6BANP;AAYA,SACEC,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,QAKO,yBALP;AAMA,SACEC,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,mBAJF,EAKEC,QALF,EAMEC,cANF,QAOO,gCAPP;AAQA,SAASC,WAAT,QAA4B,kCAA5B;AAyCA,SAAS9B,OAAO,IAAI+B,SAApB,QAAqC,wBAArC;AASA,SAAS/B,OAAO,IAAIgC,YAApB,QAAwC,2BAAxC;AAEA,SACEC,mCADF,EAEEC,6BAFF,QAGO,8BAHP;AAKArC,UAAU","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './components/GestureHandlerRootView';\nexport type {\n // event types\n GestureEvent,\n HandlerStateChangeEvent,\n // event payloads types\n GestureEventPayload,\n HandlerStateChangeEventPayload,\n // pointer events\n GestureTouchEvent,\n TouchData,\n // new api event types\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n TapGestureHandlerProps,\n} from './handlers/TapGestureHandler';\nexport type {\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureHandlerProps,\n} from './handlers/ForceTouchGestureHandler';\nexport type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';\nexport type {\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from './handlers/LongPressGestureHandler';\nexport type {\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from './handlers/PanGestureHandler';\nexport type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';\nexport type {\n PinchGestureHandlerEventPayload,\n PinchGestureHandlerProps,\n} from './handlers/PinchGestureHandler';\nexport type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';\nexport type {\n RotationGestureHandlerEventPayload,\n RotationGestureHandlerProps,\n} from './handlers/RotationGestureHandler';\nexport type {\n FlingGestureHandlerEventPayload,\n FlingGestureHandlerProps,\n} from './handlers/FlingGestureHandler';\nexport { TapGestureHandler } from './handlers/TapGestureHandler';\nexport { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';\nexport { LongPressGestureHandler } from './handlers/LongPressGestureHandler';\nexport { PanGestureHandler } from './handlers/PanGestureHandler';\nexport { PinchGestureHandler } from './handlers/PinchGestureHandler';\nexport { RotationGestureHandler } from './handlers/RotationGestureHandler';\nexport { FlingGestureHandler } from './handlers/FlingGestureHandler';\nexport { default as createNativeWrapper } from './handlers/createNativeWrapper';\nexport type {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from './handlers/NativeViewGestureHandler';\nexport { GestureDetector } from './handlers/gestures/GestureDetector';\nexport { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';\nexport type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';\nexport type { PanGestureType as PanGesture } from './handlers/gestures/panGesture';\nexport type { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';\nexport type { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';\nexport type { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';\nexport type { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';\nexport type { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';\nexport type { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';\nexport type { HoverGestureType as HoverGesture } from './handlers/gestures/hoverGesture';\nexport type {\n ComposedGestureType as ComposedGesture,\n RaceGestureType as RaceGesture,\n SimultaneousGestureType as SimultaneousGesture,\n ExclusiveGestureType as ExclusiveGesture,\n} from './handlers/gestures/gestureComposition';\nexport type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';\nexport { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';\nexport type {\n RawButtonProps,\n BaseButtonProps,\n RectButtonProps,\n BorderlessButtonProps,\n} from './components/GestureButtons';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PureNativeButton,\n} from './components/GestureButtons';\nexport type {\n TouchableHighlightProps,\n TouchableOpacityProps,\n TouchableWithoutFeedbackProps,\n} from './components/touchables';\nexport {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} from './components/touchables';\nexport {\n ScrollView,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n FlatList,\n RefreshControl,\n} from './components/GestureComponents';\nexport { HoverEffect } from './handlers/gestures/hoverGesture';\nexport type {\n //events\n GestureHandlerGestureEvent,\n GestureHandlerStateChangeEvent,\n //event payloads\n GestureHandlerGestureEventNativeEvent,\n GestureHandlerStateChangeNativeEvent,\n NativeViewGestureHandlerGestureEvent,\n NativeViewGestureHandlerStateChangeEvent,\n TapGestureHandlerGestureEvent,\n TapGestureHandlerStateChangeEvent,\n ForceTouchGestureHandlerGestureEvent,\n ForceTouchGestureHandlerStateChangeEvent,\n LongPressGestureHandlerGestureEvent,\n LongPressGestureHandlerStateChangeEvent,\n PanGestureHandlerGestureEvent,\n PanGestureHandlerStateChangeEvent,\n PinchGestureHandlerGestureEvent,\n PinchGestureHandlerStateChangeEvent,\n RotationGestureHandlerGestureEvent,\n RotationGestureHandlerStateChangeEvent,\n FlingGestureHandlerGestureEvent,\n FlingGestureHandlerStateChangeEvent,\n // handlers props\n NativeViewGestureHandlerProperties,\n TapGestureHandlerProperties,\n LongPressGestureHandlerProperties,\n PanGestureHandlerProperties,\n PinchGestureHandlerProperties,\n RotationGestureHandlerProperties,\n FlingGestureHandlerProperties,\n ForceTouchGestureHandlerProperties,\n // buttons props\n RawButtonProperties,\n BaseButtonProperties,\n RectButtonProperties,\n BorderlessButtonProperties,\n} from './handlers/gestureHandlerTypesCompat';\n\nexport type { SwipeableProps } from './components/Swipeable';\nexport { default as Swipeable } from './components/Swipeable';\nexport type {\n DrawerLayoutProps,\n DrawerPosition,\n DrawerState,\n DrawerType,\n DrawerLockMode,\n DrawerKeyboardDismissMode,\n} from './components/DrawerLayout';\nexport { default as DrawerLayout } from './components/DrawerLayout';\n\nexport {\n enableExperimentalWebImplementation,\n enableLegacyWebImplementation,\n} from './EnableNewWebImplementation';\n\ninitialize();\n"]}
|
|
@@ -52,16 +52,6 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
transformNativeEvent() {
|
|
56
|
-
const rect = this.view.getBoundingClientRect();
|
|
57
|
-
return {
|
|
58
|
-
x: this.tracker.getLastAvgX() - rect.left,
|
|
59
|
-
y: this.tracker.getLastAvgY() - rect.top,
|
|
60
|
-
absoluteX: this.tracker.getLastAvgX(),
|
|
61
|
-
absoluteY: this.tracker.getLastAvgY()
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
55
|
startFling() {
|
|
66
56
|
this.startX = this.tracker.getLastX(this.keyPointer);
|
|
67
57
|
this.startY = this.tracker.getLastY(this.keyPointer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FlingGestureHandler.ts"],"names":["State","Direction","GestureHandler","DEFAULT_MAX_DURATION_MS","DEFAULT_MIN_ACCEPTABLE_DELTA","DEFAULT_DIRECTION","RIGHT","DEFAULT_NUMBER_OF_TOUCHES_REQUIRED","FlingGestureHandler","NaN","init","ref","propsRef","updateGestureConfig","enabled","props","config","direction","numberOfPointers","numberOfPointersRequired","
|
|
1
|
+
{"version":3,"sources":["FlingGestureHandler.ts"],"names":["State","Direction","GestureHandler","DEFAULT_MAX_DURATION_MS","DEFAULT_MIN_ACCEPTABLE_DELTA","DEFAULT_DIRECTION","RIGHT","DEFAULT_NUMBER_OF_TOUCHES_REQUIRED","FlingGestureHandler","NaN","init","ref","propsRef","updateGestureConfig","enabled","props","config","direction","numberOfPointers","numberOfPointersRequired","startFling","startX","tracker","getLastX","keyPointer","startY","getLastY","begin","maxNumberOfPointersSimultaneously","delayTimeout","setTimeout","fail","maxDurationMs","tryEndFling","minAcceptableDelta","LEFT","UP","DOWN","clearTimeout","activate","endFling","onPointerDown","event","addToTracker","pointerId","newPointerAction","onPointerAdd","currentState","UNDETERMINED","BEGAN","getTrackedPointersCount","onPointerMove","track","onPointerUp","onUp","onPointerRemove","removeFromTracker","force","end","resetConfig"],"mappings":"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","sourcesContent":["import { State } from '../../State';\nimport { Direction } from '../constants';\nimport { AdaptedEvent, Config } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\n\nconst DEFAULT_MAX_DURATION_MS = 800;\nconst DEFAULT_MIN_ACCEPTABLE_DELTA = 160;\nconst DEFAULT_DIRECTION = Direction.RIGHT;\nconst DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;\n\nexport default class FlingGestureHandler extends GestureHandler {\n private numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n private direction = DEFAULT_DIRECTION;\n\n private maxDurationMs = DEFAULT_MAX_DURATION_MS;\n private minAcceptableDelta = DEFAULT_MIN_ACCEPTABLE_DELTA;\n private delayTimeout!: number;\n\n private startX = 0;\n private startY = 0;\n\n private maxNumberOfPointersSimultaneously = 0;\n private keyPointer = NaN;\n\n public init(ref: number, propsRef: React.RefObject<unknown>): void {\n super.init(ref, propsRef);\n }\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n super.updateGestureConfig({ enabled: enabled, ...props });\n\n if (this.config.direction) {\n this.direction = this.config.direction;\n }\n\n if (this.config.numberOfPointers) {\n this.numberOfPointersRequired = this.config.numberOfPointers;\n }\n }\n\n private startFling(): void {\n this.startX = this.tracker.getLastX(this.keyPointer);\n this.startY = this.tracker.getLastY(this.keyPointer);\n\n this.begin();\n\n this.maxNumberOfPointersSimultaneously = 1;\n\n this.delayTimeout = setTimeout(() => this.fail(), this.maxDurationMs);\n }\n\n private tryEndFling(): boolean {\n if (\n this.maxNumberOfPointersSimultaneously ===\n this.numberOfPointersRequired &&\n ((this.direction & Direction.RIGHT &&\n this.tracker.getLastX(this.keyPointer) - this.startX >\n this.minAcceptableDelta) ||\n (this.direction & Direction.LEFT &&\n this.startX - this.tracker.getLastX(this.keyPointer) >\n this.minAcceptableDelta) ||\n (this.direction & Direction.UP &&\n this.startY - this.tracker.getLastY(this.keyPointer) >\n this.minAcceptableDelta) ||\n (this.direction & Direction.DOWN &&\n this.tracker.getLastY(this.keyPointer) - this.startY >\n this.minAcceptableDelta))\n ) {\n clearTimeout(this.delayTimeout);\n this.activate();\n\n return true;\n }\n\n return false;\n }\n\n private endFling() {\n if (!this.tryEndFling()) {\n this.fail();\n }\n }\n\n protected onPointerDown(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n this.keyPointer = event.pointerId;\n\n super.onPointerDown(event);\n this.newPointerAction();\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n this.newPointerAction();\n }\n\n private newPointerAction(): void {\n if (this.currentState === State.UNDETERMINED) {\n this.startFling();\n }\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n\n if (\n this.tracker.getTrackedPointersCount() >\n this.maxNumberOfPointersSimultaneously\n ) {\n this.maxNumberOfPointersSimultaneously =\n this.tracker.getTrackedPointersCount();\n }\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n\n if (this.currentState !== State.BEGAN) {\n return;\n }\n\n this.tryEndFling();\n\n super.onPointerMove(event);\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.onUp(event);\n\n this.keyPointer = NaN;\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.onUp(event);\n }\n\n private onUp(event: AdaptedEvent): void {\n this.tracker.removeFromTracker(event.pointerId);\n if (this.currentState !== State.BEGAN) {\n return;\n }\n this.endFling();\n }\n\n public activate(force?: boolean): void {\n super.activate(force);\n this.end();\n }\n\n protected resetConfig(): void {\n super.resetConfig();\n this.numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;\n this.direction = DEFAULT_DIRECTION;\n }\n}\n"]}
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
4
|
-
import { findNodeHandle } from 'react-native';
|
|
5
4
|
import { State } from '../../State';
|
|
6
5
|
import { PointerType, TouchEventType, EventTypes } from '../interfaces';
|
|
7
6
|
import GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';
|
|
8
7
|
import InteractionManager from '../tools/InteractionManager';
|
|
9
|
-
import PointerEventManager from '../tools/PointerEventManager';
|
|
10
8
|
import PointerTracker from '../tools/PointerTracker';
|
|
11
|
-
import TouchEventManager from '../tools/TouchEventManager';
|
|
12
|
-
import { isPointerInBounds } from '../utils';
|
|
13
9
|
export default class GestureHandler {
|
|
14
10
|
// Orchestrator properties
|
|
15
|
-
constructor() {
|
|
11
|
+
constructor(delegate) {
|
|
16
12
|
_defineProperty(this, "lastSentState", null);
|
|
17
13
|
|
|
18
14
|
_defineProperty(this, "currentState", State.UNDETERMINED);
|
|
19
15
|
|
|
20
16
|
_defineProperty(this, "shouldCancellWhenOutside", false);
|
|
21
17
|
|
|
22
|
-
_defineProperty(this, "hasCustomActivationCriteria",
|
|
18
|
+
_defineProperty(this, "hasCustomActivationCriteria", false);
|
|
23
19
|
|
|
24
20
|
_defineProperty(this, "enabled", false);
|
|
25
21
|
|
|
26
|
-
_defineProperty(this, "
|
|
22
|
+
_defineProperty(this, "viewRef", void 0);
|
|
27
23
|
|
|
28
24
|
_defineProperty(this, "propsRef", void 0);
|
|
29
25
|
|
|
@@ -33,10 +29,6 @@ export default class GestureHandler {
|
|
|
33
29
|
enabled: false
|
|
34
30
|
});
|
|
35
31
|
|
|
36
|
-
_defineProperty(this, "view", void 0);
|
|
37
|
-
|
|
38
|
-
_defineProperty(this, "eventManagers", []);
|
|
39
|
-
|
|
40
32
|
_defineProperty(this, "tracker", new PointerTracker());
|
|
41
33
|
|
|
42
34
|
_defineProperty(this, "activationIndex", 0);
|
|
@@ -49,6 +41,8 @@ export default class GestureHandler {
|
|
|
49
41
|
|
|
50
42
|
_defineProperty(this, "pointerType", PointerType.NONE);
|
|
51
43
|
|
|
44
|
+
_defineProperty(this, "delegate", void 0);
|
|
45
|
+
|
|
52
46
|
_defineProperty(this, "sendEvent", (newState, oldState) => {
|
|
53
47
|
const {
|
|
54
48
|
onGestureHandlerEvent,
|
|
@@ -70,52 +64,32 @@ export default class GestureHandler {
|
|
|
70
64
|
}
|
|
71
65
|
});
|
|
72
66
|
|
|
73
|
-
this.
|
|
67
|
+
this.delegate = delegate;
|
|
74
68
|
} //
|
|
75
69
|
// Initializing handler
|
|
76
70
|
//
|
|
77
71
|
|
|
78
72
|
|
|
79
|
-
init(
|
|
73
|
+
init(viewRef, propsRef) {
|
|
80
74
|
this.propsRef = propsRef;
|
|
81
|
-
this.
|
|
75
|
+
this.viewRef = viewRef;
|
|
82
76
|
this.currentState = State.UNDETERMINED;
|
|
83
|
-
this.
|
|
84
|
-
this.addEventManager(new PointerEventManager(this.view));
|
|
85
|
-
this.addEventManager(new TouchEventManager(this.view));
|
|
77
|
+
this.delegate.init(viewRef, this);
|
|
86
78
|
}
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
if (!this.ref) {
|
|
90
|
-
throw new Error(`Cannot find HTML Element for handler ${this.handlerTag}`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this.view = findNodeHandle(this.ref);
|
|
94
|
-
this.view.style['touchAction'] = 'none'; //@ts-ignore This one disables default events on Safari
|
|
95
|
-
|
|
96
|
-
this.view.style['WebkitTouchCallout'] = 'none';
|
|
97
|
-
|
|
98
|
-
if (!this.config.userSelect) {
|
|
99
|
-
this.view.style['webkitUserSelect'] = 'none';
|
|
100
|
-
this.view.style['userSelect'] = 'none';
|
|
101
|
-
} else {
|
|
102
|
-
this.view.style['webkitUserSelect'] = this.config.userSelect;
|
|
103
|
-
this.view.style['userSelect'] = this.config.userSelect;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
addEventManager(manager) {
|
|
80
|
+
attachEventManager(manager) {
|
|
108
81
|
manager.setOnPointerDown(this.onPointerDown.bind(this));
|
|
109
82
|
manager.setOnPointerAdd(this.onPointerAdd.bind(this));
|
|
110
83
|
manager.setOnPointerUp(this.onPointerUp.bind(this));
|
|
111
84
|
manager.setOnPointerRemove(this.onPointerRemove.bind(this));
|
|
112
85
|
manager.setOnPointerMove(this.onPointerMove.bind(this));
|
|
113
86
|
manager.setOnPointerEnter(this.onPointerEnter.bind(this));
|
|
114
|
-
manager.
|
|
87
|
+
manager.setOnPointerLeave(this.onPointerLeave.bind(this));
|
|
115
88
|
manager.setOnPointerCancel(this.onPointerCancel.bind(this));
|
|
116
89
|
manager.setOnPointerOutOfBounds(this.onPointerOutOfBounds.bind(this));
|
|
90
|
+
manager.setOnPointerMoveOver(this.onPointerMoveOver.bind(this));
|
|
91
|
+
manager.setOnPointerMoveOut(this.onPointerMoveOut.bind(this));
|
|
117
92
|
manager.setListeners();
|
|
118
|
-
this.eventManagers.push(manager);
|
|
119
93
|
} //
|
|
120
94
|
// Resetting handler
|
|
121
95
|
//
|
|
@@ -131,7 +105,7 @@ export default class GestureHandler {
|
|
|
131
105
|
this.tracker.resetTracker();
|
|
132
106
|
this.onReset();
|
|
133
107
|
this.resetProgress();
|
|
134
|
-
this.
|
|
108
|
+
this.delegate.reset();
|
|
135
109
|
this.currentState = State.UNDETERMINED;
|
|
136
110
|
} //
|
|
137
111
|
// State logic
|
|
@@ -172,8 +146,10 @@ export default class GestureHandler {
|
|
|
172
146
|
|
|
173
147
|
fail(sendIfDisabled) {
|
|
174
148
|
if (this.currentState === State.ACTIVE || this.currentState === State.BEGAN) {
|
|
149
|
+
// Here the order of calling the delegate and moveToState is important.
|
|
150
|
+
// At this point we can use currentState as previuos state, because immediately after changing cursor we call moveToState method.
|
|
151
|
+
this.delegate.onFail();
|
|
175
152
|
this.moveToState(State.FAILED, sendIfDisabled);
|
|
176
|
-
this.view.style.cursor = 'auto';
|
|
177
153
|
}
|
|
178
154
|
|
|
179
155
|
this.resetProgress();
|
|
@@ -185,23 +161,25 @@ export default class GestureHandler {
|
|
|
185
161
|
|
|
186
162
|
cancel(sendIfDisabled) {
|
|
187
163
|
if (this.currentState === State.ACTIVE || this.currentState === State.UNDETERMINED || this.currentState === State.BEGAN) {
|
|
188
|
-
this.onCancel();
|
|
164
|
+
this.onCancel(); // Same as above - order matters
|
|
165
|
+
|
|
166
|
+
this.delegate.onCancel();
|
|
189
167
|
this.moveToState(State.CANCELLED, sendIfDisabled);
|
|
190
|
-
this.view.style.cursor = 'auto';
|
|
191
168
|
}
|
|
192
169
|
}
|
|
193
170
|
|
|
194
171
|
activate(_force = false) {
|
|
195
172
|
if (this.currentState === State.UNDETERMINED || this.currentState === State.BEGAN) {
|
|
173
|
+
this.delegate.onActivate();
|
|
196
174
|
this.moveToState(State.ACTIVE);
|
|
197
|
-
this.view.style.cursor = 'grab';
|
|
198
175
|
}
|
|
199
176
|
}
|
|
200
177
|
|
|
201
178
|
end() {
|
|
202
179
|
if (this.currentState === State.BEGAN || this.currentState === State.ACTIVE) {
|
|
180
|
+
// Same as above - order matters
|
|
181
|
+
this.delegate.onEnd();
|
|
203
182
|
this.moveToState(State.END);
|
|
204
|
-
this.view.style.cursor = 'auto';
|
|
205
183
|
}
|
|
206
184
|
|
|
207
185
|
this.resetProgress();
|
|
@@ -318,7 +296,7 @@ export default class GestureHandler {
|
|
|
318
296
|
}
|
|
319
297
|
}
|
|
320
298
|
|
|
321
|
-
|
|
299
|
+
onPointerLeave(event) {
|
|
322
300
|
if (this.shouldCancellWhenOutside) {
|
|
323
301
|
switch (this.currentState) {
|
|
324
302
|
case State.ACTIVE:
|
|
@@ -361,6 +339,12 @@ export default class GestureHandler {
|
|
|
361
339
|
}
|
|
362
340
|
}
|
|
363
341
|
|
|
342
|
+
onPointerMoveOver(_event) {// used only by hover gesture handler atm
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
onPointerMoveOut(_event) {// used only by hover gesture handler atm
|
|
346
|
+
}
|
|
347
|
+
|
|
364
348
|
tryToSendMoveEvent(out) {
|
|
365
349
|
if (this.enabled && this.active && (!out || out && !this.shouldCancellWhenOutside)) {
|
|
366
350
|
this.sendEvent(this.currentState, this.currentState);
|
|
@@ -390,13 +374,13 @@ export default class GestureHandler {
|
|
|
390
374
|
nativeEvent: {
|
|
391
375
|
numberOfPointers: this.tracker.getTrackedPointersCount(),
|
|
392
376
|
state: newState,
|
|
393
|
-
pointerInside: isPointerInBounds(
|
|
377
|
+
pointerInside: this.delegate.isPointerInBounds({
|
|
394
378
|
x: this.tracker.getLastAvgX(),
|
|
395
379
|
y: this.tracker.getLastAvgY()
|
|
396
380
|
}),
|
|
397
381
|
...this.transformNativeEvent(),
|
|
398
382
|
handlerTag: this.handlerTag,
|
|
399
|
-
target: this.
|
|
383
|
+
target: this.viewRef,
|
|
400
384
|
oldState: newState !== oldState ? oldState : undefined
|
|
401
385
|
},
|
|
402
386
|
timeStamp: Date.now()
|
|
@@ -406,7 +390,7 @@ export default class GestureHandler {
|
|
|
406
390
|
transformTouchEvent(event) {
|
|
407
391
|
var _event$touchEventType;
|
|
408
392
|
|
|
409
|
-
const rect = this.
|
|
393
|
+
const rect = this.delegate.measureView();
|
|
410
394
|
const all = [];
|
|
411
395
|
const changed = [];
|
|
412
396
|
const trackerData = this.tracker.getData(); // This if handles edge case where all pointers have been cancelled
|
|
@@ -422,8 +406,8 @@ export default class GestureHandler {
|
|
|
422
406
|
const id = this.tracker.getMappedTouchEventId(key);
|
|
423
407
|
all.push({
|
|
424
408
|
id: id,
|
|
425
|
-
x: element.lastX - rect.
|
|
426
|
-
y: element.lastY - rect.
|
|
409
|
+
x: element.lastX - rect.pageX,
|
|
410
|
+
y: element.lastY - rect.pageY,
|
|
427
411
|
absoluteX: element.lastX,
|
|
428
412
|
absoluteY: element.lastY
|
|
429
413
|
});
|
|
@@ -433,8 +417,8 @@ export default class GestureHandler {
|
|
|
433
417
|
if (event.eventType !== EventTypes.CANCEL) {
|
|
434
418
|
changed.push({
|
|
435
419
|
id: this.tracker.getMappedTouchEventId(event.pointerId),
|
|
436
|
-
x: event.x - rect.
|
|
437
|
-
y: event.y - rect.
|
|
420
|
+
x: event.x - rect.pageX,
|
|
421
|
+
y: event.y - rect.pageY,
|
|
438
422
|
absoluteX: event.x,
|
|
439
423
|
absoluteY: event.y
|
|
440
424
|
});
|
|
@@ -443,8 +427,8 @@ export default class GestureHandler {
|
|
|
443
427
|
const id = this.tracker.getMappedTouchEventId(key);
|
|
444
428
|
changed.push({
|
|
445
429
|
id: id,
|
|
446
|
-
x: element.lastX - rect.
|
|
447
|
-
y: element.lastY - rect.
|
|
430
|
+
x: element.lastX - rect.pageX,
|
|
431
|
+
y: element.lastY - rect.pageY,
|
|
448
432
|
absoluteX: element.lastX,
|
|
449
433
|
absoluteY: element.lastY
|
|
450
434
|
});
|
|
@@ -496,7 +480,7 @@ export default class GestureHandler {
|
|
|
496
480
|
}
|
|
497
481
|
|
|
498
482
|
cancelTouches() {
|
|
499
|
-
const rect = this.
|
|
483
|
+
const rect = this.delegate.measureView();
|
|
500
484
|
const all = [];
|
|
501
485
|
const changed = [];
|
|
502
486
|
const trackerData = this.tracker.getData();
|
|
@@ -509,15 +493,15 @@ export default class GestureHandler {
|
|
|
509
493
|
const id = this.tracker.getMappedTouchEventId(key);
|
|
510
494
|
all.push({
|
|
511
495
|
id: id,
|
|
512
|
-
x: element.lastX - rect.
|
|
513
|
-
y: element.lastY - rect.
|
|
496
|
+
x: element.lastX - rect.pageX,
|
|
497
|
+
y: element.lastY - rect.pageY,
|
|
514
498
|
absoluteX: element.lastX,
|
|
515
499
|
absoluteY: element.lastY
|
|
516
500
|
});
|
|
517
501
|
changed.push({
|
|
518
502
|
id: id,
|
|
519
|
-
x: element.lastX - rect.
|
|
520
|
-
y: element.lastY - rect.
|
|
503
|
+
x: element.lastX - rect.pageX,
|
|
504
|
+
y: element.lastY - rect.pageY,
|
|
521
505
|
absoluteX: element.lastX,
|
|
522
506
|
absoluteY: element.lastY
|
|
523
507
|
});
|
|
@@ -540,7 +524,14 @@ export default class GestureHandler {
|
|
|
540
524
|
}
|
|
541
525
|
|
|
542
526
|
transformNativeEvent() {
|
|
543
|
-
|
|
527
|
+
// those properties are shared by most handlers and if not this method will be overriden
|
|
528
|
+
const rect = this.delegate.measureView();
|
|
529
|
+
return {
|
|
530
|
+
x: this.tracker.getLastAvgX() - rect.pageX,
|
|
531
|
+
y: this.tracker.getLastAvgY() - rect.pageY,
|
|
532
|
+
absoluteX: this.tracker.getLastAvgX(),
|
|
533
|
+
absoluteY: this.tracker.getLastAvgY()
|
|
534
|
+
};
|
|
544
535
|
} //
|
|
545
536
|
// Handling config
|
|
546
537
|
//
|
|
@@ -616,8 +607,10 @@ export default class GestureHandler {
|
|
|
616
607
|
return true;
|
|
617
608
|
}
|
|
618
609
|
|
|
619
|
-
const
|
|
620
|
-
|
|
610
|
+
const {
|
|
611
|
+
width,
|
|
612
|
+
height
|
|
613
|
+
} = this.delegate.measureView();
|
|
621
614
|
let left = 0;
|
|
622
615
|
let top = 0;
|
|
623
616
|
let right = width;
|
|
@@ -665,9 +658,9 @@ export default class GestureHandler {
|
|
|
665
658
|
}
|
|
666
659
|
}
|
|
667
660
|
|
|
668
|
-
const rect = this.
|
|
669
|
-
const offsetX = this.tracker.getLastX() - rect.
|
|
670
|
-
const offsetY = this.tracker.getLastY() - rect.
|
|
661
|
+
const rect = this.delegate.measureView();
|
|
662
|
+
const offsetX = this.tracker.getLastX() - rect.pageX;
|
|
663
|
+
const offsetY = this.tracker.getLastY() - rect.pageY;
|
|
671
664
|
|
|
672
665
|
if (offsetX >= left && offsetX <= right && offsetY >= top && offsetY <= bottom) {
|
|
673
666
|
return true;
|
|
@@ -676,14 +669,6 @@ export default class GestureHandler {
|
|
|
676
669
|
return false;
|
|
677
670
|
}
|
|
678
671
|
|
|
679
|
-
isPointerInBounds({
|
|
680
|
-
x,
|
|
681
|
-
y
|
|
682
|
-
}) {
|
|
683
|
-
const rect = this.view.getBoundingClientRect();
|
|
684
|
-
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
672
|
resetConfig() {} //
|
|
688
673
|
// Getters and setters
|
|
689
674
|
//
|
|
@@ -701,16 +686,8 @@ export default class GestureHandler {
|
|
|
701
686
|
return this.config;
|
|
702
687
|
}
|
|
703
688
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
getView() {
|
|
709
|
-
return this.view;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
getEventManagers() {
|
|
713
|
-
return this.eventManagers;
|
|
689
|
+
getDelegate() {
|
|
690
|
+
return this.delegate;
|
|
714
691
|
}
|
|
715
692
|
|
|
716
693
|
getTracker() {
|