@predy-js/render-interface 0.3.4-beta.14 → 0.3.4-beta.16
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 +63 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -66
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/event/RNHandler.d.ts +1 -0
- package/dist/src/render/event/UniversalRecognizer.d.ts +0 -2
- package/dist/statistic.js +1 -1
- package/dist/types/EventSystem.d.ts +11 -6
- package/dist/types/native/GPUBufferInternal.d.ts +1 -0
- package/dist/types/native/PredyNativeInternal.d.ts +2 -0
- package/dist/types/native/index.d.ts +1 -0
- package/dist/types/native/motion.d.ts +20 -0
- package/package.json +1 -1
- package/types/EventSystem.ts +14 -7
- package/types/native/DataBlockInternal.ts +3 -0
- package/types/native/GPUBufferInternal.ts +1 -0
- package/types/native/PredyNativeInternal.ts +4 -0
- package/types/native/index.ts +1 -0
- package/types/native/motion.ts +26 -0
@@ -19,13 +19,11 @@ export declare class UniversalRecognizer implements PredyRecognizer {
|
|
19
19
|
/**
|
20
20
|
* 手势识别核心算法
|
21
21
|
*/
|
22
|
-
private validateGesture;
|
23
22
|
private validateTouchCount;
|
24
23
|
private validateDuration;
|
25
24
|
private validateDistance;
|
26
25
|
private validateDirection;
|
27
26
|
private validateThreshold;
|
28
|
-
private validateFinalConditions;
|
29
27
|
private calculateOverallDelta;
|
30
28
|
/**
|
31
29
|
* 计算聚合缩放比例(基于各触点到中心点的距离变化)
|
package/dist/statistic.js
CHANGED
@@ -21,26 +21,31 @@ export declare const EVENT_TYPE_TOUCH_START = "touchstart";
|
|
21
21
|
export declare const EVENT_TYPE_TOUCH_MOVE = "touchmove";
|
22
22
|
export declare const EVENT_TYPE_TOUCH_END = "touchend";
|
23
23
|
export declare const EVENT_TYPE_TOUCH_CANCEL = "touchcancel";
|
24
|
+
export declare enum PredyNativeEventType {
|
25
|
+
touchstart = 1,
|
26
|
+
touchmove = 2,
|
27
|
+
touchend = 3
|
28
|
+
}
|
24
29
|
export type BASE_EVENT_TYPE = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
|
25
30
|
export type PredyTouch = {
|
26
31
|
id: number;
|
27
32
|
x: number;
|
28
33
|
y: number;
|
29
|
-
clientX: number;
|
30
|
-
clientY: number;
|
31
|
-
force: number;
|
32
34
|
ts: number;
|
35
|
+
layout: {
|
36
|
+
width: number;
|
37
|
+
height: number;
|
38
|
+
};
|
33
39
|
};
|
34
40
|
export type PredyTouchEventArg = {
|
35
41
|
type: BASE_EVENT_TYPE;
|
36
42
|
timestamp: number;
|
37
|
-
target: EventTarget | null;
|
38
43
|
touches: Array<PredyTouch>;
|
39
|
-
changedTouches
|
44
|
+
changedTouches?: Array<PredyTouch>;
|
40
45
|
velocity?: vec2;
|
41
46
|
preventDefault: Function;
|
42
47
|
stopPropagation: Function;
|
43
|
-
nativeEvent
|
48
|
+
nativeEvent?: any;
|
44
49
|
};
|
45
50
|
export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
|
46
51
|
/**
|
@@ -6,6 +6,7 @@ import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
|
6
6
|
import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
|
7
7
|
import type { ResourcePlatform } from './ResourceInternal';
|
8
8
|
import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
|
9
|
+
import type { MotionOrientationManager } from './motion';
|
9
10
|
export interface PredyRequestOptions {
|
10
11
|
url: string;
|
11
12
|
disableCache?: boolean;
|
@@ -94,6 +95,7 @@ export interface PredyNativeInternal {
|
|
94
95
|
* @param codec
|
95
96
|
*/
|
96
97
|
supportVideoCodec(codec: PredyVideoCodec): boolean;
|
98
|
+
createOrientationManager(): MotionOrientationManager;
|
97
99
|
}
|
98
100
|
type renderSDFImageCallback = (img: SDFImage) => void;
|
99
101
|
export {};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { vec4 } from '../type';
|
2
|
+
export interface OrientationData {
|
3
|
+
timestamp: number;
|
4
|
+
orientation: {
|
5
|
+
alpha: number;
|
6
|
+
beta: number;
|
7
|
+
gamma: number;
|
8
|
+
quat: vec4;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
export interface MotionStartOptions {
|
12
|
+
fps?: number;
|
13
|
+
}
|
14
|
+
type MotionStartCallback = (success: boolean, msg: string) => void;
|
15
|
+
export declare abstract class MotionOrientationManager {
|
16
|
+
motionCallback?: (motion: OrientationData) => void;
|
17
|
+
abstract start(options: MotionStartOptions, callback?: MotionStartCallback): void;
|
18
|
+
abstract destroy(): void;
|
19
|
+
}
|
20
|
+
export {};
|
package/package.json
CHANGED
package/types/EventSystem.ts
CHANGED
@@ -24,6 +24,12 @@ export const EVENT_TYPE_TOUCH_MOVE = 'touchmove';
|
|
24
24
|
export const EVENT_TYPE_TOUCH_END = 'touchend';
|
25
25
|
export const EVENT_TYPE_TOUCH_CANCEL = 'touchcancel';
|
26
26
|
|
27
|
+
export enum PredyNativeEventType {
|
28
|
+
touchstart = 1,
|
29
|
+
touchmove = 2,
|
30
|
+
touchend = 3,
|
31
|
+
}
|
32
|
+
|
27
33
|
// export type PredyTouchEventArg = {
|
28
34
|
// x: number,
|
29
35
|
// y: number,
|
@@ -41,24 +47,25 @@ export type BASE_EVENT_TYPE = 'touchstart' | 'touchmove' | 'touchend' | 'touchca
|
|
41
47
|
|
42
48
|
export type PredyTouch = {
|
43
49
|
id: number,
|
44
|
-
x: number,
|
50
|
+
x: number, // 物理坐标
|
45
51
|
y: number,
|
46
|
-
clientX: number, // 物理坐标
|
47
|
-
clientY: number,
|
48
|
-
force: number,
|
49
52
|
ts: number,
|
53
|
+
layout: {
|
54
|
+
width: number,
|
55
|
+
height: number,
|
56
|
+
},
|
50
57
|
};
|
51
58
|
|
52
59
|
export type PredyTouchEventArg = {
|
53
60
|
type: BASE_EVENT_TYPE,
|
54
61
|
timestamp: number,
|
55
|
-
target: EventTarget | null,
|
62
|
+
// target: EventTarget | null,
|
56
63
|
touches: Array<PredyTouch>,
|
57
|
-
changedTouches
|
64
|
+
changedTouches?: Array<PredyTouch>,
|
58
65
|
velocity?: vec2,
|
59
66
|
preventDefault: Function,
|
60
67
|
stopPropagation: Function,
|
61
|
-
nativeEvent
|
68
|
+
nativeEvent?: any,
|
62
69
|
};
|
63
70
|
|
64
71
|
export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
|
@@ -21,6 +21,9 @@ export abstract class DataBlockInternal implements ResourceInternal {
|
|
21
21
|
|
22
22
|
protected constructor (options: DataBlockInternalOptions) {}
|
23
23
|
|
24
|
+
//todo
|
25
|
+
// setUniformValues (uniforms: Record<string, TypedArray>): void;
|
26
|
+
|
24
27
|
abstract destroy (): void;
|
25
28
|
|
26
29
|
/**
|
@@ -6,6 +6,7 @@ import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
|
6
6
|
import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
|
7
7
|
import type { ResourcePlatform } from './ResourceInternal';
|
8
8
|
import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
|
9
|
+
import type { MotionOrientationManager } from './motion';
|
9
10
|
|
10
11
|
export interface PredyRequestOptions {
|
11
12
|
url: string,
|
@@ -110,6 +111,9 @@ export interface PredyNativeInternal {
|
|
110
111
|
* @param codec
|
111
112
|
*/
|
112
113
|
supportVideoCodec(codec: PredyVideoCodec): boolean,
|
114
|
+
|
115
|
+
createOrientationManager(): MotionOrientationManager,
|
116
|
+
|
113
117
|
}
|
114
118
|
|
115
119
|
type renderSDFImageCallback = (img: SDFImage) => void;
|
package/types/native/index.ts
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { vec4 } from '../type';
|
2
|
+
|
3
|
+
export interface OrientationData {
|
4
|
+
timestamp: number,
|
5
|
+
orientation: {
|
6
|
+
alpha: number,
|
7
|
+
beta: number,
|
8
|
+
gamma: number,
|
9
|
+
quat: vec4,
|
10
|
+
},
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface MotionStartOptions {
|
14
|
+
fps?: number,
|
15
|
+
}
|
16
|
+
|
17
|
+
type MotionStartCallback = (success: boolean, msg: string) => void;
|
18
|
+
|
19
|
+
export abstract class MotionOrientationManager {
|
20
|
+
// 设置数据监听的回调
|
21
|
+
motionCallback?: (motion: OrientationData) => void;
|
22
|
+
// start 之后开始监听事件
|
23
|
+
abstract start (options: MotionStartOptions, callback?: MotionStartCallback): void;
|
24
|
+
// 停止并销毁
|
25
|
+
abstract destroy (): void;
|
26
|
+
}
|