assistsx-js 0.0.2010 → 0.0.2011

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/Bounds.d.ts CHANGED
@@ -3,12 +3,26 @@ export declare class Bounds {
3
3
  readonly top: number;
4
4
  readonly right: number;
5
5
  readonly bottom: number;
6
- constructor(left: number, top: number, right: number, bottom: number);
6
+ readonly width: number;
7
+ readonly height: number;
8
+ readonly centerX: number;
9
+ readonly centerY: number;
10
+ readonly exactCenterX: number;
11
+ readonly exactCenterY: number;
12
+ readonly isEmpty: boolean;
13
+ constructor(left: number, top: number, right: number, bottom: number, width: number, height: number, centerX: number, centerY: number, exactCenterX: number, exactCenterY: number, isEmpty: boolean);
7
14
  static from(data: {
8
15
  left: number;
9
16
  top: number;
10
17
  right: number;
11
18
  bottom: number;
19
+ width: number;
20
+ height: number;
21
+ centerX: number;
22
+ centerY: number;
23
+ exactCenterX: number;
24
+ exactCenterY: number;
25
+ isEmpty: boolean;
12
26
  }): Bounds;
13
27
  static fromJSON(json: string): Bounds;
14
28
  static fromData(data: any): Bounds;
@@ -17,6 +31,13 @@ export declare class Bounds {
17
31
  top: number;
18
32
  right: number;
19
33
  bottom: number;
34
+ width: number;
35
+ height: number;
36
+ centerX: number;
37
+ centerY: number;
38
+ exactCenterX: number;
39
+ exactCenterY: number;
40
+ isEmpty: boolean;
20
41
  };
21
42
  clone(): Bounds;
22
43
  }
package/dist/Bounds.js CHANGED
@@ -1,15 +1,22 @@
1
1
  // Bounds 类,对应 Kotlin 的 data class
