react-native-gesture-handler 2.16.0-rc.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt +2 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +9 -0
- package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/core/DiagonalDirections.kt +8 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt +61 -24
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +17 -22
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +30 -11
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +3 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +66 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +119 -19
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +2 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +4 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +1 -4
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +4 -7
- package/apple/Handlers/RNLongPressHandler.m +5 -13
- package/apple/Handlers/RNPinchHandler.m +12 -1
- package/apple/RNGestureHandler.m +3 -1
- package/lib/commonjs/Directions.js +19 -6
- package/lib/commonjs/Directions.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +7 -61
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/Swipeable.js +3 -1
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +1 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +2 -2
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +14 -0
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +11 -0
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/commonjs/handlers/gestureHandlerCommon.js +13 -2
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +10 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mocks.js +2 -0
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/commonjs/web/Gestures.js +66 -0
- package/lib/commonjs/web/Gestures.js.map +1 -0
- package/lib/commonjs/web/constants.js +3 -8
- package/lib/commonjs/web/constants.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +36 -12
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +4 -2
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/IGestureHandler.js +2 -0
- package/lib/commonjs/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +1 -13
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/EventManager.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +114 -115
- package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +10 -5
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/InteractionManager.js +12 -3
- package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +55 -27
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +26 -5
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/Vector.js +58 -0
- package/lib/commonjs/web/tools/Vector.js.map +1 -0
- package/lib/commonjs/web/utils.js +9 -1
- package/lib/commonjs/web/utils.js.map +1 -1
- package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
- package/lib/module/Directions.js +16 -4
- package/lib/module/Directions.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +2 -39
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/Swipeable.js +3 -1
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/components/touchables/GenericTouchable.js +1 -0
- package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
- package/lib/module/handlers/createHandler.js +2 -3
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +3 -0
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -0
- package/lib/module/handlers/customDirectEventTypes.web.js +5 -0
- package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -0
- package/lib/module/handlers/gestureHandlerCommon.js +11 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +10 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks.js +2 -0
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -1
- package/lib/module/web/Gestures.js +39 -0
- package/lib/module/web/Gestures.js.map +1 -0
- package/lib/module/web/constants.js +1 -6
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +34 -12
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +3 -2
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/IGestureHandler.js +2 -0
- package/lib/module/web/handlers/IGestureHandler.js.map +1 -0
- package/lib/module/web/handlers/NativeViewGestureHandler.js +5 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +0 -11
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/EventManager.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerOrchestrator.js +114 -115
- package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +9 -4
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/InteractionManager.js +9 -3
- package/lib/module/web/tools/InteractionManager.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +53 -26
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +26 -5
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/web/tools/Vector.js +47 -0
- package/lib/module/web/tools/Vector.js.map +1 -0
- package/lib/module/web/utils.js +2 -0
- package/lib/module/web/utils.js.map +1 -1
- package/lib/module/web_hammer/NodeManager.js.map +1 -1
- package/lib/typescript/Directions.d.ts +7 -0
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +4 -39
- package/lib/typescript/components/DrawerLayout.d.ts +1 -2
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +2 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +2 -0
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +11 -2
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +1 -2
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/mocks.d.ts +1 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +4 -1
- package/lib/typescript/web/Gestures.d.ts +36 -0
- package/lib/typescript/web/constants.d.ts +1 -6
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +3 -3
- package/lib/typescript/web/handlers/GestureHandler.d.ts +11 -9
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +38 -0
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
- package/lib/typescript/web/interfaces.d.ts +7 -10
- package/lib/typescript/web/tools/EventManager.d.ts +15 -12
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +3 -4
- package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +7 -5
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -3
- package/lib/typescript/web/tools/InteractionManager.d.ts +6 -6
- package/lib/typescript/web/tools/NodeManager.d.ts +4 -3
- package/lib/typescript/web/tools/PointerEventManager.d.ts +11 -2
- package/lib/typescript/web/tools/TouchEventManager.d.ts +6 -1
- package/lib/typescript/web/tools/Vector.d.ts +15 -0
- package/lib/typescript/web/utils.d.ts +4 -4
- package/lib/typescript/web_hammer/NodeManager.d.ts +1 -1
- package/package.json +2 -1
- package/src/Directions.ts +21 -4
- package/src/RNGestureHandlerModule.web.ts +3 -44
- package/src/components/DrawerLayout.tsx +1 -1
- package/src/components/Swipeable.tsx +2 -0
- package/src/components/touchables/GenericTouchable.tsx +3 -0
- package/src/handlers/createHandler.tsx +10 -4
- package/src/handlers/customDirectEventTypes.ts +2 -0
- package/src/handlers/customDirectEventTypes.web.ts +5 -0
- package/src/handlers/gestureHandlerCommon.ts +28 -1
- package/src/handlers/gestures/GestureDetector.tsx +15 -0
- package/src/handlers/gestures/gesture.ts +1 -1
- package/src/index.ts +1 -1
- package/src/mocks.ts +2 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +4 -0
- package/src/web/Gestures.ts +41 -0
- package/src/web/constants.ts +1 -7
- package/src/web/handlers/FlingGestureHandler.ts +54 -24
- package/src/web/handlers/GestureHandler.ts +14 -10
- package/src/web/handlers/IGestureHandler.ts +50 -0
- package/src/web/handlers/NativeViewGestureHandler.ts +5 -6
- package/src/web/interfaces.ts +13 -10
- package/src/web/tools/EventManager.ts +16 -14
- package/src/web/tools/GestureHandlerDelegate.ts +3 -4
- package/src/web/tools/GestureHandlerOrchestrator.ts +160 -145
- package/src/web/tools/GestureHandlerWebDelegate.ts +14 -9
- package/src/web/tools/InteractionManager.ts +18 -12
- package/src/web/tools/NodeManager.ts +4 -3
- package/src/web/tools/PointerEventManager.ts +181 -166
- package/src/web/tools/TouchEventManager.ts +126 -114
- package/src/web/tools/Vector.ts +60 -0
- package/src/web/utils.ts +7 -4
- package/src/web_hammer/NodeManager.ts +1 -1
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
HandlerStateChangeEvent,
|
|
29
29
|
UserSelect,
|
|
30
30
|
ActiveCursor,
|
|
31
|
+
MouseButton,
|
|
31
32
|
} from '../handlers/gestureHandlerCommon';
|
|
32
33
|
import {
|
|
33
34
|
PanGestureHandler,
|
|
@@ -38,7 +39,6 @@ import {
|
|
|
38
39
|
TapGestureHandlerEventPayload,
|
|
39
40
|
} from '../handlers/TapGestureHandler';
|
|
40
41
|
import { State } from '../State';
|
|
41
|
-
import { MouseButton } from '../web/interfaces';
|
|
42
42
|
|
|
43
43
|
const DRAG_TOSS = 0.05;
|
|
44
44
|
|
|
@@ -541,6 +541,7 @@ export default class Swipeable extends Component<
|
|
|
541
541
|
return (
|
|
542
542
|
<PanGestureHandler
|
|
543
543
|
activeOffsetX={[-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]}
|
|
544
|
+
touchAction="pan-y"
|
|
544
545
|
{...this.props}
|
|
545
546
|
onGestureEvent={this.onGestureEvent}
|
|
546
547
|
onHandlerStateChange={this.onHandlerStateChange}>
|
|
@@ -551,6 +552,7 @@ export default class Swipeable extends Component<
|
|
|
551
552
|
{right}
|
|
552
553
|
<TapGestureHandler
|
|
553
554
|
enabled={rowState !== 0}
|
|
555
|
+
touchAction="pan-y"
|
|
554
556
|
onHandlerStateChange={this.onTapHandlerStateChange}>
|
|
555
557
|
<Animated.View
|
|
556
558
|
pointerEvents={rowState === 0 ? 'auto' : 'box-only'}
|
|
@@ -15,6 +15,7 @@ import { BaseButton } from '../GestureButtons';
|
|
|
15
15
|
import {
|
|
16
16
|
GestureEvent,
|
|
17
17
|
HandlerStateChangeEvent,
|
|
18
|
+
UserSelect,
|
|
18
19
|
} from '../../handlers/gestureHandlerCommon';
|
|
19
20
|
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
|
|
20
21
|
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
|
|
@@ -51,6 +52,7 @@ export interface GenericTouchableProps
|
|
|
51
52
|
|
|
52
53
|
containerStyle?: StyleProp<ViewStyle>;
|
|
53
54
|
hitSlop?: Insets | number;
|
|
55
|
+
userSelect?: UserSelect;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
interface InternalProps {
|
|
@@ -286,6 +288,7 @@ export default class GenericTouchable extends Component<
|
|
|
286
288
|
}
|
|
287
289
|
onGestureEvent={this.onGestureEvent}
|
|
288
290
|
hitSlop={hitSlop}
|
|
291
|
+
userSelect={this.props.userSelect}
|
|
289
292
|
shouldActivateOnStart={this.props.shouldActivateOnStart}
|
|
290
293
|
disallowInterruption={this.props.disallowInterruption}
|
|
291
294
|
testID={this.props.testID}
|
|
@@ -5,12 +5,10 @@ import {
|
|
|
5
5
|
DeviceEventEmitter,
|
|
6
6
|
EmitterSubscription,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
|
|
8
|
+
import { customDirectEventTypes } from './customDirectEventTypes';
|
|
10
9
|
// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
|
|
11
10
|
import deepEqual from 'lodash/isEqual';
|
|
12
11
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
13
|
-
import type RNGestureHandlerModuleWeb from '../RNGestureHandlerModule.web';
|
|
14
12
|
import { State } from '../State';
|
|
15
13
|
import {
|
|
16
14
|
handlerIDToTag,
|
|
@@ -155,6 +153,14 @@ type InternalEventHandlers = {
|
|
|
155
153
|
onGestureHandlerStateChange?: (event: any) => void;
|
|
156
154
|
};
|
|
157
155
|
|
|
156
|
+
type AttachGestureHandlerWeb = (
|
|
157
|
+
handlerTag: number,
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
newView: any,
|
|
160
|
+
_actionType: ActionType,
|
|
161
|
+
propsRef: React.RefObject<unknown>
|
|
162
|
+
) => void;
|
|
163
|
+
|
|
158
164
|
const UNRESOLVED_REFS_RETRY_LIMIT = 1;
|
|
159
165
|
|
|
160
166
|
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
|
|
@@ -321,7 +327,7 @@ export default function createHandler<
|
|
|
321
327
|
if (Platform.OS === 'web') {
|
|
322
328
|
// typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
|
|
323
329
|
(
|
|
324
|
-
RNGestureHandlerModule.attachGestureHandler as
|
|
330
|
+
RNGestureHandlerModule.attachGestureHandler as AttachGestureHandlerWeb
|
|
325
331
|
)(
|
|
326
332
|
this.handlerTag,
|
|
327
333
|
newViewTag,
|
|
@@ -12,7 +12,6 @@ import { handlerIDToTag } from './handlersRegistry';
|
|
|
12
12
|
import { toArray } from '../utils';
|
|
13
13
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
|
14
14
|
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
15
|
-
import { MouseButton } from '../web/interfaces';
|
|
16
15
|
import { PointerType } from '../PointerType';
|
|
17
16
|
|
|
18
17
|
const commonProps = [
|
|
@@ -25,6 +24,7 @@ const commonProps = [
|
|
|
25
24
|
'activeCursor',
|
|
26
25
|
'mouseButton',
|
|
27
26
|
'enableContextMenu',
|
|
27
|
+
'touchAction',
|
|
28
28
|
] as const;
|
|
29
29
|
|
|
30
30
|
const componentInteractionProps = [
|
|
@@ -113,6 +113,32 @@ export type ActiveCursor =
|
|
|
113
113
|
| 'zoom-in'
|
|
114
114
|
| 'zoom-out';
|
|
115
115
|
|
|
116
|
+
export enum MouseButton {
|
|
117
|
+
LEFT = 1,
|
|
118
|
+
RIGHT = 2,
|
|
119
|
+
MIDDLE = 4,
|
|
120
|
+
BUTTON_4 = 8,
|
|
121
|
+
BUTTON_5 = 16,
|
|
122
|
+
ALL = 31,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type TouchAction =
|
|
126
|
+
| 'auto'
|
|
127
|
+
| 'none'
|
|
128
|
+
| 'pan-x'
|
|
129
|
+
| 'pan-left'
|
|
130
|
+
| 'pan-right'
|
|
131
|
+
| 'pan-y'
|
|
132
|
+
| 'pan-up'
|
|
133
|
+
| 'pan-down'
|
|
134
|
+
| 'pinch-zoom'
|
|
135
|
+
| 'manipulation'
|
|
136
|
+
| 'inherit'
|
|
137
|
+
| 'initial'
|
|
138
|
+
| 'revert'
|
|
139
|
+
| 'revert-layer'
|
|
140
|
+
| 'unset';
|
|
141
|
+
|
|
116
142
|
//TODO(TS) events in handlers
|
|
117
143
|
|
|
118
144
|
export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
|
|
@@ -156,6 +182,7 @@ export type CommonGestureConfig = {
|
|
|
156
182
|
activeCursor?: ActiveCursor;
|
|
157
183
|
mouseButton?: MouseButton;
|
|
158
184
|
enableContextMenu?: boolean;
|
|
185
|
+
touchAction?: TouchAction;
|
|
159
186
|
};
|
|
160
187
|
|
|
161
188
|
// Events payloads are types instead of interfaces due to TS limitation.
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
HandlerStateChangeEvent,
|
|
20
20
|
scheduleFlushOperations,
|
|
21
21
|
UserSelect,
|
|
22
|
+
TouchAction,
|
|
22
23
|
} from '../gestureHandlerCommon';
|
|
23
24
|
import {
|
|
24
25
|
GestureStateManager,
|
|
@@ -614,11 +615,21 @@ const applyEnableContextMenuProp = (
|
|
|
614
615
|
}
|
|
615
616
|
};
|
|
616
617
|
|
|
618
|
+
const applyTouchActionProp = (
|
|
619
|
+
touchAction: TouchAction,
|
|
620
|
+
gesture: ComposedGesture | GestureType
|
|
621
|
+
): void => {
|
|
622
|
+
for (const g of gesture.toGestureArray()) {
|
|
623
|
+
g.config.touchAction = touchAction;
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
|
|
617
627
|
interface GestureDetectorProps {
|
|
618
628
|
gesture: ComposedGesture | GestureType;
|
|
619
629
|
children?: React.ReactNode;
|
|
620
630
|
userSelect?: UserSelect;
|
|
621
631
|
enableContextMenu?: boolean;
|
|
632
|
+
touchAction?: TouchAction;
|
|
622
633
|
}
|
|
623
634
|
interface GestureDetectorState {
|
|
624
635
|
firstRender: boolean;
|
|
@@ -644,6 +655,10 @@ export const GestureDetector = (props: GestureDetectorProps) => {
|
|
|
644
655
|
applyEnableContextMenuProp(props.enableContextMenu, gestureConfig);
|
|
645
656
|
}
|
|
646
657
|
|
|
658
|
+
if (props.touchAction !== undefined) {
|
|
659
|
+
applyTouchActionProp(props.touchAction, gestureConfig);
|
|
660
|
+
}
|
|
661
|
+
|
|
647
662
|
const gesture = gestureConfig.toGestureArray();
|
|
648
663
|
const useReanimatedHook = gesture.some((g) => g.shouldUseReanimated);
|
|
649
664
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
GestureStateChangeEvent,
|
|
8
8
|
GestureUpdateEvent,
|
|
9
9
|
ActiveCursor,
|
|
10
|
+
MouseButton,
|
|
10
11
|
} from '../gestureHandlerCommon';
|
|
11
12
|
import { getNextHandlerTag } from '../handlersRegistry';
|
|
12
13
|
import { GestureStateManagerType } from './gestureStateManager';
|
|
@@ -17,7 +18,6 @@ import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
|
|
|
17
18
|
import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
|
|
18
19
|
import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
|
|
19
20
|
import { isRemoteDebuggingEnabled } from '../../utils';
|
|
20
|
-
import { MouseButton } from '../../web/interfaces';
|
|
21
21
|
|
|
22
22
|
export type GestureType =
|
|
23
23
|
| BaseGesture<Record<string, unknown>>
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { initialize } from './init';
|
|
|
2
2
|
|
|
3
3
|
export { Directions } from './Directions';
|
|
4
4
|
export { State } from './State';
|
|
5
|
-
export { MouseButton } from './web/interfaces';
|
|
6
5
|
export { PointerType } from './PointerType';
|
|
7
6
|
export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
|
|
8
7
|
export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
|
|
@@ -20,6 +19,7 @@ export type {
|
|
|
20
19
|
GestureUpdateEvent,
|
|
21
20
|
GestureStateChangeEvent,
|
|
22
21
|
} from './handlers/gestureHandlerCommon';
|
|
22
|
+
export { MouseButton } from './handlers/gestureHandlerCommon';
|
|
23
23
|
export type { GestureType } from './handlers/gestures/gesture';
|
|
24
24
|
export type {
|
|
25
25
|
TapGestureHandlerEventPayload,
|
package/src/mocks.ts
CHANGED
|
@@ -22,6 +22,7 @@ const createGestureHandler = NOOP;
|
|
|
22
22
|
const dropGestureHandler = NOOP;
|
|
23
23
|
const updateGestureHandler = NOOP;
|
|
24
24
|
const flushOperations = NOOP;
|
|
25
|
+
const install = NOOP;
|
|
25
26
|
const NativeViewGestureHandler = View;
|
|
26
27
|
const TapGestureHandler = View;
|
|
27
28
|
const ForceTouchGestureHandler = View;
|
|
@@ -61,6 +62,7 @@ export default {
|
|
|
61
62
|
dropGestureHandler,
|
|
62
63
|
updateGestureHandler,
|
|
63
64
|
flushOperations,
|
|
65
|
+
install,
|
|
64
66
|
// probably can be removed
|
|
65
67
|
Directions,
|
|
66
68
|
State,
|
|
@@ -2,6 +2,7 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNati
|
|
|
2
2
|
import type {
|
|
3
3
|
Int32,
|
|
4
4
|
WithDefault,
|
|
5
|
+
Float,
|
|
5
6
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
7
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
7
8
|
|
|
@@ -13,6 +14,9 @@ interface NativeProps extends ViewProps {
|
|
|
13
14
|
rippleColor?: ColorValue;
|
|
14
15
|
rippleRadius?: Int32;
|
|
15
16
|
touchSoundDisabled?: WithDefault<boolean, false>;
|
|
17
|
+
borderWidth?: Float;
|
|
18
|
+
borderColor?: ColorValue;
|
|
19
|
+
borderStyle?: WithDefault<string, 'solid'>;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export default codegenNativeComponent<NativeProps>('RNGestureHandlerButton');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Gesture Handlers
|
|
2
|
+
import PanGestureHandler from './handlers/PanGestureHandler';
|
|
3
|
+
import TapGestureHandler from './handlers/TapGestureHandler';
|
|
4
|
+
import LongPressGestureHandler from './handlers/LongPressGestureHandler';
|
|
5
|
+
import PinchGestureHandler from './handlers/PinchGestureHandler';
|
|
6
|
+
import RotationGestureHandler from './handlers/RotationGestureHandler';
|
|
7
|
+
import FlingGestureHandler from './handlers/FlingGestureHandler';
|
|
8
|
+
import NativeViewGestureHandler from './handlers/NativeViewGestureHandler';
|
|
9
|
+
import ManualGestureHandler from './handlers/ManualGestureHandler';
|
|
10
|
+
import HoverGestureHandler from './handlers/HoverGestureHandler';
|
|
11
|
+
|
|
12
|
+
//Hammer Handlers
|
|
13
|
+
import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler';
|
|
14
|
+
import HammerPanGestureHandler from '../web_hammer/PanGestureHandler';
|
|
15
|
+
import HammerTapGestureHandler from '../web_hammer/TapGestureHandler';
|
|
16
|
+
import HammerLongPressGestureHandler from '../web_hammer/LongPressGestureHandler';
|
|
17
|
+
import HammerPinchGestureHandler from '../web_hammer/PinchGestureHandler';
|
|
18
|
+
import HammerRotationGestureHandler from '../web_hammer/RotationGestureHandler';
|
|
19
|
+
import HammerFlingGestureHandler from '../web_hammer/FlingGestureHandler';
|
|
20
|
+
|
|
21
|
+
export const Gestures = {
|
|
22
|
+
NativeViewGestureHandler,
|
|
23
|
+
PanGestureHandler,
|
|
24
|
+
TapGestureHandler,
|
|
25
|
+
LongPressGestureHandler,
|
|
26
|
+
PinchGestureHandler,
|
|
27
|
+
RotationGestureHandler,
|
|
28
|
+
FlingGestureHandler,
|
|
29
|
+
ManualGestureHandler,
|
|
30
|
+
HoverGestureHandler,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const HammerGestures = {
|
|
34
|
+
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
|
35
|
+
PanGestureHandler: HammerPanGestureHandler,
|
|
36
|
+
TapGestureHandler: HammerTapGestureHandler,
|
|
37
|
+
LongPressGestureHandler: HammerLongPressGestureHandler,
|
|
38
|
+
PinchGestureHandler: HammerPinchGestureHandler,
|
|
39
|
+
RotationGestureHandler: HammerRotationGestureHandler,
|
|
40
|
+
FlingGestureHandler: HammerFlingGestureHandler,
|
|
41
|
+
};
|
package/src/web/constants.ts
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { State } from '../../State';
|
|
2
|
-
import {
|
|
2
|
+
import { DiagonalDirections, Directions } from '../../Directions';
|
|
3
3
|
import { AdaptedEvent, Config } from '../interfaces';
|
|
4
4
|
|
|
5
5
|
import GestureHandler from './GestureHandler';
|
|
6
|
+
import Vector from '../tools/Vector';
|
|
7
|
+
import { coneToDeviation } from '../utils';
|
|
6
8
|
|
|
7
9
|
const DEFAULT_MAX_DURATION_MS = 800;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
+
const DEFAULT_MIN_VELOCITY = 700;
|
|
11
|
+
const DEFAULT_ALIGNMENT_CONE = 30;
|
|
12
|
+
const DEFAULT_DIRECTION = Directions.RIGHT;
|
|
10
13
|
const DEFAULT_NUMBER_OF_TOUCHES_REQUIRED = 1;
|
|
11
14
|
|
|
15
|
+
const AXIAL_DEVIATION_COSINE = coneToDeviation(DEFAULT_ALIGNMENT_CONE);
|
|
16
|
+
const DIAGONAL_DEVIATION_COSINE = coneToDeviation(90 - DEFAULT_ALIGNMENT_CONE);
|
|
17
|
+
|
|
12
18
|
export default class FlingGestureHandler extends GestureHandler {
|
|
13
19
|
private numberOfPointersRequired = DEFAULT_NUMBER_OF_TOUCHES_REQUIRED;
|
|
14
|
-
private direction = DEFAULT_DIRECTION;
|
|
20
|
+
private direction: Directions = DEFAULT_DIRECTION;
|
|
15
21
|
|
|
16
22
|
private maxDurationMs = DEFAULT_MAX_DURATION_MS;
|
|
17
|
-
private
|
|
23
|
+
private minVelocity = DEFAULT_MIN_VELOCITY;
|
|
18
24
|
private delayTimeout!: number;
|
|
19
25
|
|
|
20
|
-
private startX = 0;
|
|
21
|
-
private startY = 0;
|
|
22
|
-
|
|
23
26
|
private maxNumberOfPointersSimultaneously = 0;
|
|
24
27
|
private keyPointer = NaN;
|
|
25
28
|
|
|
@@ -40,9 +43,6 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
private startFling(): void {
|
|
43
|
-
this.startX = this.tracker.getLastX(this.keyPointer);
|
|
44
|
-
this.startY = this.tracker.getLastY(this.keyPointer);
|
|
45
|
-
|
|
46
46
|
this.begin();
|
|
47
47
|
|
|
48
48
|
this.maxNumberOfPointersSimultaneously = 1;
|
|
@@ -51,21 +51,43 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
private tryEndFling(): boolean {
|
|
54
|
+
const velocityVector = Vector.fromVelocity(this.tracker, this.keyPointer);
|
|
55
|
+
|
|
56
|
+
const getAlignment = (
|
|
57
|
+
direction: Directions | DiagonalDirections,
|
|
58
|
+
minimalAlignmentCosine: number
|
|
59
|
+
) => {
|
|
60
|
+
return (
|
|
61
|
+
(direction & this.direction) === direction &&
|
|
62
|
+
velocityVector.isSimilar(
|
|
63
|
+
Vector.fromDirection(direction),
|
|
64
|
+
minimalAlignmentCosine
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const axialDirectionsList = Object.values(Directions);
|
|
70
|
+
const diagonalDirectionsList = Object.values(DiagonalDirections);
|
|
71
|
+
|
|
72
|
+
// list of alignments to all activated directions
|
|
73
|
+
const axialAlignmentList = axialDirectionsList.map((direction) =>
|
|
74
|
+
getAlignment(direction, AXIAL_DEVIATION_COSINE)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const diagonalAlignmentList = diagonalDirectionsList.map((direction) =>
|
|
78
|
+
getAlignment(direction, DIAGONAL_DEVIATION_COSINE)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const isAligned =
|
|
82
|
+
axialAlignmentList.some(Boolean) || diagonalAlignmentList.some(Boolean);
|
|
83
|
+
|
|
84
|
+
const isFast = velocityVector.magnitude > this.minVelocity;
|
|
85
|
+
|
|
54
86
|
if (
|
|
55
87
|
this.maxNumberOfPointersSimultaneously ===
|
|
56
88
|
this.numberOfPointersRequired &&
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.minAcceptableDelta) ||
|
|
60
|
-
(this.direction & Direction.LEFT &&
|
|
61
|
-
this.startX - this.tracker.getLastX(this.keyPointer) >
|
|
62
|
-
this.minAcceptableDelta) ||
|
|
63
|
-
(this.direction & Direction.UP &&
|
|
64
|
-
this.startY - this.tracker.getLastY(this.keyPointer) >
|
|
65
|
-
this.minAcceptableDelta) ||
|
|
66
|
-
(this.direction & Direction.DOWN &&
|
|
67
|
-
this.tracker.getLastY(this.keyPointer) - this.startY >
|
|
68
|
-
this.minAcceptableDelta))
|
|
89
|
+
isAligned &&
|
|
90
|
+
isFast
|
|
69
91
|
) {
|
|
70
92
|
clearTimeout(this.delayTimeout);
|
|
71
93
|
this.activate();
|
|
@@ -120,7 +142,7 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
120
142
|
}
|
|
121
143
|
}
|
|
122
144
|
|
|
123
|
-
|
|
145
|
+
private pointerMoveAction(event: AdaptedEvent): void {
|
|
124
146
|
this.tracker.track(event);
|
|
125
147
|
|
|
126
148
|
if (this.currentState !== State.BEGAN) {
|
|
@@ -128,10 +150,18 @@ export default class FlingGestureHandler extends GestureHandler {
|
|
|
128
150
|
}
|
|
129
151
|
|
|
130
152
|
this.tryEndFling();
|
|
153
|
+
}
|
|
131
154
|
|
|
155
|
+
protected onPointerMove(event: AdaptedEvent): void {
|
|
156
|
+
this.pointerMoveAction(event);
|
|
132
157
|
super.onPointerMove(event);
|
|
133
158
|
}
|
|
134
159
|
|
|
160
|
+
protected onPointerOutOfBounds(event: AdaptedEvent): void {
|
|
161
|
+
this.pointerMoveAction(event);
|
|
162
|
+
super.onPointerOutOfBounds(event);
|
|
163
|
+
}
|
|
164
|
+
|
|
135
165
|
protected onPointerUp(event: AdaptedEvent): void {
|
|
136
166
|
super.onPointerUp(event);
|
|
137
167
|
this.onUp(event);
|
|
@@ -9,16 +9,17 @@ import {
|
|
|
9
9
|
ResultTouchEvent,
|
|
10
10
|
TouchEventType,
|
|
11
11
|
EventTypes,
|
|
12
|
-
MouseButton,
|
|
13
12
|
} from '../interfaces';
|
|
14
13
|
import EventManager from '../tools/EventManager';
|
|
15
14
|
import GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';
|
|
16
15
|
import InteractionManager from '../tools/InteractionManager';
|
|
17
16
|
import PointerTracker, { TrackerElement } from '../tools/PointerTracker';
|
|
18
17
|
import { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';
|
|
18
|
+
import IGestureHandler from './IGestureHandler';
|
|
19
|
+
import { MouseButton } from '../../handlers/gestureHandlerCommon';
|
|
19
20
|
import { PointerType } from '../../PointerType';
|
|
20
21
|
|
|
21
|
-
export default abstract class GestureHandler {
|
|
22
|
+
export default abstract class GestureHandler implements IGestureHandler {
|
|
22
23
|
private lastSentState: State | null = null;
|
|
23
24
|
protected currentState: State = State.UNDETERMINED;
|
|
24
25
|
|
|
@@ -40,9 +41,11 @@ export default abstract class GestureHandler {
|
|
|
40
41
|
protected shouldResetProgress = false;
|
|
41
42
|
protected pointerType: PointerType = PointerType.MOUSE;
|
|
42
43
|
|
|
43
|
-
protected delegate: GestureHandlerDelegate<unknown>;
|
|
44
|
+
protected delegate: GestureHandlerDelegate<unknown, IGestureHandler>;
|
|
44
45
|
|
|
45
|
-
public constructor(
|
|
46
|
+
public constructor(
|
|
47
|
+
delegate: GestureHandlerDelegate<unknown, IGestureHandler>
|
|
48
|
+
) {
|
|
46
49
|
this.delegate = delegate;
|
|
47
50
|
}
|
|
48
51
|
|
|
@@ -71,7 +74,8 @@ export default abstract class GestureHandler {
|
|
|
71
74
|
manager.setOnPointerOutOfBounds(this.onPointerOutOfBounds.bind(this));
|
|
72
75
|
manager.setOnPointerMoveOver(this.onPointerMoveOver.bind(this));
|
|
73
76
|
manager.setOnPointerMoveOut(this.onPointerMoveOut.bind(this));
|
|
74
|
-
|
|
77
|
+
|
|
78
|
+
manager.registerListeners();
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
//
|
|
@@ -229,7 +233,7 @@ export default abstract class GestureHandler {
|
|
|
229
233
|
this.activationIndex = value;
|
|
230
234
|
}
|
|
231
235
|
|
|
232
|
-
public shouldWaitForHandlerFailure(handler:
|
|
236
|
+
public shouldWaitForHandlerFailure(handler: IGestureHandler): boolean {
|
|
233
237
|
if (handler === this) {
|
|
234
238
|
return false;
|
|
235
239
|
}
|
|
@@ -240,7 +244,7 @@ export default abstract class GestureHandler {
|
|
|
240
244
|
);
|
|
241
245
|
}
|
|
242
246
|
|
|
243
|
-
public shouldRequireToWaitForFailure(handler:
|
|
247
|
+
public shouldRequireToWaitForFailure(handler: IGestureHandler): boolean {
|
|
244
248
|
if (handler === this) {
|
|
245
249
|
return false;
|
|
246
250
|
}
|
|
@@ -251,7 +255,7 @@ export default abstract class GestureHandler {
|
|
|
251
255
|
);
|
|
252
256
|
}
|
|
253
257
|
|
|
254
|
-
public shouldRecognizeSimultaneously(handler:
|
|
258
|
+
public shouldRecognizeSimultaneously(handler: IGestureHandler): boolean {
|
|
255
259
|
if (handler === this) {
|
|
256
260
|
return true;
|
|
257
261
|
}
|
|
@@ -262,7 +266,7 @@ export default abstract class GestureHandler {
|
|
|
262
266
|
);
|
|
263
267
|
}
|
|
264
268
|
|
|
265
|
-
public shouldBeCancelledByOther(handler:
|
|
269
|
+
public shouldBeCancelledByOther(handler: IGestureHandler): boolean {
|
|
266
270
|
if (handler === this) {
|
|
267
271
|
return false;
|
|
268
272
|
}
|
|
@@ -772,7 +776,7 @@ export default abstract class GestureHandler {
|
|
|
772
776
|
return this.config;
|
|
773
777
|
}
|
|
774
778
|
|
|
775
|
-
public getDelegate(): GestureHandlerDelegate<unknown> {
|
|
779
|
+
public getDelegate(): GestureHandlerDelegate<unknown, IGestureHandler> {
|
|
776
780
|
return this.delegate;
|
|
777
781
|
}
|
|
778
782
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PointerType } from '../../PointerType';
|
|
2
|
+
import type { MouseButton } from '../../handlers/gestureHandlerCommon';
|
|
3
|
+
import type { State } from '../../State';
|
|
4
|
+
import type { Config } from '../interfaces';
|
|
5
|
+
import type EventManager from '../tools/EventManager';
|
|
6
|
+
import type { GestureHandlerDelegate } from '../tools/GestureHandlerDelegate';
|
|
7
|
+
import type PointerTracker from '../tools/PointerTracker';
|
|
8
|
+
|
|
9
|
+
export default interface IGestureHandler {
|
|
10
|
+
getTag: () => number;
|
|
11
|
+
getState: () => State;
|
|
12
|
+
getConfig: () => Config;
|
|
13
|
+
getDelegate: () => GestureHandlerDelegate<unknown, this>;
|
|
14
|
+
|
|
15
|
+
attachEventManager: (manager: EventManager<unknown>) => void;
|
|
16
|
+
|
|
17
|
+
isButtonInConfig: (
|
|
18
|
+
mouseButton: MouseButton | undefined
|
|
19
|
+
) => boolean | number | undefined;
|
|
20
|
+
getPointerType: () => PointerType;
|
|
21
|
+
|
|
22
|
+
getTracker: () => PointerTracker;
|
|
23
|
+
getTrackedPointersID: () => number[];
|
|
24
|
+
|
|
25
|
+
begin: () => void;
|
|
26
|
+
activate: () => void;
|
|
27
|
+
end: () => void;
|
|
28
|
+
fail: () => void;
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
|
|
31
|
+
reset: () => void;
|
|
32
|
+
isEnabled: () => boolean;
|
|
33
|
+
isActive: () => boolean;
|
|
34
|
+
setActive: (value: boolean) => void;
|
|
35
|
+
isAwaiting: () => boolean;
|
|
36
|
+
setAwaiting: (value: boolean) => void;
|
|
37
|
+
setActivationIndex: (value: number) => void;
|
|
38
|
+
setShouldResetProgress: (value: boolean) => void;
|
|
39
|
+
|
|
40
|
+
shouldWaitForHandlerFailure: (handler: IGestureHandler) => boolean;
|
|
41
|
+
shouldRequireToWaitForFailure: (handler: IGestureHandler) => boolean;
|
|
42
|
+
shouldRecognizeSimultaneously: (handler: IGestureHandler) => boolean;
|
|
43
|
+
shouldBeCancelledByOther: (handler: IGestureHandler) => boolean;
|
|
44
|
+
|
|
45
|
+
sendEvent: (newState: State, oldState: State) => void;
|
|
46
|
+
|
|
47
|
+
updateGestureConfig: (config: Config) => void;
|
|
48
|
+
|
|
49
|
+
isButton?: () => boolean;
|
|
50
|
+
}
|
|
@@ -28,15 +28,10 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
|
28
28
|
const view = this.delegate.getView() as HTMLElement;
|
|
29
29
|
|
|
30
30
|
view.style['touchAction'] = 'auto';
|
|
31
|
-
|
|
32
31
|
//@ts-ignore Turns on defualt touch behavior on Safari
|
|
33
32
|
view.style['WebkitTouchCallout'] = 'auto';
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
this.buttonRole = true;
|
|
37
|
-
} else {
|
|
38
|
-
this.buttonRole = false;
|
|
39
|
-
}
|
|
34
|
+
this.buttonRole = view.getAttribute('role') === 'button';
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
public updateGestureConfig({ enabled = true, ...props }: Config): void {
|
|
@@ -164,4 +159,8 @@ export default class NativeViewGestureHandler extends GestureHandler {
|
|
|
164
159
|
public disallowsInterruption(): boolean {
|
|
165
160
|
return this.disallowInterruption;
|
|
166
161
|
}
|
|
162
|
+
|
|
163
|
+
public isButton(): boolean {
|
|
164
|
+
return this.buttonRole;
|
|
165
|
+
}
|
|
167
166
|
}
|
package/src/web/interfaces.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
UserSelect,
|
|
3
|
+
ActiveCursor,
|
|
4
|
+
MouseButton,
|
|
5
|
+
TouchAction,
|
|
6
|
+
} from '../handlers/gestureHandlerCommon';
|
|
2
7
|
import { Directions } from '../Directions';
|
|
3
8
|
import { State } from '../State';
|
|
4
9
|
import { PointerType } from '../PointerType';
|
|
@@ -23,6 +28,7 @@ type ConfigArgs =
|
|
|
23
28
|
| boolean
|
|
24
29
|
| HitSlop
|
|
25
30
|
| UserSelect
|
|
31
|
+
| TouchAction
|
|
26
32
|
| ActiveCursor
|
|
27
33
|
| Directions
|
|
28
34
|
| Handler[]
|
|
@@ -40,6 +46,7 @@ export interface Config extends Record<string, ConfigArgs> {
|
|
|
40
46
|
activeCursor?: ActiveCursor;
|
|
41
47
|
mouseButton?: MouseButton;
|
|
42
48
|
enableContextMenu?: boolean;
|
|
49
|
+
touchAction?: TouchAction;
|
|
43
50
|
|
|
44
51
|
activateAfterLongPress?: number;
|
|
45
52
|
failOffsetXStart?: number;
|
|
@@ -83,6 +90,11 @@ interface NativeEvent extends Record<string, NativeEventArgs> {
|
|
|
83
90
|
pointerType: PointerType;
|
|
84
91
|
}
|
|
85
92
|
|
|
93
|
+
export interface Point {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
86
98
|
export interface PointerData {
|
|
87
99
|
id: number;
|
|
88
100
|
x: number;
|
|
@@ -133,15 +145,6 @@ export interface AdaptedEvent {
|
|
|
133
145
|
touchEventType?: TouchEventType;
|
|
134
146
|
}
|
|
135
147
|
|
|
136
|
-
export enum MouseButton {
|
|
137
|
-
LEFT = 1,
|
|
138
|
-
RIGHT = 2,
|
|
139
|
-
MIDDLE = 4,
|
|
140
|
-
BUTTON_4 = 8,
|
|
141
|
-
BUTTON_5 = 16,
|
|
142
|
-
ALL = 31,
|
|
143
|
-
}
|
|
144
|
-
|
|
145
148
|
export enum EventTypes {
|
|
146
149
|
DOWN,
|
|
147
150
|
ADDITIONAL_POINTER_DOWN,
|