@netless/appliance-plugin 1.1.0 → 1.1.1-beta.0
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/README.md +5 -5
- package/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-CjGKnN.js → fullWorker-D2RITq.js} +26 -26
- package/cdn/{subWorker-DUJqv_.js → subWorker-UKUWKN.js} +26 -26
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/collector/base.d.ts +3 -0
- package/dist/collector/collector.d.ts +16 -1
- package/dist/collector/enum.d.ts +0 -3
- package/dist/collector/eventCollector.d.ts +1 -0
- package/dist/collector/magixEventCollector.d.ts +1 -0
- package/dist/collector/types.d.ts +38 -12
- package/dist/core/enum.d.ts +7 -1
- package/dist/core/mainEngine.d.ts +5 -4
- package/dist/core/renderCotrol.d.ts +66 -0
- package/dist/core/tools/eraser.d.ts +1 -1
- package/dist/core/tools/pencilEraser.d.ts +1 -1
- package/dist/core/types.d.ts +3 -1
- package/dist/core/utils/spriteNode.d.ts +0 -2
- package/dist/core/vNodeManager.d.ts +11 -3
- package/dist/fullWorker.js +26 -26
- package/dist/{index-C4KNxHht.mjs → index-BVcY9dXC.mjs} +334 -305
- package/dist/index-Bc02VTGL.js +1 -0
- package/dist/{index-CIJP6_Qj.mjs → index-DXSmA8_B.mjs} +5735 -5368
- package/dist/index-gKuc4bsw.js +1 -0
- package/dist/members/index.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +11 -2
- package/dist/plugin/types.d.ts +7 -1
- package/dist/subWorker.js +26 -26
- package/package.json +2 -2
- package/dist/index-C29o_HLi.js +0 -1
- package/dist/index-DmfRoAiB.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (N, t, e) =>
|
|
4
|
-
import { E as f, a as
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var te = (N, t, e) => t in N ? ee(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
|
|
3
|
+
var d = (N, t, e) => te(N, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { E as f, a as T, c as D, b as se, i as oe, d as re, e as U, g as ie, S as P, f as ae, D as A, h as v, j as B, t as x, k as p, l as L, m as K, n as ce, C as _, o as ne, p as I, M as R, T as G, q as z, r as V, s as le, u as $, V as Z, v as he } from "./index-DXSmA8_B.mjs";
|
|
5
|
+
import { Scene as X, Group as Y } from "spritejs";
|
|
6
|
+
import { cloneDeep as Q, xor as pe, isEqual as j, isNumber as de } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
8
8
|
import "white-web-sdk";
|
|
9
9
|
import "react-dom";
|
|
@@ -16,6 +16,8 @@ class ue {
|
|
|
16
16
|
d(this, "curNodeMap", /* @__PURE__ */ new Map());
|
|
17
17
|
d(this, "targetNodeMap", []);
|
|
18
18
|
d(this, "highLevelIds");
|
|
19
|
+
d(this, "canClearUids");
|
|
20
|
+
d(this, "localUid");
|
|
19
21
|
this.viewId = t, this.scene = e;
|
|
20
22
|
}
|
|
21
23
|
init(t) {
|
|
@@ -24,11 +26,23 @@ class ue {
|
|
|
24
26
|
get(t) {
|
|
25
27
|
return this.curNodeMap.get(t);
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
29
|
+
setLocalUid(t) {
|
|
30
|
+
this.localUid = t;
|
|
31
|
+
}
|
|
32
|
+
getLocalUid() {
|
|
33
|
+
return this.localUid;
|
|
34
|
+
}
|
|
35
|
+
setCanClearUids(t) {
|
|
36
|
+
this.canClearUids = t;
|
|
37
|
+
}
|
|
38
|
+
getCanClearUids() {
|
|
39
|
+
return this.canClearUids;
|
|
40
|
+
}
|
|
41
|
+
getCanEraserNodes(t) {
|
|
42
|
+
const e = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const [s, o] of t.entries())
|
|
44
|
+
o.toolsType === f.Image && o.opt.locked || o.toolsType === f.Text && (o.opt.workState === T.Doing || o.opt.workState === T.Start) || this.isCanClearWorkId(s) && e.set(s, o);
|
|
45
|
+
return e;
|
|
32
46
|
}
|
|
33
47
|
getNodesByType(t) {
|
|
34
48
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -37,10 +51,7 @@ class ue {
|
|
|
37
51
|
}), e;
|
|
38
52
|
}
|
|
39
53
|
hasRenderNodes() {
|
|
40
|
-
|
|
41
|
-
for (const e of this.curNodeMap.values())
|
|
42
|
-
oe(e) && (t = !0);
|
|
43
|
-
return t;
|
|
54
|
+
return !0;
|
|
44
55
|
}
|
|
45
56
|
has(t) {
|
|
46
57
|
return this.curNodeMap.has(t);
|
|
@@ -50,7 +61,7 @@ class ue {
|
|
|
50
61
|
name: t,
|
|
51
62
|
rect: e.rect
|
|
52
63
|
};
|
|
53
|
-
e.rect && (s.rect =
|
|
64
|
+
e.rect && (s.rect = D(e.rect)), e.op && se(e.op) && (s.op = D(e.op)), e.canRotate && (s.canRotate = e.canRotate), e.scaleType && (s.scaleType = e.scaleType), e.opt && (s.opt = D(e.opt)), e.toolsType && (s.toolsType = e.toolsType), e.centerPos && (s.centerPos = D(e.centerPos)), oe(e.isSelected) && (s.isSelected = e.isSelected), s.rect ? this.curNodeMap.set(t, s) : this.curNodeMap.delete(t);
|
|
54
65
|
}
|
|
55
66
|
selected(t) {
|
|
56
67
|
this.setInfo(t, { isSelected: !0 });
|
|
@@ -64,23 +75,14 @@ class ue {
|
|
|
64
75
|
clear() {
|
|
65
76
|
this.curNodeMap.clear(), this.targetNodeMap.length = 0;
|
|
66
77
|
}
|
|
67
|
-
hasRectIntersectRange(t, e = !0) {
|
|
68
|
-
for (const s of this.curNodeMap.values())
|
|
69
|
-
if (B(t, s.rect)) {
|
|
70
|
-
if (e && s.toolsType === f.Image && s.opt.locked || e && s.toolsType === f.Text && (s.opt.workState === I.Doing || s.opt.workState === I.Start))
|
|
71
|
-
continue;
|
|
72
|
-
return !0;
|
|
73
|
-
}
|
|
74
|
-
return !1;
|
|
75
|
-
}
|
|
76
78
|
getRectIntersectRange(t, e = !0, s = !0) {
|
|
77
79
|
let o;
|
|
78
80
|
const r = /* @__PURE__ */ new Map();
|
|
79
81
|
for (const [i, a] of this.curNodeMap.entries())
|
|
80
|
-
if (
|
|
81
|
-
if (e && a.toolsType === f.Image && a.opt.locked || s && a.toolsType === f.Text && (a.opt.workState ===
|
|
82
|
+
if (re(t, a.rect)) {
|
|
83
|
+
if (e && a.toolsType === f.Image && a.opt.locked || s && a.toolsType === f.Text && (a.opt.workState === T.Doing || a.opt.workState === T.Start))
|
|
82
84
|
continue;
|
|
83
|
-
o =
|
|
85
|
+
o = U(o, a.rect), r.set(i, a);
|
|
84
86
|
}
|
|
85
87
|
return {
|
|
86
88
|
rectRange: o,
|
|
@@ -88,7 +90,7 @@ class ue {
|
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
getNodeRectFormShape(t, e) {
|
|
91
|
-
const s =
|
|
93
|
+
const s = ie(e.toolsType);
|
|
92
94
|
return this.fullLayer && (s == null ? void 0 : s.getRectFromLayer(this.fullLayer, t));
|
|
93
95
|
}
|
|
94
96
|
updateNodeRect(t) {
|
|
@@ -115,22 +117,16 @@ class ue {
|
|
|
115
117
|
clearHighLevelIds() {
|
|
116
118
|
this.highLevelIds = void 0;
|
|
117
119
|
}
|
|
118
|
-
combineIntersectRect(t) {
|
|
119
|
-
let e = t;
|
|
120
|
-
return this.curNodeMap.forEach((s) => {
|
|
121
|
-
B(e, s.rect) && (e = A(e, s.rect));
|
|
122
|
-
}), e;
|
|
123
|
-
}
|
|
124
120
|
setTargetAssignKeys(t) {
|
|
125
121
|
const e = /* @__PURE__ */ new Map();
|
|
126
122
|
for (const s of t) {
|
|
127
123
|
const o = this.curNodeMap.get(s);
|
|
128
|
-
o && e.set(s,
|
|
124
|
+
o && e.set(s, D(o));
|
|
129
125
|
}
|
|
130
|
-
return this.targetNodeMap.push(
|
|
126
|
+
return this.targetNodeMap.push(D(e)), this.targetNodeMap.length - 1;
|
|
131
127
|
}
|
|
132
128
|
setTarget() {
|
|
133
|
-
return this.targetNodeMap.push(
|
|
129
|
+
return this.targetNodeMap.push(D(this.curNodeMap)), this.targetNodeMap.length - 1;
|
|
134
130
|
}
|
|
135
131
|
getLastTarget() {
|
|
136
132
|
return this.targetNodeMap[this.targetNodeMap.length - 1];
|
|
@@ -147,6 +143,21 @@ class ue {
|
|
|
147
143
|
clearTarget() {
|
|
148
144
|
this.targetNodeMap.length = 0;
|
|
149
145
|
}
|
|
146
|
+
isLocalWorkId(t) {
|
|
147
|
+
return t.split(P).length === 1;
|
|
148
|
+
}
|
|
149
|
+
isCanClearWorkId(t) {
|
|
150
|
+
if (this.canClearUids === void 0 || this.canClearUids === !0)
|
|
151
|
+
return !0;
|
|
152
|
+
if (ae(this.canClearUids)) {
|
|
153
|
+
const e = t.split(P);
|
|
154
|
+
if (e.length === 1)
|
|
155
|
+
return this.canClearUids.has("localSelf");
|
|
156
|
+
if (e.length === 2)
|
|
157
|
+
return this.canClearUids.has(e[0]);
|
|
158
|
+
}
|
|
159
|
+
return !1;
|
|
160
|
+
}
|
|
150
161
|
}
|
|
151
162
|
class fe {
|
|
152
163
|
constructor(t) {
|
|
@@ -156,7 +167,7 @@ class fe {
|
|
|
156
167
|
d(this, "localWorkShapes", /* @__PURE__ */ new Map());
|
|
157
168
|
d(this, "tmpOpt");
|
|
158
169
|
d(this, "animationId");
|
|
159
|
-
d(this, "syncUnitTime",
|
|
170
|
+
d(this, "syncUnitTime", A.syncOpt.interval);
|
|
160
171
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
161
172
|
}
|
|
162
173
|
createLocalWork(t) {
|
|
@@ -181,7 +192,7 @@ class fe {
|
|
|
181
192
|
return o && this.localWorkShapes.set(t, {
|
|
182
193
|
node: o,
|
|
183
194
|
toolsType: o.toolsType,
|
|
184
|
-
workState:
|
|
195
|
+
workState: T.Start
|
|
185
196
|
}), o;
|
|
186
197
|
}
|
|
187
198
|
}
|
|
@@ -198,14 +209,14 @@ class fe {
|
|
|
198
209
|
}
|
|
199
210
|
consumeDraw(t) {
|
|
200
211
|
const { workId: e, dataType: s } = t;
|
|
201
|
-
if (s ===
|
|
212
|
+
if (s === v.Service)
|
|
202
213
|
this.activeServiceWorkShape(t);
|
|
203
214
|
else {
|
|
204
215
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
205
216
|
if (!r)
|
|
206
217
|
return;
|
|
207
218
|
const i = r.node.consume({ data: t, isFullWork: !1, isSubWorker: !0 });
|
|
208
|
-
i.rect && (r.result = i, r.workState =
|
|
219
|
+
i.rect && (r.result = i, r.workState = T.Doing, o && this.localWorkShapes.set(o, r));
|
|
209
220
|
}
|
|
210
221
|
this.runAnimation();
|
|
211
222
|
}
|
|
@@ -219,17 +230,17 @@ class fe {
|
|
|
219
230
|
createWorkShapeNode(t) {
|
|
220
231
|
const { toolsType: e } = t;
|
|
221
232
|
if (e === f.LaserPen)
|
|
222
|
-
return
|
|
233
|
+
return B({ ...t, vNodes: this.vNodes, fullLayer: this.thread.topLayer, drawLayer: this.thread.topLayer });
|
|
223
234
|
}
|
|
224
235
|
setNodeKey(t, e, s, o) {
|
|
225
236
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
226
237
|
}
|
|
227
238
|
activeServiceWorkShape(t) {
|
|
228
|
-
var
|
|
239
|
+
var k, u;
|
|
229
240
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: n } = t;
|
|
230
241
|
if (!e)
|
|
231
242
|
return;
|
|
232
|
-
const c = e.toString(), h = (
|
|
243
|
+
const c = e.toString(), h = (k = this.vNodes.get(c)) == null ? void 0 : k.rect;
|
|
233
244
|
if (!((u = this.serviceWorkShapes) != null && u.has(c))) {
|
|
234
245
|
let y = {
|
|
235
246
|
toolsType: o,
|
|
@@ -243,7 +254,7 @@ class fe {
|
|
|
243
254
|
o && s && (y = this.setNodeKey(c, y, o, s)), this.serviceWorkShapes.set(c, y);
|
|
244
255
|
}
|
|
245
256
|
const l = this.serviceWorkShapes.get(c);
|
|
246
|
-
r && (l.type = r), a && (l.animationWorkData =
|
|
257
|
+
r && (l.type = r), a && (l.animationWorkData = x(a), l.ops = a), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(c, l, o, s), l.node && l.node.setWorkOptions(s));
|
|
247
258
|
}
|
|
248
259
|
computNextAnimationIndex(t, e) {
|
|
249
260
|
var r;
|
|
@@ -258,12 +269,12 @@ class fe {
|
|
|
258
269
|
for (const [n, c] of this.serviceWorkShapes.entries())
|
|
259
270
|
switch (c.toolsType) {
|
|
260
271
|
case f.LaserPen: {
|
|
261
|
-
const l = this.computNextAnimationIndex(c, 8),
|
|
272
|
+
const l = this.computNextAnimationIndex(c, 8), k = Math.max(0, c.animationIndex || 0), u = (c.animationWorkData || []).slice(k, l);
|
|
262
273
|
if ((c.animationIndex || 0) < l && ((o = c.node) == null || o.consumeService({
|
|
263
274
|
op: u,
|
|
264
275
|
isFullWork: !1
|
|
265
276
|
}), c.animationIndex = l, u.length && e.set(n, {
|
|
266
|
-
workState:
|
|
277
|
+
workState: k === 0 ? T.Start : l === ((r = c.animationWorkData) == null ? void 0 : r.length) ? T.Done : T.Doing,
|
|
267
278
|
op: u.slice(-2)
|
|
268
279
|
})), c.isDel) {
|
|
269
280
|
(i = c.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
|
|
@@ -274,17 +285,17 @@ class fe {
|
|
|
274
285
|
}
|
|
275
286
|
}
|
|
276
287
|
for (const [n, c] of this.localWorkShapes.entries()) {
|
|
277
|
-
const { result: h, toolsType: l, isDel:
|
|
288
|
+
const { result: h, toolsType: l, isDel: k, workState: u } = c;
|
|
278
289
|
switch (l) {
|
|
279
290
|
case f.LaserPen: {
|
|
280
|
-
if (
|
|
291
|
+
if (k) {
|
|
281
292
|
c.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
|
|
282
293
|
removeIds: [n.toString()],
|
|
283
294
|
type: p.RemoveNode
|
|
284
295
|
});
|
|
285
296
|
break;
|
|
286
297
|
}
|
|
287
|
-
h && ((h.op || h.ops) && s.push(h), c.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && u ===
|
|
298
|
+
h && ((h.op || h.ops) && s.push(h), c.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && u === T.Done && (c.isDel = !0, this.localWorkShapes.set(n, c)), t = !0;
|
|
288
299
|
break;
|
|
289
300
|
}
|
|
290
301
|
}
|
|
@@ -292,7 +303,7 @@ class fe {
|
|
|
292
303
|
t && this.runAnimation(), e.size && e.forEach((n, c) => {
|
|
293
304
|
s.push({
|
|
294
305
|
type: p.Cursor,
|
|
295
|
-
uid: c.split(
|
|
306
|
+
uid: c.split(P)[0],
|
|
296
307
|
op: n.op,
|
|
297
308
|
workState: n.workState,
|
|
298
309
|
viewId: this.thread.viewId
|
|
@@ -310,26 +321,26 @@ class fe {
|
|
|
310
321
|
this.tmpOpt.toolsOpt = e, s = this.createWorkShapeNode({ workId: t, toolsType: r, toolsOpt: e }), s && this.localWorkShapes.set(t, {
|
|
311
322
|
node: s,
|
|
312
323
|
toolsType: r,
|
|
313
|
-
workState:
|
|
324
|
+
workState: T.Start
|
|
314
325
|
}), this.setToolsOpt(this.tmpOpt);
|
|
315
326
|
}
|
|
316
327
|
e != null && e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s && s.setWorkOptions(e);
|
|
317
328
|
}
|
|
318
329
|
consumeDrawAll(t) {
|
|
319
330
|
const { workId: e, dataType: s } = t;
|
|
320
|
-
if (s ===
|
|
331
|
+
if (s === v.Service)
|
|
321
332
|
this.activeServiceWorkShape(t);
|
|
322
333
|
else {
|
|
323
334
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
324
335
|
if (!r)
|
|
325
336
|
return;
|
|
326
337
|
const i = r.node.consumeAll({ data: t });
|
|
327
|
-
r.result = i, r.workState =
|
|
338
|
+
r.result = i, r.workState = T.Done, o && this.localWorkShapes.set(o, r);
|
|
328
339
|
}
|
|
329
340
|
this.runAnimation();
|
|
330
341
|
}
|
|
331
342
|
}
|
|
332
|
-
class
|
|
343
|
+
class ke {
|
|
333
344
|
constructor(t) {
|
|
334
345
|
d(this, "vNodes");
|
|
335
346
|
d(this, "thread");
|
|
@@ -338,7 +349,7 @@ class Se {
|
|
|
338
349
|
d(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
|
|
339
350
|
d(this, "batchEraserWorks", /* @__PURE__ */ new Set());
|
|
340
351
|
d(this, "tmpOpt");
|
|
341
|
-
d(this, "syncUnitTime",
|
|
352
|
+
d(this, "syncUnitTime", A.syncOpt.interval);
|
|
342
353
|
d(this, "drawCount", 0);
|
|
343
354
|
d(this, "drawWorkActiveId");
|
|
344
355
|
d(this, "batchEraserCombine", ne(() => {
|
|
@@ -366,16 +377,16 @@ class Se {
|
|
|
366
377
|
scenePath: t,
|
|
367
378
|
viewId: this.thread.viewId,
|
|
368
379
|
msgType: p.DrawWork,
|
|
369
|
-
dataType:
|
|
380
|
+
dataType: v.Local
|
|
370
381
|
}, e);
|
|
371
382
|
}
|
|
372
383
|
async updateSelector(t) {
|
|
373
|
-
var
|
|
384
|
+
var k;
|
|
374
385
|
const e = this.workShapes.get(L);
|
|
375
|
-
if (!((
|
|
386
|
+
if (!((k = e == null ? void 0 : e.selectIds) != null && k.length)) return;
|
|
376
387
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
|
|
377
388
|
updateSelectorOpt: r,
|
|
378
|
-
selectIds:
|
|
389
|
+
selectIds: Q(e.selectIds),
|
|
379
390
|
vNodes: this.vNodes,
|
|
380
391
|
willSerializeData: i,
|
|
381
392
|
worker: this
|
|
@@ -384,11 +395,11 @@ class Se {
|
|
|
384
395
|
a != null && a.selectIds && (c = pe(e.selectIds, a.selectIds), a.selectIds.forEach((u) => {
|
|
385
396
|
const y = this.vNodes.get(u);
|
|
386
397
|
if (y) {
|
|
387
|
-
const { toolsType:
|
|
398
|
+
const { toolsType: w, op: m, opt: W } = y;
|
|
388
399
|
n.set(u, {
|
|
389
400
|
opt: W,
|
|
390
|
-
toolsType:
|
|
391
|
-
ops: (
|
|
401
|
+
toolsType: w,
|
|
402
|
+
ops: (m == null ? void 0 : m.length) && K(m) || void 0
|
|
392
403
|
});
|
|
393
404
|
}
|
|
394
405
|
}), e.selectIds = a.selectIds);
|
|
@@ -415,7 +426,7 @@ class Se {
|
|
|
415
426
|
const e = [];
|
|
416
427
|
e.push({
|
|
417
428
|
type: p.Select,
|
|
418
|
-
dataType:
|
|
429
|
+
dataType: v.Local,
|
|
419
430
|
selectIds: [],
|
|
420
431
|
willSyncService: !1
|
|
421
432
|
}), this.thread.post({ sp: e });
|
|
@@ -427,8 +438,8 @@ class Se {
|
|
|
427
438
|
if (e != null && e.length) {
|
|
428
439
|
let r;
|
|
429
440
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
430
|
-
const { rect: a, name: n, toolsType: c, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0],
|
|
431
|
-
if (c === f.Text && ce([l,
|
|
441
|
+
const { rect: a, name: n, toolsType: c, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], k = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
442
|
+
if (c === f.Text && ce([l, k], a) && h.workState === T.Done) {
|
|
432
443
|
r = n;
|
|
433
444
|
break;
|
|
434
445
|
}
|
|
@@ -500,7 +511,7 @@ class Se {
|
|
|
500
511
|
type: p.TextUpdate,
|
|
501
512
|
toolsType: f.Text,
|
|
502
513
|
workId: t,
|
|
503
|
-
dataType:
|
|
514
|
+
dataType: v.Local
|
|
504
515
|
};
|
|
505
516
|
}
|
|
506
517
|
async removeSelector(t) {
|
|
@@ -550,7 +561,7 @@ class Se {
|
|
|
550
561
|
}
|
|
551
562
|
async consumeFull(t) {
|
|
552
563
|
var o;
|
|
553
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
564
|
+
const e = this.setFullWork(t), s = t.ops && x(t.ops);
|
|
554
565
|
if (e) {
|
|
555
566
|
const r = (o = t.workId) == null ? void 0 : o.toString();
|
|
556
567
|
e.toolsType === f.Image ? await e.consumeServiceAsync({
|
|
@@ -610,7 +621,7 @@ class Se {
|
|
|
610
621
|
replaceId: r
|
|
611
622
|
});
|
|
612
623
|
else {
|
|
613
|
-
const i = s.ops &&
|
|
624
|
+
const i = s.ops && x(s.ops);
|
|
614
625
|
o.consumeService({
|
|
615
626
|
op: i,
|
|
616
627
|
isFullWork: !0,
|
|
@@ -682,12 +693,11 @@ class Se {
|
|
|
682
693
|
const e = [];
|
|
683
694
|
t.op && e.push(t), e.length && this.thread.post({ sp: e });
|
|
684
695
|
}
|
|
685
|
-
async drawBitMapEraserFull(t, e) {
|
|
686
|
-
const { willUpdateNodes:
|
|
696
|
+
async drawBitMapEraserFull(t, e, s) {
|
|
697
|
+
const { willUpdateNodes: o, scenePath: r, ...i } = e, a = t.getWorkId(), n = [
|
|
687
698
|
{
|
|
688
699
|
...i,
|
|
689
700
|
workId: a,
|
|
690
|
-
isLockSentEventCursor: o,
|
|
691
701
|
scenePath: r,
|
|
692
702
|
updateNodeOpt: {
|
|
693
703
|
useAnimation: !1
|
|
@@ -702,15 +712,18 @@ class Se {
|
|
|
702
712
|
]
|
|
703
713
|
}
|
|
704
714
|
];
|
|
705
|
-
if (s
|
|
715
|
+
if (s && n.push({
|
|
716
|
+
type: p.None,
|
|
717
|
+
isLockSentEventCursor: s
|
|
718
|
+
}), o != null && o.size) {
|
|
706
719
|
await (t == null ? void 0 : t.reRenderEffectNodes({
|
|
707
|
-
willUpdateNodes:
|
|
720
|
+
willUpdateNodes: o,
|
|
708
721
|
worker: this
|
|
709
722
|
}));
|
|
710
|
-
for (const [c, h] of
|
|
723
|
+
for (const [c, h] of o)
|
|
711
724
|
n.push({
|
|
712
725
|
type: p.UpdateNode,
|
|
713
|
-
dataType:
|
|
726
|
+
dataType: v.Local,
|
|
714
727
|
opt: h.opt,
|
|
715
728
|
workId: c,
|
|
716
729
|
updateNodeOpt: {
|
|
@@ -720,18 +733,18 @@ class Se {
|
|
|
720
733
|
}
|
|
721
734
|
n.length && this.thread.post({ sp: n });
|
|
722
735
|
}
|
|
723
|
-
drawPencilEraser(t) {
|
|
724
|
-
var
|
|
725
|
-
const
|
|
726
|
-
if ((
|
|
727
|
-
for (const
|
|
728
|
-
const
|
|
729
|
-
this.batchEraserWorks.add(
|
|
736
|
+
drawPencilEraser(t, e) {
|
|
737
|
+
var o, r;
|
|
738
|
+
const s = [];
|
|
739
|
+
if ((o = t.newWorkDatas) != null && o.size) {
|
|
740
|
+
for (const i of t.newWorkDatas.values()) {
|
|
741
|
+
const a = i.workId.toString();
|
|
742
|
+
this.batchEraserWorks.add(a), s.push({
|
|
730
743
|
type: p.FullWork,
|
|
731
|
-
workId:
|
|
732
|
-
ops: K(
|
|
733
|
-
opt:
|
|
734
|
-
toolsType:
|
|
744
|
+
workId: a,
|
|
745
|
+
ops: K(i.op),
|
|
746
|
+
opt: i.opt,
|
|
747
|
+
toolsType: i.toolsType,
|
|
735
748
|
updateNodeOpt: {
|
|
736
749
|
useAnimation: !1
|
|
737
750
|
}
|
|
@@ -739,13 +752,19 @@ class Se {
|
|
|
739
752
|
}
|
|
740
753
|
delete t.newWorkDatas;
|
|
741
754
|
}
|
|
742
|
-
(
|
|
743
|
-
this.batchEraserRemoveNodes.add(
|
|
744
|
-
}), e.push(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
755
|
+
(r = t.removeIds) == null || r.forEach((i) => {
|
|
756
|
+
this.batchEraserRemoveNodes.add(i);
|
|
757
|
+
}), e && s.push({
|
|
758
|
+
type: p.None,
|
|
759
|
+
isLockSentEventCursor: e
|
|
760
|
+
}), t.rect, this.thread.post({ sp: s }), this.batchEraserCombine();
|
|
761
|
+
}
|
|
762
|
+
drawEraser(t, e) {
|
|
763
|
+
const s = [];
|
|
764
|
+
t.removeIds && s.push(t), e && s.push({
|
|
765
|
+
type: p.None,
|
|
766
|
+
isLockSentEventCursor: e
|
|
767
|
+
}), this.thread.post({ sp: s });
|
|
749
768
|
}
|
|
750
769
|
updateBatchEraserCombineNode(t, e) {
|
|
751
770
|
for (const s of e.keys())
|
|
@@ -783,7 +802,7 @@ class Se {
|
|
|
783
802
|
scenePath: r,
|
|
784
803
|
viewId: this.thread.viewId,
|
|
785
804
|
msgType: p.DrawWork,
|
|
786
|
-
dataType:
|
|
805
|
+
dataType: v.Local
|
|
787
806
|
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && i !== L && (this.drawWorkActiveId = i), n) {
|
|
788
807
|
case f.Selector:
|
|
789
808
|
{
|
|
@@ -852,22 +871,22 @@ class Se {
|
|
|
852
871
|
const l = this.workShapes.get(h);
|
|
853
872
|
if (!l)
|
|
854
873
|
return;
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
874
|
+
const k = l.toolsType;
|
|
875
|
+
if (k === f.LaserPen)
|
|
857
876
|
return;
|
|
858
|
-
const u = this.workShapes.get(_), y = (i = u == null ? void 0 : u.selectIds) == null ? void 0 : i[0],
|
|
859
|
-
switch (
|
|
877
|
+
const u = this.workShapes.get(_), y = (i = u == null ? void 0 : u.selectIds) == null ? void 0 : i[0], w = l.consumeAll({ data: t });
|
|
878
|
+
switch (k) {
|
|
860
879
|
case f.Selector:
|
|
861
|
-
|
|
880
|
+
w.selectIds && y && ((a = w.selectIds) != null && a.includes(y)) && u.cursorBlur(), w.type === p.Select && (w.selectIds && e.runReverseSelectWork(w.selectIds), this.thread.post({ sp: [{ ...w, scenePath: o }] })), (n = l.selectIds) != null && n.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(h);
|
|
862
881
|
break;
|
|
863
882
|
case f.PencilEraser:
|
|
864
|
-
|
|
883
|
+
this.drawPencilEraser({ ...w, scenePath: o }, r), l.clearTmpPoints();
|
|
865
884
|
break;
|
|
866
885
|
case f.BitMapEraser:
|
|
867
|
-
(
|
|
886
|
+
(w.rect || (c = w.newWorkDatas) != null && c.size) && this.drawBitMapEraserFull(l, w, r);
|
|
868
887
|
break;
|
|
869
888
|
case f.Eraser:
|
|
870
|
-
|
|
889
|
+
this.drawEraser({ ...w, scenePath: o }, r), l.clearTmpPoints();
|
|
871
890
|
break;
|
|
872
891
|
case f.Arrow:
|
|
873
892
|
case f.Straight:
|
|
@@ -876,12 +895,17 @@ class Se {
|
|
|
876
895
|
case f.Star:
|
|
877
896
|
case f.Polygon:
|
|
878
897
|
case f.SpeechBalloon:
|
|
879
|
-
case f.Pencil:
|
|
880
|
-
m
|
|
898
|
+
case f.Pencil: {
|
|
899
|
+
const m = [];
|
|
900
|
+
r && m.push({
|
|
901
|
+
type: p.None,
|
|
902
|
+
isLockSentEventCursor: r
|
|
903
|
+
}), w && (m.push(w), this.drawCount = 0, this.thread.post({
|
|
881
904
|
drawCount: this.drawCount,
|
|
882
|
-
sp:
|
|
905
|
+
sp: m
|
|
883
906
|
})), this.clearWorkShapeNodeCache(h);
|
|
884
907
|
break;
|
|
908
|
+
}
|
|
885
909
|
}
|
|
886
910
|
}
|
|
887
911
|
}
|
|
@@ -901,10 +925,10 @@ class Se {
|
|
|
901
925
|
e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(e);
|
|
902
926
|
}
|
|
903
927
|
createWorkShapeNode(t) {
|
|
904
|
-
return
|
|
928
|
+
return B({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
|
|
905
929
|
}
|
|
906
930
|
}
|
|
907
|
-
class
|
|
931
|
+
class Se {
|
|
908
932
|
constructor(t) {
|
|
909
933
|
d(this, "vNodes");
|
|
910
934
|
d(this, "thread");
|
|
@@ -913,7 +937,7 @@ class ke {
|
|
|
913
937
|
d(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
|
|
914
938
|
d(this, "runEffectId");
|
|
915
939
|
d(this, "animationId");
|
|
916
|
-
d(this, "syncUnitTime",
|
|
940
|
+
d(this, "syncUnitTime", A.syncOpt.interval);
|
|
917
941
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
918
942
|
}
|
|
919
943
|
async loadImageBitMap(t) {
|
|
@@ -974,14 +998,14 @@ class ke {
|
|
|
974
998
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
975
999
|
}
|
|
976
1000
|
async animationDraw() {
|
|
977
|
-
var s, o, r, i, a, n, c, h, l,
|
|
1001
|
+
var s, o, r, i, a, n, c, h, l, k, u, y, w, m, W;
|
|
978
1002
|
this.animationId = void 0;
|
|
979
1003
|
let t = !1;
|
|
980
1004
|
const e = /* @__PURE__ */ new Map();
|
|
981
|
-
for (const [g,
|
|
982
|
-
switch (
|
|
1005
|
+
for (const [g, S] of this.workShapes.entries())
|
|
1006
|
+
switch (S.toolsType) {
|
|
983
1007
|
case f.Image: {
|
|
984
|
-
await ((s =
|
|
1008
|
+
await ((s = S.node) == null ? void 0 : s.consumeServiceAsync({
|
|
985
1009
|
isFullWork: !0,
|
|
986
1010
|
worker: this
|
|
987
1011
|
})), this.selectorWorkShapes.forEach((b, O) => {
|
|
@@ -991,13 +1015,13 @@ class ke {
|
|
|
991
1015
|
break;
|
|
992
1016
|
}
|
|
993
1017
|
case f.Text: {
|
|
994
|
-
|
|
1018
|
+
S.node && (await ((o = S.node) == null ? void 0 : o.consumeServiceAsync({
|
|
995
1019
|
isFullWork: !0,
|
|
996
1020
|
replaceId: g
|
|
997
1021
|
})), this.selectorWorkShapes.forEach((b, O) => {
|
|
998
1022
|
var M;
|
|
999
1023
|
(M = b.selectIds) != null && M.includes(g) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
|
|
1000
|
-
}), (r =
|
|
1024
|
+
}), (r = S.node) == null || r.clearTmpPoints(), this.workShapes.delete(g));
|
|
1001
1025
|
break;
|
|
1002
1026
|
}
|
|
1003
1027
|
case f.Arrow:
|
|
@@ -1007,62 +1031,62 @@ class ke {
|
|
|
1007
1031
|
case f.Star:
|
|
1008
1032
|
case f.Polygon:
|
|
1009
1033
|
case f.SpeechBalloon: {
|
|
1010
|
-
const b = !!
|
|
1011
|
-
if ((i =
|
|
1012
|
-
const O =
|
|
1013
|
-
(a =
|
|
1014
|
-
op:
|
|
1034
|
+
const b = !!S.ops;
|
|
1035
|
+
if ((i = S.animationWorkData) != null && i.length) {
|
|
1036
|
+
const O = S.oldRect;
|
|
1037
|
+
(a = S.node) == null || a.consumeService({
|
|
1038
|
+
op: S.animationWorkData,
|
|
1015
1039
|
isFullWork: b
|
|
1016
|
-
}), b && (this.selectorWorkShapes.forEach((M,
|
|
1017
|
-
var
|
|
1018
|
-
(
|
|
1019
|
-
}), (n =
|
|
1020
|
-
workState: O ?
|
|
1021
|
-
op:
|
|
1022
|
-
if (
|
|
1040
|
+
}), b && (this.selectorWorkShapes.forEach((M, C) => {
|
|
1041
|
+
var F;
|
|
1042
|
+
(F = M.selectIds) != null && F.includes(g) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
1043
|
+
}), (n = S.node) == null || n.clearTmpPoints(), this.workShapes.delete(g)), e.set(g, {
|
|
1044
|
+
workState: O ? S.ops ? T.Done : T.Doing : T.Start,
|
|
1045
|
+
op: S.animationWorkData.filter((M, C) => {
|
|
1046
|
+
if (C % 3 !== 2)
|
|
1023
1047
|
return !0;
|
|
1024
1048
|
}).slice(-2)
|
|
1025
|
-
}),
|
|
1049
|
+
}), S.animationWorkData.length = 0;
|
|
1026
1050
|
}
|
|
1027
1051
|
break;
|
|
1028
1052
|
}
|
|
1029
1053
|
case f.Pencil: {
|
|
1030
|
-
if (!
|
|
1031
|
-
(c =
|
|
1032
|
-
op:
|
|
1054
|
+
if (!S.useAnimation && S.ops)
|
|
1055
|
+
(c = S.node) == null || c.consumeService({
|
|
1056
|
+
op: S.animationWorkData || [],
|
|
1033
1057
|
isFullWork: !0,
|
|
1034
1058
|
replaceId: g
|
|
1035
|
-
}), (h =
|
|
1059
|
+
}), (h = S.node) == null || h.updataOptService(S.updateNodeOpt), this.selectorWorkShapes.forEach((b, O) => {
|
|
1036
1060
|
var M;
|
|
1037
1061
|
(M = b.selectIds) != null && M.includes(g) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
|
|
1038
|
-
}), (l =
|
|
1039
|
-
else if (
|
|
1040
|
-
if (
|
|
1041
|
-
(
|
|
1062
|
+
}), (l = S.node) == null || l.clearTmpPoints(), this.workShapes.delete(g);
|
|
1063
|
+
else if (S.useAnimation) {
|
|
1064
|
+
if (S.isDel) {
|
|
1065
|
+
(k = S.node) == null || k.clearTmpPoints(), this.workShapes.delete(g);
|
|
1042
1066
|
break;
|
|
1043
1067
|
}
|
|
1044
|
-
const b = 3, O = this.computNextAnimationIndex(
|
|
1045
|
-
if ((
|
|
1046
|
-
if ((
|
|
1047
|
-
op:
|
|
1068
|
+
const b = 3, O = this.computNextAnimationIndex(S, b), M = S.isDiff ? 0 : Math.max(0, (S.animationIndex || 0) - b), C = (S.animationWorkData || []).slice(M, O), F = (y = (u = S.node) == null ? void 0 : u.getWorkId()) == null ? void 0 : y.toString();
|
|
1069
|
+
if ((S.animationIndex || 0) < O || S.isDiff) {
|
|
1070
|
+
if ((w = S.node) == null || w.consumeService({
|
|
1071
|
+
op: C,
|
|
1048
1072
|
isFullWork: !1
|
|
1049
|
-
}),
|
|
1050
|
-
const H =
|
|
1051
|
-
if (
|
|
1073
|
+
}), S.animationIndex = O, S.isDiff && (S.isDiff = !1), C.length) {
|
|
1074
|
+
const H = C.filter((q, J) => {
|
|
1075
|
+
if (J % b !== b - 1)
|
|
1052
1076
|
return !0;
|
|
1053
1077
|
}).slice(-2);
|
|
1054
1078
|
e.set(g, {
|
|
1055
|
-
workState: M === 0 ?
|
|
1079
|
+
workState: M === 0 ? T.Start : O === ((m = S.animationWorkData) == null ? void 0 : m.length) ? T.Done : T.Doing,
|
|
1056
1080
|
op: H
|
|
1057
1081
|
});
|
|
1058
1082
|
}
|
|
1059
|
-
} else
|
|
1060
|
-
op:
|
|
1083
|
+
} else S.ops && ((W = S.node) == null || W.consumeService({
|
|
1084
|
+
op: S.animationWorkData || [],
|
|
1061
1085
|
isFullWork: !0,
|
|
1062
|
-
replaceId:
|
|
1063
|
-
}),
|
|
1064
|
-
workState:
|
|
1065
|
-
op:
|
|
1086
|
+
replaceId: F
|
|
1087
|
+
}), S.isDel = !0, e.set(g, {
|
|
1088
|
+
workState: T.Done,
|
|
1089
|
+
op: C.filter((H, q) => {
|
|
1066
1090
|
if (q % b !== b - 1)
|
|
1067
1091
|
return !0;
|
|
1068
1092
|
}).slice(-2)
|
|
@@ -1075,12 +1099,12 @@ class ke {
|
|
|
1075
1099
|
}
|
|
1076
1100
|
if (t && this.runAnimation(), e.size) {
|
|
1077
1101
|
const g = [];
|
|
1078
|
-
e.forEach((
|
|
1102
|
+
e.forEach((S, b) => {
|
|
1079
1103
|
g.push({
|
|
1080
1104
|
type: p.Cursor,
|
|
1081
|
-
uid: b.split(
|
|
1082
|
-
op:
|
|
1083
|
-
workState:
|
|
1105
|
+
uid: b.split(P)[0],
|
|
1106
|
+
op: S.op,
|
|
1107
|
+
workState: S.workState,
|
|
1084
1108
|
viewId: this.thread.viewId
|
|
1085
1109
|
});
|
|
1086
1110
|
}), this.thread.post({ sp: g });
|
|
@@ -1110,12 +1134,12 @@ class ke {
|
|
|
1110
1134
|
return !1;
|
|
1111
1135
|
}
|
|
1112
1136
|
activeWorkShape(t) {
|
|
1113
|
-
var y,
|
|
1137
|
+
var y, w, m, W;
|
|
1114
1138
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: n, useAnimation: c, imageBitmap: h } = t;
|
|
1115
1139
|
if (!e)
|
|
1116
1140
|
return;
|
|
1117
|
-
const l = e.toString(),
|
|
1118
|
-
if (!((
|
|
1141
|
+
const l = e.toString(), k = (y = this.vNodes.get(l)) == null ? void 0 : y.rect;
|
|
1142
|
+
if (!((w = this.workShapes) != null && w.has(l))) {
|
|
1119
1143
|
let g = {
|
|
1120
1144
|
toolsType: o,
|
|
1121
1145
|
animationWorkData: n || [],
|
|
@@ -1124,14 +1148,14 @@ class ke {
|
|
|
1124
1148
|
updateNodeOpt: i,
|
|
1125
1149
|
ops: a,
|
|
1126
1150
|
useAnimation: typeof c < "u" ? c : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1127
|
-
oldRect:
|
|
1151
|
+
oldRect: k,
|
|
1128
1152
|
isDiff: !1,
|
|
1129
1153
|
imageBitmap: h
|
|
1130
1154
|
};
|
|
1131
|
-
o && s && (g = this.setNodeKey(l, g, o, s)), (
|
|
1155
|
+
o && s && (g = this.setNodeKey(l, g, o, s)), (m = this.workShapes) == null || m.set(l, g);
|
|
1132
1156
|
}
|
|
1133
1157
|
const u = (W = this.workShapes) == null ? void 0 : W.get(l);
|
|
1134
|
-
r && (u.type = r), a && (u.animationWorkData =
|
|
1158
|
+
r && (u.type = r), a && (u.animationWorkData = x(a), u.ops = a), i && (u.updateNodeOpt = i), n && (u.isDiff = this.hasDiffData(u.animationWorkData || [], n, u.toolsType), u.animationWorkData = n), u.node && u.node.getWorkId() !== l && u.node.setWorkId(l), k && (u.oldRect = k), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), u.toolsType !== o && o && s && this.setNodeKey(l, u, o, s), u.node && u.node.setWorkOptions(s)), h && (u.imageBitmap = h);
|
|
1135
1159
|
}
|
|
1136
1160
|
removeNode(t, e) {
|
|
1137
1161
|
t.indexOf(L) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1151,19 +1175,19 @@ class ke {
|
|
|
1151
1175
|
return;
|
|
1152
1176
|
const a = e.toString();
|
|
1153
1177
|
if (!((c = this.selectorWorkShapes) != null && c.has(a))) {
|
|
1154
|
-
let
|
|
1178
|
+
let k = {
|
|
1155
1179
|
toolsType: o,
|
|
1156
1180
|
selectIds: i,
|
|
1157
1181
|
type: r,
|
|
1158
1182
|
opt: s
|
|
1159
1183
|
};
|
|
1160
|
-
o && s && (
|
|
1184
|
+
o && s && (k = this.setNodeKey(a, k, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, k);
|
|
1161
1185
|
}
|
|
1162
1186
|
const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
|
|
1163
1187
|
r && (n.type = r), n.node && n.node.getWorkId() !== a && n.node.setWorkId(a), n.selectIds = i || [];
|
|
1164
1188
|
}
|
|
1165
1189
|
setNodeKey(t, e, s, o) {
|
|
1166
|
-
return e.toolsType = s, e.node =
|
|
1190
|
+
return e.toolsType = s, e.node = B({
|
|
1167
1191
|
toolsType: s,
|
|
1168
1192
|
toolsOpt: o,
|
|
1169
1193
|
vNodes: this.vNodes,
|
|
@@ -1186,11 +1210,11 @@ class E {
|
|
|
1186
1210
|
class me extends E {
|
|
1187
1211
|
constructor() {
|
|
1188
1212
|
super(...arguments);
|
|
1189
|
-
d(this, "emitEventType",
|
|
1213
|
+
d(this, "emitEventType", I.CopyNode);
|
|
1190
1214
|
}
|
|
1191
1215
|
async consume(e) {
|
|
1192
1216
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1193
|
-
if (s === p.FullWork && o ===
|
|
1217
|
+
if (s === p.FullWork && o === v.Local && r === this.emitEventType)
|
|
1194
1218
|
return this.consumeForLocalWorker(e), !0;
|
|
1195
1219
|
}
|
|
1196
1220
|
async consumeForLocalWorker(e) {
|
|
@@ -1202,11 +1226,11 @@ class me extends E {
|
|
|
1202
1226
|
class ye extends E {
|
|
1203
1227
|
constructor() {
|
|
1204
1228
|
super(...arguments);
|
|
1205
|
-
d(this, "emitEventType",
|
|
1229
|
+
d(this, "emitEventType", I.SetColorNode);
|
|
1206
1230
|
}
|
|
1207
1231
|
async consume(e) {
|
|
1208
1232
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1209
|
-
if (s === p.UpdateNode && o ===
|
|
1233
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1210
1234
|
return this.consumeForLocalWorker(e), !0;
|
|
1211
1235
|
}
|
|
1212
1236
|
async consumeForLocalWorker(e) {
|
|
@@ -1229,7 +1253,7 @@ class ye extends E {
|
|
|
1229
1253
|
...l,
|
|
1230
1254
|
workId: h,
|
|
1231
1255
|
type: p.TextUpdate,
|
|
1232
|
-
dataType:
|
|
1256
|
+
dataType: v.Local,
|
|
1233
1257
|
willSyncService: !0
|
|
1234
1258
|
}) : c.push(
|
|
1235
1259
|
{
|
|
@@ -1250,11 +1274,11 @@ class ye extends E {
|
|
|
1250
1274
|
class we extends E {
|
|
1251
1275
|
constructor() {
|
|
1252
1276
|
super(...arguments);
|
|
1253
|
-
d(this, "emitEventType",
|
|
1277
|
+
d(this, "emitEventType", I.ZIndexNode);
|
|
1254
1278
|
}
|
|
1255
1279
|
async consume(e) {
|
|
1256
1280
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1257
|
-
if (s === p.UpdateNode && o ===
|
|
1281
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1258
1282
|
return this.consumeForLocalWorker(e), !0;
|
|
1259
1283
|
}
|
|
1260
1284
|
async consumeForLocalWorker(e) {
|
|
@@ -1291,17 +1315,17 @@ class we extends E {
|
|
|
1291
1315
|
class ve extends E {
|
|
1292
1316
|
constructor() {
|
|
1293
1317
|
super(...arguments);
|
|
1294
|
-
d(this, "emitEventType",
|
|
1318
|
+
d(this, "emitEventType", I.TranslateNode);
|
|
1295
1319
|
}
|
|
1296
1320
|
async consume(e) {
|
|
1297
1321
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1298
|
-
if (s === p.UpdateNode && o ===
|
|
1322
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1299
1323
|
return await this.consumeForLocalWorker(e), !0;
|
|
1300
1324
|
}
|
|
1301
1325
|
async consumeForLocalWorker(e) {
|
|
1302
1326
|
var h, l;
|
|
1303
1327
|
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: n, emitEventType: c } = e;
|
|
1304
|
-
s === L && o && (o.workState ===
|
|
1328
|
+
s === L && o && (o.workState === T.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== T.Done ? await ((h = this.localWork) == null ? void 0 : h.updateSelector({
|
|
1305
1329
|
updateSelectorOpt: o,
|
|
1306
1330
|
willRefreshSelector: r,
|
|
1307
1331
|
willSyncService: i,
|
|
@@ -1310,18 +1334,18 @@ class ve extends E {
|
|
|
1310
1334
|
textUpdateForWoker: n,
|
|
1311
1335
|
emitEventType: c,
|
|
1312
1336
|
callback: this.updateSelectorCallback
|
|
1313
|
-
})) : o.workState ===
|
|
1337
|
+
})) : o.workState === T.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1314
1338
|
}
|
|
1315
1339
|
updateSelectorCallback(e) {
|
|
1316
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1317
|
-
if (
|
|
1340
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s, k = h.workState, u = o.sp || [];
|
|
1341
|
+
if (k === T.Start)
|
|
1318
1342
|
return {
|
|
1319
1343
|
sp: [],
|
|
1320
1344
|
render: []
|
|
1321
1345
|
};
|
|
1322
1346
|
const y = a == null ? void 0 : a.selectRect;
|
|
1323
1347
|
if (n) {
|
|
1324
|
-
|
|
1348
|
+
k === T.Doing && u.push({
|
|
1325
1349
|
type: p.Select,
|
|
1326
1350
|
selectIds: i.selectIds,
|
|
1327
1351
|
selectRect: y,
|
|
@@ -1330,17 +1354,17 @@ class ve extends E {
|
|
|
1330
1354
|
points: i.getChildrenPoints(),
|
|
1331
1355
|
textOpt: i.textOpt
|
|
1332
1356
|
});
|
|
1333
|
-
for (const [
|
|
1334
|
-
l &&
|
|
1335
|
-
...
|
|
1336
|
-
workId:
|
|
1357
|
+
for (const [w, m] of r.entries())
|
|
1358
|
+
l && m.toolsType === f.Text ? u.push({
|
|
1359
|
+
...m,
|
|
1360
|
+
workId: w,
|
|
1337
1361
|
type: p.TextUpdate,
|
|
1338
|
-
dataType:
|
|
1362
|
+
dataType: v.Local,
|
|
1339
1363
|
willSyncService: !0
|
|
1340
1364
|
}) : u.push(
|
|
1341
1365
|
{
|
|
1342
|
-
...
|
|
1343
|
-
workId:
|
|
1366
|
+
...m,
|
|
1367
|
+
workId: w,
|
|
1344
1368
|
type: p.UpdateNode,
|
|
1345
1369
|
updateNodeOpt: {
|
|
1346
1370
|
useAnimation: !1
|
|
@@ -1357,20 +1381,20 @@ class ve extends E {
|
|
|
1357
1381
|
class ge extends E {
|
|
1358
1382
|
constructor() {
|
|
1359
1383
|
super(...arguments);
|
|
1360
|
-
d(this, "emitEventType",
|
|
1384
|
+
d(this, "emitEventType", I.DeleteNode);
|
|
1361
1385
|
}
|
|
1362
1386
|
async consume() {
|
|
1363
1387
|
return !1;
|
|
1364
1388
|
}
|
|
1365
1389
|
}
|
|
1366
|
-
class
|
|
1390
|
+
class Ie extends E {
|
|
1367
1391
|
constructor() {
|
|
1368
1392
|
super(...arguments);
|
|
1369
|
-
d(this, "emitEventType",
|
|
1393
|
+
d(this, "emitEventType", I.ScaleNode);
|
|
1370
1394
|
}
|
|
1371
1395
|
async consume(e) {
|
|
1372
1396
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1373
|
-
if (s === p.UpdateNode && o ===
|
|
1397
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1374
1398
|
return await this.consumeForLocalWorker(e), !0;
|
|
1375
1399
|
}
|
|
1376
1400
|
async consumeForLocalWorker(e) {
|
|
@@ -1385,8 +1409,8 @@ class Te extends E {
|
|
|
1385
1409
|
}));
|
|
1386
1410
|
}
|
|
1387
1411
|
updateSelectorCallback(e) {
|
|
1388
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c } = s, h = n.workState, l = o.sp || [],
|
|
1389
|
-
if (h ===
|
|
1412
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c } = s, h = n.workState, l = o.sp || [], k = i == null ? void 0 : i.selectRect;
|
|
1413
|
+
if (h === T.Start)
|
|
1390
1414
|
return {
|
|
1391
1415
|
sp: [],
|
|
1392
1416
|
render: []
|
|
@@ -1395,10 +1419,10 @@ class Te extends E {
|
|
|
1395
1419
|
l.push({
|
|
1396
1420
|
type: p.Select,
|
|
1397
1421
|
selectIds: r.selectIds,
|
|
1398
|
-
selectRect:
|
|
1422
|
+
selectRect: k,
|
|
1399
1423
|
willSyncService: !0,
|
|
1400
1424
|
isSync: !0,
|
|
1401
|
-
points: h ===
|
|
1425
|
+
points: h === T.Done && r.getChildrenPoints() || void 0,
|
|
1402
1426
|
textOpt: r.textOpt
|
|
1403
1427
|
});
|
|
1404
1428
|
for (const [u, y] of a.entries())
|
|
@@ -1406,7 +1430,7 @@ class Te extends E {
|
|
|
1406
1430
|
...y,
|
|
1407
1431
|
workId: u,
|
|
1408
1432
|
type: p.TextUpdate,
|
|
1409
|
-
dataType:
|
|
1433
|
+
dataType: v.Local,
|
|
1410
1434
|
willSyncService: !0
|
|
1411
1435
|
}) : l.push(
|
|
1412
1436
|
{
|
|
@@ -1425,14 +1449,14 @@ class Te extends E {
|
|
|
1425
1449
|
};
|
|
1426
1450
|
}
|
|
1427
1451
|
}
|
|
1428
|
-
class
|
|
1452
|
+
class Te extends E {
|
|
1429
1453
|
constructor() {
|
|
1430
1454
|
super(...arguments);
|
|
1431
|
-
d(this, "emitEventType",
|
|
1455
|
+
d(this, "emitEventType", I.RotateNode);
|
|
1432
1456
|
}
|
|
1433
1457
|
async consume(e) {
|
|
1434
1458
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1435
|
-
if (s === p.UpdateNode && o ===
|
|
1459
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1436
1460
|
return await this.consumeForLocalWorker(e), !0;
|
|
1437
1461
|
}
|
|
1438
1462
|
async consumeForLocalWorker(e) {
|
|
@@ -1449,9 +1473,9 @@ class Ie extends E {
|
|
|
1449
1473
|
}));
|
|
1450
1474
|
}
|
|
1451
1475
|
updateSelectorCallback(e) {
|
|
1452
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c, willSerializeData: h, isSync: l } = s,
|
|
1476
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c, willSerializeData: h, isSync: l } = s, k = n.workState, u = o.sp || [], y = i == null ? void 0 : i.selectRect;
|
|
1453
1477
|
if (c) {
|
|
1454
|
-
h &&
|
|
1478
|
+
h && k === T.Done && u.push({
|
|
1455
1479
|
type: p.Select,
|
|
1456
1480
|
selectIds: r.selectIds,
|
|
1457
1481
|
selectRect: y,
|
|
@@ -1459,11 +1483,11 @@ class Ie extends E {
|
|
|
1459
1483
|
isSync: l,
|
|
1460
1484
|
points: r.getChildrenPoints()
|
|
1461
1485
|
});
|
|
1462
|
-
for (const [
|
|
1486
|
+
for (const [w, m] of a.entries())
|
|
1463
1487
|
u.push(
|
|
1464
1488
|
{
|
|
1465
|
-
...
|
|
1466
|
-
workId:
|
|
1489
|
+
...m,
|
|
1490
|
+
workId: w,
|
|
1467
1491
|
type: p.UpdateNode,
|
|
1468
1492
|
updateNodeOpt: {
|
|
1469
1493
|
useAnimation: !1
|
|
@@ -1480,11 +1504,11 @@ class Ie extends E {
|
|
|
1480
1504
|
class We extends E {
|
|
1481
1505
|
constructor() {
|
|
1482
1506
|
super(...arguments);
|
|
1483
|
-
d(this, "emitEventType",
|
|
1507
|
+
d(this, "emitEventType", I.SetFontStyle);
|
|
1484
1508
|
}
|
|
1485
1509
|
async consume(e) {
|
|
1486
1510
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1487
|
-
if (s === p.UpdateNode && o ===
|
|
1511
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1488
1512
|
return await this.consumeForLocalWorker(e), !0;
|
|
1489
1513
|
}
|
|
1490
1514
|
async consumeForLocalWorker(e) {
|
|
@@ -1500,9 +1524,9 @@ class We extends E {
|
|
|
1500
1524
|
}));
|
|
1501
1525
|
}
|
|
1502
1526
|
updateSelectorCallback(e) {
|
|
1503
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1504
|
-
if (n &&
|
|
1505
|
-
h.fontSize &&
|
|
1527
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s, k = o.sp || [], u = a == null ? void 0 : a.selectRect;
|
|
1528
|
+
if (n && k) {
|
|
1529
|
+
h.fontSize && k.push({
|
|
1506
1530
|
type: p.Select,
|
|
1507
1531
|
selectIds: i.selectIds,
|
|
1508
1532
|
selectRect: u,
|
|
@@ -1510,16 +1534,16 @@ class We extends E {
|
|
|
1510
1534
|
isSync: c,
|
|
1511
1535
|
points: i.getChildrenPoints()
|
|
1512
1536
|
});
|
|
1513
|
-
for (const [y,
|
|
1514
|
-
l &&
|
|
1515
|
-
...
|
|
1537
|
+
for (const [y, w] of r.entries())
|
|
1538
|
+
l && w.toolsType === f.Text ? k.push({
|
|
1539
|
+
...w,
|
|
1516
1540
|
workId: y,
|
|
1517
1541
|
type: p.TextUpdate,
|
|
1518
|
-
dataType:
|
|
1542
|
+
dataType: v.Local,
|
|
1519
1543
|
willSyncService: !0
|
|
1520
|
-
}) :
|
|
1544
|
+
}) : k.push(
|
|
1521
1545
|
{
|
|
1522
|
-
...
|
|
1546
|
+
...w,
|
|
1523
1547
|
workId: y,
|
|
1524
1548
|
type: p.UpdateNode,
|
|
1525
1549
|
updateNodeOpt: {
|
|
@@ -1530,18 +1554,18 @@ class We extends E {
|
|
|
1530
1554
|
);
|
|
1531
1555
|
}
|
|
1532
1556
|
return {
|
|
1533
|
-
sp:
|
|
1557
|
+
sp: k
|
|
1534
1558
|
};
|
|
1535
1559
|
}
|
|
1536
1560
|
}
|
|
1537
1561
|
class Ne extends E {
|
|
1538
1562
|
constructor() {
|
|
1539
1563
|
super(...arguments);
|
|
1540
|
-
d(this, "emitEventType",
|
|
1564
|
+
d(this, "emitEventType", I.SetPoint);
|
|
1541
1565
|
}
|
|
1542
1566
|
async consume(e) {
|
|
1543
1567
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1544
|
-
if (s === p.UpdateNode && o ===
|
|
1568
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1545
1569
|
return this.consumeForLocalWorker(e), !0;
|
|
1546
1570
|
}
|
|
1547
1571
|
async consumeForLocalWorker(e) {
|
|
@@ -1561,11 +1585,11 @@ class Ne extends E {
|
|
|
1561
1585
|
updateSelectorCallback(e) {
|
|
1562
1586
|
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c } = s, h = o.sp || [], l = a == null ? void 0 : a.selectRect;
|
|
1563
1587
|
if (n && h) {
|
|
1564
|
-
for (const [
|
|
1588
|
+
for (const [k, u] of r.entries())
|
|
1565
1589
|
h.push(
|
|
1566
1590
|
{
|
|
1567
1591
|
...u,
|
|
1568
|
-
workId:
|
|
1592
|
+
workId: k,
|
|
1569
1593
|
type: p.UpdateNode,
|
|
1570
1594
|
updateNodeOpt: {
|
|
1571
1595
|
useAnimation: !1
|
|
@@ -1590,11 +1614,11 @@ class Ne extends E {
|
|
|
1590
1614
|
class Le extends E {
|
|
1591
1615
|
constructor() {
|
|
1592
1616
|
super(...arguments);
|
|
1593
|
-
d(this, "emitEventType",
|
|
1617
|
+
d(this, "emitEventType", I.SetLock);
|
|
1594
1618
|
}
|
|
1595
1619
|
async consume(e) {
|
|
1596
1620
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1597
|
-
if (s === p.UpdateNode && o ===
|
|
1621
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1598
1622
|
return this.consumeForLocalWorker(e), !0;
|
|
1599
1623
|
}
|
|
1600
1624
|
async consumeForLocalWorker(e) {
|
|
@@ -1609,7 +1633,7 @@ class Le extends E {
|
|
|
1609
1633
|
}));
|
|
1610
1634
|
}
|
|
1611
1635
|
updateSelectorCallback(e) {
|
|
1612
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h } = s, l = o.sp || [],
|
|
1636
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h } = s, l = o.sp || [], k = a == null ? void 0 : a.selectRect;
|
|
1613
1637
|
if (n && l) {
|
|
1614
1638
|
for (const [u, y] of r.entries())
|
|
1615
1639
|
l.push(
|
|
@@ -1630,7 +1654,7 @@ class Le extends E {
|
|
|
1630
1654
|
canRotate: i.canRotate,
|
|
1631
1655
|
type: p.Select,
|
|
1632
1656
|
selectIds: i.selectIds,
|
|
1633
|
-
selectRect:
|
|
1657
|
+
selectRect: k,
|
|
1634
1658
|
willSyncService: n,
|
|
1635
1659
|
isSync: c
|
|
1636
1660
|
});
|
|
@@ -1643,11 +1667,11 @@ class Le extends E {
|
|
|
1643
1667
|
class be extends E {
|
|
1644
1668
|
constructor() {
|
|
1645
1669
|
super(...arguments);
|
|
1646
|
-
d(this, "emitEventType",
|
|
1670
|
+
d(this, "emitEventType", I.SetShapeOpt);
|
|
1647
1671
|
}
|
|
1648
1672
|
async consume(e) {
|
|
1649
1673
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1650
|
-
if (s === p.UpdateNode && o ===
|
|
1674
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1651
1675
|
return this.consumeForLocalWorker(e), !0;
|
|
1652
1676
|
}
|
|
1653
1677
|
async consumeForLocalWorker(e) {
|
|
@@ -1688,27 +1712,27 @@ class Me {
|
|
|
1688
1712
|
}
|
|
1689
1713
|
build(t) {
|
|
1690
1714
|
switch (t) {
|
|
1691
|
-
case
|
|
1715
|
+
case I.TranslateNode:
|
|
1692
1716
|
return new ve();
|
|
1693
|
-
case
|
|
1717
|
+
case I.ZIndexNode:
|
|
1694
1718
|
return new we();
|
|
1695
|
-
case
|
|
1719
|
+
case I.CopyNode:
|
|
1696
1720
|
return new me();
|
|
1697
|
-
case
|
|
1721
|
+
case I.SetColorNode:
|
|
1698
1722
|
return new ye();
|
|
1699
|
-
case
|
|
1723
|
+
case I.DeleteNode:
|
|
1700
1724
|
return new ge();
|
|
1701
|
-
case
|
|
1702
|
-
return new Te();
|
|
1703
|
-
case T.RotateNode:
|
|
1725
|
+
case I.ScaleNode:
|
|
1704
1726
|
return new Ie();
|
|
1705
|
-
case
|
|
1727
|
+
case I.RotateNode:
|
|
1728
|
+
return new Te();
|
|
1729
|
+
case I.SetFontStyle:
|
|
1706
1730
|
return new We();
|
|
1707
|
-
case
|
|
1731
|
+
case I.SetPoint:
|
|
1708
1732
|
return new Ne();
|
|
1709
|
-
case
|
|
1733
|
+
case I.SetLock:
|
|
1710
1734
|
return new Le();
|
|
1711
|
-
case
|
|
1735
|
+
case I.SetShapeOpt:
|
|
1712
1736
|
return new be();
|
|
1713
1737
|
}
|
|
1714
1738
|
}
|
|
@@ -1749,24 +1773,24 @@ class Oe {
|
|
|
1749
1773
|
d(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
1750
1774
|
d(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1751
1775
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1752
|
-
const s =
|
|
1753
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
1776
|
+
const s = A.bufferSize.full, o = A.bufferSize.sub;
|
|
1777
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === R ? s : o }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === R, o) }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === R, o) }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === R, o) }), this.vNodes = new ue(t, this.scene);
|
|
1754
1778
|
const r = {
|
|
1755
1779
|
thread: this,
|
|
1756
1780
|
vNodes: this.vNodes
|
|
1757
1781
|
};
|
|
1758
|
-
this.localWork = new
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1782
|
+
this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new fe(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Me([
|
|
1783
|
+
I.CopyNode,
|
|
1784
|
+
I.SetColorNode,
|
|
1785
|
+
I.DeleteNode,
|
|
1786
|
+
I.RotateNode,
|
|
1787
|
+
I.ScaleNode,
|
|
1788
|
+
I.TranslateNode,
|
|
1789
|
+
I.ZIndexNode,
|
|
1790
|
+
I.SetFontStyle,
|
|
1791
|
+
I.SetPoint,
|
|
1792
|
+
I.SetLock,
|
|
1793
|
+
I.SetShapeOpt
|
|
1770
1794
|
]).registerForMainThread(this);
|
|
1771
1795
|
}
|
|
1772
1796
|
getCachedImages(t) {
|
|
@@ -1788,6 +1812,11 @@ class Oe {
|
|
|
1788
1812
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1789
1813
|
const { msgType: s, toolsType: o, opt: r, dataType: i, workId: a, workState: n, imageSrc: c, imageBitmap: h } = t, l = a == null ? void 0 : a.toString();
|
|
1790
1814
|
switch (s) {
|
|
1815
|
+
case p.AuthClear: {
|
|
1816
|
+
const { clearUids: k, localUid: u } = t;
|
|
1817
|
+
this.vNodes.setCanClearUids(k), this.vNodes.setLocalUid(u);
|
|
1818
|
+
break;
|
|
1819
|
+
}
|
|
1791
1820
|
case p.Destroy:
|
|
1792
1821
|
this.destroy();
|
|
1793
1822
|
break;
|
|
@@ -1799,11 +1828,11 @@ class Oe {
|
|
|
1799
1828
|
break;
|
|
1800
1829
|
case p.UpdateTools:
|
|
1801
1830
|
if (o && r) {
|
|
1802
|
-
const
|
|
1831
|
+
const k = {
|
|
1803
1832
|
toolsType: o,
|
|
1804
1833
|
toolsOpt: r
|
|
1805
1834
|
};
|
|
1806
|
-
this.topWork.canUseTopLayer(o) ? this.topWork.setToolsOpt(
|
|
1835
|
+
this.topWork.canUseTopLayer(o) ? this.topWork.setToolsOpt(k) : this.localWork.setToolsOpt(k);
|
|
1807
1836
|
}
|
|
1808
1837
|
break;
|
|
1809
1838
|
case p.CreateWork:
|
|
@@ -1822,7 +1851,7 @@ class Oe {
|
|
|
1822
1851
|
}
|
|
1823
1852
|
break;
|
|
1824
1853
|
case p.DrawWork:
|
|
1825
|
-
n ===
|
|
1854
|
+
n === T.Done && i === v.Local ? this.consumeDrawAll(i, t) : this.consumeDraw(i, t);
|
|
1826
1855
|
break;
|
|
1827
1856
|
case p.UpdateNode:
|
|
1828
1857
|
case p.FullWork:
|
|
@@ -1836,18 +1865,18 @@ class Oe {
|
|
|
1836
1865
|
await this.removeNode(t);
|
|
1837
1866
|
return;
|
|
1838
1867
|
case p.Select:
|
|
1839
|
-
i ===
|
|
1868
|
+
i === v.Service && (a === L ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
|
|
1840
1869
|
break;
|
|
1841
1870
|
case p.CursorHover:
|
|
1842
1871
|
this.localWork.cursorHover(t);
|
|
1843
1872
|
break;
|
|
1844
1873
|
case p.GetTextActive:
|
|
1845
|
-
i ===
|
|
1874
|
+
i === v.Local && this.localWork.checkTextActive(t);
|
|
1846
1875
|
break;
|
|
1847
1876
|
case p.GetImageBitMap:
|
|
1848
1877
|
if (c && h && this.cacheImages.set(c, h), a) {
|
|
1849
|
-
const
|
|
1850
|
-
u && u(
|
|
1878
|
+
const k = a.toString(), u = (e = this.imageResolveMap.get(k)) == null ? void 0 : e.resolve;
|
|
1879
|
+
u && u(k);
|
|
1851
1880
|
}
|
|
1852
1881
|
break;
|
|
1853
1882
|
}
|
|
@@ -1890,12 +1919,12 @@ class Oe {
|
|
|
1890
1919
|
await this.localWork.removeSelector(t);
|
|
1891
1920
|
continue;
|
|
1892
1921
|
}
|
|
1893
|
-
e ===
|
|
1922
|
+
e === v.Local ? this.localWork.removeWork(t) : e === v.Service && this.serviceWork.removeWork(t), await this.localWork.colloctEffectSelectWork(t);
|
|
1894
1923
|
}
|
|
1895
1924
|
}
|
|
1896
1925
|
async consumeFull(t, e) {
|
|
1897
1926
|
const s = await this.localWork.colloctEffectSelectWork(e);
|
|
1898
|
-
s && t ===
|
|
1927
|
+
s && t === v.Local && await this.localWork.consumeFull(s), s && t === v.Service && this.serviceWork.consumeFull(s);
|
|
1899
1928
|
}
|
|
1900
1929
|
setCameraOpt(t) {
|
|
1901
1930
|
this.cameraOpt = t;
|
|
@@ -1930,7 +1959,7 @@ class Oe {
|
|
|
1930
1959
|
}
|
|
1931
1960
|
combinePost() {
|
|
1932
1961
|
var s, o;
|
|
1933
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None);
|
|
1962
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
|
|
1934
1963
|
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.drawCount === void 0 && delete t.drawCount, (t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
|
|
1935
1964
|
}
|
|
1936
1965
|
clearAll() {
|
|
@@ -1947,10 +1976,10 @@ class Oe {
|
|
|
1947
1976
|
if (o) {
|
|
1948
1977
|
const r = o.toString();
|
|
1949
1978
|
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1950
|
-
t ===
|
|
1979
|
+
t === v.Local && (this.topWork.getLocalWorkShape(o.toString()) || this.topWork.createLocalWork(e)), this.topWork.consumeDrawAll(e);
|
|
1951
1980
|
return;
|
|
1952
1981
|
}
|
|
1953
|
-
t ===
|
|
1982
|
+
t === v.Local && (this.localWork.getWorkShape(r) || this.localWork.createLocalWork(e), this.localWork.consumeDrawAll(e, this.serviceWork));
|
|
1954
1983
|
}
|
|
1955
1984
|
}
|
|
1956
1985
|
consumeDraw(t, e) {
|
|
@@ -1958,10 +1987,10 @@ class Oe {
|
|
|
1958
1987
|
if (o && r && s) {
|
|
1959
1988
|
const i = o.toString();
|
|
1960
1989
|
if (this.topWork.canUseTopLayer(r)) {
|
|
1961
|
-
t ===
|
|
1990
|
+
t === v.Local && (this.topWork.getLocalWorkShape(i) || this.topWork.createLocalWork(e)), this.topWork.consumeDraw(e);
|
|
1962
1991
|
return;
|
|
1963
1992
|
}
|
|
1964
|
-
t ===
|
|
1993
|
+
t === v.Local ? (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(e), this.localWork.consumeDraw(e, this.serviceWork)) : t === v.Service && this.serviceWork.consumeDraw(e);
|
|
1965
1994
|
return;
|
|
1966
1995
|
}
|
|
1967
1996
|
}
|
|
@@ -1994,7 +2023,7 @@ class Oe {
|
|
|
1994
2023
|
const r = /* @__PURE__ */ new Map();
|
|
1995
2024
|
for (const [c, h] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
1996
2025
|
const l = h.rect;
|
|
1997
|
-
r.set(c,
|
|
2026
|
+
r.set(c, Q(l));
|
|
1998
2027
|
}
|
|
1999
2028
|
const i = new Set(r.keys());
|
|
2000
2029
|
let a = !1;
|
|
@@ -2021,11 +2050,11 @@ class Oe {
|
|
|
2021
2050
|
for (const [c, h] of r.entries()) {
|
|
2022
2051
|
const l = this.vNodes.get(c);
|
|
2023
2052
|
if (l) {
|
|
2024
|
-
const
|
|
2053
|
+
const k = h, u = l.rect, y = this.getSceneRect(), w = z(k, y), m = z(u, y);
|
|
2025
2054
|
let W = !1;
|
|
2026
|
-
if ((
|
|
2027
|
-
const { toolsType: g, opt:
|
|
2028
|
-
g === f.Text &&
|
|
2055
|
+
if ((w !== m || k.w !== u.w || k.h !== u.h || m === V.intersect) && (W = !0), W) {
|
|
2056
|
+
const { toolsType: g, opt: S } = l;
|
|
2057
|
+
g === f.Text && S.workState === T.Done && this.debounceUpdateCache.add(c);
|
|
2029
2058
|
}
|
|
2030
2059
|
}
|
|
2031
2060
|
}
|
|
@@ -2035,7 +2064,7 @@ class Oe {
|
|
|
2035
2064
|
workId: c,
|
|
2036
2065
|
selectIds: h.selectIds,
|
|
2037
2066
|
msgType: p.Select,
|
|
2038
|
-
dataType:
|
|
2067
|
+
dataType: v.Service,
|
|
2039
2068
|
viewId: this.viewId
|
|
2040
2069
|
});
|
|
2041
2070
|
this.debounceUpdateCameraId = setTimeout(() => {
|
|
@@ -2046,17 +2075,17 @@ class Oe {
|
|
|
2046
2075
|
if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
|
|
2047
2076
|
const u = this.vNodes.get(l);
|
|
2048
2077
|
if (u) {
|
|
2049
|
-
const { toolsType: y, opt:
|
|
2078
|
+
const { toolsType: y, opt: w, rect: m } = u, W = this.localWork.setFullWork({
|
|
2050
2079
|
toolsType: y,
|
|
2051
|
-
opt:
|
|
2080
|
+
opt: w,
|
|
2052
2081
|
workId: l
|
|
2053
2082
|
});
|
|
2054
2083
|
if (W) {
|
|
2055
|
-
const g = this.getSceneRect(),
|
|
2084
|
+
const g = this.getSceneRect(), S = z(m, g);
|
|
2056
2085
|
c.push(W.consumeServiceAsync({
|
|
2057
2086
|
isFullWork: !0,
|
|
2058
2087
|
replaceId: l,
|
|
2059
|
-
isDrawLabel:
|
|
2088
|
+
isDrawLabel: S !== V.outside
|
|
2060
2089
|
}));
|
|
2061
2090
|
}
|
|
2062
2091
|
}
|
|
@@ -2078,7 +2107,7 @@ class Oe {
|
|
|
2078
2107
|
};
|
|
2079
2108
|
}
|
|
2080
2109
|
createScene(t) {
|
|
2081
|
-
return new
|
|
2110
|
+
return new X({
|
|
2082
2111
|
displayRatio: this.opt.displayer.dpr,
|
|
2083
2112
|
depth: !1,
|
|
2084
2113
|
desynchronized: !0,
|
|
@@ -2088,7 +2117,7 @@ class Oe {
|
|
|
2088
2117
|
});
|
|
2089
2118
|
}
|
|
2090
2119
|
createLayer(t, e, s) {
|
|
2091
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), n = new
|
|
2120
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), n = new Y({
|
|
2092
2121
|
anchor: [0.5, 0.5],
|
|
2093
2122
|
pos: [o * 0.5, r * 0.5],
|
|
2094
2123
|
size: [o, r],
|
|
@@ -2122,7 +2151,7 @@ class Ee {
|
|
|
2122
2151
|
d(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2123
2152
|
d(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2124
2153
|
d(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
2125
|
-
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
2154
|
+
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === R ? 6e3 : 3e3 });
|
|
2126
2155
|
}
|
|
2127
2156
|
getCachedImages(t) {
|
|
2128
2157
|
return this.cacheImages.get(t);
|
|
@@ -2186,7 +2215,7 @@ class Ee {
|
|
|
2186
2215
|
}
|
|
2187
2216
|
}
|
|
2188
2217
|
createWorkShapeNode(t) {
|
|
2189
|
-
return
|
|
2218
|
+
return B({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
|
|
2190
2219
|
}
|
|
2191
2220
|
setFullWork(t) {
|
|
2192
2221
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -2202,7 +2231,7 @@ class Ee {
|
|
|
2202
2231
|
}
|
|
2203
2232
|
async runFullWork(t) {
|
|
2204
2233
|
var o;
|
|
2205
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
2234
|
+
const e = this.setFullWork(t), s = t.ops && x(t.ops);
|
|
2206
2235
|
if (e) {
|
|
2207
2236
|
let r, i;
|
|
2208
2237
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
@@ -2217,7 +2246,7 @@ class Ee {
|
|
|
2217
2246
|
op: s,
|
|
2218
2247
|
isFullWork: !0,
|
|
2219
2248
|
replaceId: a
|
|
2220
|
-
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)),
|
|
2249
|
+
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), U(r, i);
|
|
2221
2250
|
}
|
|
2222
2251
|
}
|
|
2223
2252
|
async getSnapshot(t) {
|
|
@@ -2230,15 +2259,15 @@ class Ee {
|
|
|
2230
2259
|
switch (h == null ? void 0 : h.type) {
|
|
2231
2260
|
case p.UpdateNode:
|
|
2232
2261
|
case p.FullWork: {
|
|
2233
|
-
const { opt: l } = h,
|
|
2262
|
+
const { opt: l } = h, k = {
|
|
2234
2263
|
...h,
|
|
2235
2264
|
opt: l,
|
|
2236
2265
|
workId: c,
|
|
2237
2266
|
msgType: p.FullWork,
|
|
2238
|
-
dataType:
|
|
2267
|
+
dataType: v.Service,
|
|
2239
2268
|
viewId: this.viewId
|
|
2240
|
-
}, u = await this.runFullWork(
|
|
2241
|
-
a =
|
|
2269
|
+
}, u = await this.runFullWork(k);
|
|
2270
|
+
a = U(a, u);
|
|
2242
2271
|
break;
|
|
2243
2272
|
}
|
|
2244
2273
|
}
|
|
@@ -2290,10 +2319,10 @@ class Ee {
|
|
|
2290
2319
|
...a,
|
|
2291
2320
|
workId: i,
|
|
2292
2321
|
msgType: p.FullWork,
|
|
2293
|
-
dataType:
|
|
2322
|
+
dataType: v.Service,
|
|
2294
2323
|
viewId: this.viewId
|
|
2295
2324
|
});
|
|
2296
|
-
r =
|
|
2325
|
+
r = U(r, n);
|
|
2297
2326
|
break;
|
|
2298
2327
|
}
|
|
2299
2328
|
}
|
|
@@ -2334,11 +2363,11 @@ class Ee {
|
|
|
2334
2363
|
}
|
|
2335
2364
|
combinePost() {
|
|
2336
2365
|
var s, o;
|
|
2337
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None);
|
|
2366
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
|
|
2338
2367
|
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
|
|
2339
2368
|
}
|
|
2340
2369
|
createScene(t) {
|
|
2341
|
-
return new
|
|
2370
|
+
return new X({
|
|
2342
2371
|
displayRatio: this.opt.displayer.dpr,
|
|
2343
2372
|
depth: !1,
|
|
2344
2373
|
desynchronized: !0,
|
|
@@ -2347,7 +2376,7 @@ class Ee {
|
|
|
2347
2376
|
});
|
|
2348
2377
|
}
|
|
2349
2378
|
createLayer(t, e, s) {
|
|
2350
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), n = new
|
|
2379
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), n = new Y({
|
|
2351
2380
|
anchor: [0.5, 0.5],
|
|
2352
2381
|
pos: [o * 0.5, r * 0.5],
|
|
2353
2382
|
size: [o, r],
|
|
@@ -2392,20 +2421,20 @@ class Be {
|
|
|
2392
2421
|
async consume(t) {
|
|
2393
2422
|
var e, s, o, r;
|
|
2394
2423
|
for (const i of t.values()) {
|
|
2395
|
-
const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt:
|
|
2424
|
+
const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: k, cameraOpt: u, isSubWorker: y } = i;
|
|
2396
2425
|
if (a === p.Console) {
|
|
2397
2426
|
console.log(this);
|
|
2398
2427
|
continue;
|
|
2399
2428
|
}
|
|
2400
2429
|
if (a === p.Init) {
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2430
|
+
const m = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, W = m == null ? void 0 : m.canvasContainerRef.current;
|
|
2431
|
+
if (m && W && l && k) {
|
|
2403
2432
|
const g = this.createMainThread(n, {
|
|
2404
|
-
displayer:
|
|
2433
|
+
displayer: m,
|
|
2405
2434
|
container: W,
|
|
2406
2435
|
layerOpt: l,
|
|
2407
2436
|
master: this.master,
|
|
2408
|
-
canvasOpt:
|
|
2437
|
+
canvasOpt: k,
|
|
2409
2438
|
post: this.post.bind(this)
|
|
2410
2439
|
});
|
|
2411
2440
|
this.mainThreadMap.set(n, g), g && u && g.setCameraOpt(u);
|
|
@@ -2413,25 +2442,25 @@ class Be {
|
|
|
2413
2442
|
continue;
|
|
2414
2443
|
}
|
|
2415
2444
|
if ((a === p.Snapshot || a === p.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2445
|
+
const m = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, W = (r = m.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2446
|
+
if (m && W && u) {
|
|
2418
2447
|
W.style.width = `${u.width}px`, W.style.height = `${u.height}px`;
|
|
2419
2448
|
const g = {
|
|
2420
2449
|
...Z.defaultLayerOpt,
|
|
2421
2450
|
offscreen: !1,
|
|
2422
2451
|
width: u.width,
|
|
2423
2452
|
height: u.height
|
|
2424
|
-
},
|
|
2453
|
+
}, S = {
|
|
2425
2454
|
...Z.defaultScreenCanvasOpt,
|
|
2426
2455
|
width: u.width,
|
|
2427
2456
|
height: u.height
|
|
2428
2457
|
};
|
|
2429
2458
|
this.snapshotThread = this.createSnapshotThread(n, {
|
|
2430
|
-
displayer:
|
|
2459
|
+
displayer: m,
|
|
2431
2460
|
container: W,
|
|
2432
2461
|
layerOpt: g,
|
|
2433
2462
|
master: this.master,
|
|
2434
|
-
canvasOpt:
|
|
2463
|
+
canvasOpt: S,
|
|
2435
2464
|
post: this.post.bind(this)
|
|
2436
2465
|
}), this.snapshotThread.on(i).then(() => {
|
|
2437
2466
|
this.snapshotThread = void 0, W.innerHTML = "", W.style.width = "", W.style.height = "";
|
|
@@ -2444,19 +2473,19 @@ class Be {
|
|
|
2444
2473
|
continue;
|
|
2445
2474
|
}
|
|
2446
2475
|
if (a === p.TasksQueue && (c != null && c.size)) {
|
|
2447
|
-
for (const [
|
|
2448
|
-
const g = c.get(
|
|
2476
|
+
for (const [m, W] of this.mainThreadMap.entries()) {
|
|
2477
|
+
const g = c.get(m);
|
|
2449
2478
|
g && (await W.on(g), h && this.post({ workerTasksqueueCount: h }));
|
|
2450
2479
|
}
|
|
2451
2480
|
continue;
|
|
2452
2481
|
}
|
|
2453
2482
|
if (n === he) {
|
|
2454
|
-
for (const
|
|
2455
|
-
|
|
2483
|
+
for (const m of this.mainThreadMap.values())
|
|
2484
|
+
m.on(i), a === p.Destroy && this.mainThreadMap.delete(n);
|
|
2456
2485
|
continue;
|
|
2457
2486
|
}
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2487
|
+
const w = this.mainThreadMap.get(n);
|
|
2488
|
+
w && (w.on(i), a === p.Destroy && this.mainThreadMap.delete(n));
|
|
2460
2489
|
}
|
|
2461
2490
|
}
|
|
2462
2491
|
}
|