2
2
  export class Bounds {
3
3
  // 构造函数
4
- constructor(left, top, right, bottom) {
4
+ constructor(left, top, right, bottom, width, height, centerX, centerY, exactCenterX, exactCenterY, isEmpty) {
5
5
  this.left = left;
6
6
  this.top = top;
7
7
  this.right = right;
8
8
  this.bottom = bottom;
9
+ this.width = width;
10
+ this.height = height;
11
+ this.centerX = centerX;
12
+ this.centerY = centerY;
13
+ this.exactCenterX = exactCenterX;
14
+ this.exactCenterY = exactCenterY;
15
+ this.isEmpty = isEmpty;
9
16
  }
10
17
  // 从普通对象创建 Bounds 实例
11
18
  static from(data) {
12
- return new Bounds(data.left, data.top, data.right, data.bottom);
19
+ return new Bounds(data.left, data.top, data.right, data.bottom, data.width, data.height, data.centerX, data.centerY, data.exactCenterX, data.exactCenterY, data.isEmpty);
13
20
  }
14
21
  // 从 JSON 字符串创建实例
15
22
  static fromJSON(json) {
@@ -17,7 +24,7 @@ export class Bounds {
17
24
  return Bounds.from(data);
18
25
  }
19
26
  static fromData(data) {
20
- return new Bounds(data.left, data.top, data.right, data.bottom);
27
+ return new Bounds(data.left, data.top, data.right, data.bottom, data.width, data.height, data.centerX, data.centerY, data.exactCenterX, data.exactCenterY, data.isEmpty);
21
28
  }
22
29
  // 转换为普通对象
23
30
  toJSON() {
@@ -25,11 +32,18 @@ export class Bounds {
25
32
  left: this.left,
26
33
  top: this.top,
27
34
  right: this.right,
28
- bottom: this.bottom
35
+ bottom: this.bottom,
36
+ width: this.width,
37
+ height: this.height,
38
+ centerX: this.centerX,
39
+ centerY: this.centerY,
40
+ exactCenterX: this.exactCenterX,
41
+ exactCenterY: this.exactCenterY,
42
+ isEmpty: this.isEmpty,
29
43
  };
30
44
  }
31
45
  // 克隆方法
32
46
  clone() {
33
- return new Bounds(this.left, this.top, this.right, this.bottom);
47
+ return new Bounds(this.left, this.top, this.right, this.bottom, this.width, this.height, this.centerX, this.centerY, this.exactCenterX, this.exactCenterY, this.isEmpty);
34
48
  }
35
49
  }
package/dist/Node.d.ts CHANGED
@@ -81,6 +81,10 @@ export declare class Node {
81
81
  * 绘制顺序
82
82
  */
83
83
  drawingOrder: number;
84
+ /**
85
+ * 节点在屏幕中的边界
86
+ */
87
+ boundsInScreen: Bounds;
84
88
  /**
85
89
  * 构造函数
86
90
  * @param params 节点参数对象
@@ -105,6 +109,7 @@ export declare class Node {
105
109
  isSelected: boolean;
106
110
  isVisibleToUser: boolean;
107
111
  drawingOrder: number;
112
+ boundsInScreen: Bounds;
108
113
  });
109
114
  get async(): NodeAsync;
110
115
  /**
@@ -296,6 +301,7 @@ export declare class Node {
296
301
  isSelected: boolean;
297
302
  isVisibleToUser: boolean;
298
303
  drawingOrder: number;
304
+ boundsInScreen: Bounds;
299
305
  }): Node;
300
306
  /**
301
307
  * 从JSON数组创建节点数组
package/dist/Node.js CHANGED
@@ -27,6 +27,7 @@ export class Node {
27
27
  this.isSelected = params.isSelected;
28
28
  this.isVisibleToUser = params.isVisibleToUser;
29
29
  this.drawingOrder = params.drawingOrder;
30
+ this.boundsInScreen = params.boundsInScreen;
30
31
  }
31
32
  get async() {
32
33
  return new NodeAsync(this);
@@ -200,6 +200,7 @@ export declare class NodeAsync {
200
200
  isSelected: boolean;
201
201
  isVisibleToUser: boolean;
202
202
  drawingOrder: number;
203
+ boundsInScreen: Bounds;
203
204
  }): Node;
204
205
  /**
205
206
  * 从JSON数组创建节点数组
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2010",
3
+ "version": "0.0.2011",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/Bounds.ts CHANGED
@@ -1,40 +1,114 @@
1
1
  // Bounds 类,对应 Kotlin 的 data class
2
2
  export class Bounds {
3
- // 构造函数
4
- constructor(
5
- public readonly left: number,
6
- public readonly top: number,
7
- public readonly right: number,
8
- public readonly bottom: number
9
- ) { }
3
+ // 构造函数
4
+ constructor(
5
+ public readonly left: number,
6
+ public readonly top: number,
7
+ public readonly right: number,
8
+ public readonly bottom: number,
9
+ public readonly width: number,
10
+ public readonly height: number,
11
+ public readonly centerX: number,
12
+ public readonly centerY: number,
13
+ public readonly exactCenterX: number,
14
+ public readonly exactCenterY: number,
15
+ public readonly isEmpty: boolean
16
+ ) {}
10
17
 
11
- // 从普通对象创建 Bounds 实例
12
- static from(data: { left: number; top: number; right: number; bottom: number }): Bounds {
13
- return new Bounds(data.left, data.top, data.right, data.bottom);
14
- }
18
+ // 从普通对象创建 Bounds 实例
19
+ static from(data: {
20
+ left: number;
21
+ top: number;
22
+ right: number;
23
+ bottom: number;
24
+ width: number;
25
+ height: number;
26
+ centerX: number;
27
+ centerY: number;
28
+ exactCenterX: number;
29
+ exactCenterY: number;
30
+ isEmpty: boolean;
31
+ }): Bounds {
32
+ return new Bounds(
33
+ data.left,
34
+ data.top,
35
+ data.right,
36
+ data.bottom,
37
+ data.width,
38
+ data.height,
39
+ data.centerX,
40
+ data.centerY,
41
+ data.exactCenterX,
42
+ data.exactCenterY,
43
+ data.isEmpty
44
+ );
45
+ }
15
46
 
16
- // 从 JSON 字符串创建实例
17
- static fromJSON(json: string): Bounds {
18
- const data = JSON.parse(json);
19
- return Bounds.from(data);
20
- }
47
+ // 从 JSON 字符串创建实例
48
+ static fromJSON(json: string): Bounds {
49
+ const data = JSON.parse(json);
50
+ return Bounds.from(data);
51
+ }
21
52
 
22
- static fromData(data: any): Bounds {
23
- return new Bounds(data.left, data.top, data.right, data.bottom);
24
- }
53
+ static fromData(data: any): Bounds {
54
+ return new Bounds(
55
+ data.left,
56
+ data.top,
57
+ data.right,
58
+ data.bottom,
59
+ data.width,
60
+ data.height,
61
+ data.centerX,
62
+ data.centerY,
63
+ data.exactCenterX,
64
+ data.exactCenterY,
65
+ data.isEmpty
66
+ );
67
+ }
25
68
 
26
- // 转换为普通对象
27
- toJSON(): { left: number; top: number; right: number; bottom: number } {
28
- return {
29
- left: this.left,
30
- top: this.top,
31
- right: this.right,
32
- bottom: this.bottom
33
- };
34
- }
69
+ // 转换为普通对象
70
+ toJSON(): {
71
+ left: number;
72
+ top: number;
73
+ right: number;
74
+ bottom: number;
75
+ width: number;
76
+ height: number;
77
+ centerX: number;
78
+ centerY: number;
79
+ exactCenterX: number;
80
+ exactCenterY: number;
81
+ isEmpty: boolean;
82
+ } {
83
+ return {
84
+ left: this.left,
85
+ top: this.top,
86
+ right: this.right,
87
+ bottom: this.bottom,
88
+ width: this.width,
89
+ height: this.height,
90
+ centerX: this.centerX,
91
+ centerY: this.centerY,
92
+ exactCenterX: this.exactCenterX,
93
+ exactCenterY: this.exactCenterY,
94
+ isEmpty: this.isEmpty,
95
+ };
96
+ }
35
97
 
36
- // 克隆方法
37
- clone(): Bounds {
38
- return new Bounds(this.left, this.top, this.right, this.bottom);
39
- }
40
- }
98
+ // 克隆方法
99
+ clone(): Bounds {
100
+ return new Bounds(
101
+ this.left,
102
+ this.top,
103
+ this.right,
104
+ this.bottom,
105
+ this.width,
106
+ this.height,
107
+ this.centerX,
108
+ this.centerY,
109
+ this.exactCenterX,
110
+ this.exactCenterY,
111
+ this.isEmpty
112
+ );
113
+ }
114
+ }
package/src/Node.ts CHANGED
@@ -104,6 +104,11 @@ export class Node {
104
104
  */
105
105
  drawingOrder: number;
106
106
 
107
+ /**
108
+ * 节点在屏幕中的边界
109
+ */
110
+ boundsInScreen: Bounds;
111
+
107
112
  /**
108
113
  * 构造函数
109
114
  * @param params 节点参数对象
@@ -128,6 +133,7 @@ export class Node {
128
133
  isSelected: boolean;
129
134
  isVisibleToUser: boolean;
130
135
  drawingOrder: number;
136
+ boundsInScreen: Bounds;
131
137
  }) {
132
138
  this.nodeId = params.nodeId;
133
139
  this.text = params.text;
@@ -148,6 +154,7 @@ export class Node {
148
154
  this.isSelected = params.isSelected;
149
155
  this.isVisibleToUser = params.isVisibleToUser;
150
156
  this.drawingOrder = params.drawingOrder;
157
+ this.boundsInScreen = params.boundsInScreen;
151
158
  }
152
159
 
153
160
  public get async(): NodeAsync {
@@ -533,6 +540,7 @@ export class Node {
533
540
  isSelected: boolean;
534
541
  isVisibleToUser: boolean;
535
542
  drawingOrder: number;
543
+ boundsInScreen: Bounds;
536
544
  }): Node {
537
545
  return new Node(params);
538
546
  }
package/src/NodeAsync.ts CHANGED
@@ -406,6 +406,7 @@ export class NodeAsync {
406
406
  isSelected: boolean;
407
407
  isVisibleToUser: boolean;
408
408
  drawingOrder: number;
409
+ boundsInScreen: Bounds;
409
410
  }): Node {
410
411
  return new Node(params);
411
412
  }