react-native-gesture-handler 2.21.2 → 2.22.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -3
- package/android/build.gradle +10 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +3 -2
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +3 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +16 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +45 -8
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +18 -0
- package/apple/Handlers/RNFlingHandler.m +0 -1
- package/apple/Handlers/RNForceTouchHandler.m +0 -1
- package/apple/Handlers/RNLongPressHandler.m +0 -1
- package/apple/Handlers/RNManualHandler.m +0 -1
- package/apple/Handlers/RNPanHandler.m +0 -3
- package/apple/Handlers/RNPinchHandler.m +0 -1
- package/apple/Handlers/RNRotationHandler.m +0 -1
- package/apple/Handlers/RNTapHandler.m +0 -1
- package/apple/RNGestureHandlerButton.h +1 -0
- package/apple/RNGestureHandlerButton.mm +51 -0
- package/apple/RNGestureHandlerManager.mm +6 -1
- package/apple/RNManualActivationRecognizer.m +1 -0
- package/lib/commonjs/ActionType.js.map +1 -1
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/EnableNewWebImplementation.js +14 -1
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -1
- package/lib/commonjs/State.js.map +1 -1
- package/lib/commonjs/TouchEventType.js.map +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js +1 -1
- package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
- package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/Text.js +61 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.js +10 -2
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +12 -0
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +4 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js +3 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js +48 -0
- package/lib/commonjs/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/utils.js +1 -0
- package/lib/commonjs/handlers/utils.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
- package/lib/commonjs/mountRegistry.js +49 -0
- package/lib/commonjs/mountRegistry.js.map +1 -0
- package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -4
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/module/ActionType.js.map +1 -1
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +14 -1
- package/lib/module/EnableNewWebImplementation.js.map +1 -1
- package/lib/module/State.js.map +1 -1
- package/lib/module/TouchEventType.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +1 -1
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/Text.js +44 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.js +10 -2
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js.map +1 -1
- package/lib/module/handlers/createHandler.js +11 -0
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +3 -0
- package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/index.js +2 -0
- package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js +39 -0
- package/lib/module/handlers/gestures/GestureDetector/useMountReactions.js.map +1 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/utils.js +1 -3
- package/lib/module/handlers/utils.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jestUtils/jestUtils.js.map +1 -1
- package/lib/module/mountRegistry.js +40 -0
- package/lib/module/mountRegistry.js.map +1 -0
- package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -4
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +0 -14
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -14
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +3 -5
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +0 -4
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -10
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -14
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -4
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/web_hammer/PressGestureHandler.js.map +1 -1
- package/lib/typescript/ActionType.d.ts +1 -1
- package/lib/typescript/Directions.d.ts +2 -2
- package/lib/typescript/EnableNewWebImplementation.d.ts +6 -0
- package/lib/typescript/State.d.ts +1 -1
- package/lib/typescript/TouchEventType.d.ts +1 -1
- package/lib/typescript/components/GestureButtonsProps.d.ts +2 -2
- package/lib/typescript/components/Text.d.ts +4 -0
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +1 -1
- package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +2 -2
- package/lib/typescript/handlers/gestures/GestureDetector/useMountReactions.d.ts +2 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -1
- package/lib/typescript/handlers/utils.d.ts +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/mocks.d.ts +3 -3
- package/lib/typescript/mountRegistry.d.ts +17 -0
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -4
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -2
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -2
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -3
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -2
- package/package.json +16 -17
- package/src/ActionType.ts +1 -1
- package/src/Directions.ts +2 -2
- package/src/EnableNewWebImplementation.ts +18 -0
- package/src/State.ts +1 -1
- package/src/TouchEventType.ts +2 -1
- package/src/components/GestureButtonsProps.ts +4 -2
- package/src/components/Pressable/Pressable.tsx +3 -3
- package/src/components/ReanimatedSwipeable.tsx +8 -8
- package/src/components/Swipeable.tsx +4 -4
- package/src/components/Text.tsx +60 -0
- package/src/components/touchables/GenericTouchable.tsx +1 -1
- package/src/getShadowNodeFromRef.ts +8 -2
- package/src/ghQueueMicrotask.ts +2 -2
- package/src/handlers/GestureHandlerEventPayload.ts +2 -2
- package/src/handlers/createHandler.tsx +14 -1
- package/src/handlers/gestureHandlerCommon.ts +3 -3
- package/src/handlers/gestures/GestureDetector/attachHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/dropHandlers.ts +3 -0
- package/src/handlers/gestures/GestureDetector/index.tsx +3 -0
- package/src/handlers/gestures/GestureDetector/useMountReactions.ts +51 -0
- package/src/handlers/gestures/gesture.ts +3 -3
- package/src/handlers/utils.ts +2 -1
- package/src/index.ts +1 -0
- package/src/jestUtils/jestUtils.ts +10 -12
- package/src/mountRegistry.ts +51 -0
- package/src/web/detectors/ScaleGestureDetector.ts +1 -1
- package/src/web/handlers/FlingGestureHandler.ts +0 -4
- package/src/web/handlers/GestureHandler.ts +1 -3
- package/src/web/handlers/HoverGestureHandler.ts +1 -9
- package/src/web/handlers/ManualGestureHandler.ts +1 -9
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -5
- package/src/web/handlers/PanGestureHandler.ts +0 -4
- package/src/web/handlers/PinchGestureHandler.ts +1 -5
- package/src/web/handlers/RotationGestureHandler.ts +1 -9
- package/src/web/handlers/TapGestureHandler.ts +0 -4
- package/src/web/tools/GestureHandlerWebDelegate.ts +4 -4
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/src/web_hammer/PressGestureHandler.ts +7 -4
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +0 -86
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["GestureHandler.ts"],"names":["State","TouchEventType","EventTypes","GestureHandlerOrchestrator","InteractionManager","PointerTracker","MouseButton","PointerType","GestureHandler","constructor","delegate","UNDETERMINED","enabled","MOUSE","newState","oldState","onGestureHandlerEvent","onGestureHandlerStateChange","propsRef","current","resultEvent","transformEventData","lastSentState","invokeNullableMethod","currentState","ACTIVE","nativeEvent","undefined","init","viewRef","attachEventManager","manager","setOnPointerDown","onPointerDown","bind","setOnPointerAdd","onPointerAdd","setOnPointerUp","onPointerUp","setOnPointerRemove","onPointerRemove","setOnPointerMove","onPointerMove","setOnPointerEnter","onPointerEnter","setOnPointerLeave","onPointerLeave","setOnPointerCancel","onPointerCancel","setOnPointerOutOfBounds","onPointerOutOfBounds","setOnPointerMoveOver","onPointerMoveOver","setOnPointerMoveOut","onPointerMoveOut","setOnWheel","onWheel","registerListeners","onCancel","onReset","resetProgress","reset","tracker","resetTracker","moveToState","sendIfDisabled","getTrackedPointersCount","config","needsPointerData","isFinished","cancelTouches","getInstance","onHandlerStateChange","onStateChange","_newState","_oldState","begin","checkHitSlop","BEGAN","fail","onFail","FAILED","cancel","CANCELLED","activate","force","manualActivation","onActivate","end","onEnd","END","isAwaiting","awaiting","setAwaiting","value","isActive","active","setActive","getShouldResetProgress","shouldResetProgress","setShouldResetProgress","getActivationIndex","activationIndex","setActivationIndex","shouldWaitForHandlerFailure","handler","shouldRequireToWaitForFailure","shouldRequireHandlerToWaitForFailure","shouldRecognizeSimultaneously","shouldBeCancelledByOther","shouldHandlerBeCancelledBy","event","recordHandlerIfNotPresent","pointerType","TOUCH","cancelMouseAndPenGestures","tryToSendTouchEvent","tryToSendMoveEvent","shouldCancelWhenOutside","_event","out","sendEvent","sendTouchEvent","touchEvent","transformTouchEvent","numberOfPointers","state","pointerInside","isPointerInBounds","getAbsoluteCoordsAverage","transformNativeEvent","handlerTag","target","timeStamp","Date","now","rect","measureView","all","changed","trackerData","getData","size","has","pointerId","forEach","element","key","id","getMappedTouchEventId","push","x","abosoluteCoords","pageX","y","pageY","absoluteX","absoluteY","eventType","CANCEL","DOWN","ADDITIONAL_POINTER_DOWN","UP","ADDITIONAL_POINTER_UP","MOVE","numberOfTouches","length","changedTouches","allTouches","cancelEvent","lastCoords","lastRelativeCoords","getRelativeCoordsAverage","updateGestureConfig","props","onEnabledChange","setShouldCancelWhenOutside","validateHitSlops","removeHandlerFromOrchestrator","checkCustomActivationCriteria","criterias","indexOf","hasCustomActivationCriteria","hitSlop","left","right","width","Error","height","top","bottom","horizontal","vertical","getLastAbsoluteCoords","offsetX","offsetY","isButtonInConfig","mouseButton","LEFT","resetConfig","onDestroy","destroy","getTag","setTag","tag","getConfig","getDelegate","getTracker","getTrackedPointersID","getState","isEnabled","shouldCancel","getShouldCancelWhenOutside","getPointerType","method","__getHandler","argMapping","__nodeConfig","Array","isArray","index","entries","nativeValue","setValue"],"mappings":";;AAAA;AACA,SAASA,KAAT,QAAsB,aAAtB;AACA,SAOEC,cAPF,EAQEC,UARF,QASO,eATP;AAWA,OAAOC,0BAAP,MAAuC,qCAAvC;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AACA,OAAOC,cAAP,MAA+C,yBAA/C;AAEA,SAASC,WAAT,QAA4B,qCAA5B;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAGA,eAAe,MAAeC,cAAf,CAAyD;AAetE;AASOC,EAAAA,WAAW,CAChBC,QADgB,EAEhB;AAAA,2CAzBoC,IAyBpC;;AAAA,0CAxB8BV,KAAK,CAACW,YAwBpC;;AAAA,qDAtBkC,KAsBlC;;AAAA,yDArBsC,KAqBtC;;AAAA,qCApBkB,KAoBlB;;AAAA;;AAAA;;AAAA;;AAAA,oCAfyB;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAezB;;AAAA,qCAbkC,IAAIP,cAAJ,EAalC;;AAAA,6CAV0B,CAU1B;;AAAA,sCATmB,KASnB;;AAAA,oCARiB,KAQjB;;AAAA,iDAP8B,KAO9B;;AAAA,yCANmCE,WAAW,CAACM,KAM/C;;AAAA;;AAAA,uCA+UiB,CAACC,QAAD,EAAkBC,QAAlB,KAA4C;AAC7D,YAAM;AAAEC,QAAAA,qBAAF;AAAyBC,QAAAA;AAAzB,UACJ,KAAKC,QAAL,CAAcC,OADhB;AAGA,YAAMC,WAAwB,GAAG,KAAKC,kBAAL,CAC/BP,QAD+B,EAE/B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,CAApB,CANwD,CAQxD;;AACA,QAAIrD,KAAJ,aAAIA,KAAJ,eAAIA,KAAK,CAAEiI,QAAX,EAAqB;AACnB;AACA;AACAjI,MAAAA,KAAK,CAACiI,QAAN,CAAeD,WAAf;AACD,KAJD,MAIO;AACL;AACAR,MAAAA,MAAM,CAACG,YAAP,CAAoBD,UAApB,CAA+BI,KAA/B,IAAwC,CAACzE,GAAD,EAAM2E,WAAN,CAAxC;AACD;AACF;;AAED;AACD","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport { State } from '../../State';\nimport {\n Config,\n AdaptedEvent,\n PropsRef,\n ResultEvent,\n PointerData,\n ResultTouchEvent,\n TouchEventType,\n EventTypes,\n} from '../interfaces';\nimport EventManager from '../tools/EventManager';\nimport GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';\nimport InteractionManager from '../tools/InteractionManager';\nimport PointerTracker, { TrackerElement } from '../tools/PointerTracker';\nimport IGestureHandler from './IGestureHandler';\nimport { MouseButton } from '../../handlers/gestureHandlerCommon';\nimport { PointerType } from '../../PointerType';\nimport { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';\n\nexport default abstract class GestureHandler implements IGestureHandler {\n private lastSentState: State | null = null;\n protected currentState: State = State.UNDETERMINED;\n\n protected shouldCancelWhenOutside = false;\n protected hasCustomActivationCriteria = false;\n protected enabled = false;\n\n private viewRef!: number;\n private propsRef!: React.RefObject<unknown>;\n private handlerTag!: number;\n protected config: Config = { enabled: false };\n\n protected tracker: PointerTracker = new PointerTracker();\n\n // Orchestrator properties\n protected activationIndex = 0;\n protected awaiting = false;\n protected active = false;\n protected shouldResetProgress = false;\n protected pointerType: PointerType = PointerType.MOUSE;\n\n protected delegate: GestureHandlerDelegate<unknown, IGestureHandler>;\n\n public constructor(\n delegate: GestureHandlerDelegate<unknown, IGestureHandler>\n ) {\n this.delegate = delegate;\n }\n\n //\n // Initializing handler\n //\n\n protected init(viewRef: number, propsRef: React.RefObject<unknown>) {\n this.propsRef = propsRef;\n this.viewRef = viewRef;\n\n this.currentState = State.UNDETERMINED;\n\n this.delegate.init(viewRef, this);\n }\n\n public attachEventManager(manager: EventManager<unknown>): void {\n manager.setOnPointerDown(this.onPointerDown.bind(this));\n manager.setOnPointerAdd(this.onPointerAdd.bind(this));\n manager.setOnPointerUp(this.onPointerUp.bind(this));\n manager.setOnPointerRemove(this.onPointerRemove.bind(this));\n manager.setOnPointerMove(this.onPointerMove.bind(this));\n manager.setOnPointerEnter(this.onPointerEnter.bind(this));\n manager.setOnPointerLeave(this.onPointerLeave.bind(this));\n manager.setOnPointerCancel(this.onPointerCancel.bind(this));\n manager.setOnPointerOutOfBounds(this.onPointerOutOfBounds.bind(this));\n manager.setOnPointerMoveOver(this.onPointerMoveOver.bind(this));\n manager.setOnPointerMoveOut(this.onPointerMoveOut.bind(this));\n manager.setOnWheel(this.onWheel.bind(this));\n\n manager.registerListeners();\n }\n\n //\n // Resetting handler\n //\n\n protected onCancel(): void {}\n protected onReset(): void {}\n protected resetProgress(): void {}\n\n public reset(): void {\n this.tracker.resetTracker();\n this.onReset();\n this.resetProgress();\n this.delegate.reset();\n this.currentState = State.UNDETERMINED;\n }\n\n //\n // State logic\n //\n\n public moveToState(newState: State, sendIfDisabled?: boolean) {\n if (this.currentState === newState) {\n return;\n }\n\n const oldState = this.currentState;\n this.currentState = newState;\n\n if (\n this.tracker.getTrackedPointersCount() > 0 &&\n this.config.needsPointerData &&\n this.isFinished()\n ) {\n this.cancelTouches();\n }\n\n GestureHandlerOrchestrator.getInstance().onHandlerStateChange(\n this,\n newState,\n oldState,\n sendIfDisabled\n );\n\n this.onStateChange(newState, oldState);\n\n if (!this.enabled && this.isFinished()) {\n this.currentState = State.UNDETERMINED;\n }\n }\n\n protected onStateChange(_newState: State, _oldState: State): void {}\n\n public begin(): void {\n if (!this.checkHitSlop()) {\n return;\n }\n\n if (this.currentState === State.UNDETERMINED) {\n this.moveToState(State.BEGAN);\n }\n }\n\n /**\n * @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send fail event\n */\n public fail(sendIfDisabled?: boolean): void {\n if (\n this.currentState === State.ACTIVE ||\n this.currentState === State.BEGAN\n ) {\n // Here the order of calling the delegate and moveToState is important.\n // At this point we can use currentState as previuos state, because immediately after changing cursor we call moveToState method.\n this.delegate.onFail();\n\n this.moveToState(State.FAILED, sendIfDisabled);\n }\n\n this.resetProgress();\n }\n\n /**\n * @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send cancel event\n */\n public cancel(sendIfDisabled?: boolean): void {\n if (\n this.currentState === State.ACTIVE ||\n this.currentState === State.UNDETERMINED ||\n this.currentState === State.BEGAN\n ) {\n this.onCancel();\n\n // Same as above - order matters\n this.delegate.onCancel();\n\n this.moveToState(State.CANCELLED, sendIfDisabled);\n }\n }\n\n public activate(force = false) {\n if (\n (this.config.manualActivation !== true || force) &&\n (this.currentState === State.UNDETERMINED ||\n this.currentState === State.BEGAN)\n ) {\n this.delegate.onActivate();\n this.moveToState(State.ACTIVE);\n }\n }\n\n public end() {\n if (\n this.currentState === State.BEGAN ||\n this.currentState === State.ACTIVE\n ) {\n // Same as above - order matters\n this.delegate.onEnd();\n\n this.moveToState(State.END);\n }\n\n this.resetProgress();\n }\n\n //\n // Methods for orchestrator\n //\n\n public isAwaiting(): boolean {\n return this.awaiting;\n }\n public setAwaiting(value: boolean): void {\n this.awaiting = value;\n }\n\n public isActive(): boolean {\n return this.active;\n }\n public setActive(value: boolean): void {\n this.active = value;\n }\n\n public getShouldResetProgress(): boolean {\n return this.shouldResetProgress;\n }\n public setShouldResetProgress(value: boolean): void {\n this.shouldResetProgress = value;\n }\n\n public getActivationIndex(): number {\n return this.activationIndex;\n }\n public setActivationIndex(value: number): void {\n this.activationIndex = value;\n }\n\n public shouldWaitForHandlerFailure(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldWaitForHandlerFailure(\n this,\n handler\n );\n }\n\n public shouldRequireToWaitForFailure(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldRequireHandlerToWaitForFailure(\n this,\n handler\n );\n }\n\n public shouldRecognizeSimultaneously(handler: IGestureHandler): boolean {\n if (handler === this) {\n return true;\n }\n\n return InteractionManager.getInstance().shouldRecognizeSimultaneously(\n this,\n handler\n );\n }\n\n public shouldBeCancelledByOther(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldHandlerBeCancelledBy(\n this,\n handler\n );\n }\n\n //\n // Event actions\n //\n\n protected onPointerDown(event: AdaptedEvent): void {\n GestureHandlerOrchestrator.getInstance().recordHandlerIfNotPresent(this);\n this.pointerType = event.pointerType;\n\n if (this.pointerType === PointerType.TOUCH) {\n GestureHandlerOrchestrator.getInstance().cancelMouseAndPenGestures(this);\n }\n\n // TODO: Bring back touch events along with introducing `handleDown` method that will handle handler specific stuff\n }\n // Adding another pointer to existing ones\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerUp(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n // Removing pointer, when there is more than one pointers\n protected onPointerRemove(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerMove(event: AdaptedEvent): void {\n this.tryToSendMoveEvent(false, event);\n }\n protected onPointerLeave(event: AdaptedEvent): void {\n if (this.shouldCancelWhenOutside) {\n switch (this.currentState) {\n case State.ACTIVE:\n this.cancel();\n break;\n case State.BEGAN:\n this.fail();\n break;\n }\n return;\n }\n\n this.tryToSendTouchEvent(event);\n }\n protected onPointerEnter(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerCancel(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n\n this.cancel();\n this.reset();\n }\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n this.tryToSendMoveEvent(true, event);\n }\n protected onPointerMoveOver(_event: AdaptedEvent): void {\n // Used only by hover gesture handler atm\n }\n protected onPointerMoveOut(_event: AdaptedEvent): void {\n // Used only by hover gesture handler atm\n }\n protected onWheel(_event: AdaptedEvent): void {\n // Used only by pan gesture handler\n }\n protected tryToSendMoveEvent(out: boolean, event: AdaptedEvent): void {\n if ((out && this.shouldCancelWhenOutside) || !this.enabled) {\n return;\n }\n\n if (this.active) {\n this.sendEvent(this.currentState, this.currentState);\n }\n\n this.tryToSendTouchEvent(event);\n }\n\n protected tryToSendTouchEvent(event: AdaptedEvent): void {\n if (this.config.needsPointerData) {\n this.sendTouchEvent(event);\n }\n }\n\n public sendTouchEvent(event: AdaptedEvent): void {\n if (!this.enabled) {\n return;\n }\n\n const { onGestureHandlerEvent }: PropsRef = this.propsRef\n .current as PropsRef;\n\n const touchEvent: ResultTouchEvent | undefined =\n this.transformTouchEvent(event);\n\n if (touchEvent) {\n invokeNullableMethod(onGestureHandlerEvent, touchEvent);\n }\n }\n\n //\n // Events Sending\n //\n\n public sendEvent = (newState: State, oldState: State): void => {\n const { onGestureHandlerEvent, onGestureHandlerStateChange }: PropsRef =\n this.propsRef.current as PropsRef;\n\n const resultEvent: ResultEvent = this.transformEventData(\n newState,\n oldState\n );\n\n // In the new API oldState field has to be undefined, unless we send event state changed\n // Here the order is flipped to avoid workarounds such as making backup of the state and setting it to undefined first, then changing it back\n // Flipping order with setting oldState to undefined solves issue, when events were being sent twice instead of once\n // However, this may cause trouble in the future (but for now we don't know that)\n\n if (this.lastSentState !== newState) {\n this.lastSentState = newState;\n invokeNullableMethod(onGestureHandlerStateChange, resultEvent);\n }\n if (this.currentState === State.ACTIVE) {\n resultEvent.nativeEvent.oldState = undefined;\n invokeNullableMethod(onGestureHandlerEvent, resultEvent);\n }\n };\n\n private transformEventData(newState: State, oldState: State): ResultEvent {\n return {\n nativeEvent: {\n numberOfPointers: this.tracker.getTrackedPointersCount(),\n state: newState,\n pointerInside: this.delegate.isPointerInBounds(\n this.tracker.getAbsoluteCoordsAverage()\n ),\n ...this.transformNativeEvent(),\n handlerTag: this.handlerTag,\n target: this.viewRef,\n oldState: newState !== oldState ? oldState : undefined,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n }\n\n private transformTouchEvent(\n event: AdaptedEvent\n ): ResultTouchEvent | undefined {\n const rect = this.delegate.measureView();\n\n const all: PointerData[] = [];\n const changed: PointerData[] = [];\n\n const trackerData = this.tracker.getData();\n\n // This if handles edge case where all pointers have been cancelled\n // When pointercancel is triggered, reset method is called. This means that tracker will be reset after first pointer being cancelled\n // The problem is, that handler will receive another pointercancel event from the rest of the pointers\n // To avoid crashing, we don't send event if tracker tracks no pointers, i.e. has been reset\n if (trackerData.size === 0 || !trackerData.has(event.pointerId)) {\n return;\n }\n\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n all.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n\n // Each pointer sends its own event, so we want changed touches to contain only the pointer that has changed.\n // However, if the event is cancel, we want to cancel all pointers to avoid crashes\n if (event.eventType !== EventTypes.CANCEL) {\n changed.push({\n id: this.tracker.getMappedTouchEventId(event.pointerId),\n x: event.x - rect.pageX,\n y: event.y - rect.pageY,\n absoluteX: event.x,\n absoluteY: event.y,\n });\n } else {\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n changed.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n }\n\n let eventType: TouchEventType = TouchEventType.UNDETERMINED;\n\n switch (event.eventType) {\n case EventTypes.DOWN:\n case EventTypes.ADDITIONAL_POINTER_DOWN:\n eventType = TouchEventType.DOWN;\n break;\n case EventTypes.UP:\n case EventTypes.ADDITIONAL_POINTER_UP:\n eventType = TouchEventType.UP;\n break;\n case EventTypes.MOVE:\n eventType = TouchEventType.MOVE;\n break;\n case EventTypes.CANCEL:\n eventType = TouchEventType.CANCELLED;\n break;\n }\n\n // Here, when we receive up event, we want to decrease number of touches\n // That's because we want handler to send information that there's one pointer less\n // However, we still want this pointer to be present in allTouches array, so that its data can be accessed\n let numberOfTouches: number = all.length;\n\n if (\n event.eventType === EventTypes.UP ||\n event.eventType === EventTypes.ADDITIONAL_POINTER_UP\n ) {\n --numberOfTouches;\n }\n\n return {\n nativeEvent: {\n handlerTag: this.handlerTag,\n state: this.currentState,\n eventType: eventType,\n changedTouches: changed,\n allTouches: all,\n numberOfTouches: numberOfTouches,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n }\n\n private cancelTouches(): void {\n const rect = this.delegate.measureView();\n\n const all: PointerData[] = [];\n const changed: PointerData[] = [];\n\n const trackerData = this.tracker.getData();\n\n if (trackerData.size === 0) {\n return;\n }\n\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n all.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n\n changed.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n\n const cancelEvent: ResultTouchEvent = {\n nativeEvent: {\n handlerTag: this.handlerTag,\n state: this.currentState,\n eventType: TouchEventType.CANCELLED,\n changedTouches: changed,\n allTouches: all,\n numberOfTouches: all.length,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n\n const { onGestureHandlerEvent }: PropsRef = this.propsRef\n .current as PropsRef;\n\n invokeNullableMethod(onGestureHandlerEvent, cancelEvent);\n }\n\n protected transformNativeEvent(): Record<string, unknown> {\n // Those properties are shared by most handlers and if not this method will be overriden\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n const lastRelativeCoords = this.tracker.getRelativeCoordsAverage();\n\n return {\n x: lastRelativeCoords.x,\n y: lastRelativeCoords.y,\n absoluteX: lastCoords.x,\n absoluteY: lastCoords.y,\n };\n }\n\n //\n // Handling config\n //\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n this.config = { enabled: enabled, ...props };\n this.enabled = enabled;\n\n this.delegate.onEnabledChange(enabled);\n\n if (this.config.shouldCancelWhenOutside !== undefined) {\n this.setShouldCancelWhenOutside(this.config.shouldCancelWhenOutside);\n }\n\n this.validateHitSlops();\n\n if (this.enabled) {\n return;\n }\n\n switch (this.currentState) {\n case State.ACTIVE:\n this.fail(true);\n break;\n case State.UNDETERMINED:\n GestureHandlerOrchestrator.getInstance().removeHandlerFromOrchestrator(\n this\n );\n break;\n default:\n this.cancel(true);\n break;\n }\n }\n\n protected checkCustomActivationCriteria(criterias: string[]): void {\n for (const key in this.config) {\n if (criterias.indexOf(key) >= 0) {\n this.hasCustomActivationCriteria = true;\n }\n }\n }\n\n private validateHitSlops(): void {\n if (!this.config.hitSlop) {\n return;\n }\n\n if (\n this.config.hitSlop.left !== undefined &&\n this.config.hitSlop.right !== undefined &&\n this.config.hitSlop.width !== undefined\n ) {\n throw new Error(\n 'HitSlop Error: Cannot define left, right and width at the same time'\n );\n }\n\n if (\n this.config.hitSlop.width !== undefined &&\n this.config.hitSlop.left === undefined &&\n this.config.hitSlop.right === undefined\n ) {\n throw new Error(\n 'HitSlop Error: When width is defined, either left or right has to be defined'\n );\n }\n\n if (\n this.config.hitSlop.height !== undefined &&\n this.config.hitSlop.top !== undefined &&\n this.config.hitSlop.bottom !== undefined\n ) {\n throw new Error(\n 'HitSlop Error: Cannot define top, bottom and height at the same time'\n );\n }\n\n if (\n this.config.hitSlop.height !== undefined &&\n this.config.hitSlop.top === undefined &&\n this.config.hitSlop.bottom === undefined\n ) {\n throw new Error(\n 'HitSlop Error: When height is defined, either top or bottom has to be defined'\n );\n }\n }\n\n private checkHitSlop(): boolean {\n if (!this.config.hitSlop) {\n return true;\n }\n\n const { width, height } = this.delegate.measureView();\n\n let left = 0;\n let top = 0;\n let right: number = width;\n let bottom: number = height;\n\n if (this.config.hitSlop.horizontal !== undefined) {\n left -= this.config.hitSlop.horizontal;\n right += this.config.hitSlop.horizontal;\n }\n\n if (this.config.hitSlop.vertical !== undefined) {\n top -= this.config.hitSlop.vertical;\n bottom += this.config.hitSlop.vertical;\n }\n\n if (this.config.hitSlop.left !== undefined) {\n left = -this.config.hitSlop.left;\n }\n\n if (this.config.hitSlop.right !== undefined) {\n right = width + this.config.hitSlop.right;\n }\n\n if (this.config.hitSlop.top !== undefined) {\n top = -this.config.hitSlop.top;\n }\n\n if (this.config.hitSlop.bottom !== undefined) {\n bottom = width + this.config.hitSlop.bottom;\n }\n if (this.config.hitSlop.width !== undefined) {\n if (this.config.hitSlop.left !== undefined) {\n right = left + this.config.hitSlop.width;\n } else if (this.config.hitSlop.right !== undefined) {\n left = right - this.config.hitSlop.width;\n }\n }\n\n if (this.config.hitSlop.height !== undefined) {\n if (this.config.hitSlop.top !== undefined) {\n bottom = top + this.config.hitSlop.height;\n } else if (this.config.hitSlop.bottom !== undefined) {\n top = bottom - this.config.hitSlop.height;\n }\n }\n\n const rect = this.delegate.measureView();\n const { x, y } = this.tracker.getLastAbsoluteCoords();\n const offsetX: number = x - rect.pageX;\n const offsetY: number = y - rect.pageY;\n\n return (\n offsetX >= left && offsetX <= right && offsetY >= top && offsetY <= bottom\n );\n }\n\n public isButtonInConfig(mouseButton: MouseButton | undefined) {\n return (\n !mouseButton ||\n (!this.config.mouseButton && mouseButton === MouseButton.LEFT) ||\n (this.config.mouseButton && mouseButton & this.config.mouseButton)\n );\n }\n\n protected resetConfig(): void {}\n\n public onDestroy(): void {\n this.delegate.destroy(this.config);\n }\n\n //\n // Getters and setters\n //\n\n public getTag(): number {\n return this.handlerTag;\n }\n\n public setTag(tag: number): void {\n this.handlerTag = tag;\n }\n\n public getConfig() {\n return this.config;\n }\n\n public getDelegate(): GestureHandlerDelegate<unknown, IGestureHandler> {\n return this.delegate;\n }\n\n public getTracker(): PointerTracker {\n return this.tracker;\n }\n\n public getTrackedPointersID(): number[] {\n return this.tracker.getTrackedPointersID();\n }\n\n public getState(): State {\n return this.currentState;\n }\n\n public isEnabled(): boolean {\n return this.enabled;\n }\n\n private isFinished(): boolean {\n return (\n this.currentState === State.END ||\n this.currentState === State.FAILED ||\n this.currentState === State.CANCELLED\n );\n }\n\n protected setShouldCancelWhenOutside(shouldCancel: boolean) {\n this.shouldCancelWhenOutside = shouldCancel;\n }\n\n protected getShouldCancelWhenOutside(): boolean {\n return this.shouldCancelWhenOutside;\n }\n\n public getPointerType(): PointerType {\n return this.pointerType;\n }\n}\n\nfunction invokeNullableMethod(\n method:\n | ((event: ResultEvent | ResultTouchEvent) => void)\n | { __getHandler: () => (event: ResultEvent | ResultTouchEvent) => void }\n | { __nodeConfig: { argMapping: unknown[] } },\n event: ResultEvent | ResultTouchEvent\n): void {\n if (!method) {\n return;\n }\n\n if (typeof method === 'function') {\n method(event);\n return;\n }\n\n if ('__getHandler' in method && typeof method.__getHandler === 'function') {\n const handler = method.__getHandler();\n invokeNullableMethod(handler, event);\n return;\n }\n\n if (!('__nodeConfig' in method)) {\n return;\n }\n\n const { argMapping }: { argMapping: unknown } = method.__nodeConfig;\n if (!Array.isArray(argMapping)) {\n return;\n }\n\n for (const [index, [key, value]] of argMapping.entries()) {\n if (!(key in event.nativeEvent)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const nativeValue = event.nativeEvent[key];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (value?.setValue) {\n // Reanimated API\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n value.setValue(nativeValue);\n } else {\n // RN Animated API\n method.__nodeConfig.argMapping[index] = [key, nativeValue];\n }\n }\n\n return;\n}\n"]}
|
1
|
+
{"version":3,"sources":["GestureHandler.ts"],"names":["State","TouchEventType","EventTypes","GestureHandlerOrchestrator","InteractionManager","PointerTracker","MouseButton","PointerType","GestureHandler","constructor","delegate","UNDETERMINED","enabled","MOUSE","newState","oldState","onGestureHandlerEvent","onGestureHandlerStateChange","propsRef","current","resultEvent","transformEventData","lastSentState","invokeNullableMethod","currentState","ACTIVE","nativeEvent","undefined","init","viewRef","attachEventManager","manager","setOnPointerDown","onPointerDown","bind","setOnPointerAdd","onPointerAdd","setOnPointerUp","onPointerUp","setOnPointerRemove","onPointerRemove","setOnPointerMove","onPointerMove","setOnPointerEnter","onPointerEnter","setOnPointerLeave","onPointerLeave","setOnPointerCancel","onPointerCancel","setOnPointerOutOfBounds","onPointerOutOfBounds","setOnPointerMoveOver","onPointerMoveOver","setOnPointerMoveOut","onPointerMoveOut","setOnWheel","onWheel","registerListeners","onCancel","onReset","resetProgress","reset","tracker","resetTracker","moveToState","sendIfDisabled","getTrackedPointersCount","config","needsPointerData","isFinished","cancelTouches","getInstance","onHandlerStateChange","onStateChange","_newState","_oldState","begin","checkHitSlop","BEGAN","fail","onFail","FAILED","cancel","CANCELLED","activate","force","manualActivation","onActivate","end","onEnd","END","isAwaiting","awaiting","setAwaiting","value","isActive","active","setActive","getShouldResetProgress","shouldResetProgress","setShouldResetProgress","getActivationIndex","activationIndex","setActivationIndex","shouldWaitForHandlerFailure","handler","shouldRequireToWaitForFailure","shouldRequireHandlerToWaitForFailure","shouldRecognizeSimultaneously","shouldBeCancelledByOther","shouldHandlerBeCancelledBy","event","recordHandlerIfNotPresent","pointerType","TOUCH","cancelMouseAndPenGestures","tryToSendTouchEvent","tryToSendMoveEvent","shouldCancelWhenOutside","_event","out","sendEvent","sendTouchEvent","touchEvent","transformTouchEvent","numberOfPointers","state","pointerInside","isPointerInBounds","getAbsoluteCoordsAverage","transformNativeEvent","handlerTag","target","timeStamp","Date","now","rect","measureView","all","changed","trackerData","getData","size","has","pointerId","forEach","element","key","id","getMappedTouchEventId","push","x","abosoluteCoords","pageX","y","pageY","absoluteX","absoluteY","eventType","CANCEL","DOWN","ADDITIONAL_POINTER_DOWN","UP","ADDITIONAL_POINTER_UP","MOVE","numberOfTouches","length","changedTouches","allTouches","cancelEvent","lastCoords","lastRelativeCoords","getRelativeCoordsAverage","updateGestureConfig","props","onEnabledChange","setShouldCancelWhenOutside","validateHitSlops","removeHandlerFromOrchestrator","checkCustomActivationCriteria","criterias","indexOf","hasCustomActivationCriteria","hitSlop","left","right","width","Error","height","top","bottom","horizontal","vertical","getLastAbsoluteCoords","offsetX","offsetY","isButtonInConfig","mouseButton","LEFT","resetConfig","onDestroy","destroy","getTag","setTag","tag","getConfig","getDelegate","getTracker","getTrackedPointersID","getState","isEnabled","shouldCancel","getShouldCancelWhenOutside","getPointerType","method","__getHandler","argMapping","__nodeConfig","Array","isArray","index","entries","nativeValue","setValue"],"mappings":";;AAAA;AACA,SAASA,KAAT,QAAsB,aAAtB;AACA,SAOEC,cAPF,EAQEC,UARF,QASO,eATP;AAWA,OAAOC,0BAAP,MAAuC,qCAAvC;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AACA,OAAOC,cAAP,MAA+C,yBAA/C;AAEA,SAASC,WAAT,QAA4B,qCAA5B;AACA,SAASC,WAAT,QAA4B,mBAA5B;AAGA,eAAe,MAAeC,cAAf,CAAyD;AAetE;AASAC,EAAAA,WAAW,CAACC,QAAD,EAA6D;AAAA,2CAvBlC,IAuBkC;;AAAA,0CAtBxCV,KAAK,CAACW,YAsBkC;;AAAA,qDApBpC,KAoBoC;;AAAA,yDAnBhC,KAmBgC;;AAAA,qCAlBpD,KAkBoD;;AAAA;;AAAA;;AAAA;;AAAA,oCAb7C;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAa6C;;AAAA,qCAXpC,IAAIP,cAAJ,EAWoC;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CAACC,KAAK,CAACC,OAAN,CAAcH,UAAd,CAAL,EAAgC;AAC9B;AACD;;AAED,OAAK,MAAM,CAACI,KAAD,EAAQ,CAACzE,GAAD,EAAMrD,KAAN,CAAR,CAAX,IAAoC0H,UAAU,CAACK,OAAX,EAApC,EAA0D;AACxD,QAAI,EAAE1E,GAAG,IAAIpC,KAAK,CAACrF,WAAf,CAAJ,EAAiC;AAC/B;AACD,KAHuD,CAKxD;;;AACA,UAAMoM,WAAW,GAAG/G,KAAK,CAACrF,WAAN,CAAkByH,GAAlB,CAApB,CANwD,CAQxD;;AACA,QAAIrD,KAAJ,aAAIA,KAAJ,eAAIA,KAAK,CAAEiI,QAAX,EAAqB;AACnB;AACA;AACAjI,MAAAA,KAAK,CAACiI,QAAN,CAAeD,WAAf;AACD,KAJD,MAIO;AACL;AACAR,MAAAA,MAAM,CAACG,YAAP,CAAoBD,UAApB,CAA+BI,KAA/B,IAAwC,CAACzE,GAAD,EAAM2E,WAAN,CAAxC;AACD;AACF;;AAED;AACD","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport { State } from '../../State';\nimport {\n Config,\n AdaptedEvent,\n PropsRef,\n ResultEvent,\n PointerData,\n ResultTouchEvent,\n TouchEventType,\n EventTypes,\n} from '../interfaces';\nimport EventManager from '../tools/EventManager';\nimport GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';\nimport InteractionManager from '../tools/InteractionManager';\nimport PointerTracker, { TrackerElement } from '../tools/PointerTracker';\nimport IGestureHandler from './IGestureHandler';\nimport { MouseButton } from '../../handlers/gestureHandlerCommon';\nimport { PointerType } from '../../PointerType';\nimport { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';\n\nexport default abstract class GestureHandler implements IGestureHandler {\n private lastSentState: State | null = null;\n protected currentState: State = State.UNDETERMINED;\n\n protected shouldCancelWhenOutside = false;\n protected hasCustomActivationCriteria = false;\n protected enabled = false;\n\n private viewRef!: number;\n private propsRef!: React.RefObject<unknown>;\n private handlerTag!: number;\n protected config: Config = { enabled: false };\n\n protected tracker: PointerTracker = new PointerTracker();\n\n // Orchestrator properties\n protected activationIndex = 0;\n protected awaiting = false;\n protected active = false;\n protected shouldResetProgress = false;\n protected pointerType: PointerType = PointerType.MOUSE;\n\n protected delegate: GestureHandlerDelegate<unknown, IGestureHandler>;\n\n constructor(delegate: GestureHandlerDelegate<unknown, IGestureHandler>) {\n this.delegate = delegate;\n }\n\n //\n // Initializing handler\n //\n\n protected init(viewRef: number, propsRef: React.RefObject<unknown>) {\n this.propsRef = propsRef;\n this.viewRef = viewRef;\n\n this.currentState = State.UNDETERMINED;\n\n this.delegate.init(viewRef, this);\n }\n\n public attachEventManager(manager: EventManager<unknown>): void {\n manager.setOnPointerDown(this.onPointerDown.bind(this));\n manager.setOnPointerAdd(this.onPointerAdd.bind(this));\n manager.setOnPointerUp(this.onPointerUp.bind(this));\n manager.setOnPointerRemove(this.onPointerRemove.bind(this));\n manager.setOnPointerMove(this.onPointerMove.bind(this));\n manager.setOnPointerEnter(this.onPointerEnter.bind(this));\n manager.setOnPointerLeave(this.onPointerLeave.bind(this));\n manager.setOnPointerCancel(this.onPointerCancel.bind(this));\n manager.setOnPointerOutOfBounds(this.onPointerOutOfBounds.bind(this));\n manager.setOnPointerMoveOver(this.onPointerMoveOver.bind(this));\n manager.setOnPointerMoveOut(this.onPointerMoveOut.bind(this));\n manager.setOnWheel(this.onWheel.bind(this));\n\n manager.registerListeners();\n }\n\n //\n // Resetting handler\n //\n\n protected onCancel(): void {}\n protected onReset(): void {}\n protected resetProgress(): void {}\n\n public reset(): void {\n this.tracker.resetTracker();\n this.onReset();\n this.resetProgress();\n this.delegate.reset();\n this.currentState = State.UNDETERMINED;\n }\n\n //\n // State logic\n //\n\n public moveToState(newState: State, sendIfDisabled?: boolean) {\n if (this.currentState === newState) {\n return;\n }\n\n const oldState = this.currentState;\n this.currentState = newState;\n\n if (\n this.tracker.getTrackedPointersCount() > 0 &&\n this.config.needsPointerData &&\n this.isFinished()\n ) {\n this.cancelTouches();\n }\n\n GestureHandlerOrchestrator.getInstance().onHandlerStateChange(\n this,\n newState,\n oldState,\n sendIfDisabled\n );\n\n this.onStateChange(newState, oldState);\n\n if (!this.enabled && this.isFinished()) {\n this.currentState = State.UNDETERMINED;\n }\n }\n\n protected onStateChange(_newState: State, _oldState: State): void {}\n\n public begin(): void {\n if (!this.checkHitSlop()) {\n return;\n }\n\n if (this.currentState === State.UNDETERMINED) {\n this.moveToState(State.BEGAN);\n }\n }\n\n /**\n * @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send fail event\n */\n public fail(sendIfDisabled?: boolean): void {\n if (\n this.currentState === State.ACTIVE ||\n this.currentState === State.BEGAN\n ) {\n // Here the order of calling the delegate and moveToState is important.\n // At this point we can use currentState as previuos state, because immediately after changing cursor we call moveToState method.\n this.delegate.onFail();\n\n this.moveToState(State.FAILED, sendIfDisabled);\n }\n\n this.resetProgress();\n }\n\n /**\n * @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send cancel event\n */\n public cancel(sendIfDisabled?: boolean): void {\n if (\n this.currentState === State.ACTIVE ||\n this.currentState === State.UNDETERMINED ||\n this.currentState === State.BEGAN\n ) {\n this.onCancel();\n\n // Same as above - order matters\n this.delegate.onCancel();\n\n this.moveToState(State.CANCELLED, sendIfDisabled);\n }\n }\n\n public activate(force = false) {\n if (\n (this.config.manualActivation !== true || force) &&\n (this.currentState === State.UNDETERMINED ||\n this.currentState === State.BEGAN)\n ) {\n this.delegate.onActivate();\n this.moveToState(State.ACTIVE);\n }\n }\n\n public end() {\n if (\n this.currentState === State.BEGAN ||\n this.currentState === State.ACTIVE\n ) {\n // Same as above - order matters\n this.delegate.onEnd();\n\n this.moveToState(State.END);\n }\n\n this.resetProgress();\n }\n\n //\n // Methods for orchestrator\n //\n\n public isAwaiting(): boolean {\n return this.awaiting;\n }\n public setAwaiting(value: boolean): void {\n this.awaiting = value;\n }\n\n public isActive(): boolean {\n return this.active;\n }\n public setActive(value: boolean): void {\n this.active = value;\n }\n\n public getShouldResetProgress(): boolean {\n return this.shouldResetProgress;\n }\n public setShouldResetProgress(value: boolean): void {\n this.shouldResetProgress = value;\n }\n\n public getActivationIndex(): number {\n return this.activationIndex;\n }\n public setActivationIndex(value: number): void {\n this.activationIndex = value;\n }\n\n public shouldWaitForHandlerFailure(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldWaitForHandlerFailure(\n this,\n handler\n );\n }\n\n public shouldRequireToWaitForFailure(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldRequireHandlerToWaitForFailure(\n this,\n handler\n );\n }\n\n public shouldRecognizeSimultaneously(handler: IGestureHandler): boolean {\n if (handler === this) {\n return true;\n }\n\n return InteractionManager.getInstance().shouldRecognizeSimultaneously(\n this,\n handler\n );\n }\n\n public shouldBeCancelledByOther(handler: IGestureHandler): boolean {\n if (handler === this) {\n return false;\n }\n\n return InteractionManager.getInstance().shouldHandlerBeCancelledBy(\n this,\n handler\n );\n }\n\n //\n // Event actions\n //\n\n protected onPointerDown(event: AdaptedEvent): void {\n GestureHandlerOrchestrator.getInstance().recordHandlerIfNotPresent(this);\n this.pointerType = event.pointerType;\n\n if (this.pointerType === PointerType.TOUCH) {\n GestureHandlerOrchestrator.getInstance().cancelMouseAndPenGestures(this);\n }\n\n // TODO: Bring back touch events along with introducing `handleDown` method that will handle handler specific stuff\n }\n // Adding another pointer to existing ones\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerUp(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n // Removing pointer, when there is more than one pointers\n protected onPointerRemove(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerMove(event: AdaptedEvent): void {\n this.tryToSendMoveEvent(false, event);\n }\n protected onPointerLeave(event: AdaptedEvent): void {\n if (this.shouldCancelWhenOutside) {\n switch (this.currentState) {\n case State.ACTIVE:\n this.cancel();\n break;\n case State.BEGAN:\n this.fail();\n break;\n }\n return;\n }\n\n this.tryToSendTouchEvent(event);\n }\n protected onPointerEnter(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n }\n protected onPointerCancel(event: AdaptedEvent): void {\n this.tryToSendTouchEvent(event);\n\n this.cancel();\n this.reset();\n }\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n this.tryToSendMoveEvent(true, event);\n }\n protected onPointerMoveOver(_event: AdaptedEvent): void {\n // Used only by hover gesture handler atm\n }\n protected onPointerMoveOut(_event: AdaptedEvent): void {\n // Used only by hover gesture handler atm\n }\n protected onWheel(_event: AdaptedEvent): void {\n // Used only by pan gesture handler\n }\n protected tryToSendMoveEvent(out: boolean, event: AdaptedEvent): void {\n if ((out && this.shouldCancelWhenOutside) || !this.enabled) {\n return;\n }\n\n if (this.active) {\n this.sendEvent(this.currentState, this.currentState);\n }\n\n this.tryToSendTouchEvent(event);\n }\n\n protected tryToSendTouchEvent(event: AdaptedEvent): void {\n if (this.config.needsPointerData) {\n this.sendTouchEvent(event);\n }\n }\n\n public sendTouchEvent(event: AdaptedEvent): void {\n if (!this.enabled) {\n return;\n }\n\n const { onGestureHandlerEvent }: PropsRef = this.propsRef\n .current as PropsRef;\n\n const touchEvent: ResultTouchEvent | undefined =\n this.transformTouchEvent(event);\n\n if (touchEvent) {\n invokeNullableMethod(onGestureHandlerEvent, touchEvent);\n }\n }\n\n //\n // Events Sending\n //\n\n public sendEvent = (newState: State, oldState: State): void => {\n const { onGestureHandlerEvent, onGestureHandlerStateChange }: PropsRef =\n this.propsRef.current as PropsRef;\n\n const resultEvent: ResultEvent = this.transformEventData(\n newState,\n oldState\n );\n\n // In the new API oldState field has to be undefined, unless we send event state changed\n // Here the order is flipped to avoid workarounds such as making backup of the state and setting it to undefined first, then changing it back\n // Flipping order with setting oldState to undefined solves issue, when events were being sent twice instead of once\n // However, this may cause trouble in the future (but for now we don't know that)\n\n if (this.lastSentState !== newState) {\n this.lastSentState = newState;\n invokeNullableMethod(onGestureHandlerStateChange, resultEvent);\n }\n if (this.currentState === State.ACTIVE) {\n resultEvent.nativeEvent.oldState = undefined;\n invokeNullableMethod(onGestureHandlerEvent, resultEvent);\n }\n };\n\n private transformEventData(newState: State, oldState: State): ResultEvent {\n return {\n nativeEvent: {\n numberOfPointers: this.tracker.getTrackedPointersCount(),\n state: newState,\n pointerInside: this.delegate.isPointerInBounds(\n this.tracker.getAbsoluteCoordsAverage()\n ),\n ...this.transformNativeEvent(),\n handlerTag: this.handlerTag,\n target: this.viewRef,\n oldState: newState !== oldState ? oldState : undefined,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n }\n\n private transformTouchEvent(\n event: AdaptedEvent\n ): ResultTouchEvent | undefined {\n const rect = this.delegate.measureView();\n\n const all: PointerData[] = [];\n const changed: PointerData[] = [];\n\n const trackerData = this.tracker.getData();\n\n // This if handles edge case where all pointers have been cancelled\n // When pointercancel is triggered, reset method is called. This means that tracker will be reset after first pointer being cancelled\n // The problem is, that handler will receive another pointercancel event from the rest of the pointers\n // To avoid crashing, we don't send event if tracker tracks no pointers, i.e. has been reset\n if (trackerData.size === 0 || !trackerData.has(event.pointerId)) {\n return;\n }\n\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n all.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n\n // Each pointer sends its own event, so we want changed touches to contain only the pointer that has changed.\n // However, if the event is cancel, we want to cancel all pointers to avoid crashes\n if (event.eventType !== EventTypes.CANCEL) {\n changed.push({\n id: this.tracker.getMappedTouchEventId(event.pointerId),\n x: event.x - rect.pageX,\n y: event.y - rect.pageY,\n absoluteX: event.x,\n absoluteY: event.y,\n });\n } else {\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n changed.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n }\n\n let eventType: TouchEventType = TouchEventType.UNDETERMINED;\n\n switch (event.eventType) {\n case EventTypes.DOWN:\n case EventTypes.ADDITIONAL_POINTER_DOWN:\n eventType = TouchEventType.DOWN;\n break;\n case EventTypes.UP:\n case EventTypes.ADDITIONAL_POINTER_UP:\n eventType = TouchEventType.UP;\n break;\n case EventTypes.MOVE:\n eventType = TouchEventType.MOVE;\n break;\n case EventTypes.CANCEL:\n eventType = TouchEventType.CANCELLED;\n break;\n }\n\n // Here, when we receive up event, we want to decrease number of touches\n // That's because we want handler to send information that there's one pointer less\n // However, we still want this pointer to be present in allTouches array, so that its data can be accessed\n let numberOfTouches: number = all.length;\n\n if (\n event.eventType === EventTypes.UP ||\n event.eventType === EventTypes.ADDITIONAL_POINTER_UP\n ) {\n --numberOfTouches;\n }\n\n return {\n nativeEvent: {\n handlerTag: this.handlerTag,\n state: this.currentState,\n eventType: eventType,\n changedTouches: changed,\n allTouches: all,\n numberOfTouches: numberOfTouches,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n }\n\n private cancelTouches(): void {\n const rect = this.delegate.measureView();\n\n const all: PointerData[] = [];\n const changed: PointerData[] = [];\n\n const trackerData = this.tracker.getData();\n\n if (trackerData.size === 0) {\n return;\n }\n\n trackerData.forEach((element: TrackerElement, key: number): void => {\n const id: number = this.tracker.getMappedTouchEventId(key);\n\n all.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n\n changed.push({\n id: id,\n x: element.abosoluteCoords.x - rect.pageX,\n y: element.abosoluteCoords.y - rect.pageY,\n absoluteX: element.abosoluteCoords.x,\n absoluteY: element.abosoluteCoords.y,\n });\n });\n\n const cancelEvent: ResultTouchEvent = {\n nativeEvent: {\n handlerTag: this.handlerTag,\n state: this.currentState,\n eventType: TouchEventType.CANCELLED,\n changedTouches: changed,\n allTouches: all,\n numberOfTouches: all.length,\n pointerType: this.pointerType,\n },\n timeStamp: Date.now(),\n };\n\n const { onGestureHandlerEvent }: PropsRef = this.propsRef\n .current as PropsRef;\n\n invokeNullableMethod(onGestureHandlerEvent, cancelEvent);\n }\n\n protected transformNativeEvent(): Record<string, unknown> {\n // Those properties are shared by most handlers and if not this method will be overriden\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n const lastRelativeCoords = this.tracker.getRelativeCoordsAverage();\n\n return {\n x: lastRelativeCoords.x,\n y: lastRelativeCoords.y,\n absoluteX: lastCoords.x,\n absoluteY: lastCoords.y,\n };\n }\n\n //\n // Handling config\n //\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n this.config = { enabled: enabled, ...props };\n this.enabled = enabled;\n\n this.delegate.onEnabledChange(enabled);\n\n if (this.config.shouldCancelWhenOutside !== undefined) {\n this.setShouldCancelWhenOutside(this.config.shouldCancelWhenOutside);\n }\n\n this.validateHitSlops();\n\n if (this.enabled) {\n return;\n }\n\n switch (this.currentState) {\n case State.ACTIVE:\n this.fail(true);\n break;\n case State.UNDETERMINED:\n GestureHandlerOrchestrator.getInstance().removeHandlerFromOrchestrator(\n this\n );\n break;\n default:\n this.cancel(true);\n break;\n }\n }\n\n protected checkCustomActivationCriteria(criterias: string[]): void {\n for (const key in this.config) {\n if (criterias.indexOf(key) >= 0) {\n this.hasCustomActivationCriteria = true;\n }\n }\n }\n\n private validateHitSlops(): void {\n if (!this.config.hitSlop) {\n return;\n }\n\n if (\n this.config.hitSlop.left !== undefined &&\n this.config.hitSlop.right !== undefined &&\n this.config.hitSlop.width !== undefined\n ) {\n throw new Error(\n 'HitSlop Error: Cannot define left, right and width at the same time'\n );\n }\n\n if (\n this.config.hitSlop.width !== undefined &&\n this.config.hitSlop.left === undefined &&\n this.config.hitSlop.right === undefined\n ) {\n throw new Error(\n 'HitSlop Error: When width is defined, either left or right has to be defined'\n );\n }\n\n if (\n this.config.hitSlop.height !== undefined &&\n this.config.hitSlop.top !== undefined &&\n this.config.hitSlop.bottom !== undefined\n ) {\n throw new Error(\n 'HitSlop Error: Cannot define top, bottom and height at the same time'\n );\n }\n\n if (\n this.config.hitSlop.height !== undefined &&\n this.config.hitSlop.top === undefined &&\n this.config.hitSlop.bottom === undefined\n ) {\n throw new Error(\n 'HitSlop Error: When height is defined, either top or bottom has to be defined'\n );\n }\n }\n\n private checkHitSlop(): boolean {\n if (!this.config.hitSlop) {\n return true;\n }\n\n const { width, height } = this.delegate.measureView();\n\n let left = 0;\n let top = 0;\n let right: number = width;\n let bottom: number = height;\n\n if (this.config.hitSlop.horizontal !== undefined) {\n left -= this.config.hitSlop.horizontal;\n right += this.config.hitSlop.horizontal;\n }\n\n if (this.config.hitSlop.vertical !== undefined) {\n top -= this.config.hitSlop.vertical;\n bottom += this.config.hitSlop.vertical;\n }\n\n if (this.config.hitSlop.left !== undefined) {\n left = -this.config.hitSlop.left;\n }\n\n if (this.config.hitSlop.right !== undefined) {\n right = width + this.config.hitSlop.right;\n }\n\n if (this.config.hitSlop.top !== undefined) {\n top = -this.config.hitSlop.top;\n }\n\n if (this.config.hitSlop.bottom !== undefined) {\n bottom = width + this.config.hitSlop.bottom;\n }\n if (this.config.hitSlop.width !== undefined) {\n if (this.config.hitSlop.left !== undefined) {\n right = left + this.config.hitSlop.width;\n } else if (this.config.hitSlop.right !== undefined) {\n left = right - this.config.hitSlop.width;\n }\n }\n\n if (this.config.hitSlop.height !== undefined) {\n if (this.config.hitSlop.top !== undefined) {\n bottom = top + this.config.hitSlop.height;\n } else if (this.config.hitSlop.bottom !== undefined) {\n top = bottom - this.config.hitSlop.height;\n }\n }\n\n const rect = this.delegate.measureView();\n const { x, y } = this.tracker.getLastAbsoluteCoords();\n const offsetX: number = x - rect.pageX;\n const offsetY: number = y - rect.pageY;\n\n return (\n offsetX >= left && offsetX <= right && offsetY >= top && offsetY <= bottom\n );\n }\n\n public isButtonInConfig(mouseButton: MouseButton | undefined) {\n return (\n !mouseButton ||\n (!this.config.mouseButton && mouseButton === MouseButton.LEFT) ||\n (this.config.mouseButton && mouseButton & this.config.mouseButton)\n );\n }\n\n protected resetConfig(): void {}\n\n public onDestroy(): void {\n this.delegate.destroy(this.config);\n }\n\n //\n // Getters and setters\n //\n\n public getTag(): number {\n return this.handlerTag;\n }\n\n public setTag(tag: number): void {\n this.handlerTag = tag;\n }\n\n public getConfig() {\n return this.config;\n }\n\n public getDelegate(): GestureHandlerDelegate<unknown, IGestureHandler> {\n return this.delegate;\n }\n\n public getTracker(): PointerTracker {\n return this.tracker;\n }\n\n public getTrackedPointersID(): number[] {\n return this.tracker.getTrackedPointersID();\n }\n\n public getState(): State {\n return this.currentState;\n }\n\n public isEnabled(): boolean {\n return this.enabled;\n }\n\n private isFinished(): boolean {\n return (\n this.currentState === State.END ||\n this.currentState === State.FAILED ||\n this.currentState === State.CANCELLED\n );\n }\n\n protected setShouldCancelWhenOutside(shouldCancel: boolean) {\n this.shouldCancelWhenOutside = shouldCancel;\n }\n\n protected getShouldCancelWhenOutside(): boolean {\n return this.shouldCancelWhenOutside;\n }\n\n public getPointerType(): PointerType {\n return this.pointerType;\n }\n}\n\nfunction invokeNullableMethod(\n method:\n | ((event: ResultEvent | ResultTouchEvent) => void)\n | { __getHandler: () => (event: ResultEvent | ResultTouchEvent) => void }\n | { __nodeConfig: { argMapping: unknown[] } },\n event: ResultEvent | ResultTouchEvent\n): void {\n if (!method) {\n return;\n }\n\n if (typeof method === 'function') {\n method(event);\n return;\n }\n\n if ('__getHandler' in method && typeof method.__getHandler === 'function') {\n const handler = method.__getHandler();\n invokeNullableMethod(handler, event);\n return;\n }\n\n if (!('__nodeConfig' in method)) {\n return;\n }\n\n const { argMapping }: { argMapping: unknown } = method.__nodeConfig;\n if (!Array.isArray(argMapping)) {\n return;\n }\n\n for (const [index, [key, value]] of argMapping.entries()) {\n if (!(key in event.nativeEvent)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const nativeValue = event.nativeEvent[key];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (value?.setValue) {\n // Reanimated API\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n value.setValue(nativeValue);\n } else {\n // RN Animated API\n method.__nodeConfig.argMapping[index] = [key, nativeValue];\n }\n }\n\n return;\n}\n"]}
|
@@ -10,26 +10,12 @@ export default class HoverGestureHandler extends GestureHandler {
|
|
10
10
|
_defineProperty(this, "stylusData", void 0);
|
11
11
|
}
|
12
12
|
|
13
|
-
init(ref, propsRef) {
|
14
|
-
super.init(ref, propsRef);
|
15
|
-
}
|
16
|
-
|
17
13
|
transformNativeEvent() {
|
18
14
|
return { ...super.transformNativeEvent(),
|
19
15
|
stylusData: this.stylusData
|
20
16
|
};
|
21
17
|
}
|
22
18
|
|
23
|
-
updateGestureConfig({
|
24
|
-
enabled = true,
|
25
|
-
...props
|
26
|
-
}) {
|
27
|
-
super.updateGestureConfig({
|
28
|
-
enabled: enabled,
|
29
|
-
...props
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
19
|
onPointerMoveOver(event) {
|
34
20
|
GestureHandlerOrchestrator.getInstance().recordHandlerIfNotPresent(this);
|
35
21
|
this.tracker.addToTracker(event);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["HoverGestureHandler.ts"],"names":["State","GestureHandlerOrchestrator","GestureHandler","HoverGestureHandler","
|
1
|
+
{"version":3,"sources":["HoverGestureHandler.ts"],"names":["State","GestureHandlerOrchestrator","GestureHandler","HoverGestureHandler","transformNativeEvent","stylusData","onPointerMoveOver","event","getInstance","recordHandlerIfNotPresent","tracker","addToTracker","getState","UNDETERMINED","begin","activate","onPointerMoveOut","removeFromTracker","pointerId","end","onPointerMove","track","onPointerCancel","reset"],"mappings":";;AAAA,SAASA,KAAT,QAAsB,aAAtB;AAEA,OAAOC,0BAAP,MAAuC,qCAAvC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,eAAe,MAAMC,mBAAN,SAAkCD,cAAlC,CAAiD;AAAA;AAAA;;AAAA;AAAA;;AAGpDE,EAAAA,oBAAoB,GAA4B;AACxD,WAAO,EACL,GAAG,MAAMA,oBAAN,EADE;AAELC,MAAAA,UAAU,EAAE,KAAKA;AAFZ,KAAP;AAID;;AAESC,EAAAA,iBAAiB,CAACC,KAAD,EAA4B;AACrDN,IAAAA,0BAA0B,CAACO,WAA3B,GAAyCC,yBAAzC,CAAmE,IAAnE;AAEA,SAAKC,OAAL,CAAaC,YAAb,CAA0BJ,KAA1B;AACA,SAAKF,UAAL,GAAkBE,KAAK,CAACF,UAAxB;AACA,UAAMC,iBAAN,CAAwBC,KAAxB;;AAEA,QAAI,KAAKK,QAAL,OAAoBZ,KAAK,CAACa,YAA9B,EAA4C;AAC1C,WAAKC,KAAL;AACA,WAAKC,QAAL;AACD;AACF;;AAESC,EAAAA,gBAAgB,CAACT,KAAD,EAA4B;AACpD,SAAKG,OAAL,CAAaO,iBAAb,CAA+BV,KAAK,CAACW,SAArC;AACA,SAAKb,UAAL,GAAkBE,KAAK,CAACF,UAAxB;AAEA,UAAMW,gBAAN,CAAuBT,KAAvB;AAEA,SAAKY,GAAL;AACD;;AAESC,EAAAA,aAAa,CAACb,KAAD,EAA4B;AACjD,SAAKG,OAAL,CAAaW,KAAb,CAAmBd,KAAnB;AACA,SAAKF,UAAL,GAAkBE,KAAK,CAACF,UAAxB;AAEA,UAAMe,aAAN,CAAoBb,KAApB;AACD;;AAESe,EAAAA,eAAe,CAACf,KAAD,EAA4B;AACnD,UAAMe,eAAN,CAAsBf,KAAtB;AACA,SAAKgB,KAAL;AACD;;AA1C6D","sourcesContent":["import { State } from '../../State';\nimport { AdaptedEvent, StylusData } from '../interfaces';\nimport GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';\nimport GestureHandler from './GestureHandler';\n\nexport default class HoverGestureHandler extends GestureHandler {\n private stylusData: StylusData | undefined;\n\n protected transformNativeEvent(): Record<string, unknown> {\n return {\n ...super.transformNativeEvent(),\n stylusData: this.stylusData,\n };\n }\n\n protected onPointerMoveOver(event: AdaptedEvent): void {\n GestureHandlerOrchestrator.getInstance().recordHandlerIfNotPresent(this);\n\n this.tracker.addToTracker(event);\n this.stylusData = event.stylusData;\n super.onPointerMoveOver(event);\n\n if (this.getState() === State.UNDETERMINED) {\n this.begin();\n this.activate();\n }\n }\n\n protected onPointerMoveOut(event: AdaptedEvent): void {\n this.tracker.removeFromTracker(event.pointerId);\n this.stylusData = event.stylusData;\n\n super.onPointerMoveOut(event);\n\n this.end();\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n this.stylusData = event.stylusData;\n\n super.onPointerMove(event);\n }\n\n protected onPointerCancel(event: AdaptedEvent): void {\n super.onPointerCancel(event);\n this.reset();\n }\n}\n"]}
|
@@ -1,19 +1,5 @@
|
|
1
1
|
import GestureHandler from './GestureHandler';
|
2
2
|
export default class ManualGestureHandler extends GestureHandler {
|
3
|
-
init(ref, propsRef) {
|
4
|
-
super.init(ref, propsRef);
|
5
|
-
}
|
6
|
-
|
7
|
-
updateGestureConfig({
|
8
|
-
enabled = true,
|
9
|
-
...props
|
10
|
-
}) {
|
11
|
-
super.updateGestureConfig({
|
12
|
-
enabled: enabled,
|
13
|
-
...props
|
14
|
-
});
|
15
|
-
}
|
16
|
-
|
17
3
|
onPointerDown(event) {
|
18
4
|
this.tracker.addToTracker(event);
|
19
5
|
super.onPointerDown(event);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["ManualGestureHandler.ts"],"names":["GestureHandler","ManualGestureHandler","
|
1
|
+
{"version":3,"sources":["ManualGestureHandler.ts"],"names":["GestureHandler","ManualGestureHandler","onPointerDown","event","tracker","addToTracker","begin","tryToSendTouchEvent","onPointerAdd","onPointerMove","track","onPointerOutOfBounds","onPointerUp","removeFromTracker","pointerId","onPointerRemove"],"mappings":"AACA,OAAOA,cAAP,MAA2B,kBAA3B;AAEA,eAAe,MAAMC,oBAAN,SAAmCD,cAAnC,CAAkD;AACrDE,EAAAA,aAAa,CAACC,KAAD,EAA4B;AACjD,SAAKC,OAAL,CAAaC,YAAb,CAA0BF,KAA1B;AACA,UAAMD,aAAN,CAAoBC,KAApB;AACA,SAAKG,KAAL;AAEA,SAAKC,mBAAL,CAAyBJ,KAAzB;AACD;;AAESK,EAAAA,YAAY,CAACL,KAAD,EAA4B;AAChD,SAAKC,OAAL,CAAaC,YAAb,CAA0BF,KAA1B;AACA,UAAMK,YAAN,CAAmBL,KAAnB;AACD;;AAESM,EAAAA,aAAa,CAACN,KAAD,EAA4B;AACjD,SAAKC,OAAL,CAAaM,KAAb,CAAmBP,KAAnB;AACA,UAAMM,aAAN,CAAoBN,KAApB;AACD;;AAESQ,EAAAA,oBAAoB,CAACR,KAAD,EAA4B;AACxD,SAAKC,OAAL,CAAaM,KAAb,CAAmBP,KAAnB;AACA,UAAMQ,oBAAN,CAA2BR,KAA3B;AACD;;AAESS,EAAAA,WAAW,CAACT,KAAD,EAA4B;AAC/C,UAAMS,WAAN,CAAkBT,KAAlB;AACA,SAAKC,OAAL,CAAaS,iBAAb,CAA+BV,KAAK,CAACW,SAArC;AACD;;AAESC,EAAAA,eAAe,CAACZ,KAAD,EAA4B;AACnD,UAAMY,eAAN,CAAsBZ,KAAtB;AACA,SAAKC,OAAL,CAAaS,iBAAb,CAA+BV,KAAK,CAACW,SAArC;AACD;;AAhC8D","sourcesContent":["import { AdaptedEvent } from '../interfaces';\nimport GestureHandler from './GestureHandler';\n\nexport default class ManualGestureHandler extends GestureHandler {\n protected onPointerDown(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerDown(event);\n this.begin();\n\n this.tryToSendTouchEvent(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n this.tracker.track(event);\n super.onPointerOutOfBounds(event);\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.tracker.removeFromTracker(event.pointerId);\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.tracker.removeFromTracker(event.pointerId);\n }\n}\n"]}
|
@@ -65,10 +65,6 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
65
65
|
view.style['WebkitTouchCallout'] = 'auto';
|
66
66
|
}
|
67
67
|
|
68
|
-
resetConfig() {
|
69
|
-
super.resetConfig();
|
70
|
-
}
|
71
|
-
|
72
68
|
onPointerDown(event) {
|
73
69
|
this.tracker.addToTracker(event);
|
74
70
|
super.onPointerDown(event);
|
@@ -92,8 +88,10 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
92
88
|
}
|
93
89
|
|
94
90
|
this.begin();
|
91
|
+
const view = this.delegate.getView();
|
92
|
+
const isRNGHText = view.hasAttribute('rnghtext');
|
95
93
|
|
96
|
-
if (this.buttonRole) {
|
94
|
+
if (this.buttonRole || isRNGHText) {
|
97
95
|
this.activate();
|
98
96
|
}
|
99
97
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["Platform","State","DEFAULT_TOUCH_SLOP","GestureHandler","NativeViewGestureHandler","init","ref","propsRef","setShouldCancelWhenOutside","OS","view","delegate","getView","restoreViewStyles","buttonRole","getAttribute","updateGestureConfig","enabled","props","config","shouldActivateOnStart","undefined","disallowInterruption","style","
|
1
|
+
{"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["Platform","State","DEFAULT_TOUCH_SLOP","GestureHandler","NativeViewGestureHandler","init","ref","propsRef","setShouldCancelWhenOutside","OS","view","delegate","getView","restoreViewStyles","buttonRole","getAttribute","updateGestureConfig","enabled","props","config","shouldActivateOnStart","undefined","disallowInterruption","style","onPointerDown","event","tracker","addToTracker","newPointerAction","tryToSendTouchEvent","onPointerAdd","lastCoords","getAbsoluteCoordsAverage","startX","x","startY","y","currentState","UNDETERMINED","begin","isRNGHText","hasAttribute","activate","onPointerMove","track","dx","dy","distSq","minDistSq","ACTIVE","cancel","BEGAN","onPointerLeave","onPointerUp","onUp","onPointerRemove","removeFromTracker","pointerId","getTrackedPointersCount","end","fail","shouldRecognizeSimultaneously","handler","getState","disallowsInterruption","canBeInterrupted","getTag","shouldBeCancelledByOther","_handler","isButton"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,cAAzB;AACA,SAASC,KAAT,QAAsB,aAAtB;AACA,SAASC,kBAAT,QAAmC,cAAnC;AAGA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,eAAe,MAAMC,wBAAN,SAAuCD,cAAvC,CAAsD;AAAA;AAAA;;AAAA;;AAAA,mDAKnC,KALmC;;AAAA,kDAMpC,KANoC;;AAAA,oCAQlD,CARkD;;AAAA,oCASlD,CATkD;;AAAA,uCAU/CD,kBAAkB,GAAGA,kBAV0B;AAAA;;AAY5DG,EAAAA,IAAI,CAACC,GAAD,EAAcC,QAAd,EAAwD;AACjE,UAAMF,IAAN,CAAWC,GAAX,EAAgBC,QAAhB;AAEA,SAAKC,0BAAL,CAAgC,IAAhC;;AAEA,QAAIR,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzB;AACD;;AAED,UAAMC,IAAI,GAAG,KAAKC,QAAL,CAAcC,OAAd,EAAb;AAEA,SAAKC,iBAAL,CAAuBH,IAAvB;AACA,SAAKI,UAAL,GAAkBJ,IAAI,CAACK,YAAL,CAAkB,MAAlB,MAA8B,QAAhD;AACD;;AAEMC,EAAAA,mBAAmB,CAAC;A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","sourcesContent":["import { Platform } from 'react-native';\nimport { State } from '../../State';\nimport { DEFAULT_TOUCH_SLOP } from '../constants';\nimport { AdaptedEvent, Config } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\nexport default class NativeViewGestureHandler extends GestureHandler {\n private buttonRole!: boolean;\n\n // TODO: Implement logic for activation on start\n // @ts-ignore Logic yet to be implemented\n private shouldActivateOnStart = false;\n private disallowInterruption = false;\n\n private startX = 0;\n private startY = 0;\n private minDistSq = DEFAULT_TOUCH_SLOP * DEFAULT_TOUCH_SLOP;\n\n public init(ref: number, propsRef: React.RefObject<unknown>): void {\n super.init(ref, propsRef);\n\n this.setShouldCancelWhenOutside(true);\n\n if (Platform.OS !== 'web') {\n return;\n }\n\n const view = this.delegate.getView() as HTMLElement;\n\n this.restoreViewStyles(view);\n this.buttonRole = view.getAttribute('role') === 'button';\n }\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n super.updateGestureConfig({ enabled: enabled, ...props });\n\n if (this.config.shouldActivateOnStart !== undefined) {\n this.shouldActivateOnStart = this.config.shouldActivateOnStart;\n }\n if (this.config.disallowInterruption !== undefined) {\n this.disallowInterruption = this.config.disallowInterruption;\n }\n\n const view = this.delegate.getView() as HTMLElement;\n this.restoreViewStyles(view);\n }\n\n private restoreViewStyles(view: HTMLElement) {\n if (!view) {\n return;\n }\n\n view.style['touchAction'] = 'auto';\n // @ts-ignore Turns on defualt touch behavior on Safari\n view.style['WebkitTouchCallout'] = 'auto';\n }\n\n protected onPointerDown(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerDown(event);\n this.newPointerAction();\n\n this.tryToSendTouchEvent(event);\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 const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.startX = lastCoords.x;\n this.startY = lastCoords.y;\n\n if (this.currentState !== State.UNDETERMINED) {\n return;\n }\n\n this.begin();\n\n const view = this.delegate.getView() as HTMLElement;\n const isRNGHText = view.hasAttribute('rnghtext');\n\n if (this.buttonRole || isRNGHText) {\n this.activate();\n }\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n const dx = this.startX - lastCoords.x;\n const dy = this.startY - lastCoords.y;\n const distSq = dx * dx + dy * dy;\n\n if (distSq >= this.minDistSq) {\n if (this.buttonRole && this.currentState === State.ACTIVE) {\n this.cancel();\n } else if (!this.buttonRole && this.currentState === State.BEGAN) {\n this.activate();\n }\n }\n }\n\n protected onPointerLeave(): void {\n if (\n this.currentState === State.BEGAN ||\n this.currentState === State.ACTIVE\n ) {\n this.cancel();\n }\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n super.onPointerUp(event);\n this.onUp(event);\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\n if (this.tracker.getTrackedPointersCount() === 0) {\n if (this.currentState === State.ACTIVE) {\n this.end();\n } else {\n this.fail();\n }\n }\n }\n\n public shouldRecognizeSimultaneously(handler: GestureHandler): boolean {\n if (super.shouldRecognizeSimultaneously(handler)) {\n return true;\n }\n\n if (\n handler instanceof NativeViewGestureHandler &&\n handler.getState() === State.ACTIVE &&\n handler.disallowsInterruption()\n ) {\n return false;\n }\n\n const canBeInterrupted = !this.disallowInterruption;\n\n if (\n this.currentState === State.ACTIVE &&\n handler.getState() === State.ACTIVE &&\n canBeInterrupted\n ) {\n return false;\n }\n\n return (\n this.currentState === State.ACTIVE &&\n canBeInterrupted &&\n handler.getTag() > 0\n );\n }\n\n public shouldBeCancelledByOther(_handler: GestureHandler): boolean {\n return !this.disallowInterruption;\n }\n\n public disallowsInterruption(): boolean {\n return this.disallowInterruption;\n }\n\n public isButton(): boolean {\n return this.buttonRole;\n }\n}\n"]}
|
@@ -70,10 +70,6 @@ export default class PanGestureHandler extends GestureHandler {
|
|
70
70
|
_defineProperty(this, "wheelDevice", WheelDevice.UNDETERMINED);
|
71
71
|
}
|
72
72
|
|
73
|
-
init(ref, propsRef) {
|
74
|
-
super.init(ref, propsRef);
|
75
|
-
}
|
76
|
-
|
77
73
|
updateGestureConfig({
|
78
74
|
enabled = true,
|
79
75
|
...props
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["PanGestureHandler.ts"],"names":["State","DEFAULT_TOUCH_SLOP","WheelDevice","GestureHandler","DEFAULT_MIN_POINTERS","DEFAULT_MAX_POINTERS","DEFAULT_MIN_DIST_SQ","PanGestureHandler","Number","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","UNDETERMINED","init","ref","propsRef","updateGestureConfig","enabled","props","resetConfig","checkCustomActivationCriteria","customActivationProperties","config","minDist","undefined","minDistSq","hasCustomActivationCriteria","minPointers","maxPointers","minVelocity","minVelocityX","minVelocityY","activateAfterLongPress","activeOffsetXStart","activeOffsetXEnd","failOffsetXStart","failOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","failOffsetYStart","failOffsetYEnd","enableTrackpadTwoFingerGesture","minVelocitySq","transformNativeEvent","translationX","getTranslationX","translationY","getTranslationY","isNaN","velocityX","velocityY","stylusData","lastX","startX","offsetX","lastY","startY","offsetY","clearActivationTimeout","clearTimeout","activationTimeout","onPointerDown","event","isButtonInConfig","button","tracker","addToTracker","lastCoords","getAbsoluteCoordsAverage","x","y","tryBegin","checkBegan","tryToSendTouchEvent","onPointerAdd","getTrackedPointersCount","currentState","ACTIVE","cancel","fail","onPointerUp","removeFromTracker","pointerId","end","resetProgress","onPointerRemove","onPointerMove","track","velocity","getVelocity","onPointerOutOfBounds","getShouldCancelWhenOutside","scheduleWheelEnd","endWheelTimeout","setTimeout","wheelDevice","onWheel","MOUSE","wheelDeltaY","TOUCHPAD","begin","activate","tryToSendMoveEvent","shouldActivate","dx","dy","dist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,OAAL,CAAawB,WAAb,CAAyB3B,KAAK,CAACoB,SAA/B,CAAjB;AACA,WAAKjC,SAAL,GAAiBuC,QAAQ,CAACnB,CAA1B;AACA,WAAKnB,SAAL,GAAiBsC,QAAQ,CAAClB,CAA1B;AACD;AACF;;AAEOE,EAAAA,UAAU,GAAS;AACzB,QAAI,KAAKI,YAAL,KAAsB3E,KAAK,CAAC8G,KAAhC,EAAuC;AACrC,UAAI,KAAKD,UAAL,EAAJ,EAAuB;AACrB,aAAK/B,IAAL;AACD,OAFD,MAEO,IAAI,KAAKwB,cAAL,EAAJ,EAA2B;AAChC,aAAKF,QAAL;AACD;AACF;AACF;;AAEMA,EAAAA,QAAQ,CAACW,KAAK,GAAG,KAAT,EAAsB;AACnC,QAAI,KAAKpC,YAAL,KAAsB3E,KAAK,CAAC4E,MAAhC,EAAwC;AACtC,WAAKO,aAAL;AACD;;AAED,UAAMiB,QAAN,CAAeW,KAAf;AACD;;AAESC,EAAAA,QAAQ,GAAS;AACzB,SAAKvD,sBAAL;AACD;;AAESwD,EAAAA,OAAO,GAAS;AACxB,SAAKxD,sBAAL;AACD;;AAES0B,EAAAA,aAAa,GAAS;AAC9B,QAAI,KAAKR,YAAL,KAAsB3E,KAAK,CAAC4E,MAAhC,EAAwC;AACtC;AACD;;AAED,SAAKxB,MAAL,GAAc,KAAKD,KAAnB;AACA,SAAKI,MAAL,GAAc,KAAKD,KAAnB;AACD;;AA/jB2D","sourcesContent":["import { State } from '../../State';\nimport { DEFAULT_TOUCH_SLOP } from '../constants';\nimport { AdaptedEvent, Config, StylusData, WheelDevice } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\n\nconst DEFAULT_MIN_POINTERS = 1;\nconst DEFAULT_MAX_POINTERS = 10;\nconst DEFAULT_MIN_DIST_SQ = DEFAULT_TOUCH_SLOP * DEFAULT_TOUCH_SLOP;\n\nexport default class PanGestureHandler extends GestureHandler {\n private readonly customActivationProperties: string[] = [\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'minVelocityX',\n 'minVelocityY',\n 'minVelocity',\n ];\n\n public velocityX = 0;\n public velocityY = 0;\n\n private minDistSq = DEFAULT_MIN_DIST_SQ;\n\n private activeOffsetXStart = -Number.MAX_SAFE_INTEGER;\n private activeOffsetXEnd = Number.MIN_SAFE_INTEGER;\n private failOffsetXStart = Number.MIN_SAFE_INTEGER;\n private failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n\n private activeOffsetYStart = Number.MAX_SAFE_INTEGER;\n private activeOffsetYEnd = Number.MIN_SAFE_INTEGER;\n private failOffsetYStart = Number.MIN_SAFE_INTEGER;\n private failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n\n private minVelocityX = Number.MAX_SAFE_INTEGER;\n private minVelocityY = Number.MAX_SAFE_INTEGER;\n private minVelocitySq = Number.MAX_SAFE_INTEGER;\n\n private minPointers = DEFAULT_MIN_POINTERS;\n private maxPointers = DEFAULT_MAX_POINTERS;\n\n private startX = 0;\n private startY = 0;\n private offsetX = 0;\n private offsetY = 0;\n private lastX = 0;\n private lastY = 0;\n\n private stylusData: StylusData | undefined;\n\n private activateAfterLongPress = 0;\n private activationTimeout = 0;\n\n private enableTrackpadTwoFingerGesture = false;\n private endWheelTimeout = 0;\n private wheelDevice = WheelDevice.UNDETERMINED;\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 this.resetConfig();\n\n super.updateGestureConfig({ enabled: enabled, ...props });\n this.checkCustomActivationCriteria(this.customActivationProperties);\n\n if (this.config.minDist !== undefined) {\n this.minDistSq = this.config.minDist * this.config.minDist;\n } else if (this.hasCustomActivationCriteria) {\n this.minDistSq = Number.MAX_SAFE_INTEGER;\n }\n\n if (this.config.minPointers !== undefined) {\n this.minPointers = this.config.minPointers;\n }\n\n if (this.config.maxPointers !== undefined) {\n this.maxPointers = this.config.maxPointers;\n }\n\n if (this.config.minVelocity !== undefined) {\n this.minVelocityX = this.config.minVelocity;\n this.minVelocityY = this.config.minVelocity;\n }\n\n if (this.config.minVelocityX !== undefined) {\n this.minVelocityX = this.config.minVelocityX;\n }\n\n if (this.config.minVelocityY !== undefined) {\n this.minVelocityY = this.config.minVelocityY;\n }\n\n if (this.config.activateAfterLongPress !== undefined) {\n this.activateAfterLongPress = this.config.activateAfterLongPress;\n }\n\n if (this.config.activeOffsetXStart !== undefined) {\n this.activeOffsetXStart = this.config.activeOffsetXStart;\n\n if (this.config.activeOffsetXEnd === undefined) {\n this.activeOffsetXEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetXEnd !== undefined) {\n this.activeOffsetXEnd = this.config.activeOffsetXEnd;\n\n if (this.config.activeOffsetXStart === undefined) {\n this.activeOffsetXStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetXStart !== undefined) {\n this.failOffsetXStart = this.config.failOffsetXStart;\n\n if (this.config.failOffsetXEnd === undefined) {\n this.failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetXEnd !== undefined) {\n this.failOffsetXEnd = this.config.failOffsetXEnd;\n\n if (this.config.failOffsetXStart === undefined) {\n this.failOffsetXStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetYStart !== undefined) {\n this.activeOffsetYStart = this.config.activeOffsetYStart;\n\n if (this.config.activeOffsetYEnd === undefined) {\n this.activeOffsetYEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetYEnd !== undefined) {\n this.activeOffsetYEnd = this.config.activeOffsetYEnd;\n\n if (this.config.activeOffsetYStart === undefined) {\n this.activeOffsetYStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetYStart !== undefined) {\n this.failOffsetYStart = this.config.failOffsetYStart;\n\n if (this.config.failOffsetYEnd === undefined) {\n this.failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetYEnd !== undefined) {\n this.failOffsetYEnd = this.config.failOffsetYEnd;\n\n if (this.config.failOffsetYStart === undefined) {\n this.failOffsetYStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.enableTrackpadTwoFingerGesture !== undefined) {\n this.enableTrackpadTwoFingerGesture =\n this.config.enableTrackpadTwoFingerGesture;\n }\n }\n\n protected resetConfig(): void {\n super.resetConfig();\n\n this.activeOffsetXStart = -Number.MAX_SAFE_INTEGER;\n this.activeOffsetXEnd = Number.MIN_SAFE_INTEGER;\n this.failOffsetXStart = Number.MIN_SAFE_INTEGER;\n this.failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n\n this.activeOffsetYStart = Number.MAX_SAFE_INTEGER;\n this.activeOffsetYEnd = Number.MIN_SAFE_INTEGER;\n this.failOffsetYStart = Number.MIN_SAFE_INTEGER;\n this.failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n\n this.minVelocityX = Number.MAX_SAFE_INTEGER;\n this.minVelocityY = Number.MAX_SAFE_INTEGER;\n this.minVelocitySq = Number.MAX_SAFE_INTEGER;\n\n this.minDistSq = DEFAULT_MIN_DIST_SQ;\n\n this.minPointers = DEFAULT_MIN_POINTERS;\n this.maxPointers = DEFAULT_MAX_POINTERS;\n\n this.activateAfterLongPress = 0;\n }\n\n protected transformNativeEvent() {\n const translationX: number = this.getTranslationX();\n const translationY: number = this.getTranslationY();\n\n return {\n ...super.transformNativeEvent(),\n translationX: isNaN(translationX) ? 0 : translationX,\n translationY: isNaN(translationY) ? 0 : translationY,\n velocityX: this.velocityX,\n velocityY: this.velocityY,\n stylusData: this.stylusData,\n };\n }\n\n private getTranslationX(): number {\n return this.lastX - this.startX + this.offsetX;\n }\n private getTranslationY(): number {\n return this.lastY - this.startY + this.offsetY;\n }\n\n private clearActivationTimeout(): void {\n clearTimeout(this.activationTimeout);\n }\n\n // Events Handling\n protected onPointerDown(event: AdaptedEvent): void {\n if (!this.isButtonInConfig(event.button)) {\n return;\n }\n\n this.tracker.addToTracker(event);\n this.stylusData = event.stylusData;\n\n super.onPointerDown(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n this.tryBegin(event);\n this.checkBegan();\n\n this.tryToSendTouchEvent(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n this.tryBegin(event);\n\n this.offsetX += this.lastX - this.startX;\n this.offsetY += this.lastY - this.startY;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n if (this.tracker.getTrackedPointersCount() > this.maxPointers) {\n if (this.currentState === State.ACTIVE) {\n this.cancel();\n } else {\n this.fail();\n }\n } else {\n this.checkBegan();\n }\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n this.stylusData = event.stylusData;\n\n super.onPointerUp(event);\n if (this.currentState === State.ACTIVE) {\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n }\n\n this.tracker.removeFromTracker(event.pointerId);\n\n if (this.tracker.getTrackedPointersCount() === 0) {\n this.clearActivationTimeout();\n }\n\n if (this.currentState === State.ACTIVE) {\n this.end();\n } else {\n this.resetProgress();\n this.fail();\n }\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.tracker.removeFromTracker(event.pointerId);\n\n this.offsetX += this.lastX - this.startX;\n this.offsetY += this.lastY - this.startY;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n if (\n !(\n this.currentState === State.ACTIVE &&\n this.tracker.getTrackedPointersCount() < this.minPointers\n )\n ) {\n this.checkBegan();\n }\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n this.stylusData = event.stylusData;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.checkBegan();\n\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n if (this.getShouldCancelWhenOutside()) {\n return;\n }\n\n this.tracker.track(event);\n this.stylusData = event.stylusData;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.checkBegan();\n\n if (this.currentState === State.ACTIVE) {\n super.onPointerOutOfBounds(event);\n }\n }\n\n private scheduleWheelEnd(event: AdaptedEvent) {\n clearTimeout(this.endWheelTimeout);\n\n this.endWheelTimeout = setTimeout(() => {\n if (this.currentState === State.ACTIVE) {\n this.end();\n this.tracker.removeFromTracker(event.pointerId);\n this.currentState = State.UNDETERMINED;\n }\n\n this.wheelDevice = WheelDevice.UNDETERMINED;\n }, 30);\n }\n\n protected onWheel(event: AdaptedEvent): void {\n if (\n this.wheelDevice === WheelDevice.MOUSE ||\n !this.enableTrackpadTwoFingerGesture\n ) {\n return;\n }\n\n if (this.currentState === State.UNDETERMINED) {\n this.wheelDevice =\n event.wheelDeltaY! % 120 !== 0\n ? WheelDevice.TOUCHPAD\n : WheelDevice.MOUSE;\n\n if (this.wheelDevice === WheelDevice.MOUSE) {\n this.scheduleWheelEnd(event);\n return;\n }\n\n this.tracker.addToTracker(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n this.begin();\n this.activate();\n }\n this.tracker.track(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.tryToSendMoveEvent(false, event);\n this.scheduleWheelEnd(event);\n }\n\n private shouldActivate(): boolean {\n const dx: number = this.getTranslationX();\n\n if (\n this.activeOffsetXStart !== Number.MAX_SAFE_INTEGER &&\n dx < this.activeOffsetXStart\n ) {\n return true;\n }\n\n if (\n this.activeOffsetXEnd !== Number.MIN_SAFE_INTEGER &&\n dx > this.activeOffsetXEnd\n ) {\n return true;\n }\n\n const dy: number = this.getTranslationY();\n\n if (\n this.activeOffsetYStart !== Number.MAX_SAFE_INTEGER &&\n dy < this.activeOffsetYStart\n ) {\n return true;\n }\n\n if (\n this.activeOffsetYEnd !== Number.MIN_SAFE_INTEGER &&\n dy > this.activeOffsetYEnd\n ) {\n return true;\n }\n\n const distanceSq: number = dx * dx + dy * dy;\n\n if (\n this.minDistSq !== Number.MAX_SAFE_INTEGER &&\n distanceSq >= this.minDistSq\n ) {\n return true;\n }\n\n const vx: number = this.velocityX;\n\n if (\n this.minVelocityX !== Number.MAX_SAFE_INTEGER &&\n ((this.minVelocityX < 0 && vx <= this.minVelocityX) ||\n (this.minVelocityX >= 0 && this.minVelocityX <= vx))\n ) {\n return true;\n }\n\n const vy: number = this.velocityY;\n if (\n this.minVelocityY !== Number.MAX_SAFE_INTEGER &&\n ((this.minVelocityY < 0 && vy <= this.minVelocityY) ||\n (this.minVelocityY >= 0 && this.minVelocityY <= vy))\n ) {\n return true;\n }\n\n const velocitySq: number = vx * vx + vy * vy;\n\n return (\n this.minVelocitySq !== Number.MAX_SAFE_INTEGER &&\n velocitySq >= this.minVelocitySq\n );\n }\n\n private shouldFail(): boolean {\n const dx: number = this.getTranslationX();\n const dy: number = this.getTranslationY();\n const distanceSq = dx * dx + dy * dy;\n\n if (this.activateAfterLongPress > 0 && distanceSq > DEFAULT_MIN_DIST_SQ) {\n this.clearActivationTimeout();\n return true;\n }\n\n if (\n this.failOffsetXStart !== Number.MIN_SAFE_INTEGER &&\n dx < this.failOffsetXStart\n ) {\n return true;\n }\n\n if (\n this.failOffsetXEnd !== Number.MAX_SAFE_INTEGER &&\n dx > this.failOffsetXEnd\n ) {\n return true;\n }\n\n if (\n this.failOffsetYStart !== Number.MIN_SAFE_INTEGER &&\n dy < this.failOffsetYStart\n ) {\n return true;\n }\n\n return (\n this.failOffsetYEnd !== Number.MAX_SAFE_INTEGER &&\n dy > this.failOffsetYEnd\n );\n }\n\n private tryBegin(event: AdaptedEvent): void {\n if (\n this.currentState === State.UNDETERMINED &&\n this.tracker.getTrackedPointersCount() >= this.minPointers\n ) {\n this.resetProgress();\n this.offsetX = 0;\n this.offsetY = 0;\n this.velocityX = 0;\n this.velocityY = 0;\n\n this.begin();\n\n if (this.activateAfterLongPress > 0) {\n this.activationTimeout = setTimeout(() => {\n this.activate();\n }, this.activateAfterLongPress);\n }\n } else {\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n }\n }\n\n private checkBegan(): void {\n if (this.currentState === State.BEGAN) {\n if (this.shouldFail()) {\n this.fail();\n } else if (this.shouldActivate()) {\n this.activate();\n }\n }\n }\n\n public activate(force = false): void {\n if (this.currentState !== State.ACTIVE) {\n this.resetProgress();\n }\n\n super.activate(force);\n }\n\n protected onCancel(): void {\n this.clearActivationTimeout();\n }\n\n protected onReset(): void {\n this.clearActivationTimeout();\n }\n\n protected resetProgress(): void {\n if (this.currentState === State.ACTIVE) {\n return;\n }\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["PanGestureHandler.ts"],"names":["State","DEFAULT_TOUCH_SLOP","WheelDevice","GestureHandler","DEFAULT_MIN_POINTERS","DEFAULT_MAX_POINTERS","DEFAULT_MIN_DIST_SQ","PanGestureHandler","Number","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","UNDETERMINED","updateGestureConfig","enabled","props","resetConfig","checkCustomActivationCriteria","customActivationProperties","config","minDist","undefined","minDistSq","hasCustomActivationCriteria","minPointers","maxPointers","minVelocity","minVelocityX","minVelocityY","activateAfterLongPress","activeOffsetXStart","activeOffsetXEnd","failOffsetXStart","failOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","failOffsetYStart","failOffsetYEnd","enableTrackpadTwoFingerGesture","minVelocitySq","transformNativeEvent","translationX","getTranslationX","translationY","getTranslationY","isNaN","velocityX","velocityY","stylusData","lastX","startX","offsetX","lastY","startY","offsetY","clearActivationTimeout","clearTimeout","activationTimeout","onPointerDown","event","isButtonInConfig","button","tracker","addToTracker","lastCoords","getAbsoluteCoordsAverage","x","y","tryBegin","checkBegan","tryToSendTouchEvent","onPointerAdd","getTrackedPointersCount","currentState","ACTIVE","cancel","fail","onPointerUp","removeFromTracker","pointerId","end","resetProgress","onPointerRemove","onPointerMove","track","velocity","getVelocity","onPointerOutOfBounds","getShouldCancelWhenOutside","scheduleWheelEnd","endWheelTimeout","setTimeout","wheelDevice","onWheel","MOUSE","wheelDeltaY","TOUCHPAD","begin","activate","tryToSendMoveEvent","shouldActivate","dx","dy","distanceSq","vx","vy","velocitySq","shouldFail","BEGAN","force","onCancel","onReset"],"mappings":";;AAAA,SAASA,KAAT,QAAsB,aAAtB;AACA,SAASC,kBAAT,QAAmC,cAAnC;AACA,SAA2CC,WAA3C,QAA8D,eAA9D;AAEA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,MAAMC,oBAAoB,GAAG,CAA7B;AACA,MAAMC,oBAAoB,GAAG,EAA7B;AACA,MAAMC,mBAAmB,GAAGL,kBAAkB,GAAGA,kBAAjD;AAEA,eAAe,MAAMM,iBAAN,SAAgCJ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B;AACnC,QAAI,KAAKpC,YAAL,KAAsBxE,KAAK,CAACyE,MAAhC,EAAwC;AACtC,WAAKO,aAAL;AACD;;AAED,UAAMiB,QAAN,CAAeW,KAAf;AACD;;AAESC,EAAAA,QAAQ,GAAS;AACzB,SAAKvD,sBAAL;AACD;;AAESwD,EAAAA,OAAO,GAAS;AACxB,SAAKxD,sBAAL;AACD;;AAES0B,EAAAA,aAAa,GAAS;AAC9B,QAAI,KAAKR,YAAL,KAAsBxE,KAAK,CAACyE,MAAhC,EAAwC;AACtC;AACD;;AAED,SAAKxB,MAAL,GAAc,KAAKD,KAAnB;AACA,SAAKI,MAAL,GAAc,KAAKD,KAAnB;AACD;;AA3jB2D","sourcesContent":["import { State } from '../../State';\nimport { DEFAULT_TOUCH_SLOP } from '../constants';\nimport { AdaptedEvent, Config, StylusData, WheelDevice } from '../interfaces';\n\nimport GestureHandler from './GestureHandler';\n\nconst DEFAULT_MIN_POINTERS = 1;\nconst DEFAULT_MAX_POINTERS = 10;\nconst DEFAULT_MIN_DIST_SQ = DEFAULT_TOUCH_SLOP * DEFAULT_TOUCH_SLOP;\n\nexport default class PanGestureHandler extends GestureHandler {\n private readonly customActivationProperties: string[] = [\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'minVelocityX',\n 'minVelocityY',\n 'minVelocity',\n ];\n\n public velocityX = 0;\n public velocityY = 0;\n\n private minDistSq = DEFAULT_MIN_DIST_SQ;\n\n private activeOffsetXStart = -Number.MAX_SAFE_INTEGER;\n private activeOffsetXEnd = Number.MIN_SAFE_INTEGER;\n private failOffsetXStart = Number.MIN_SAFE_INTEGER;\n private failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n\n private activeOffsetYStart = Number.MAX_SAFE_INTEGER;\n private activeOffsetYEnd = Number.MIN_SAFE_INTEGER;\n private failOffsetYStart = Number.MIN_SAFE_INTEGER;\n private failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n\n private minVelocityX = Number.MAX_SAFE_INTEGER;\n private minVelocityY = Number.MAX_SAFE_INTEGER;\n private minVelocitySq = Number.MAX_SAFE_INTEGER;\n\n private minPointers = DEFAULT_MIN_POINTERS;\n private maxPointers = DEFAULT_MAX_POINTERS;\n\n private startX = 0;\n private startY = 0;\n private offsetX = 0;\n private offsetY = 0;\n private lastX = 0;\n private lastY = 0;\n\n private stylusData: StylusData | undefined;\n\n private activateAfterLongPress = 0;\n private activationTimeout = 0;\n\n private enableTrackpadTwoFingerGesture = false;\n private endWheelTimeout = 0;\n private wheelDevice = WheelDevice.UNDETERMINED;\n\n public updateGestureConfig({ enabled = true, ...props }: Config): void {\n this.resetConfig();\n\n super.updateGestureConfig({ enabled: enabled, ...props });\n this.checkCustomActivationCriteria(this.customActivationProperties);\n\n if (this.config.minDist !== undefined) {\n this.minDistSq = this.config.minDist * this.config.minDist;\n } else if (this.hasCustomActivationCriteria) {\n this.minDistSq = Number.MAX_SAFE_INTEGER;\n }\n\n if (this.config.minPointers !== undefined) {\n this.minPointers = this.config.minPointers;\n }\n\n if (this.config.maxPointers !== undefined) {\n this.maxPointers = this.config.maxPointers;\n }\n\n if (this.config.minVelocity !== undefined) {\n this.minVelocityX = this.config.minVelocity;\n this.minVelocityY = this.config.minVelocity;\n }\n\n if (this.config.minVelocityX !== undefined) {\n this.minVelocityX = this.config.minVelocityX;\n }\n\n if (this.config.minVelocityY !== undefined) {\n this.minVelocityY = this.config.minVelocityY;\n }\n\n if (this.config.activateAfterLongPress !== undefined) {\n this.activateAfterLongPress = this.config.activateAfterLongPress;\n }\n\n if (this.config.activeOffsetXStart !== undefined) {\n this.activeOffsetXStart = this.config.activeOffsetXStart;\n\n if (this.config.activeOffsetXEnd === undefined) {\n this.activeOffsetXEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetXEnd !== undefined) {\n this.activeOffsetXEnd = this.config.activeOffsetXEnd;\n\n if (this.config.activeOffsetXStart === undefined) {\n this.activeOffsetXStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetXStart !== undefined) {\n this.failOffsetXStart = this.config.failOffsetXStart;\n\n if (this.config.failOffsetXEnd === undefined) {\n this.failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetXEnd !== undefined) {\n this.failOffsetXEnd = this.config.failOffsetXEnd;\n\n if (this.config.failOffsetXStart === undefined) {\n this.failOffsetXStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetYStart !== undefined) {\n this.activeOffsetYStart = this.config.activeOffsetYStart;\n\n if (this.config.activeOffsetYEnd === undefined) {\n this.activeOffsetYEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.activeOffsetYEnd !== undefined) {\n this.activeOffsetYEnd = this.config.activeOffsetYEnd;\n\n if (this.config.activeOffsetYStart === undefined) {\n this.activeOffsetYStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetYStart !== undefined) {\n this.failOffsetYStart = this.config.failOffsetYStart;\n\n if (this.config.failOffsetYEnd === undefined) {\n this.failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n }\n }\n\n if (this.config.failOffsetYEnd !== undefined) {\n this.failOffsetYEnd = this.config.failOffsetYEnd;\n\n if (this.config.failOffsetYStart === undefined) {\n this.failOffsetYStart = Number.MIN_SAFE_INTEGER;\n }\n }\n\n if (this.config.enableTrackpadTwoFingerGesture !== undefined) {\n this.enableTrackpadTwoFingerGesture =\n this.config.enableTrackpadTwoFingerGesture;\n }\n }\n\n protected resetConfig(): void {\n super.resetConfig();\n\n this.activeOffsetXStart = -Number.MAX_SAFE_INTEGER;\n this.activeOffsetXEnd = Number.MIN_SAFE_INTEGER;\n this.failOffsetXStart = Number.MIN_SAFE_INTEGER;\n this.failOffsetXEnd = Number.MAX_SAFE_INTEGER;\n\n this.activeOffsetYStart = Number.MAX_SAFE_INTEGER;\n this.activeOffsetYEnd = Number.MIN_SAFE_INTEGER;\n this.failOffsetYStart = Number.MIN_SAFE_INTEGER;\n this.failOffsetYEnd = Number.MAX_SAFE_INTEGER;\n\n this.minVelocityX = Number.MAX_SAFE_INTEGER;\n this.minVelocityY = Number.MAX_SAFE_INTEGER;\n this.minVelocitySq = Number.MAX_SAFE_INTEGER;\n\n this.minDistSq = DEFAULT_MIN_DIST_SQ;\n\n this.minPointers = DEFAULT_MIN_POINTERS;\n this.maxPointers = DEFAULT_MAX_POINTERS;\n\n this.activateAfterLongPress = 0;\n }\n\n protected transformNativeEvent() {\n const translationX: number = this.getTranslationX();\n const translationY: number = this.getTranslationY();\n\n return {\n ...super.transformNativeEvent(),\n translationX: isNaN(translationX) ? 0 : translationX,\n translationY: isNaN(translationY) ? 0 : translationY,\n velocityX: this.velocityX,\n velocityY: this.velocityY,\n stylusData: this.stylusData,\n };\n }\n\n private getTranslationX(): number {\n return this.lastX - this.startX + this.offsetX;\n }\n private getTranslationY(): number {\n return this.lastY - this.startY + this.offsetY;\n }\n\n private clearActivationTimeout(): void {\n clearTimeout(this.activationTimeout);\n }\n\n // Events Handling\n protected onPointerDown(event: AdaptedEvent): void {\n if (!this.isButtonInConfig(event.button)) {\n return;\n }\n\n this.tracker.addToTracker(event);\n this.stylusData = event.stylusData;\n\n super.onPointerDown(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n this.tryBegin(event);\n this.checkBegan();\n\n this.tryToSendTouchEvent(event);\n }\n\n protected onPointerAdd(event: AdaptedEvent): void {\n this.tracker.addToTracker(event);\n super.onPointerAdd(event);\n this.tryBegin(event);\n\n this.offsetX += this.lastX - this.startX;\n this.offsetY += this.lastY - this.startY;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n if (this.tracker.getTrackedPointersCount() > this.maxPointers) {\n if (this.currentState === State.ACTIVE) {\n this.cancel();\n } else {\n this.fail();\n }\n } else {\n this.checkBegan();\n }\n }\n\n protected onPointerUp(event: AdaptedEvent): void {\n this.stylusData = event.stylusData;\n\n super.onPointerUp(event);\n if (this.currentState === State.ACTIVE) {\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n }\n\n this.tracker.removeFromTracker(event.pointerId);\n\n if (this.tracker.getTrackedPointersCount() === 0) {\n this.clearActivationTimeout();\n }\n\n if (this.currentState === State.ACTIVE) {\n this.end();\n } else {\n this.resetProgress();\n this.fail();\n }\n }\n\n protected onPointerRemove(event: AdaptedEvent): void {\n super.onPointerRemove(event);\n this.tracker.removeFromTracker(event.pointerId);\n\n this.offsetX += this.lastX - this.startX;\n this.offsetY += this.lastY - this.startY;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n if (\n !(\n this.currentState === State.ACTIVE &&\n this.tracker.getTrackedPointersCount() < this.minPointers\n )\n ) {\n this.checkBegan();\n }\n }\n\n protected onPointerMove(event: AdaptedEvent): void {\n this.tracker.track(event);\n this.stylusData = event.stylusData;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.checkBegan();\n\n super.onPointerMove(event);\n }\n\n protected onPointerOutOfBounds(event: AdaptedEvent): void {\n if (this.getShouldCancelWhenOutside()) {\n return;\n }\n\n this.tracker.track(event);\n this.stylusData = event.stylusData;\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.checkBegan();\n\n if (this.currentState === State.ACTIVE) {\n super.onPointerOutOfBounds(event);\n }\n }\n\n private scheduleWheelEnd(event: AdaptedEvent) {\n clearTimeout(this.endWheelTimeout);\n\n this.endWheelTimeout = setTimeout(() => {\n if (this.currentState === State.ACTIVE) {\n this.end();\n this.tracker.removeFromTracker(event.pointerId);\n this.currentState = State.UNDETERMINED;\n }\n\n this.wheelDevice = WheelDevice.UNDETERMINED;\n }, 30);\n }\n\n protected onWheel(event: AdaptedEvent): void {\n if (\n this.wheelDevice === WheelDevice.MOUSE ||\n !this.enableTrackpadTwoFingerGesture\n ) {\n return;\n }\n\n if (this.currentState === State.UNDETERMINED) {\n this.wheelDevice =\n event.wheelDeltaY! % 120 !== 0\n ? WheelDevice.TOUCHPAD\n : WheelDevice.MOUSE;\n\n if (this.wheelDevice === WheelDevice.MOUSE) {\n this.scheduleWheelEnd(event);\n return;\n }\n\n this.tracker.addToTracker(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n\n this.begin();\n this.activate();\n }\n this.tracker.track(event);\n\n const lastCoords = this.tracker.getAbsoluteCoordsAverage();\n this.lastX = lastCoords.x;\n this.lastY = lastCoords.y;\n\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n\n this.tryToSendMoveEvent(false, event);\n this.scheduleWheelEnd(event);\n }\n\n private shouldActivate(): boolean {\n const dx: number = this.getTranslationX();\n\n if (\n this.activeOffsetXStart !== Number.MAX_SAFE_INTEGER &&\n dx < this.activeOffsetXStart\n ) {\n return true;\n }\n\n if (\n this.activeOffsetXEnd !== Number.MIN_SAFE_INTEGER &&\n dx > this.activeOffsetXEnd\n ) {\n return true;\n }\n\n const dy: number = this.getTranslationY();\n\n if (\n this.activeOffsetYStart !== Number.MAX_SAFE_INTEGER &&\n dy < this.activeOffsetYStart\n ) {\n return true;\n }\n\n if (\n this.activeOffsetYEnd !== Number.MIN_SAFE_INTEGER &&\n dy > this.activeOffsetYEnd\n ) {\n return true;\n }\n\n const distanceSq: number = dx * dx + dy * dy;\n\n if (\n this.minDistSq !== Number.MAX_SAFE_INTEGER &&\n distanceSq >= this.minDistSq\n ) {\n return true;\n }\n\n const vx: number = this.velocityX;\n\n if (\n this.minVelocityX !== Number.MAX_SAFE_INTEGER &&\n ((this.minVelocityX < 0 && vx <= this.minVelocityX) ||\n (this.minVelocityX >= 0 && this.minVelocityX <= vx))\n ) {\n return true;\n }\n\n const vy: number = this.velocityY;\n if (\n this.minVelocityY !== Number.MAX_SAFE_INTEGER &&\n ((this.minVelocityY < 0 && vy <= this.minVelocityY) ||\n (this.minVelocityY >= 0 && this.minVelocityY <= vy))\n ) {\n return true;\n }\n\n const velocitySq: number = vx * vx + vy * vy;\n\n return (\n this.minVelocitySq !== Number.MAX_SAFE_INTEGER &&\n velocitySq >= this.minVelocitySq\n );\n }\n\n private shouldFail(): boolean {\n const dx: number = this.getTranslationX();\n const dy: number = this.getTranslationY();\n const distanceSq = dx * dx + dy * dy;\n\n if (this.activateAfterLongPress > 0 && distanceSq > DEFAULT_MIN_DIST_SQ) {\n this.clearActivationTimeout();\n return true;\n }\n\n if (\n this.failOffsetXStart !== Number.MIN_SAFE_INTEGER &&\n dx < this.failOffsetXStart\n ) {\n return true;\n }\n\n if (\n this.failOffsetXEnd !== Number.MAX_SAFE_INTEGER &&\n dx > this.failOffsetXEnd\n ) {\n return true;\n }\n\n if (\n this.failOffsetYStart !== Number.MIN_SAFE_INTEGER &&\n dy < this.failOffsetYStart\n ) {\n return true;\n }\n\n return (\n this.failOffsetYEnd !== Number.MAX_SAFE_INTEGER &&\n dy > this.failOffsetYEnd\n );\n }\n\n private tryBegin(event: AdaptedEvent): void {\n if (\n this.currentState === State.UNDETERMINED &&\n this.tracker.getTrackedPointersCount() >= this.minPointers\n ) {\n this.resetProgress();\n this.offsetX = 0;\n this.offsetY = 0;\n this.velocityX = 0;\n this.velocityY = 0;\n\n this.begin();\n\n if (this.activateAfterLongPress > 0) {\n this.activationTimeout = setTimeout(() => {\n this.activate();\n }, this.activateAfterLongPress);\n }\n } else {\n const velocity = this.tracker.getVelocity(event.pointerId);\n this.velocityX = velocity.x;\n this.velocityY = velocity.y;\n }\n }\n\n private checkBegan(): void {\n if (this.currentState === State.BEGAN) {\n if (this.shouldFail()) {\n this.fail();\n } else if (this.shouldActivate()) {\n this.activate();\n }\n }\n }\n\n public activate(force = false): void {\n if (this.currentState !== State.ACTIVE) {\n this.resetProgress();\n }\n\n super.activate(force);\n }\n\n protected onCancel(): void {\n this.clearActivationTimeout();\n }\n\n protected onReset(): void {\n this.clearActivationTimeout();\n }\n\n protected resetProgress(): void {\n if (this.currentState === State.ACTIVE) {\n return;\n }\n\n this.startX = this.lastX;\n this.startY = this.lastY;\n }\n}\n"]}
|
@@ -47,16 +47,6 @@ export default class PinchGestureHandler extends GestureHandler {
|
|
47
47
|
this.setShouldCancelWhenOutside(false);
|
48
48
|
}
|
49
49
|
|
50
|
-
updateGestureConfig({
|
51
|
-
enabled = true,
|
52
|
-
...props
|
53
|
-
}) {
|
54
|
-
super.updateGestureConfig({
|
55
|
-
enabled: enabled,
|
56
|
-
...props
|
57
|
-
});
|
58
|
-
}
|
59
|
-
|
60
50
|
transformNativeEvent() {
|
61
51
|
return {
|
62
52
|
focalX: this.scaleGestureDetector.getFocusX(),
|