@meta2d/core 1.0.15 → 1.0.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.
- package/package.json +1 -1
- package/src/canvas/canvas.d.ts +4 -2
- package/src/canvas/canvas.js +210 -194
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +42 -13
- package/src/core.js +669 -172
- package/src/core.js.map +1 -1
- package/src/diagrams/gif.js +3 -0
- package/src/diagrams/gif.js.map +1 -1
- package/src/dialog/dialog.d.ts +14 -0
- package/src/dialog/dialog.js +77 -0
- package/src/dialog/dialog.js.map +1 -0
- package/src/dialog/index.d.ts +1 -0
- package/src/dialog/index.js +2 -0
- package/src/dialog/index.js.map +1 -0
- package/src/event/event.d.ts +48 -3
- package/src/event/event.js +3 -0
- package/src/event/event.js.map +1 -1
- package/src/options.d.ts +1 -0
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/pen/model.d.ts +4 -1
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +1 -0
- package/src/pen/render.js +18 -6
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +19 -14
- package/src/store/store.js.map +1 -1
- package/src/tooltip/tooltip.js +2 -2
- package/src/tooltip/tooltip.js.map +1 -1
- package/src/utils/index.d.ts +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/index.js.map +1 -1
- package/src/utils/object.d.ts +2 -0
- package/src/utils/object.js +21 -0
- package/src/utils/object.js.map +1 -0
package/src/core.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { Canvas } from './canvas';
|
|
|
3
3
|
import { Options } from './options';
|
|
4
4
|
import { calcTextDrawRect, calcTextLines, calcTextRect, facePen, getWords, LockState, Pen, renderPenRaw, IValue, setElemPosition } from './pen';
|
|
5
5
|
import { Point } from './point';
|
|
6
|
-
import { EditAction, register, registerAnchors, registerCanvasDraw, Meta2dData, Meta2dStore } from './store';
|
|
6
|
+
import { EditAction, register, registerAnchors, registerCanvasDraw, Meta2dData, Meta2dStore, Network } from './store';
|
|
7
7
|
import { Padding } from './utils';
|
|
8
8
|
import { Rect } from './rect';
|
|
9
|
-
import { Event } from './event';
|
|
9
|
+
import { Event, TriggerCondition } from './event';
|
|
10
10
|
import { ViewMap } from './map';
|
|
11
11
|
import { MqttClient } from 'mqtt';
|
|
12
12
|
export declare class Meta2d {
|
|
@@ -16,7 +16,12 @@ export declare class Meta2d {
|
|
|
16
16
|
mqttClient: MqttClient;
|
|
17
17
|
websockets: WebSocket[];
|
|
18
18
|
mqttClients: MqttClient[];
|
|
19
|
-
socketFn: (e: string,
|
|
19
|
+
socketFn: (e: string, context?: {
|
|
20
|
+
meta2d?: Meta2d;
|
|
21
|
+
type?: string;
|
|
22
|
+
topic?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
}) => boolean;
|
|
20
25
|
events: Record<number, (pen: Pen, e: Event) => void>;
|
|
21
26
|
map: ViewMap;
|
|
22
27
|
mapTimer: any;
|
|
@@ -47,7 +52,9 @@ export declare class Meta2d {
|
|
|
47
52
|
setDatabyOptions(options?: Options): void;
|
|
48
53
|
private init;
|
|
49
54
|
initEventFns(): void;
|
|
55
|
+
navigatorTo(id: string): void;
|
|
50
56
|
doSendDataEvent(value: any, topics?: string): void;
|
|
57
|
+
sendDataToNetWork(value: any, network: Network): Promise<void>;
|
|
51
58
|
resize(width?: number, height?: number): void;
|
|
52
59
|
/**
|
|
53
60
|
*
|
|
@@ -68,7 +75,7 @@ export declare class Meta2d {
|
|
|
68
75
|
rule?: boolean;
|
|
69
76
|
ruleColor?: string;
|
|
70
77
|
}): void;
|
|
71
|
-
open(data?: Meta2dData): void;
|
|
78
|
+
open(data?: Meta2dData, render?: boolean): void;
|
|
72
79
|
initBindDatas(): void;
|
|
73
80
|
connectSocket(): void;
|
|
74
81
|
/**
|
|
@@ -126,7 +133,7 @@ export declare class Meta2d {
|
|
|
126
133
|
height: number;
|
|
127
134
|
};
|
|
128
135
|
setPenRect(pen: Pen, rect: Rect, render?: boolean): void;
|
|
129
|
-
startAnimate(idOrTagOrPens?: string | Pen[],
|
|
136
|
+
startAnimate(idOrTagOrPens?: string | Pen[], params?: number | string): void;
|
|
130
137
|
pauseAnimate(idOrTagOrPens?: string | Pen[]): void;
|
|
131
138
|
stopAnimate(idOrTagOrPens?: string | Pen[]): void;
|
|
132
139
|
startVideo(idOrTagOrPens?: string | Pen[]): void;
|
|
@@ -143,6 +150,7 @@ export declare class Meta2d {
|
|
|
143
150
|
isCombine(pen: Pen): boolean;
|
|
144
151
|
active(pens: Pen[], emit?: boolean): void;
|
|
145
152
|
inactive(): void;
|
|
153
|
+
activeAll(): void;
|
|
146
154
|
/**
|
|
147
155
|
* 删除画笔
|
|
148
156
|
* @param pens 需要删除的画笔们
|
|
@@ -181,7 +189,17 @@ export declare class Meta2d {
|
|
|
181
189
|
connectHttp(): void;
|
|
182
190
|
sendDatabyHttp(data: string): Promise<void>;
|
|
183
191
|
closeHttp(): void;
|
|
184
|
-
|
|
192
|
+
updateTimer: any;
|
|
193
|
+
connectNetwork(): void;
|
|
194
|
+
randomString(e: number): string;
|
|
195
|
+
penMock(pen: Pen): void;
|
|
196
|
+
onNetworkConnect(https: Network[]): void;
|
|
197
|
+
closeNetwork(): void;
|
|
198
|
+
socketCallback(message: string, context?: {
|
|
199
|
+
type?: string;
|
|
200
|
+
topic?: string;
|
|
201
|
+
url?: string;
|
|
202
|
+
}): void;
|
|
185
203
|
setDatas(datas: {
|
|
186
204
|
dataId: string;
|
|
187
205
|
value: any;
|
|
@@ -205,6 +223,7 @@ export declare class Meta2d {
|
|
|
205
223
|
clearDropdownList(): void;
|
|
206
224
|
private onEvent;
|
|
207
225
|
private doEvent;
|
|
226
|
+
judgeCondition(pen: Pen, key: string, condition: TriggerCondition): boolean;
|
|
208
227
|
pushChildren(parent: Pen, children: Pen[]): void;
|
|
209
228
|
renderPenRaw: typeof renderPenRaw;
|
|
210
229
|
toPng(padding?: Padding, callback?: BlobCallback, containBkImg?: boolean): string;
|
|
@@ -241,6 +260,11 @@ export declare class Meta2d {
|
|
|
241
260
|
* @param pens 画笔们
|
|
242
261
|
*/
|
|
243
262
|
beSameByFirst(pens?: Pen[], attribute?: string): void;
|
|
263
|
+
/**
|
|
264
|
+
* 大小相同
|
|
265
|
+
* @param pens 画笔们
|
|
266
|
+
*/
|
|
267
|
+
beSameByLast(pens?: Pen[], attribute?: string): void;
|
|
244
268
|
/**
|
|
245
269
|
* 格式刷(样式相同,大小无需一致。)
|
|
246
270
|
* @param pens 画笔们
|
|
@@ -256,6 +280,12 @@ export declare class Meta2d {
|
|
|
256
280
|
* @param pens
|
|
257
281
|
*/
|
|
258
282
|
alignNodesByFirst(align: string, pens?: Pen[]): void;
|
|
283
|
+
/**
|
|
284
|
+
* 对齐画笔,基于最后选中的画笔
|
|
285
|
+
* @param align 左对齐,右对齐,上对齐,下对齐,居中对齐
|
|
286
|
+
* @param pens
|
|
287
|
+
*/
|
|
288
|
+
alignNodesByLast(align: string, pens?: Pen[]): void;
|
|
259
289
|
/**
|
|
260
290
|
* 将画笔参照 rect 进行 align 对齐
|
|
261
291
|
* @param align 左对齐,右对齐,上对齐,下对齐,居中对齐
|
|
@@ -285,9 +315,8 @@ export declare class Meta2d {
|
|
|
285
315
|
/**
|
|
286
316
|
* 将该画笔置顶,即放到数组最后,最后绘制即在顶部
|
|
287
317
|
* @param pen pen 置顶的画笔
|
|
288
|
-
* @param pens 画笔们,注意 pen 必须在该数组内才有效
|
|
289
318
|
*/
|
|
290
|
-
top(pen: Pen
|
|
319
|
+
top(pen: Pen): void;
|
|
291
320
|
/**
|
|
292
321
|
* 若本次改变的画笔存在图片,并且在上层 or 下层,需要擦除上层 or 下层
|
|
293
322
|
* 子节点中包含图片,也需要重绘
|
|
@@ -298,7 +327,7 @@ export declare class Meta2d {
|
|
|
298
327
|
* 该画笔置底,即放到数组最前,最后绘制即在底部
|
|
299
328
|
* @param pens 画笔们,注意 pen 必须在该数组内才有效
|
|
300
329
|
*/
|
|
301
|
-
bottom(pen: Pen
|
|
330
|
+
bottom(pen: Pen): void;
|
|
302
331
|
/**
|
|
303
332
|
* data.pens 决定了绘制顺序,即越后面的越在上层
|
|
304
333
|
* 该方法通过区域重叠计算,找出该画笔之后第一个与其重叠的画笔,然后把该画笔放到找出的画笔之后
|
|
@@ -307,14 +336,14 @@ export declare class Meta2d {
|
|
|
307
336
|
upByArea(pen: Pen): void;
|
|
308
337
|
/**
|
|
309
338
|
* 该画笔上移,即把该画笔在数组中的位置向后移动一个
|
|
310
|
-
* @param
|
|
339
|
+
* @param pen 画笔
|
|
311
340
|
*/
|
|
312
|
-
up(pen: Pen
|
|
341
|
+
up(pen: Pen): void;
|
|
313
342
|
/**
|
|
314
343
|
* 该画笔下移,即把该画笔在该数组中的位置前移一个
|
|
315
|
-
* @param
|
|
344
|
+
* @param pen 画笔
|
|
316
345
|
*/
|
|
317
|
-
down(pen: Pen
|
|
346
|
+
down(pen: Pen): void;
|
|
318
347
|
setLayer(pen: Pen, toIndex: number, pens?: Pen[]): void;
|
|
319
348
|
changePenId(oldId: string, newId: string): void;
|
|
320
349
|
/**
|