@predy-js/render-interface 0.3.4-beta.16 → 0.3.4-beta.18
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/dist/index.js +2 -705
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -700
- package/dist/index.mjs.map +1 -1
- package/dist/src/module.d.ts +0 -2
- package/dist/statistic.js +1 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/types/index.ts +0 -1
- package/dist/src/render/EventSystem.d.ts +0 -22
- package/dist/src/render/event/H5Handler.d.ts +0 -15
- package/dist/src/render/event/RNHandler.d.ts +0 -10
- package/dist/src/render/event/UniversalRecognizer.d.ts +0 -52
- package/dist/src/render/event/WebHandler.d.ts +0 -16
- package/dist/types/EventSystem.d.ts +0 -133
- package/types/EventSystem.ts +0 -226
package/dist/src/module.d.ts
CHANGED
@@ -2,7 +2,6 @@ export * from '../types/constants';
|
|
2
2
|
export * from '../types/RenderPass';
|
3
3
|
export * from '../types/Texture';
|
4
4
|
export * from '../types/GPUBuffer';
|
5
|
-
export * from '../types/EventSystem';
|
6
5
|
export { constants } from './webgl/constants';
|
7
6
|
export * from '../types/ShaderLibrary';
|
8
7
|
export { MarsRenderFrame as RenderFrame } from './render/MarsRenderFrame';
|
@@ -16,5 +15,4 @@ export { MarsMaterialDataBlock as MaterialDataBlock } from './render/MarsMateria
|
|
16
15
|
export { MarsSharedGeometry as SharedGeometry } from './render/MarsSharedGeometry';
|
17
16
|
export { getDefaultGPUCapability } from './render/MarsGPUCapability';
|
18
17
|
export { getDefaultTextureFactory, setDefaultTextureFactory, MarsTextureFactory } from './render/MarsTextureFactory';
|
19
|
-
export { PredyEventSystem as EventSystem } from './render/EventSystem';
|
20
18
|
export declare const ModuleMsg = "RI Package: @predy-js/render-interface";
|
package/dist/statistic.js
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -14,7 +14,6 @@ export * from './Mesh';
|
|
14
14
|
export * from './Geometry';
|
15
15
|
export * from './ShaderLibrary';
|
16
16
|
export { GPURenderer as Renderer } from './Renderer';
|
17
|
-
export * from './EventSystem';
|
18
17
|
export * from './type';
|
19
18
|
export declare function getDefaultTextureFactory(): TextureFactory;
|
20
19
|
export declare function setDefaultTextureFactory(factory: TextureFactory): void;
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
@@ -16,7 +16,6 @@ export * from './Mesh';
|
|
16
16
|
export * from './Geometry';
|
17
17
|
export * from './ShaderLibrary';
|
18
18
|
export { GPURenderer as Renderer } from './Renderer';
|
19
|
-
export * from './EventSystem';
|
20
19
|
export * from './type';
|
21
20
|
|
22
21
|
export declare function getDefaultTextureFactory (): TextureFactory;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import type { PredyTouchEventArg, PredyRecognizer, UniversalRecognizerOptions } from 'types';
|
2
|
-
import { type EventSystem } from 'types';
|
3
|
-
import { EventSystemEnv } from 'types';
|
4
|
-
import type { Canvas } from 'types/Canvas';
|
5
|
-
export declare class PredyEventSystem implements EventSystem {
|
6
|
-
readonly target: HTMLCanvasElement | Canvas;
|
7
|
-
private _handlerMap;
|
8
|
-
private _platformHandler;
|
9
|
-
private _enabled;
|
10
|
-
private recognizer;
|
11
|
-
constructor(target: HTMLCanvasElement | Canvas, env: EventSystemEnv);
|
12
|
-
get enabled(): boolean;
|
13
|
-
set enabled(value: boolean);
|
14
|
-
private createPlatformHandler;
|
15
|
-
setRecognizer(recognizer: PredyRecognizer): void;
|
16
|
-
setUniversalRecognizer(options: UniversalRecognizerOptions): void;
|
17
|
-
handleBaseEvent(event: PredyTouchEventArg): void;
|
18
|
-
dispatch(type: string, event: PredyTouchEventArg): void;
|
19
|
-
addEventListener(type: string, handler: (e: PredyTouchEventArg) => void): () => void;
|
20
|
-
removeEventListener(type: string, handler: (e: PredyTouchEventArg) => void): void;
|
21
|
-
destroy(): void;
|
22
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { EventSystem, IEventPlatformHandler, PredyTouch } from 'types';
|
2
|
-
export declare class H5Handler implements IEventPlatformHandler {
|
3
|
-
readonly system: EventSystem;
|
4
|
-
private readonly timeOrigin;
|
5
|
-
constructor(system: EventSystem);
|
6
|
-
get timeStamp(): number;
|
7
|
-
setup(): void;
|
8
|
-
teardown(): void;
|
9
|
-
private getNormalizedPos;
|
10
|
-
private handleTouch;
|
11
|
-
encapsulate(list: TouchList): PredyTouch[];
|
12
|
-
handleStart: (e: TouchEvent) => void;
|
13
|
-
handleMove: (e: TouchEvent) => void;
|
14
|
-
handleEnd: (e: TouchEvent) => void;
|
15
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { EventSystem, IEventPlatformHandler } from 'types';
|
2
|
-
export declare class RNHandler implements IEventPlatformHandler {
|
3
|
-
readonly system: EventSystem;
|
4
|
-
private readonly timeOrigin;
|
5
|
-
constructor(system: EventSystem);
|
6
|
-
get timeStamp(): number;
|
7
|
-
setup(): void;
|
8
|
-
teardown(): void;
|
9
|
-
private handleTouch;
|
10
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import type { PredyRecognizer, UniversalRecognizerOptions, PredyTouchEventArg } from 'types';
|
2
|
-
import { RecognizerState } from 'types';
|
3
|
-
export declare class UniversalRecognizer implements PredyRecognizer {
|
4
|
-
readonly options: UniversalRecognizerOptions;
|
5
|
-
private _state;
|
6
|
-
private trackedTouches;
|
7
|
-
private gestureStartTime;
|
8
|
-
private startPositions;
|
9
|
-
private lastEventTs;
|
10
|
-
_callback?: (type: string, event: PredyTouchEventArg) => void;
|
11
|
-
private initialCenter;
|
12
|
-
get state(): RecognizerState;
|
13
|
-
constructor(options: UniversalRecognizerOptions);
|
14
|
-
detect(event: PredyTouchEventArg): string | undefined;
|
15
|
-
trigger(event: PredyTouchEventArg): void;
|
16
|
-
private handleStart;
|
17
|
-
private handleMove;
|
18
|
-
private handleEnd;
|
19
|
-
/**
|
20
|
-
* 手势识别核心算法
|
21
|
-
*/
|
22
|
-
private validateTouchCount;
|
23
|
-
private validateDuration;
|
24
|
-
private validateDistance;
|
25
|
-
private validateDirection;
|
26
|
-
private validateThreshold;
|
27
|
-
private calculateOverallDelta;
|
28
|
-
/**
|
29
|
-
* 计算聚合缩放比例(基于各触点到中心点的距离变化)
|
30
|
-
*/
|
31
|
-
private calculateScale;
|
32
|
-
/**
|
33
|
-
* 计算聚合旋转角度(基于各触点相对于中心点的角度变化)
|
34
|
-
*/
|
35
|
-
private calculateRotation;
|
36
|
-
private calculateCenter;
|
37
|
-
private getGestureName;
|
38
|
-
private handleFailure;
|
39
|
-
/**
|
40
|
-
* 重置所有状态
|
41
|
-
*/
|
42
|
-
reset(): void;
|
43
|
-
private setState;
|
44
|
-
/**
|
45
|
-
* 验证选项合规性,抛出详细错误信息
|
46
|
-
*/
|
47
|
-
private validateOptions;
|
48
|
-
/**
|
49
|
-
* 通用区间验证工具
|
50
|
-
*/
|
51
|
-
private validateRange;
|
52
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { type IEventPlatformHandler, type EventSystem, type PredyTouch } from 'types';
|
2
|
-
export declare class WebHandler implements IEventPlatformHandler {
|
3
|
-
readonly system: EventSystem;
|
4
|
-
private readonly timeOrigin;
|
5
|
-
private isPointerDown;
|
6
|
-
pointers: Map<number, PredyTouch>;
|
7
|
-
constructor(system: EventSystem);
|
8
|
-
get timeStamp(): number;
|
9
|
-
setup(): void;
|
10
|
-
teardown(): void;
|
11
|
-
private getNormalizedPos;
|
12
|
-
private handleEvent;
|
13
|
-
handleStart: (e: PointerEvent) => void;
|
14
|
-
handleMove: (e: PointerEvent) => void;
|
15
|
-
handleEnd: (e: PointerEvent) => void;
|
16
|
-
}
|
@@ -1,133 +0,0 @@
|
|
1
|
-
import type { Canvas } from './Canvas';
|
2
|
-
import type { vec2 } from './type';
|
3
|
-
export declare enum EventSystemEnv {
|
4
|
-
web = 0,
|
5
|
-
h5 = 1,
|
6
|
-
rn = 2,
|
7
|
-
ios = 3,
|
8
|
-
android = 4,
|
9
|
-
harmony = 5
|
10
|
-
}
|
11
|
-
export declare enum RecognizerState {
|
12
|
-
UNDETERMINED = 0,
|
13
|
-
FAILED = 1,
|
14
|
-
BEGAN = 2,
|
15
|
-
CANCELLED = 3,
|
16
|
-
ACTIVE = 4,
|
17
|
-
END = 5
|
18
|
-
}
|
19
|
-
export declare const EVENT_TYPE_CLICK = "click";
|
20
|
-
export declare const EVENT_TYPE_TOUCH_START = "touchstart";
|
21
|
-
export declare const EVENT_TYPE_TOUCH_MOVE = "touchmove";
|
22
|
-
export declare const EVENT_TYPE_TOUCH_END = "touchend";
|
23
|
-
export declare const EVENT_TYPE_TOUCH_CANCEL = "touchcancel";
|
24
|
-
export declare enum PredyNativeEventType {
|
25
|
-
touchstart = 1,
|
26
|
-
touchmove = 2,
|
27
|
-
touchend = 3
|
28
|
-
}
|
29
|
-
export type BASE_EVENT_TYPE = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
|
30
|
-
export type PredyTouch = {
|
31
|
-
id: number;
|
32
|
-
x: number;
|
33
|
-
y: number;
|
34
|
-
ts: number;
|
35
|
-
layout: {
|
36
|
-
width: number;
|
37
|
-
height: number;
|
38
|
-
};
|
39
|
-
};
|
40
|
-
export type PredyTouchEventArg = {
|
41
|
-
type: BASE_EVENT_TYPE;
|
42
|
-
timestamp: number;
|
43
|
-
touches: Array<PredyTouch>;
|
44
|
-
changedTouches?: Array<PredyTouch>;
|
45
|
-
velocity?: vec2;
|
46
|
-
preventDefault: Function;
|
47
|
-
stopPropagation: Function;
|
48
|
-
nativeEvent?: any;
|
49
|
-
};
|
50
|
-
export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
|
51
|
-
/**
|
52
|
-
* 平台接口
|
53
|
-
* 封装不同平台的 touch 事件并包装成 PredyTouchEventArg,通过 handleBaseEvent 将封装好的事件传递给 Recognizer 进行手势识别
|
54
|
-
*/
|
55
|
-
export interface IEventPlatformHandler {
|
56
|
-
readonly system: EventSystem;
|
57
|
-
setup(): void;
|
58
|
-
teardown(): void;
|
59
|
-
}
|
60
|
-
/**
|
61
|
-
* 手势识别器
|
62
|
-
* 传入基础 touch 事件,返回检测结果
|
63
|
-
* 可自定义
|
64
|
-
*/
|
65
|
-
export interface PredyRecognizer {
|
66
|
-
_callback?: (type: string, event: PredyTouchEventArg) => void;
|
67
|
-
detect(event: PredyTouchEventArg): string | undefined;
|
68
|
-
reset(): void;
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* 事件系统
|
72
|
-
*/
|
73
|
-
export declare class EventSystem {
|
74
|
-
readonly target: HTMLCanvasElement | Canvas;
|
75
|
-
enabled: boolean;
|
76
|
-
constructor(target: HTMLCanvasElement | Canvas, env: EventSystemEnv);
|
77
|
-
/**
|
78
|
-
* 设置自定义手势识别器
|
79
|
-
* 如不设置则只能监听基础的 touch 事件
|
80
|
-
*/
|
81
|
-
setRecognizer: (recognizer: PredyRecognizer) => void;
|
82
|
-
/**
|
83
|
-
* 设置 Predy 提供的通用手势识别器
|
84
|
-
*/
|
85
|
-
setUniversalRecognizer: (options: UniversalRecognizerOptions) => void;
|
86
|
-
/**
|
87
|
-
* 处理基础手势,只能在平台接口中调用
|
88
|
-
*/
|
89
|
-
handleBaseEvent: (event: PredyTouchEventArg) => void;
|
90
|
-
/**
|
91
|
-
* 事件分发
|
92
|
-
*/
|
93
|
-
dispatch: (type: string, e: PredyTouchEventArg) => void;
|
94
|
-
/**
|
95
|
-
* 添加事件监听
|
96
|
-
*/
|
97
|
-
addEventListener: (type: string, handler: EventHandlerFunction) => void;
|
98
|
-
/**
|
99
|
-
* 移除事件监听
|
100
|
-
*/
|
101
|
-
removeEventListener: (type: string, handler: EventHandlerFunction) => void;
|
102
|
-
/**
|
103
|
-
* 销毁
|
104
|
-
*/
|
105
|
-
destroy: () => void;
|
106
|
-
}
|
107
|
-
export declare enum GESTURE_DIRECTION {
|
108
|
-
NONE = 0,
|
109
|
-
ANY = 1,
|
110
|
-
UP = 2,
|
111
|
-
DOWN = 3,
|
112
|
-
LEFT = 4,
|
113
|
-
RIGHT = 5,
|
114
|
-
IN = 6,
|
115
|
-
OUT = 7,
|
116
|
-
CLOCKWISE = 8,
|
117
|
-
COUNTERCLOCKWISE = 9
|
118
|
-
}
|
119
|
-
export interface UniversalRecognizerOptions {
|
120
|
-
name: string;
|
121
|
-
touchCount: number;
|
122
|
-
useTriggerPhase: boolean;
|
123
|
-
direction?: GESTURE_DIRECTION;
|
124
|
-
customPath?: Array<vec2>;
|
125
|
-
tolerance?: number;
|
126
|
-
clickCount?: number;
|
127
|
-
minDuration?: number;
|
128
|
-
maxDuration?: number;
|
129
|
-
minDistance?: number;
|
130
|
-
maxDistance?: number;
|
131
|
-
scaleThreshold?: number;
|
132
|
-
rotationThreshold?: number;
|
133
|
-
}
|
package/types/EventSystem.ts
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
import type { Canvas } from './Canvas';
|
2
|
-
import type { vec2 } from './type';
|
3
|
-
|
4
|
-
export enum EventSystemEnv {
|
5
|
-
web,
|
6
|
-
h5,
|
7
|
-
rn,
|
8
|
-
ios,
|
9
|
-
android,
|
10
|
-
harmony,
|
11
|
-
}
|
12
|
-
export enum RecognizerState {
|
13
|
-
UNDETERMINED,
|
14
|
-
FAILED,
|
15
|
-
BEGAN,
|
16
|
-
CANCELLED,
|
17
|
-
ACTIVE,
|
18
|
-
END,
|
19
|
-
}
|
20
|
-
|
21
|
-
export const EVENT_TYPE_CLICK = 'click';
|
22
|
-
export const EVENT_TYPE_TOUCH_START = 'touchstart';
|
23
|
-
export const EVENT_TYPE_TOUCH_MOVE = 'touchmove';
|
24
|
-
export const EVENT_TYPE_TOUCH_END = 'touchend';
|
25
|
-
export const EVENT_TYPE_TOUCH_CANCEL = 'touchcancel';
|
26
|
-
|
27
|
-
export enum PredyNativeEventType {
|
28
|
-
touchstart = 1,
|
29
|
-
touchmove = 2,
|
30
|
-
touchend = 3,
|
31
|
-
}
|
32
|
-
|
33
|
-
// export type PredyTouchEventArg = {
|
34
|
-
// x: number,
|
35
|
-
// y: number,
|
36
|
-
// vx: number,
|
37
|
-
// vy: number,
|
38
|
-
// ts: number,
|
39
|
-
// dx: number,
|
40
|
-
// dy: number,
|
41
|
-
// width: number,
|
42
|
-
// height: number,
|
43
|
-
// origin?: Event,
|
44
|
-
// };
|
45
|
-
|
46
|
-
export type BASE_EVENT_TYPE = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
|
47
|
-
|
48
|
-
export type PredyTouch = {
|
49
|
-
id: number,
|
50
|
-
x: number, // 物理坐标
|
51
|
-
y: number,
|
52
|
-
ts: number,
|
53
|
-
layout: {
|
54
|
-
width: number,
|
55
|
-
height: number,
|
56
|
-
},
|
57
|
-
};
|
58
|
-
|
59
|
-
export type PredyTouchEventArg = {
|
60
|
-
type: BASE_EVENT_TYPE,
|
61
|
-
timestamp: number,
|
62
|
-
// target: EventTarget | null,
|
63
|
-
touches: Array<PredyTouch>,
|
64
|
-
changedTouches?: Array<PredyTouch>,
|
65
|
-
velocity?: vec2,
|
66
|
-
preventDefault: Function,
|
67
|
-
stopPropagation: Function,
|
68
|
-
nativeEvent?: any,
|
69
|
-
};
|
70
|
-
|
71
|
-
export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
|
72
|
-
|
73
|
-
/**
|
74
|
-
* 平台接口
|
75
|
-
* 封装不同平台的 touch 事件并包装成 PredyTouchEventArg,通过 handleBaseEvent 将封装好的事件传递给 Recognizer 进行手势识别
|
76
|
-
*/
|
77
|
-
export interface IEventPlatformHandler {
|
78
|
-
readonly system: EventSystem,
|
79
|
-
setup (): void,
|
80
|
-
teardown (): void,
|
81
|
-
}
|
82
|
-
|
83
|
-
/**
|
84
|
-
* 手势识别器
|
85
|
-
* 传入基础 touch 事件,返回检测结果
|
86
|
-
* 可自定义
|
87
|
-
*/
|
88
|
-
export interface PredyRecognizer {
|
89
|
-
_callback?: (type: string, event: PredyTouchEventArg) => void,
|
90
|
-
detect(event: PredyTouchEventArg): string | undefined,
|
91
|
-
reset(): void,
|
92
|
-
}
|
93
|
-
|
94
|
-
/**
|
95
|
-
* 事件系统
|
96
|
-
*/
|
97
|
-
export declare class EventSystem {
|
98
|
-
readonly target: HTMLCanvasElement | Canvas;
|
99
|
-
enabled: boolean;
|
100
|
-
constructor (target: HTMLCanvasElement | Canvas, env: EventSystemEnv);
|
101
|
-
|
102
|
-
/**
|
103
|
-
* 设置自定义手势识别器
|
104
|
-
* 如不设置则只能监听基础的 touch 事件
|
105
|
-
*/
|
106
|
-
setRecognizer: (recognizer: PredyRecognizer) => void;
|
107
|
-
|
108
|
-
/**
|
109
|
-
* 设置 Predy 提供的通用手势识别器
|
110
|
-
*/
|
111
|
-
setUniversalRecognizer: (options: UniversalRecognizerOptions) => void;
|
112
|
-
|
113
|
-
/**
|
114
|
-
* 处理基础手势,只能在平台接口中调用
|
115
|
-
*/
|
116
|
-
handleBaseEvent: (event: PredyTouchEventArg) => void;
|
117
|
-
|
118
|
-
/**
|
119
|
-
* 事件分发
|
120
|
-
*/
|
121
|
-
dispatch: (type: string, e: PredyTouchEventArg) => void;
|
122
|
-
|
123
|
-
/**
|
124
|
-
* 添加事件监听
|
125
|
-
*/
|
126
|
-
addEventListener: (type: string, handler: EventHandlerFunction) => void;
|
127
|
-
|
128
|
-
/**
|
129
|
-
* 移除事件监听
|
130
|
-
*/
|
131
|
-
removeEventListener: (type: string, handler: EventHandlerFunction) => void;
|
132
|
-
|
133
|
-
/**
|
134
|
-
* 销毁
|
135
|
-
*/
|
136
|
-
destroy: () => void;
|
137
|
-
}
|
138
|
-
|
139
|
-
// // 扩展事件类型
|
140
|
-
// export enum EVENT_TYPE {
|
141
|
-
// // 基础事件
|
142
|
-
// START = 'start',
|
143
|
-
// MOVE = 'move',
|
144
|
-
// END = 'end',
|
145
|
-
// CANCEL = 'cancel',
|
146
|
-
|
147
|
-
// // 手势事件
|
148
|
-
// PINCH_START = 'pinchstart',
|
149
|
-
// PINCH_MOVE = 'pinchmove',
|
150
|
-
// PINCH_END = 'pinchend',
|
151
|
-
// PINCH = 'pinch',
|
152
|
-
|
153
|
-
// ROTATE_START = 'rotatestart',
|
154
|
-
// ROTATE_MOVE = 'rotatemove',
|
155
|
-
// ROTATE_END = 'rotateend',
|
156
|
-
// ROTATE = 'rotate',
|
157
|
-
|
158
|
-
// PAN_START = 'panstart',
|
159
|
-
// PAN_MOVE = 'panmove',
|
160
|
-
// PAN_END = 'panend',
|
161
|
-
// PAN = 'pan',
|
162
|
-
|
163
|
-
// SWIPE = 'swipe',
|
164
|
-
|
165
|
-
// TAP = 'tap',
|
166
|
-
// }
|
167
|
-
|
168
|
-
// export type PredyGestureEventArg = {
|
169
|
-
// type: EVENT_TYPE,
|
170
|
-
// touches: PredyTouch[], // 当前所有触点
|
171
|
-
// center: vec2, // 手势中心点
|
172
|
-
// scale?: number, // 当前缩放比例(相对于初始)
|
173
|
-
// rotation?: number, // 旋转角度(弧度,相对于初始)
|
174
|
-
// velocityX?: number, // 移动速度
|
175
|
-
// velocityY?: number, // 移动速度
|
176
|
-
// deltaX?: number, // X轴位移
|
177
|
-
// deltaY?: number, // Y轴位移
|
178
|
-
// timestamp: number, // 时间戳
|
179
|
-
// originEvent: Event, // 原始事件
|
180
|
-
// };
|
181
|
-
|
182
|
-
// 方向枚举
|
183
|
-
export enum GESTURE_DIRECTION {
|
184
|
-
NONE, // 无方向(用于点击)
|
185
|
-
ANY, // 任意方向
|
186
|
-
|
187
|
-
// 滑动方向
|
188
|
-
UP,
|
189
|
-
DOWN,
|
190
|
-
LEFT,
|
191
|
-
RIGHT,
|
192
|
-
|
193
|
-
// 缩放方向
|
194
|
-
IN, // 缩小
|
195
|
-
OUT, // 放大
|
196
|
-
|
197
|
-
// 旋转方向
|
198
|
-
CLOCKWISE, // 顺时针
|
199
|
-
COUNTERCLOCKWISE, // 逆时针
|
200
|
-
}
|
201
|
-
|
202
|
-
export interface UniversalRecognizerOptions {
|
203
|
-
// 基础参数
|
204
|
-
name: string,
|
205
|
-
// type: GESTURE_TYPE, // 手势类型
|
206
|
-
touchCount: number, // 触点数
|
207
|
-
useTriggerPhase: boolean, // 是否使用阶段(如果启用则需要监听 name + 后缀 的事件)
|
208
|
-
|
209
|
-
// 方向/路径参数
|
210
|
-
direction?: GESTURE_DIRECTION, // 移动方向(与路径轨迹互斥)
|
211
|
-
customPath?: Array<vec2>, // 自定义轨迹坐标点
|
212
|
-
tolerance?: number, // 匹配容差
|
213
|
-
|
214
|
-
// 点击参数
|
215
|
-
clickCount?: number, // 点击次数(仅当 direction=NONE 时生效)
|
216
|
-
|
217
|
-
// 时间与距离约束
|
218
|
-
minDuration?: number, // 最短持续时间(ms)
|
219
|
-
maxDuration?: number, // 最长持续时间(ms)
|
220
|
-
minDistance?: number, // 最小移动距离(像素)
|
221
|
-
maxDistance?: number, // 最大移动距离(像素)
|
222
|
-
|
223
|
-
// 高级参数
|
224
|
-
scaleThreshold?: number, // 缩放比例变化阈值(仅 PINCH 类型)
|
225
|
-
rotationThreshold?: number, // 最小旋转角度(仅 ROTATE 类型)
|
226
|
-
}
|