@netless/appliance-plugin 1.1.0-beta.1 → 1.1.0-hotfix.2
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-BHRyQO.js} +26 -26
- package/cdn/{subWorker-DUJqv_.js → subWorker-CLSA7o.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 +18 -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 +61 -12
- package/dist/core/enum.d.ts +9 -1
- package/dist/core/mainEngine.d.ts +11 -10
- package/dist/core/renderCotrol.d.ts +121 -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/core/worker/base.d.ts +3 -2
- package/dist/fullWorker.js +26 -26
- package/dist/index-BWmduyVA.js +1 -0
- package/dist/index-CF4Y05EO.js +1 -0
- package/dist/{index-C4KNxHht.mjs → index-Cu_CC99v.mjs} +314 -283
- package/dist/index-o7o698HO.mjs +14959 -0
- package/dist/members/index.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +11 -2
- package/dist/plugin/const.d.ts +0 -4
- package/dist/plugin/types.d.ts +8 -1
- package/dist/style.css +1 -1
- package/dist/subWorker.js +26 -26
- package/package.json +2 -2
- package/dist/index-C29o_HLi.js +0 -1
- package/dist/index-CIJP6_Qj.mjs +0 -14190
- package/dist/index-DmfRoAiB.js +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var te = Object.defineProperty;
|
|
2
2
|
var se = (N, t, e) => t in N ? te(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
|
|
3
3
|
var d = (N, t, e) => se(N, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { E as f, a as I,
|
|
4
|
+
import { E as f, a as I, c as D, b as oe, i as re, d as ie, e as U, g as ae, S as P, f as ce, D as A, h as v, j as B, t as x, k as p, l as L, m as K, n as ne, C as _, o as le, p as T, M as R, T as G, q as z, r as V, s as X, u as he, v as $, V as Z, w as pe } from "./index-o7o698HO.mjs";
|
|
5
5
|
import { Scene as Y, Group as Q } from "spritejs";
|
|
6
|
-
import { cloneDeep as J, xor as
|
|
6
|
+
import { cloneDeep as J, xor as de, isEqual as j, isNumber as ue } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
8
8
|
import "white-web-sdk";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "react";
|
|
11
|
-
class
|
|
11
|
+
class fe {
|
|
12
12
|
constructor(t, e) {
|
|
13
13
|
d(this, "viewId");
|
|
14
14
|
d(this, "scene");
|
|
@@ -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 === I.Doing || o.opt.workState === I.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 && oe(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)), re(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 (
|
|
82
|
+
if (ie(t, a.rect)) {
|
|
81
83
|
if (e && a.toolsType === f.Image && a.opt.locked || s && a.toolsType === f.Text && (a.opt.workState === I.Doing || a.opt.workState === I.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,
|
|
@@ -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,8 +143,23 @@ 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 (ce(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
|
-
class
|
|
162
|
+
class ke {
|
|
152
163
|
constructor(t) {
|
|
153
164
|
d(this, "vNodes");
|
|
154
165
|
d(this, "thread");
|
|
@@ -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) {
|
|
@@ -198,7 +209,7 @@ 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);
|
|
@@ -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 ? I.Start : l === ((r = c.animationWorkData) == null ? void 0 : r.length) ? I.Done : I.Doing,
|
|
267
278
|
op: u.slice(-2)
|
|
268
279
|
})), c.isDel) {
|
|
269
280
|
(i = c.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
|
|
@@ -274,10 +285,10 @@ 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
|
|
@@ -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
|
|
@@ -317,7 +328,7 @@ class fe {
|
|
|
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);
|
|
@@ -338,10 +349,10 @@ 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
|
-
d(this, "batchEraserCombine",
|
|
355
|
+
d(this, "batchEraserCombine", le(() => {
|
|
345
356
|
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
346
357
|
}, 100, { leading: !1 }));
|
|
347
358
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
@@ -366,13 +377,13 @@ 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
389
|
selectIds: J(e.selectIds),
|
|
@@ -381,14 +392,14 @@ class Se {
|
|
|
381
392
|
worker: this
|
|
382
393
|
})), n = /* @__PURE__ */ new Map();
|
|
383
394
|
let c;
|
|
384
|
-
a != null && a.selectIds && (c =
|
|
395
|
+
a != null && a.selectIds && (c = de(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 &&
|
|
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 && ne([l, k], a) && h.workState === I.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 me {
|
|
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 ? I.Done : I.Doing : I.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 =
|
|
1073
|
+
}), S.animationIndex = O, S.isDiff && (S.isDiff = !1), C.length) {
|
|
1074
|
+
const H = C.filter((q, ee) => {
|
|
1051
1075
|
if (ee % b !== b - 1)
|
|
1052
1076
|
return !0;
|
|
1053
1077
|
}).slice(-2);
|
|
1054
1078
|
e.set(g, {
|
|
1055
|
-
workState: M === 0 ? I.Start : O === ((
|
|
1079
|
+
workState: M === 0 ? I.Start : O === ((m = S.animationWorkData) == null ? void 0 : m.length) ? I.Done : I.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
|
-
}),
|
|
1086
|
+
replaceId: F
|
|
1087
|
+
}), S.isDel = !0, e.set(g, {
|
|
1064
1088
|
workState: I.Done,
|
|
1065
|
-
op:
|
|
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,
|
|
@@ -1183,14 +1207,14 @@ class E {
|
|
|
1183
1207
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1184
1208
|
}
|
|
1185
1209
|
}
|
|
1186
|
-
class
|
|
1210
|
+
class ye extends E {
|
|
1187
1211
|
constructor() {
|
|
1188
1212
|
super(...arguments);
|
|
1189
1213
|
d(this, "emitEventType", T.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) {
|
|
@@ -1199,14 +1223,14 @@ class me extends E {
|
|
|
1199
1223
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1200
1224
|
}
|
|
1201
1225
|
}
|
|
1202
|
-
class
|
|
1226
|
+
class we extends E {
|
|
1203
1227
|
constructor() {
|
|
1204
1228
|
super(...arguments);
|
|
1205
1229
|
d(this, "emitEventType", T.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
|
{
|
|
@@ -1247,14 +1271,14 @@ class ye extends E {
|
|
|
1247
1271
|
};
|
|
1248
1272
|
}
|
|
1249
1273
|
}
|
|
1250
|
-
class
|
|
1274
|
+
class ve extends E {
|
|
1251
1275
|
constructor() {
|
|
1252
1276
|
super(...arguments);
|
|
1253
1277
|
d(this, "emitEventType", T.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) {
|
|
@@ -1288,14 +1312,14 @@ class we extends E {
|
|
|
1288
1312
|
};
|
|
1289
1313
|
}
|
|
1290
1314
|
}
|
|
1291
|
-
class
|
|
1315
|
+
class ge extends E {
|
|
1292
1316
|
constructor() {
|
|
1293
1317
|
super(...arguments);
|
|
1294
1318
|
d(this, "emitEventType", T.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) {
|
|
@@ -1313,15 +1337,15 @@ class ve extends E {
|
|
|
1313
1337
|
})) : o.workState === I.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 === I.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 === I.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
|
|
@@ -1354,7 +1378,7 @@ class ve extends E {
|
|
|
1354
1378
|
};
|
|
1355
1379
|
}
|
|
1356
1380
|
}
|
|
1357
|
-
class
|
|
1381
|
+
class Te extends E {
|
|
1358
1382
|
constructor() {
|
|
1359
1383
|
super(...arguments);
|
|
1360
1384
|
d(this, "emitEventType", T.DeleteNode);
|
|
@@ -1363,14 +1387,14 @@ class ge extends E {
|
|
|
1363
1387
|
return !1;
|
|
1364
1388
|
}
|
|
1365
1389
|
}
|
|
1366
|
-
class
|
|
1390
|
+
class Ie extends E {
|
|
1367
1391
|
constructor() {
|
|
1368
1392
|
super(...arguments);
|
|
1369
1393
|
d(this, "emitEventType", T.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,7 +1409,7 @@ 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 || [],
|
|
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;
|
|
1389
1413
|
if (h === I.Start)
|
|
1390
1414
|
return {
|
|
1391
1415
|
sp: [],
|
|
@@ -1395,7 +1419,7 @@ 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
1425
|
points: h === I.Done && r.getChildrenPoints() || void 0,
|
|
@@ -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 We extends E {
|
|
1429
1453
|
constructor() {
|
|
1430
1454
|
super(...arguments);
|
|
1431
1455
|
d(this, "emitEventType", T.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 === I.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
|
|
@@ -1477,14 +1501,14 @@ class Ie extends E {
|
|
|
1477
1501
|
};
|
|
1478
1502
|
}
|
|
1479
1503
|
}
|
|
1480
|
-
class
|
|
1504
|
+
class Ne extends E {
|
|
1481
1505
|
constructor() {
|
|
1482
1506
|
super(...arguments);
|
|
1483
1507
|
d(this, "emitEventType", T.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
|
-
class
|
|
1561
|
+
class Le extends E {
|
|
1538
1562
|
constructor() {
|
|
1539
1563
|
super(...arguments);
|
|
1540
1564
|
d(this, "emitEventType", T.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
|
|
@@ -1587,14 +1611,14 @@ class Ne extends E {
|
|
|
1587
1611
|
};
|
|
1588
1612
|
}
|
|
1589
1613
|
}
|
|
1590
|
-
class
|
|
1614
|
+
class be extends E {
|
|
1591
1615
|
constructor() {
|
|
1592
1616
|
super(...arguments);
|
|
1593
1617
|
d(this, "emitEventType", T.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
|
});
|
|
@@ -1640,14 +1664,14 @@ class Le extends E {
|
|
|
1640
1664
|
};
|
|
1641
1665
|
}
|
|
1642
1666
|
}
|
|
1643
|
-
class
|
|
1667
|
+
class Me extends E {
|
|
1644
1668
|
constructor() {
|
|
1645
1669
|
super(...arguments);
|
|
1646
1670
|
d(this, "emitEventType", T.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) {
|
|
@@ -1681,7 +1705,7 @@ class be extends E {
|
|
|
1681
1705
|
};
|
|
1682
1706
|
}
|
|
1683
1707
|
}
|
|
1684
|
-
class
|
|
1708
|
+
class Oe {
|
|
1685
1709
|
constructor(t) {
|
|
1686
1710
|
d(this, "builders", /* @__PURE__ */ new Map());
|
|
1687
1711
|
this.builders = new Map(t.map((e) => [e, this.build(e)]));
|
|
@@ -1689,27 +1713,27 @@ class Me {
|
|
|
1689
1713
|
build(t) {
|
|
1690
1714
|
switch (t) {
|
|
1691
1715
|
case T.TranslateNode:
|
|
1692
|
-
return new
|
|
1716
|
+
return new ge();
|
|
1693
1717
|
case T.ZIndexNode:
|
|
1694
|
-
return new
|
|
1718
|
+
return new ve();
|
|
1695
1719
|
case T.CopyNode:
|
|
1696
|
-
return new me();
|
|
1697
|
-
case T.SetColorNode:
|
|
1698
1720
|
return new ye();
|
|
1721
|
+
case T.SetColorNode:
|
|
1722
|
+
return new we();
|
|
1699
1723
|
case T.DeleteNode:
|
|
1700
|
-
return new ge();
|
|
1701
|
-
case T.ScaleNode:
|
|
1702
1724
|
return new Te();
|
|
1703
|
-
case T.
|
|
1725
|
+
case T.ScaleNode:
|
|
1704
1726
|
return new Ie();
|
|
1705
|
-
case T.
|
|
1727
|
+
case T.RotateNode:
|
|
1706
1728
|
return new We();
|
|
1707
|
-
case T.
|
|
1729
|
+
case T.SetFontStyle:
|
|
1708
1730
|
return new Ne();
|
|
1709
|
-
case T.
|
|
1731
|
+
case T.SetPoint:
|
|
1710
1732
|
return new Le();
|
|
1711
|
-
case T.
|
|
1733
|
+
case T.SetLock:
|
|
1712
1734
|
return new be();
|
|
1735
|
+
case T.SetShapeOpt:
|
|
1736
|
+
return new Me();
|
|
1713
1737
|
}
|
|
1714
1738
|
}
|
|
1715
1739
|
registerForMainThread(t) {
|
|
@@ -1724,7 +1748,7 @@ class Me {
|
|
|
1724
1748
|
return !1;
|
|
1725
1749
|
}
|
|
1726
1750
|
}
|
|
1727
|
-
class
|
|
1751
|
+
class Ee {
|
|
1728
1752
|
constructor(t, e) {
|
|
1729
1753
|
d(this, "viewId");
|
|
1730
1754
|
d(this, "fullLayer");
|
|
@@ -1749,13 +1773,13 @@ 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 fe(t, this.scene);
|
|
1754
1778
|
const r = {
|
|
1755
1779
|
thread: this,
|
|
1756
1780
|
vNodes: this.vNodes
|
|
1757
1781
|
};
|
|
1758
|
-
this.localWork = new Se(r), this.serviceWork = new
|
|
1782
|
+
this.localWork = new Se(r), this.serviceWork = new me(r), this.topWork = new ke(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Oe([
|
|
1759
1783
|
T.CopyNode,
|
|
1760
1784
|
T.SetColorNode,
|
|
1761
1785
|
T.DeleteNode,
|
|
@@ -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 === I.Done && i ===
|
|
1854
|
+
n === I.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;
|
|
@@ -1921,7 +1950,7 @@ class Oe {
|
|
|
1921
1950
|
}
|
|
1922
1951
|
i || t.push(r);
|
|
1923
1952
|
}
|
|
1924
|
-
|
|
1953
|
+
ue(o.drawCount) && (e = o.drawCount);
|
|
1925
1954
|
}
|
|
1926
1955
|
return this.combinePostMsg.clear(), {
|
|
1927
1956
|
sp: 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
|
}
|
|
@@ -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 === I.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
|
}
|
|
@@ -2084,7 +2113,8 @@ class Oe {
|
|
|
2084
2113
|
desynchronized: !0,
|
|
2085
2114
|
...t,
|
|
2086
2115
|
autoRender: !0,
|
|
2087
|
-
id: this.viewId
|
|
2116
|
+
id: this.viewId,
|
|
2117
|
+
contextType: X.Canvas2d
|
|
2088
2118
|
});
|
|
2089
2119
|
}
|
|
2090
2120
|
createLayer(t, e, s) {
|
|
@@ -2110,7 +2140,7 @@ class Oe {
|
|
|
2110
2140
|
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), this.topLayer.remove(), this.localLayer.remove(), this.serviceLayer.remove(), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
|
|
2111
2141
|
}
|
|
2112
2142
|
}
|
|
2113
|
-
class
|
|
2143
|
+
class Ce {
|
|
2114
2144
|
constructor(t, e) {
|
|
2115
2145
|
d(this, "viewId");
|
|
2116
2146
|
d(this, "fullLayer");
|
|
@@ -2122,7 +2152,7 @@ class Ee {
|
|
|
2122
2152
|
d(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2123
2153
|
d(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2124
2154
|
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 ===
|
|
2155
|
+
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
2156
|
}
|
|
2127
2157
|
getCachedImages(t) {
|
|
2128
2158
|
return this.cacheImages.get(t);
|
|
@@ -2186,7 +2216,7 @@ class Ee {
|
|
|
2186
2216
|
}
|
|
2187
2217
|
}
|
|
2188
2218
|
createWorkShapeNode(t) {
|
|
2189
|
-
return
|
|
2219
|
+
return B({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
|
|
2190
2220
|
}
|
|
2191
2221
|
setFullWork(t) {
|
|
2192
2222
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -2202,7 +2232,7 @@ class Ee {
|
|
|
2202
2232
|
}
|
|
2203
2233
|
async runFullWork(t) {
|
|
2204
2234
|
var o;
|
|
2205
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
2235
|
+
const e = this.setFullWork(t), s = t.ops && x(t.ops);
|
|
2206
2236
|
if (e) {
|
|
2207
2237
|
let r, i;
|
|
2208
2238
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
@@ -2217,7 +2247,7 @@ class Ee {
|
|
|
2217
2247
|
op: s,
|
|
2218
2248
|
isFullWork: !0,
|
|
2219
2249
|
replaceId: a
|
|
2220
|
-
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)),
|
|
2250
|
+
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), U(r, i);
|
|
2221
2251
|
}
|
|
2222
2252
|
}
|
|
2223
2253
|
async getSnapshot(t) {
|
|
@@ -2230,15 +2260,15 @@ class Ee {
|
|
|
2230
2260
|
switch (h == null ? void 0 : h.type) {
|
|
2231
2261
|
case p.UpdateNode:
|
|
2232
2262
|
case p.FullWork: {
|
|
2233
|
-
const { opt: l } = h,
|
|
2263
|
+
const { opt: l } = h, k = {
|
|
2234
2264
|
...h,
|
|
2235
2265
|
opt: l,
|
|
2236
2266
|
workId: c,
|
|
2237
2267
|
msgType: p.FullWork,
|
|
2238
|
-
dataType:
|
|
2268
|
+
dataType: v.Service,
|
|
2239
2269
|
viewId: this.viewId
|
|
2240
|
-
}, u = await this.runFullWork(
|
|
2241
|
-
a =
|
|
2270
|
+
}, u = await this.runFullWork(k);
|
|
2271
|
+
a = U(a, u);
|
|
2242
2272
|
break;
|
|
2243
2273
|
}
|
|
2244
2274
|
}
|
|
@@ -2290,10 +2320,10 @@ class Ee {
|
|
|
2290
2320
|
...a,
|
|
2291
2321
|
workId: i,
|
|
2292
2322
|
msgType: p.FullWork,
|
|
2293
|
-
dataType:
|
|
2323
|
+
dataType: v.Service,
|
|
2294
2324
|
viewId: this.viewId
|
|
2295
2325
|
});
|
|
2296
|
-
r =
|
|
2326
|
+
r = U(r, n);
|
|
2297
2327
|
break;
|
|
2298
2328
|
}
|
|
2299
2329
|
}
|
|
@@ -2322,7 +2352,7 @@ class Ee {
|
|
|
2322
2352
|
for (const o of s.sp) {
|
|
2323
2353
|
let r = !1;
|
|
2324
2354
|
for (const i of t)
|
|
2325
|
-
if (
|
|
2355
|
+
if (he(o, i)) {
|
|
2326
2356
|
r = !0;
|
|
2327
2357
|
break;
|
|
2328
2358
|
}
|
|
@@ -2334,7 +2364,7 @@ class Ee {
|
|
|
2334
2364
|
}
|
|
2335
2365
|
combinePost() {
|
|
2336
2366
|
var s, o;
|
|
2337
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None);
|
|
2367
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
|
|
2338
2368
|
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
2369
|
}
|
|
2340
2370
|
createScene(t) {
|
|
@@ -2343,7 +2373,8 @@ class Ee {
|
|
|
2343
2373
|
depth: !1,
|
|
2344
2374
|
desynchronized: !0,
|
|
2345
2375
|
...t,
|
|
2346
|
-
autoRender: !1
|
|
2376
|
+
autoRender: !1,
|
|
2377
|
+
contextType: X.Canvas2d
|
|
2347
2378
|
});
|
|
2348
2379
|
}
|
|
2349
2380
|
createLayer(t, e, s) {
|
|
@@ -2369,7 +2400,7 @@ class Ee {
|
|
|
2369
2400
|
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), this.scene.remove();
|
|
2370
2401
|
}
|
|
2371
2402
|
}
|
|
2372
|
-
class
|
|
2403
|
+
class ze {
|
|
2373
2404
|
constructor(t) {
|
|
2374
2405
|
d(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
2375
2406
|
d(this, "snapshotThread");
|
|
@@ -2384,28 +2415,28 @@ class Be {
|
|
|
2384
2415
|
this.mainThreadMap.clear();
|
|
2385
2416
|
}
|
|
2386
2417
|
createMainThread(t, e) {
|
|
2387
|
-
return new
|
|
2418
|
+
return new Ee(t, e);
|
|
2388
2419
|
}
|
|
2389
2420
|
createSnapshotThread(t, e) {
|
|
2390
|
-
return new
|
|
2421
|
+
return new Ce(t, e);
|
|
2391
2422
|
}
|
|
2392
2423
|
async consume(t) {
|
|
2393
2424
|
var e, s, o, r;
|
|
2394
2425
|
for (const i of t.values()) {
|
|
2395
|
-
const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt:
|
|
2426
|
+
const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: k, cameraOpt: u, isSubWorker: y } = i;
|
|
2396
2427
|
if (a === p.Console) {
|
|
2397
2428
|
console.log(this);
|
|
2398
2429
|
continue;
|
|
2399
2430
|
}
|
|
2400
2431
|
if (a === p.Init) {
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2432
|
+
const m = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, W = m == null ? void 0 : m.canvasContainerRef.current;
|
|
2433
|
+
if (m && W && l && k) {
|
|
2403
2434
|
const g = this.createMainThread(n, {
|
|
2404
|
-
displayer:
|
|
2435
|
+
displayer: m,
|
|
2405
2436
|
container: W,
|
|
2406
2437
|
layerOpt: l,
|
|
2407
2438
|
master: this.master,
|
|
2408
|
-
canvasOpt:
|
|
2439
|
+
canvasOpt: k,
|
|
2409
2440
|
post: this.post.bind(this)
|
|
2410
2441
|
});
|
|
2411
2442
|
this.mainThreadMap.set(n, g), g && u && g.setCameraOpt(u);
|
|
@@ -2413,25 +2444,25 @@ class Be {
|
|
|
2413
2444
|
continue;
|
|
2414
2445
|
}
|
|
2415
2446
|
if ((a === p.Snapshot || a === p.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2447
|
+
const m = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, W = (r = m.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2448
|
+
if (m && W && u) {
|
|
2418
2449
|
W.style.width = `${u.width}px`, W.style.height = `${u.height}px`;
|
|
2419
2450
|
const g = {
|
|
2420
2451
|
...Z.defaultLayerOpt,
|
|
2421
2452
|
offscreen: !1,
|
|
2422
2453
|
width: u.width,
|
|
2423
2454
|
height: u.height
|
|
2424
|
-
},
|
|
2455
|
+
}, S = {
|
|
2425
2456
|
...Z.defaultScreenCanvasOpt,
|
|
2426
2457
|
width: u.width,
|
|
2427
2458
|
height: u.height
|
|
2428
2459
|
};
|
|
2429
2460
|
this.snapshotThread = this.createSnapshotThread(n, {
|
|
2430
|
-
displayer:
|
|
2461
|
+
displayer: m,
|
|
2431
2462
|
container: W,
|
|
2432
2463
|
layerOpt: g,
|
|
2433
2464
|
master: this.master,
|
|
2434
|
-
canvasOpt:
|
|
2465
|
+
canvasOpt: S,
|
|
2435
2466
|
post: this.post.bind(this)
|
|
2436
2467
|
}), this.snapshotThread.on(i).then(() => {
|
|
2437
2468
|
this.snapshotThread = void 0, W.innerHTML = "", W.style.width = "", W.style.height = "";
|
|
@@ -2444,22 +2475,22 @@ class Be {
|
|
|
2444
2475
|
continue;
|
|
2445
2476
|
}
|
|
2446
2477
|
if (a === p.TasksQueue && (c != null && c.size)) {
|
|
2447
|
-
for (const [
|
|
2448
|
-
const g = c.get(
|
|
2478
|
+
for (const [m, W] of this.mainThreadMap.entries()) {
|
|
2479
|
+
const g = c.get(m);
|
|
2449
2480
|
g && (await W.on(g), h && this.post({ workerTasksqueueCount: h }));
|
|
2450
2481
|
}
|
|
2451
2482
|
continue;
|
|
2452
2483
|
}
|
|
2453
|
-
if (n ===
|
|
2454
|
-
for (const
|
|
2455
|
-
|
|
2484
|
+
if (n === pe) {
|
|
2485
|
+
for (const m of this.mainThreadMap.values())
|
|
2486
|
+
m.on(i), a === p.Destroy && this.mainThreadMap.delete(n);
|
|
2456
2487
|
continue;
|
|
2457
2488
|
}
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2489
|
+
const w = this.mainThreadMap.get(n);
|
|
2490
|
+
w && (w.on(i), a === p.Destroy && this.mainThreadMap.delete(n));
|
|
2460
2491
|
}
|
|
2461
2492
|
}
|
|
2462
2493
|
}
|
|
2463
2494
|
export {
|
|
2464
|
-
|
|
2495
|
+
ze as MainThreadManagerImpl
|
|
2465
2496
|
};
|