@predy-js/render-interface 0.3.4-beta.15 → 0.3.4-beta.17

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.
@@ -6,4 +6,5 @@ export declare class RNHandler implements IEventPlatformHandler {
6
6
  get timeStamp(): number;
7
7
  setup(): void;
8
8
  teardown(): void;
9
+ private handleTouch;
9
10
  }
package/dist/statistic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.4-beta.15
5
+ * Version: v0.3.4-beta.17
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -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: Array<PredyTouch>;
44
+ changedTouches?: Array<PredyTouch>;
40
45
  velocity?: vec2;
41
46
  preventDefault: Function;
42
47
  stopPropagation: Function;
43
- nativeEvent: any;
48
+ nativeEvent?: any;
44
49
  };
45
50
  export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
46
51
  /**
@@ -89,7 +94,7 @@ export declare class EventSystem {
89
94
  /**
90
95
  * 添加事件监听
91
96
  */
92
- addEventListener: (type: string, handler: EventHandlerFunction) => void;
97
+ addEventListener: (type: string, handler: EventHandlerFunction) => () => void;
93
98
  /**
94
99
  * 移除事件监听
95
100
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.4-beta.15",
3
+ "version": "0.3.4-beta.17",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -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: Array<PredyTouch>,
64
+ changedTouches?: Array<PredyTouch>,
58
65
  velocity?: vec2,
59
66
  preventDefault: Function,
60
67
  stopPropagation: Function,
61
- nativeEvent: any,
68
+ nativeEvent?: any,
62
69
  };
63
70
 
64
71
  export type EventHandlerFunction = (e: PredyTouchEventArg) => void;
@@ -116,7 +123,7 @@ export declare class EventSystem {
116
123
  /**
117
124
  * 添加事件监听
118
125
  */
119
- addEventListener: (type: string, handler: EventHandlerFunction) => void;
126
+ addEventListener: (type: string, handler: EventHandlerFunction) => () => void;
120
127
 
121
128
  /**
122
129
  * 移除事件监听