@netless/appliance-plugin 1.1.9 → 1.1.11
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/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-DzU-Co.js → fullWorker-CnB3KR.js} +93 -93
- package/cdn/{subWorker-B5ZQoK.js → subWorker-1E_izA.js} +93 -93
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/core/enum.d.ts +3 -1
- package/dist/core/mainEngine.d.ts +1 -0
- package/dist/core/mainThread/base.d.ts +1 -0
- package/dist/core/mainThread/workerMainThread.d.ts +1 -0
- package/dist/core/tools/pencilEraserBitMap.d.ts +6 -1
- package/dist/core/types.d.ts +1 -0
- package/dist/core/vNodeManager.d.ts +1 -1
- package/dist/core/worker/base.d.ts +2 -1
- package/dist/core/worker/workerManager.d.ts +2 -0
- package/dist/fullWorker.js +93 -93
- package/dist/index-8E5yX5Xn.js +1 -0
- package/dist/{index-D8AMdzYo.mjs → index-Bd_LdZxD.mjs} +4147 -4014
- package/dist/{index-rRQeW_6Z.mjs → index-Db4VURLT.mjs} +227 -215
- package/dist/index-qS7tU8QD.js +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +6 -0
- package/dist/plugin/types.d.ts +2 -1
- package/dist/subWorker.js +93 -93
- package/package.json +1 -1
- package/dist/index-B90iIvel.js +0 -1
- package/dist/index-CpjV7Ujm.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (L, t, e) =>
|
|
4
|
-
import { D as R, E as W, a as f, b as g, g as F, t as A, c as
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var se = (L, t, e) => t in L ? te(L, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : L[t] = e;
|
|
3
|
+
var u = (L, t, e) => se(L, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { D as R, E as W, a as f, b as g, g as F, t as A, c as h, S as j, d as N, e as $, i as oe, C as U, f as re, h as T, M, V as ie, j as X, T as H, k as P, l as q, m as B, n as ae, o as G, p as V, q as ce } from "./index-Bd_LdZxD.mjs";
|
|
5
|
+
import { Scene as Y, Group as Q } from "spritejs";
|
|
6
|
+
import { cloneDeep as J, xor as ne, isNumber as K, isEqual as Z } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
8
8
|
import "white-web-sdk";
|
|
9
9
|
import "react-dom";
|
|
@@ -90,7 +90,7 @@ class le {
|
|
|
90
90
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n } = t;
|
|
91
91
|
if (!e)
|
|
92
92
|
return;
|
|
93
|
-
const a = e.toString(),
|
|
93
|
+
const a = e.toString(), p = (m = this.vNodes.get(a)) == null ? void 0 : m.rect;
|
|
94
94
|
if (!((d = this.serviceWorkShapes) != null && d.has(a))) {
|
|
95
95
|
let w = {
|
|
96
96
|
toolsType: o,
|
|
@@ -99,12 +99,12 @@ class le {
|
|
|
99
99
|
type: r,
|
|
100
100
|
updateNodeOpt: i,
|
|
101
101
|
ops: c,
|
|
102
|
-
oldRect:
|
|
102
|
+
oldRect: p
|
|
103
103
|
};
|
|
104
104
|
o && s && (w = this.setNodeKey(a, w, o, s)), this.serviceWorkShapes.set(a, w);
|
|
105
105
|
}
|
|
106
106
|
const l = this.serviceWorkShapes.get(a);
|
|
107
|
-
r && (l.type = r), c && (l.animationWorkData = A(c), l.ops = c), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== a && l.node.setWorkId(a),
|
|
107
|
+
r && (l.type = r), c && (l.animationWorkData = A(c), l.ops = c), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== a && l.node.setWorkId(a), p && (l.oldRect = p), o && s && (l.toolsType !== o && o && s && this.setNodeKey(a, l, o, s), l.node && l.node.setWorkOptions(s));
|
|
108
108
|
}
|
|
109
109
|
computNextAnimationIndex(t, e) {
|
|
110
110
|
var r;
|
|
@@ -135,25 +135,25 @@ class le {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
for (const [n, a] of this.localWorkShapes.entries()) {
|
|
138
|
-
const { result:
|
|
138
|
+
const { result: p, toolsType: l, isDel: m, workState: d } = a;
|
|
139
139
|
switch (l) {
|
|
140
140
|
case f.LaserPen: {
|
|
141
141
|
if (m) {
|
|
142
142
|
a.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
|
|
143
143
|
removeIds: [n.toString()],
|
|
144
|
-
type:
|
|
144
|
+
type: h.RemoveNode
|
|
145
145
|
});
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
p && ((p.op || p.ops) && s.push(p), a.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && d === W.Done && (a.isDel = !0, this.localWorkShapes.set(n, a)), t = !0;
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
t && this.runAnimation(), e.size && e.forEach((n, a) => {
|
|
154
154
|
s.push({
|
|
155
|
-
type:
|
|
156
|
-
uid: a.split(
|
|
155
|
+
type: h.Cursor,
|
|
156
|
+
uid: a.split(j)[0],
|
|
157
157
|
op: n.op,
|
|
158
158
|
workState: n.workState,
|
|
159
159
|
viewId: this.thread.viewId
|
|
@@ -202,7 +202,7 @@ class he {
|
|
|
202
202
|
u(this, "syncUnitTime", R.syncOpt.interval);
|
|
203
203
|
u(this, "drawCount", 0);
|
|
204
204
|
u(this, "drawWorkActiveId");
|
|
205
|
-
u(this, "batchEraserCombine",
|
|
205
|
+
u(this, "batchEraserCombine", re(() => {
|
|
206
206
|
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
207
207
|
}, 100, { leading: !1 }));
|
|
208
208
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
@@ -226,7 +226,7 @@ class he {
|
|
|
226
226
|
workId: s,
|
|
227
227
|
scenePath: t,
|
|
228
228
|
viewId: this.thread.viewId,
|
|
229
|
-
msgType:
|
|
229
|
+
msgType: h.DrawWork,
|
|
230
230
|
dataType: g.Local
|
|
231
231
|
}, e);
|
|
232
232
|
}
|
|
@@ -236,13 +236,13 @@ class he {
|
|
|
236
236
|
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
237
237
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, c = await (e == null ? void 0 : e.updateSelector({
|
|
238
238
|
updateSelectorOpt: r,
|
|
239
|
-
selectIds:
|
|
239
|
+
selectIds: J(e.selectIds),
|
|
240
240
|
vNodes: this.vNodes,
|
|
241
241
|
willSerializeData: i,
|
|
242
242
|
worker: this
|
|
243
243
|
})), n = /* @__PURE__ */ new Map();
|
|
244
244
|
let a;
|
|
245
|
-
c != null && c.selectIds && (a =
|
|
245
|
+
c != null && c.selectIds && (a = ne(e.selectIds, c.selectIds), c.selectIds.forEach((d) => {
|
|
246
246
|
const w = this.vNodes.get(d);
|
|
247
247
|
if (w) {
|
|
248
248
|
const { toolsType: k, op: S, opt: v } = w;
|
|
@@ -253,15 +253,15 @@ class he {
|
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
}), e.selectIds = c.selectIds);
|
|
256
|
-
const
|
|
256
|
+
const p = [], l = s && s({
|
|
257
257
|
res: c,
|
|
258
258
|
workShapeNode: e,
|
|
259
259
|
param: o,
|
|
260
|
-
postData: { sp:
|
|
260
|
+
postData: { sp: p },
|
|
261
261
|
newServiceStore: n
|
|
262
|
-
}) || { sp:
|
|
262
|
+
}) || { sp: p };
|
|
263
263
|
a && l.sp.push({
|
|
264
|
-
type:
|
|
264
|
+
type: h.RemoveNode,
|
|
265
265
|
removeIds: a,
|
|
266
266
|
viewId: this.thread.viewId
|
|
267
267
|
}), l.sp.length && this.thread.post(l);
|
|
@@ -275,7 +275,7 @@ class he {
|
|
|
275
275
|
}), this.thread.localLayer.removeAllChildren()), this.workShapes.get(N)) {
|
|
276
276
|
const e = [];
|
|
277
277
|
e.push({
|
|
278
|
-
type:
|
|
278
|
+
type: h.Select,
|
|
279
279
|
dataType: g.Local,
|
|
280
280
|
selectIds: [],
|
|
281
281
|
willSyncService: !1
|
|
@@ -288,20 +288,20 @@ class he {
|
|
|
288
288
|
if (e != null && e.length) {
|
|
289
289
|
let r;
|
|
290
290
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
291
|
-
const { rect: c, name: n, toolsType: a, opt:
|
|
292
|
-
if (a === f.Text &&
|
|
291
|
+
const { rect: c, name: n, toolsType: a, opt: p } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], m = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
292
|
+
if (a === f.Text && oe([l, m], c) && p.workState === W.Done) {
|
|
293
293
|
r = n;
|
|
294
294
|
break;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
r && (await this.blurSelector({
|
|
298
298
|
viewId: s,
|
|
299
|
-
msgType:
|
|
299
|
+
msgType: h.Select,
|
|
300
300
|
dataType: o,
|
|
301
301
|
isSync: !0
|
|
302
302
|
}), this.thread.post({
|
|
303
303
|
sp: [{
|
|
304
|
-
type:
|
|
304
|
+
type: h.GetTextActive,
|
|
305
305
|
toolsType: f.Text,
|
|
306
306
|
workId: r
|
|
307
307
|
}]
|
|
@@ -329,7 +329,7 @@ class he {
|
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
331
|
if (e && (s != null && s.length)) {
|
|
332
|
-
const { selectRect: a } = e.updateSelectIds(s),
|
|
332
|
+
const { selectRect: a } = e.updateSelectIds(s), p = [{
|
|
333
333
|
...t,
|
|
334
334
|
selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
|
|
335
335
|
strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
|
|
@@ -338,7 +338,7 @@ class he {
|
|
|
338
338
|
canTextEdit: e.canTextEdit,
|
|
339
339
|
canRotate: e.canRotate,
|
|
340
340
|
scaleType: e.scaleType,
|
|
341
|
-
type:
|
|
341
|
+
type: h.Select,
|
|
342
342
|
selectRect: a,
|
|
343
343
|
points: e.getChildrenPoints(),
|
|
344
344
|
willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
|
|
@@ -351,14 +351,14 @@ class he {
|
|
|
351
351
|
useStroke: e.useStroke,
|
|
352
352
|
strokeType: e.strokeType
|
|
353
353
|
}];
|
|
354
|
-
this.thread.post({ sp:
|
|
354
|
+
this.thread.post({ sp: p });
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
commandDeleteText(t) {
|
|
358
358
|
const e = this.vNodes.get(t);
|
|
359
359
|
if (e && e.toolsType === f.Text)
|
|
360
360
|
return {
|
|
361
|
-
type:
|
|
361
|
+
type: h.TextUpdate,
|
|
362
362
|
toolsType: f.Text,
|
|
363
363
|
workId: t,
|
|
364
364
|
dataType: g.Local
|
|
@@ -377,10 +377,10 @@ class he {
|
|
|
377
377
|
this.removeNode(c), o.push(c);
|
|
378
378
|
}
|
|
379
379
|
o.length && s.push({
|
|
380
|
-
type:
|
|
380
|
+
type: h.RemoveNode,
|
|
381
381
|
removeIds: o
|
|
382
382
|
}), s.push({
|
|
383
|
-
type:
|
|
383
|
+
type: h.Select,
|
|
384
384
|
selectIds: [],
|
|
385
385
|
willSyncService: e
|
|
386
386
|
}), await this.blurSelector(), s.length && this.thread.post({ sp: s });
|
|
@@ -430,7 +430,7 @@ class he {
|
|
|
430
430
|
t.workId && this.workShapes.delete(t.workId.toString()), t.willSyncService && i.push({
|
|
431
431
|
opt: t.opt,
|
|
432
432
|
toolsType: t.toolsType,
|
|
433
|
-
type:
|
|
433
|
+
type: h.FullWork,
|
|
434
434
|
workId: t.workId,
|
|
435
435
|
ops: t.ops,
|
|
436
436
|
updateNodeOpt: t.updateNodeOpt,
|
|
@@ -441,7 +441,7 @@ class he {
|
|
|
441
441
|
async colloctEffectSelectWork(t) {
|
|
442
442
|
const e = this.workShapes.get(N), { workId: s, msgType: o } = t;
|
|
443
443
|
if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
|
|
444
|
-
o ===
|
|
444
|
+
o === h.RemoveNode ? e.selectIds = e.selectIds.filter((r) => r !== s.toString()) : this.effectSelectNodeData.add(t), await new Promise((r) => {
|
|
445
445
|
setTimeout(() => {
|
|
446
446
|
r(!0);
|
|
447
447
|
}, 0);
|
|
@@ -498,7 +498,7 @@ class he {
|
|
|
498
498
|
const s = e.reRenderSelector();
|
|
499
499
|
s && this.thread.post({
|
|
500
500
|
sp: [{
|
|
501
|
-
type:
|
|
501
|
+
type: h.Select,
|
|
502
502
|
selectIds: e.selectIds,
|
|
503
503
|
selectRect: s,
|
|
504
504
|
willSyncService: t,
|
|
@@ -544,44 +544,50 @@ class he {
|
|
|
544
544
|
t.op && e.push(t), e.length && this.thread.post({ sp: e });
|
|
545
545
|
}
|
|
546
546
|
async drawBitMapEraserFull(t, e, s) {
|
|
547
|
-
const { willUpdateNodes: o,
|
|
547
|
+
const { willUpdateNodes: o, willDeleteNodes: r, scenePath: i, ...c } = e, n = t.getWorkId(), a = [
|
|
548
548
|
{
|
|
549
|
-
...
|
|
550
|
-
workId:
|
|
551
|
-
scenePath:
|
|
549
|
+
...c,
|
|
550
|
+
workId: n,
|
|
551
|
+
scenePath: i,
|
|
552
552
|
updateNodeOpt: {
|
|
553
553
|
useAnimation: !1
|
|
554
554
|
},
|
|
555
555
|
isSync: !0,
|
|
556
556
|
nextTasks: [
|
|
557
557
|
{
|
|
558
|
-
type:
|
|
559
|
-
removeIds: [
|
|
558
|
+
type: h.RemoveNode,
|
|
559
|
+
removeIds: [n],
|
|
560
560
|
viewId: this.thread.viewId
|
|
561
561
|
}
|
|
562
562
|
]
|
|
563
563
|
}
|
|
564
564
|
];
|
|
565
|
-
if (s &&
|
|
566
|
-
type:
|
|
565
|
+
if (s && a.push({
|
|
566
|
+
type: h.None,
|
|
567
567
|
isLockSentEventCursor: s
|
|
568
|
-
}), o != null && o.size) {
|
|
569
|
-
await (t == null ? void 0 : t.reRenderEffectNodes({
|
|
568
|
+
}), o != null && o.size || r != null && r.size) {
|
|
569
|
+
if (await (t == null ? void 0 : t.reRenderEffectNodes({
|
|
570
|
+
willDeleteNodes: r,
|
|
570
571
|
willUpdateNodes: o,
|
|
571
572
|
worker: this
|
|
572
|
-
}))
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
573
|
+
})), o != null && o.size)
|
|
574
|
+
for (const [p, l] of o)
|
|
575
|
+
a.push({
|
|
576
|
+
type: h.UpdateNode,
|
|
577
|
+
dataType: g.Local,
|
|
578
|
+
opt: l.opt,
|
|
579
|
+
workId: p,
|
|
580
|
+
updateNodeOpt: {
|
|
581
|
+
useAnimation: !1
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
r != null && r.size && a.push({
|
|
585
|
+
type: h.RemoveNode,
|
|
586
|
+
removeIds: [...r],
|
|
587
|
+
viewId: this.thread.viewId
|
|
588
|
+
});
|
|
583
589
|
}
|
|
584
|
-
|
|
590
|
+
a.length && this.thread.post({ sp: a });
|
|
585
591
|
}
|
|
586
592
|
drawPencilEraser(t, e) {
|
|
587
593
|
var o, r;
|
|
@@ -590,7 +596,7 @@ class he {
|
|
|
590
596
|
for (const i of t.newWorkDatas.values()) {
|
|
591
597
|
const c = i.workId.toString();
|
|
592
598
|
this.batchEraserWorks.add(c), s.push({
|
|
593
|
-
type:
|
|
599
|
+
type: h.FullWork,
|
|
594
600
|
workId: c,
|
|
595
601
|
ops: $(i.op),
|
|
596
602
|
opt: i.opt,
|
|
@@ -605,14 +611,14 @@ class he {
|
|
|
605
611
|
(r = t.removeIds) == null || r.forEach((i) => {
|
|
606
612
|
this.batchEraserRemoveNodes.add(i);
|
|
607
613
|
}), e && s.push({
|
|
608
|
-
type:
|
|
614
|
+
type: h.None,
|
|
609
615
|
isLockSentEventCursor: e
|
|
610
616
|
}), t.rect, this.thread.post({ sp: s }), this.batchEraserCombine();
|
|
611
617
|
}
|
|
612
618
|
drawEraser(t, e) {
|
|
613
619
|
const s = [];
|
|
614
620
|
t.removeIds && s.push(t), e && s.push({
|
|
615
|
-
type:
|
|
621
|
+
type: h.None,
|
|
616
622
|
isLockSentEventCursor: e
|
|
617
623
|
}), this.thread.post({ sp: s });
|
|
618
624
|
}
|
|
@@ -651,7 +657,7 @@ class he {
|
|
|
651
657
|
workId: this.drawWorkActiveId,
|
|
652
658
|
scenePath: r,
|
|
653
659
|
viewId: this.thread.viewId,
|
|
654
|
-
msgType:
|
|
660
|
+
msgType: h.DrawWork,
|
|
655
661
|
dataType: g.Local
|
|
656
662
|
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && i !== N && (this.drawWorkActiveId = i), n) {
|
|
657
663
|
case f.Selector:
|
|
@@ -660,7 +666,7 @@ class he {
|
|
|
660
666
|
data: t,
|
|
661
667
|
isFullWork: !0
|
|
662
668
|
});
|
|
663
|
-
a.type ===
|
|
669
|
+
a.type === h.Select && (a.selectIds && e.runReverseSelectWork(a.selectIds), this.thread.post({ sp: [a] }));
|
|
664
670
|
}
|
|
665
671
|
break;
|
|
666
672
|
case f.PencilEraser:
|
|
@@ -716,9 +722,9 @@ class he {
|
|
|
716
722
|
var i, c, n, a;
|
|
717
723
|
const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
|
|
718
724
|
if (s) {
|
|
719
|
-
const
|
|
720
|
-
this.drawWorkActiveId ===
|
|
721
|
-
const l = this.workShapes.get(
|
|
725
|
+
const p = s.toString();
|
|
726
|
+
this.drawWorkActiveId === p && (this.drawWorkActiveId = void 0);
|
|
727
|
+
const l = this.workShapes.get(p);
|
|
722
728
|
if (!l)
|
|
723
729
|
return;
|
|
724
730
|
const m = l.toolsType;
|
|
@@ -727,7 +733,7 @@ class he {
|
|
|
727
733
|
const d = this.workShapes.get(U), w = (i = d == null ? void 0 : d.selectIds) == null ? void 0 : i[0], k = l.consumeAll({ data: t });
|
|
728
734
|
switch (m) {
|
|
729
735
|
case f.Selector:
|
|
730
|
-
k.selectIds && w && ((c = k.selectIds) != null && c.includes(w)) && d.cursorBlur(), k.type ===
|
|
736
|
+
k.selectIds && w && ((c = k.selectIds) != null && c.includes(w)) && d.cursorBlur(), k.type === h.Select && (k.selectIds && e.runReverseSelectWork(k.selectIds), this.thread.post({ sp: [{ ...k, scenePath: o }] })), (n = l.selectIds) != null && n.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(p);
|
|
731
737
|
break;
|
|
732
738
|
case f.PencilEraser:
|
|
733
739
|
this.drawPencilEraser({ ...k, scenePath: o }, r), l.clearTmpPoints();
|
|
@@ -748,12 +754,12 @@ class he {
|
|
|
748
754
|
case f.Pencil: {
|
|
749
755
|
const S = [];
|
|
750
756
|
r && S.push({
|
|
751
|
-
type:
|
|
757
|
+
type: h.None,
|
|
752
758
|
isLockSentEventCursor: r
|
|
753
759
|
}), k && (S.push(k), this.drawCount = 0, this.thread.post({
|
|
754
760
|
drawCount: this.drawCount,
|
|
755
761
|
sp: S
|
|
756
|
-
})), this.clearWorkShapeNodeCache(
|
|
762
|
+
})), this.clearWorkShapeNodeCache(p);
|
|
757
763
|
break;
|
|
758
764
|
}
|
|
759
765
|
}
|
|
@@ -848,7 +854,7 @@ class pe {
|
|
|
848
854
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
849
855
|
}
|
|
850
856
|
async animationDraw() {
|
|
851
|
-
var s, o, r, i, c, n, a,
|
|
857
|
+
var s, o, r, i, c, n, a, p, l, m, d, w, k, S, v;
|
|
852
858
|
this.animationId = void 0;
|
|
853
859
|
let t = !1;
|
|
854
860
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -906,7 +912,7 @@ class pe {
|
|
|
906
912
|
op: y.animationWorkData || [],
|
|
907
913
|
isFullWork: !0,
|
|
908
914
|
replaceId: I
|
|
909
|
-
}), (
|
|
915
|
+
}), (p = y.node) == null || p.updataOptService(y.updateNodeOpt), this.selectorWorkShapes.forEach((b, E) => {
|
|
910
916
|
var O;
|
|
911
917
|
(O = b.selectIds) != null && O.includes(I) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
|
|
912
918
|
}), (l = y.node) == null || l.clearTmpPoints(), this.workShapes.delete(I);
|
|
@@ -921,8 +927,8 @@ class pe {
|
|
|
921
927
|
op: D,
|
|
922
928
|
isFullWork: !1
|
|
923
929
|
}), y.animationIndex = E, y.isDiff && (y.isDiff = !1), D.length) {
|
|
924
|
-
const z = D.filter((_,
|
|
925
|
-
if (
|
|
930
|
+
const z = D.filter((_, ee) => {
|
|
931
|
+
if (ee % b !== b - 1)
|
|
926
932
|
return !0;
|
|
927
933
|
}).slice(-2);
|
|
928
934
|
e.set(I, {
|
|
@@ -951,8 +957,8 @@ class pe {
|
|
|
951
957
|
const I = [];
|
|
952
958
|
e.forEach((y, b) => {
|
|
953
959
|
I.push({
|
|
954
|
-
type:
|
|
955
|
-
uid: b.split(
|
|
960
|
+
type: h.Cursor,
|
|
961
|
+
uid: b.split(j)[0],
|
|
956
962
|
op: y.op,
|
|
957
963
|
workState: y.workState,
|
|
958
964
|
viewId: this.thread.viewId
|
|
@@ -985,7 +991,7 @@ class pe {
|
|
|
985
991
|
}
|
|
986
992
|
activeWorkShape(t) {
|
|
987
993
|
var w, k, S, v;
|
|
988
|
-
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n, useAnimation: a, imageBitmap:
|
|
994
|
+
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n, useAnimation: a, imageBitmap: p } = t;
|
|
989
995
|
if (!e)
|
|
990
996
|
return;
|
|
991
997
|
const l = e.toString(), m = (w = this.vNodes.get(l)) == null ? void 0 : w.rect;
|
|
@@ -1000,12 +1006,12 @@ class pe {
|
|
|
1000
1006
|
useAnimation: typeof a < "u" ? a : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1001
1007
|
oldRect: m,
|
|
1002
1008
|
isDiff: !1,
|
|
1003
|
-
imageBitmap:
|
|
1009
|
+
imageBitmap: p
|
|
1004
1010
|
};
|
|
1005
1011
|
o && s && (I = this.setNodeKey(l, I, o, s)), (S = this.workShapes) == null || S.set(l, I);
|
|
1006
1012
|
}
|
|
1007
1013
|
const d = (v = this.workShapes) == null ? void 0 : v.get(l);
|
|
1008
|
-
r && (d.type = r), c && (d.animationWorkData = A(c), d.ops = c), i && (d.updateNodeOpt = i), n && (d.isDiff = this.hasDiffData(d.animationWorkData || [], n, d.toolsType), d.animationWorkData = n), d.node && d.node.getWorkId() !== l && d.node.setWorkId(l), m && (d.oldRect = m), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), d.toolsType !== o && o && s && this.setNodeKey(l, d, o, s), d.node && d.node.setWorkOptions(s)),
|
|
1014
|
+
r && (d.type = r), c && (d.animationWorkData = A(c), d.ops = c), i && (d.updateNodeOpt = i), n && (d.isDiff = this.hasDiffData(d.animationWorkData || [], n, d.toolsType), d.animationWorkData = n), d.node && d.node.getWorkId() !== l && d.node.setWorkId(l), m && (d.oldRect = m), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), d.toolsType !== o && o && s && this.setNodeKey(l, d, o, s), d.node && d.node.setWorkOptions(s)), p && (d.imageBitmap = p);
|
|
1009
1015
|
}
|
|
1010
1016
|
removeNode(t, e) {
|
|
1011
1017
|
t.indexOf(N) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1019,7 +1025,7 @@ class pe {
|
|
|
1019
1025
|
s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
|
|
1020
1026
|
}
|
|
1021
1027
|
activeSelectorShape(t) {
|
|
1022
|
-
var a,
|
|
1028
|
+
var a, p, l;
|
|
1023
1029
|
const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
|
|
1024
1030
|
if (!e)
|
|
1025
1031
|
return;
|
|
@@ -1031,7 +1037,7 @@ class pe {
|
|
|
1031
1037
|
type: r,
|
|
1032
1038
|
opt: s
|
|
1033
1039
|
};
|
|
1034
|
-
o && s && (m = this.setNodeKey(c, m, o, s)), (
|
|
1040
|
+
o && s && (m = this.setNodeKey(c, m, o, s)), (p = this.selectorWorkShapes) == null || p.set(c, m);
|
|
1035
1041
|
}
|
|
1036
1042
|
const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(c);
|
|
1037
1043
|
r && (n.type = r), n.node && n.node.getWorkId() !== c && n.node.setWorkId(c), n.selectIds = i || [];
|
|
@@ -1064,7 +1070,7 @@ class de extends C {
|
|
|
1064
1070
|
}
|
|
1065
1071
|
async consume(e) {
|
|
1066
1072
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1067
|
-
if (s ===
|
|
1073
|
+
if (s === h.FullWork && o === g.Local && r === this.emitEventType)
|
|
1068
1074
|
return this.consumeForLocalWorker(e), !0;
|
|
1069
1075
|
}
|
|
1070
1076
|
async consumeForLocalWorker(e) {
|
|
@@ -1080,7 +1086,7 @@ class ue extends C {
|
|
|
1080
1086
|
}
|
|
1081
1087
|
async consume(e) {
|
|
1082
1088
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1083
|
-
if (s ===
|
|
1089
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1084
1090
|
return this.consumeForLocalWorker(e), !0;
|
|
1085
1091
|
}
|
|
1086
1092
|
async consumeForLocalWorker(e) {
|
|
@@ -1098,18 +1104,18 @@ class ue extends C {
|
|
|
1098
1104
|
updateSelectorCallback(e) {
|
|
1099
1105
|
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c, textUpdateForWoker: n } = s, a = o.sp || [];
|
|
1100
1106
|
if (i)
|
|
1101
|
-
for (const [
|
|
1107
|
+
for (const [p, l] of r.entries())
|
|
1102
1108
|
n && l.toolsType === f.Text ? a.push({
|
|
1103
1109
|
...l,
|
|
1104
|
-
workId:
|
|
1105
|
-
type:
|
|
1110
|
+
workId: p,
|
|
1111
|
+
type: h.TextUpdate,
|
|
1106
1112
|
dataType: g.Local,
|
|
1107
1113
|
willSyncService: !0
|
|
1108
1114
|
}) : a.push(
|
|
1109
1115
|
{
|
|
1110
1116
|
...l,
|
|
1111
|
-
workId:
|
|
1112
|
-
type:
|
|
1117
|
+
workId: p,
|
|
1118
|
+
type: h.UpdateNode,
|
|
1113
1119
|
updateNodeOpt: {
|
|
1114
1120
|
useAnimation: !1
|
|
1115
1121
|
},
|
|
@@ -1128,7 +1134,7 @@ class fe extends C {
|
|
|
1128
1134
|
}
|
|
1129
1135
|
async consume(e) {
|
|
1130
1136
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1131
|
-
if (s ===
|
|
1137
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1132
1138
|
return this.consumeForLocalWorker(e), !0;
|
|
1133
1139
|
}
|
|
1134
1140
|
async consumeForLocalWorker(e) {
|
|
@@ -1145,12 +1151,12 @@ class fe extends C {
|
|
|
1145
1151
|
updateSelectorCallback(e) {
|
|
1146
1152
|
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
|
|
1147
1153
|
if (i && n)
|
|
1148
|
-
for (const [a,
|
|
1154
|
+
for (const [a, p] of r.entries())
|
|
1149
1155
|
n.push(
|
|
1150
1156
|
{
|
|
1151
|
-
...
|
|
1157
|
+
...p,
|
|
1152
1158
|
workId: a,
|
|
1153
|
-
type:
|
|
1159
|
+
type: h.UpdateNode,
|
|
1154
1160
|
updateNodeOpt: {
|
|
1155
1161
|
useAnimation: !1
|
|
1156
1162
|
},
|
|
@@ -1169,13 +1175,13 @@ class me extends C {
|
|
|
1169
1175
|
}
|
|
1170
1176
|
async consume(e) {
|
|
1171
1177
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1172
|
-
if (s ===
|
|
1178
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1173
1179
|
return await this.consumeForLocalWorker(e), !0;
|
|
1174
1180
|
}
|
|
1175
1181
|
async consumeForLocalWorker(e) {
|
|
1176
|
-
var
|
|
1182
|
+
var p, l;
|
|
1177
1183
|
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n, emitEventType: a } = e;
|
|
1178
|
-
s === N && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((
|
|
1184
|
+
s === N && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
|
|
1179
1185
|
updateSelectorOpt: o,
|
|
1180
1186
|
willRefreshSelector: r,
|
|
1181
1187
|
willSyncService: i,
|
|
@@ -1187,7 +1193,7 @@ class me extends C {
|
|
|
1187
1193
|
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1188
1194
|
}
|
|
1189
1195
|
updateSelectorCallback(e) {
|
|
1190
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt:
|
|
1196
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p, textUpdateForWoker: l } = s, m = p.workState, d = o.sp || [];
|
|
1191
1197
|
if (m === W.Start)
|
|
1192
1198
|
return {
|
|
1193
1199
|
sp: [],
|
|
@@ -1196,7 +1202,7 @@ class me extends C {
|
|
|
1196
1202
|
const w = c == null ? void 0 : c.selectRect;
|
|
1197
1203
|
if (n) {
|
|
1198
1204
|
m === W.Doing && d.push({
|
|
1199
|
-
type:
|
|
1205
|
+
type: h.Select,
|
|
1200
1206
|
selectIds: i.selectIds,
|
|
1201
1207
|
selectRect: w,
|
|
1202
1208
|
willSyncService: !0,
|
|
@@ -1208,14 +1214,14 @@ class me extends C {
|
|
|
1208
1214
|
l && S.toolsType === f.Text ? d.push({
|
|
1209
1215
|
...S,
|
|
1210
1216
|
workId: k,
|
|
1211
|
-
type:
|
|
1217
|
+
type: h.TextUpdate,
|
|
1212
1218
|
dataType: g.Local,
|
|
1213
1219
|
willSyncService: !0
|
|
1214
1220
|
}) : d.push(
|
|
1215
1221
|
{
|
|
1216
1222
|
...S,
|
|
1217
1223
|
workId: k,
|
|
1218
|
-
type:
|
|
1224
|
+
type: h.UpdateNode,
|
|
1219
1225
|
updateNodeOpt: {
|
|
1220
1226
|
useAnimation: !1
|
|
1221
1227
|
},
|
|
@@ -1244,7 +1250,7 @@ class Se extends C {
|
|
|
1244
1250
|
}
|
|
1245
1251
|
async consume(e) {
|
|
1246
1252
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1247
|
-
if (s ===
|
|
1253
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1248
1254
|
return await this.consumeForLocalWorker(e), !0;
|
|
1249
1255
|
}
|
|
1250
1256
|
async consumeForLocalWorker(e) {
|
|
@@ -1259,34 +1265,34 @@ class Se extends C {
|
|
|
1259
1265
|
}));
|
|
1260
1266
|
}
|
|
1261
1267
|
updateSelectorCallback(e) {
|
|
1262
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a } = s,
|
|
1263
|
-
if (
|
|
1268
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a } = s, p = n.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
|
|
1269
|
+
if (p === W.Start)
|
|
1264
1270
|
return {
|
|
1265
1271
|
sp: [],
|
|
1266
1272
|
render: []
|
|
1267
1273
|
};
|
|
1268
1274
|
if (a) {
|
|
1269
1275
|
l.push({
|
|
1270
|
-
type:
|
|
1276
|
+
type: h.Select,
|
|
1271
1277
|
selectIds: r.selectIds,
|
|
1272
1278
|
selectRect: m,
|
|
1273
1279
|
willSyncService: !0,
|
|
1274
1280
|
isSync: !0,
|
|
1275
|
-
points:
|
|
1281
|
+
points: p === W.Done && r.getChildrenPoints() || void 0,
|
|
1276
1282
|
textOpt: r.textOpt
|
|
1277
1283
|
});
|
|
1278
1284
|
for (const [d, w] of c.entries())
|
|
1279
1285
|
w.toolsType === f.Text ? l.push({
|
|
1280
1286
|
...w,
|
|
1281
1287
|
workId: d,
|
|
1282
|
-
type:
|
|
1288
|
+
type: h.TextUpdate,
|
|
1283
1289
|
dataType: g.Local,
|
|
1284
1290
|
willSyncService: !0
|
|
1285
1291
|
}) : l.push(
|
|
1286
1292
|
{
|
|
1287
1293
|
...w,
|
|
1288
1294
|
workId: d,
|
|
1289
|
-
type:
|
|
1295
|
+
type: h.UpdateNode,
|
|
1290
1296
|
updateNodeOpt: {
|
|
1291
1297
|
useAnimation: !1
|
|
1292
1298
|
},
|
|
@@ -1306,7 +1312,7 @@ class ye extends C {
|
|
|
1306
1312
|
}
|
|
1307
1313
|
async consume(e) {
|
|
1308
1314
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1309
|
-
if (s ===
|
|
1315
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1310
1316
|
return await this.consumeForLocalWorker(e), !0;
|
|
1311
1317
|
}
|
|
1312
1318
|
async consumeForLocalWorker(e) {
|
|
@@ -1323,10 +1329,10 @@ class ye extends C {
|
|
|
1323
1329
|
}));
|
|
1324
1330
|
}
|
|
1325
1331
|
updateSelectorCallback(e) {
|
|
1326
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a, willSerializeData:
|
|
1332
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a, willSerializeData: p, isSync: l } = s, m = n.workState, d = o.sp || [], w = i == null ? void 0 : i.selectRect;
|
|
1327
1333
|
if (a) {
|
|
1328
|
-
|
|
1329
|
-
type:
|
|
1334
|
+
p && m === W.Done && d.push({
|
|
1335
|
+
type: h.Select,
|
|
1330
1336
|
selectIds: r.selectIds,
|
|
1331
1337
|
selectRect: w,
|
|
1332
1338
|
willSyncService: !0,
|
|
@@ -1338,7 +1344,7 @@ class ye extends C {
|
|
|
1338
1344
|
{
|
|
1339
1345
|
...S,
|
|
1340
1346
|
workId: k,
|
|
1341
|
-
type:
|
|
1347
|
+
type: h.UpdateNode,
|
|
1342
1348
|
updateNodeOpt: {
|
|
1343
1349
|
useAnimation: !1
|
|
1344
1350
|
},
|
|
@@ -1358,7 +1364,7 @@ class we extends C {
|
|
|
1358
1364
|
}
|
|
1359
1365
|
async consume(e) {
|
|
1360
1366
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1361
|
-
if (s ===
|
|
1367
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1362
1368
|
return await this.consumeForLocalWorker(e), !0;
|
|
1363
1369
|
}
|
|
1364
1370
|
async consumeForLocalWorker(e) {
|
|
@@ -1374,10 +1380,10 @@ class we extends C {
|
|
|
1374
1380
|
}));
|
|
1375
1381
|
}
|
|
1376
1382
|
updateSelectorCallback(e) {
|
|
1377
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt:
|
|
1383
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p, textUpdateForWoker: l } = s, m = o.sp || [], d = c == null ? void 0 : c.selectRect;
|
|
1378
1384
|
if (n && m) {
|
|
1379
|
-
|
|
1380
|
-
type:
|
|
1385
|
+
p.fontSize && m.push({
|
|
1386
|
+
type: h.Select,
|
|
1381
1387
|
selectIds: i.selectIds,
|
|
1382
1388
|
selectRect: d,
|
|
1383
1389
|
willSyncService: n,
|
|
@@ -1388,14 +1394,14 @@ class we extends C {
|
|
|
1388
1394
|
l && k.toolsType === f.Text ? m.push({
|
|
1389
1395
|
...k,
|
|
1390
1396
|
workId: w,
|
|
1391
|
-
type:
|
|
1397
|
+
type: h.TextUpdate,
|
|
1392
1398
|
dataType: g.Local,
|
|
1393
1399
|
willSyncService: !0
|
|
1394
1400
|
}) : m.push(
|
|
1395
1401
|
{
|
|
1396
1402
|
...k,
|
|
1397
1403
|
workId: w,
|
|
1398
|
-
type:
|
|
1404
|
+
type: h.UpdateNode,
|
|
1399
1405
|
updateNodeOpt: {
|
|
1400
1406
|
useAnimation: !1
|
|
1401
1407
|
},
|
|
@@ -1415,7 +1421,7 @@ class ve extends C {
|
|
|
1415
1421
|
}
|
|
1416
1422
|
async consume(e) {
|
|
1417
1423
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1418
|
-
if (s ===
|
|
1424
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1419
1425
|
return this.consumeForLocalWorker(e), !0;
|
|
1420
1426
|
}
|
|
1421
1427
|
async consumeForLocalWorker(e) {
|
|
@@ -1433,22 +1439,22 @@ class ve extends C {
|
|
|
1433
1439
|
}));
|
|
1434
1440
|
}
|
|
1435
1441
|
updateSelectorCallback(e) {
|
|
1436
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a } = s,
|
|
1437
|
-
if (n &&
|
|
1442
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a } = s, p = o.sp || [], l = c == null ? void 0 : c.selectRect;
|
|
1443
|
+
if (n && p) {
|
|
1438
1444
|
for (const [m, d] of r.entries())
|
|
1439
|
-
|
|
1445
|
+
p.push(
|
|
1440
1446
|
{
|
|
1441
1447
|
...d,
|
|
1442
1448
|
workId: m,
|
|
1443
|
-
type:
|
|
1449
|
+
type: h.UpdateNode,
|
|
1444
1450
|
updateNodeOpt: {
|
|
1445
1451
|
useAnimation: !1
|
|
1446
1452
|
},
|
|
1447
1453
|
isSync: a
|
|
1448
1454
|
}
|
|
1449
1455
|
);
|
|
1450
|
-
|
|
1451
|
-
type:
|
|
1456
|
+
p.push({
|
|
1457
|
+
type: h.Select,
|
|
1452
1458
|
selectIds: i.selectIds,
|
|
1453
1459
|
selectRect: l,
|
|
1454
1460
|
willSyncService: n,
|
|
@@ -1457,7 +1463,7 @@ class ve extends C {
|
|
|
1457
1463
|
});
|
|
1458
1464
|
}
|
|
1459
1465
|
return {
|
|
1460
|
-
sp:
|
|
1466
|
+
sp: p
|
|
1461
1467
|
};
|
|
1462
1468
|
}
|
|
1463
1469
|
}
|
|
@@ -1468,7 +1474,7 @@ class ge extends C {
|
|
|
1468
1474
|
}
|
|
1469
1475
|
async consume(e) {
|
|
1470
1476
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1471
|
-
if (s ===
|
|
1477
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1472
1478
|
return this.consumeForLocalWorker(e), !0;
|
|
1473
1479
|
}
|
|
1474
1480
|
async consumeForLocalWorker(e) {
|
|
@@ -1483,14 +1489,14 @@ class ge extends C {
|
|
|
1483
1489
|
}));
|
|
1484
1490
|
}
|
|
1485
1491
|
updateSelectorCallback(e) {
|
|
1486
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt:
|
|
1492
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p } = s, l = o.sp || [], m = c == null ? void 0 : c.selectRect;
|
|
1487
1493
|
if (n && l) {
|
|
1488
1494
|
for (const [d, w] of r.entries())
|
|
1489
1495
|
l.push(
|
|
1490
1496
|
{
|
|
1491
1497
|
...w,
|
|
1492
1498
|
workId: d,
|
|
1493
|
-
type:
|
|
1499
|
+
type: h.UpdateNode,
|
|
1494
1500
|
updateNodeOpt: {
|
|
1495
1501
|
useAnimation: !1
|
|
1496
1502
|
},
|
|
@@ -1498,11 +1504,11 @@ class ge extends C {
|
|
|
1498
1504
|
}
|
|
1499
1505
|
);
|
|
1500
1506
|
l.push({
|
|
1501
|
-
isLocked:
|
|
1507
|
+
isLocked: p.isLocked,
|
|
1502
1508
|
selectorColor: i.selectorColor,
|
|
1503
1509
|
scaleType: i.scaleType,
|
|
1504
1510
|
canRotate: i.canRotate,
|
|
1505
|
-
type:
|
|
1511
|
+
type: h.Select,
|
|
1506
1512
|
selectIds: i.selectIds,
|
|
1507
1513
|
selectRect: m,
|
|
1508
1514
|
willSyncService: n,
|
|
@@ -1521,7 +1527,7 @@ class Ie extends C {
|
|
|
1521
1527
|
}
|
|
1522
1528
|
async consume(e) {
|
|
1523
1529
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1524
|
-
if (s ===
|
|
1530
|
+
if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1525
1531
|
return this.consumeForLocalWorker(e), !0;
|
|
1526
1532
|
}
|
|
1527
1533
|
async consumeForLocalWorker(e) {
|
|
@@ -1538,12 +1544,12 @@ class Ie extends C {
|
|
|
1538
1544
|
updateSelectorCallback(e) {
|
|
1539
1545
|
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
|
|
1540
1546
|
if (i && n)
|
|
1541
|
-
for (const [a,
|
|
1547
|
+
for (const [a, p] of r.entries())
|
|
1542
1548
|
n.push(
|
|
1543
1549
|
{
|
|
1544
|
-
...
|
|
1550
|
+
...p,
|
|
1545
1551
|
workId: a,
|
|
1546
|
-
type:
|
|
1552
|
+
type: h.UpdateNode,
|
|
1547
1553
|
updateNodeOpt: {
|
|
1548
1554
|
useAnimation: !1
|
|
1549
1555
|
},
|
|
@@ -1624,7 +1630,7 @@ class We {
|
|
|
1624
1630
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1625
1631
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1626
1632
|
const s = R.bufferSize.full, o = R.bufferSize.sub;
|
|
1627
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === M ? s : o }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.vNodes = new
|
|
1633
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === M ? s : o }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.vNodes = new ie(t, this.scene);
|
|
1628
1634
|
const r = {
|
|
1629
1635
|
thread: this,
|
|
1630
1636
|
vNodes: this.vNodes
|
|
@@ -1667,25 +1673,31 @@ class We {
|
|
|
1667
1673
|
post(t) {
|
|
1668
1674
|
this.combinePostMsg.add(t), this.runBatchPostData();
|
|
1669
1675
|
}
|
|
1676
|
+
updateDpr(t) {
|
|
1677
|
+
this.scene.displayRatio = t;
|
|
1678
|
+
}
|
|
1670
1679
|
async on(t) {
|
|
1671
1680
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1672
|
-
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: c, imageSrc: n, imageBitmap: a, workIds:
|
|
1681
|
+
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: c, imageSrc: n, imageBitmap: a, workIds: p } = t, l = i == null ? void 0 : i.toString();
|
|
1673
1682
|
switch (e) {
|
|
1674
|
-
case
|
|
1683
|
+
case h.UpdateDpr:
|
|
1684
|
+
K(t.dpr) && this.updateDpr(t.dpr);
|
|
1685
|
+
break;
|
|
1686
|
+
case h.AuthClear: {
|
|
1675
1687
|
const { clearUids: m, localUid: d } = t;
|
|
1676
1688
|
this.vNodes.setCanClearUids(m), this.vNodes.setLocalUid(d);
|
|
1677
1689
|
break;
|
|
1678
1690
|
}
|
|
1679
|
-
case
|
|
1691
|
+
case h.Destroy:
|
|
1680
1692
|
this.destroy();
|
|
1681
1693
|
break;
|
|
1682
|
-
case
|
|
1694
|
+
case h.Clear:
|
|
1683
1695
|
this.clearAll();
|
|
1684
1696
|
break;
|
|
1685
|
-
case
|
|
1697
|
+
case h.UpdateCamera:
|
|
1686
1698
|
await this.updateCamera(t);
|
|
1687
1699
|
break;
|
|
1688
|
-
case
|
|
1700
|
+
case h.UpdateTools:
|
|
1689
1701
|
if (s && o) {
|
|
1690
1702
|
const m = {
|
|
1691
1703
|
toolsType: s,
|
|
@@ -1694,7 +1706,7 @@ class We {
|
|
|
1694
1706
|
this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(m) : this.localWork.setToolsOpt(m);
|
|
1695
1707
|
}
|
|
1696
1708
|
break;
|
|
1697
|
-
case
|
|
1709
|
+
case h.CreateWork:
|
|
1698
1710
|
if (l && o && s) {
|
|
1699
1711
|
if (this.topWork.canUseTopLayer(s)) {
|
|
1700
1712
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
@@ -1709,30 +1721,30 @@ class We {
|
|
|
1709
1721
|
}), this.localWork.setWorkOptions(l, o);
|
|
1710
1722
|
}
|
|
1711
1723
|
break;
|
|
1712
|
-
case
|
|
1724
|
+
case h.DrawWork:
|
|
1713
1725
|
c === W.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
|
|
1714
1726
|
break;
|
|
1715
|
-
case
|
|
1716
|
-
case
|
|
1727
|
+
case h.UpdateNode:
|
|
1728
|
+
case h.FullWork:
|
|
1717
1729
|
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1718
1730
|
this.consumeDrawAll(r, t);
|
|
1719
1731
|
break;
|
|
1720
1732
|
}
|
|
1721
1733
|
this.consumeFull(r, t);
|
|
1722
1734
|
break;
|
|
1723
|
-
case
|
|
1735
|
+
case h.RemoveNode:
|
|
1724
1736
|
await this.removeNode(t);
|
|
1725
1737
|
return;
|
|
1726
|
-
case
|
|
1738
|
+
case h.Select:
|
|
1727
1739
|
r === g.Service && (i === N ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
|
|
1728
1740
|
break;
|
|
1729
|
-
case
|
|
1741
|
+
case h.CursorHover:
|
|
1730
1742
|
this.localWork.cursorHover(t);
|
|
1731
1743
|
break;
|
|
1732
|
-
case
|
|
1744
|
+
case h.GetTextActive:
|
|
1733
1745
|
r === g.Local && this.localWork.checkTextActive(t);
|
|
1734
1746
|
break;
|
|
1735
|
-
case
|
|
1747
|
+
case h.GetImageBitMap:
|
|
1736
1748
|
if (n && a && i) {
|
|
1737
1749
|
const m = i.toString();
|
|
1738
1750
|
this.deleteCachedImagesByWorkId(m), this.cacheImages.set(n, {
|
|
@@ -1746,13 +1758,13 @@ class We {
|
|
|
1746
1758
|
}
|
|
1747
1759
|
}
|
|
1748
1760
|
break;
|
|
1749
|
-
case
|
|
1750
|
-
if (i &&
|
|
1751
|
-
const m =
|
|
1761
|
+
case h.GetVNodeInfo:
|
|
1762
|
+
if (i && p) {
|
|
1763
|
+
const m = p.map((d) => this.vNodes.get(d));
|
|
1752
1764
|
this.post({
|
|
1753
1765
|
sp: [
|
|
1754
1766
|
{
|
|
1755
|
-
type:
|
|
1767
|
+
type: h.GetVNodeInfo,
|
|
1756
1768
|
dataType: g.Local,
|
|
1757
1769
|
workId: i,
|
|
1758
1770
|
vInfo: m
|
|
@@ -1771,13 +1783,13 @@ class We {
|
|
|
1771
1783
|
async loadImageBitMap(t) {
|
|
1772
1784
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
1773
1785
|
if (e === f.Image && s && o) {
|
|
1774
|
-
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor:
|
|
1786
|
+
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: p } = s;
|
|
1775
1787
|
if (!i || !c || !n || !a)
|
|
1776
1788
|
return;
|
|
1777
1789
|
let l = i;
|
|
1778
|
-
if (c ===
|
|
1790
|
+
if (c === X.Iconify) {
|
|
1779
1791
|
const [k, S] = this.getIconSize(n, a, this.opt.displayer.dpr);
|
|
1780
|
-
l = `${i}?width=${k}&height=${S}&color=${
|
|
1792
|
+
l = `${i}?width=${k}&height=${S}&color=${p}`;
|
|
1781
1793
|
}
|
|
1782
1794
|
if (this.cacheImages.has(l)) {
|
|
1783
1795
|
const k = this.getCachedImages(l);
|
|
@@ -1804,7 +1816,7 @@ class We {
|
|
|
1804
1816
|
viewId: this.viewId,
|
|
1805
1817
|
isgl: !!this.fullLayer.parent.gl,
|
|
1806
1818
|
isSubWorker: !1,
|
|
1807
|
-
type:
|
|
1819
|
+
type: h.GetImageBitMap
|
|
1808
1820
|
}]
|
|
1809
1821
|
});
|
|
1810
1822
|
});
|
|
@@ -1844,13 +1856,13 @@ class We {
|
|
|
1844
1856
|
for (const r of o.sp) {
|
|
1845
1857
|
let i = !1;
|
|
1846
1858
|
for (const c of t)
|
|
1847
|
-
if (
|
|
1859
|
+
if (Z(r, c)) {
|
|
1848
1860
|
i = !0;
|
|
1849
1861
|
break;
|
|
1850
1862
|
}
|
|
1851
1863
|
i || t.push(r);
|
|
1852
1864
|
}
|
|
1853
|
-
|
|
1865
|
+
K(o.drawCount) && (e = o.drawCount);
|
|
1854
1866
|
}
|
|
1855
1867
|
return this.combinePostMsg.clear(), {
|
|
1856
1868
|
sp: t,
|
|
@@ -1859,7 +1871,7 @@ class We {
|
|
|
1859
1871
|
}
|
|
1860
1872
|
combinePost() {
|
|
1861
1873
|
var s, o;
|
|
1862
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !==
|
|
1874
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== h.None || r.isLockSentEventCursor);
|
|
1863
1875
|
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);
|
|
1864
1876
|
}
|
|
1865
1877
|
clearAll() {
|
|
@@ -1867,7 +1879,7 @@ class We {
|
|
|
1867
1879
|
t.name !== "viewport" && t.remove();
|
|
1868
1880
|
}), this.fullLayer.removeAllChildren()), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
|
|
1869
1881
|
sp: [{
|
|
1870
|
-
type:
|
|
1882
|
+
type: h.Clear
|
|
1871
1883
|
}]
|
|
1872
1884
|
});
|
|
1873
1885
|
}
|
|
@@ -1897,10 +1909,10 @@ class We {
|
|
|
1897
1909
|
async updateCamera(t) {
|
|
1898
1910
|
var o;
|
|
1899
1911
|
const { cameraOpt: e, scenePath: s } = t;
|
|
1900
|
-
if (e && !
|
|
1912
|
+
if (e && !Z(this.cameraOpt, e)) {
|
|
1901
1913
|
if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
|
|
1902
1914
|
let a = !1;
|
|
1903
|
-
for (const [
|
|
1915
|
+
for (const [p, l] of this.localWork.getWorkShapes().entries())
|
|
1904
1916
|
switch (l.toolsType) {
|
|
1905
1917
|
case f.Text:
|
|
1906
1918
|
case f.BitMapEraser:
|
|
@@ -1910,7 +1922,7 @@ class We {
|
|
|
1910
1922
|
case f.LaserPen:
|
|
1911
1923
|
break;
|
|
1912
1924
|
default:
|
|
1913
|
-
|
|
1925
|
+
p !== U && p !== N && (a = !0);
|
|
1914
1926
|
break;
|
|
1915
1927
|
}
|
|
1916
1928
|
if (a) {
|
|
@@ -1921,9 +1933,9 @@ class We {
|
|
|
1921
1933
|
}
|
|
1922
1934
|
}
|
|
1923
1935
|
const r = /* @__PURE__ */ new Map();
|
|
1924
|
-
for (const [a,
|
|
1925
|
-
const l =
|
|
1926
|
-
r.set(a,
|
|
1936
|
+
for (const [a, p] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
1937
|
+
const l = p.rect;
|
|
1938
|
+
r.set(a, J(l));
|
|
1927
1939
|
}
|
|
1928
1940
|
const i = new Set(r.keys());
|
|
1929
1941
|
let c = !1;
|
|
@@ -1931,26 +1943,26 @@ class We {
|
|
|
1931
1943
|
const a = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
|
|
1932
1944
|
if (a) {
|
|
1933
1945
|
c = !0;
|
|
1934
|
-
for (const
|
|
1935
|
-
i.add(
|
|
1946
|
+
for (const p of a)
|
|
1947
|
+
i.add(p);
|
|
1936
1948
|
}
|
|
1937
1949
|
}
|
|
1938
1950
|
let n = !1;
|
|
1939
1951
|
if (this.serviceWork.selectorWorkShapes.size)
|
|
1940
1952
|
for (const a of this.serviceWork.selectorWorkShapes.values()) {
|
|
1941
|
-
const
|
|
1942
|
-
if (
|
|
1953
|
+
const p = a.selectIds;
|
|
1954
|
+
if (p) {
|
|
1943
1955
|
n = !0;
|
|
1944
|
-
for (const l of
|
|
1956
|
+
for (const l of p)
|
|
1945
1957
|
i.add(l);
|
|
1946
1958
|
}
|
|
1947
1959
|
}
|
|
1948
1960
|
if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
|
|
1949
1961
|
this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(i), this.debounceUpdateCameraId && clearTimeout(this.debounceUpdateCameraId);
|
|
1950
|
-
for (const [a,
|
|
1962
|
+
for (const [a, p] of r.entries()) {
|
|
1951
1963
|
const l = this.vNodes.get(a);
|
|
1952
1964
|
if (l) {
|
|
1953
|
-
const m =
|
|
1965
|
+
const m = p, d = l.rect, w = this.getSceneRect(), k = P(m, w), S = P(d, w);
|
|
1954
1966
|
let v = !1;
|
|
1955
1967
|
if ((k !== S || m.w !== d.w || m.h !== d.h || S === q.intersect) && (v = !0), v) {
|
|
1956
1968
|
const { toolsType: I, opt: y } = l;
|
|
@@ -1959,20 +1971,20 @@ class We {
|
|
|
1959
1971
|
}
|
|
1960
1972
|
}
|
|
1961
1973
|
if (c && this.localWork.reRenderSelector(), n)
|
|
1962
|
-
for (const [a,
|
|
1974
|
+
for (const [a, p] of this.serviceWork.selectorWorkShapes.entries())
|
|
1963
1975
|
this.serviceWork.runSelectWork({
|
|
1964
1976
|
workId: a,
|
|
1965
|
-
selectIds:
|
|
1966
|
-
msgType:
|
|
1977
|
+
selectIds: p.selectIds,
|
|
1978
|
+
msgType: h.Select,
|
|
1967
1979
|
dataType: g.Service,
|
|
1968
1980
|
viewId: this.viewId
|
|
1969
1981
|
});
|
|
1970
1982
|
this.debounceUpdateCameraId = setTimeout(() => {
|
|
1971
|
-
var
|
|
1983
|
+
var p;
|
|
1972
1984
|
this.debounceUpdateCameraId = void 0;
|
|
1973
1985
|
const a = [];
|
|
1974
1986
|
for (const l of this.debounceUpdateCache.values()) {
|
|
1975
|
-
if ((
|
|
1987
|
+
if ((p = this.fullLayer) == null ? void 0 : p.getElementsByName(l)[0]) {
|
|
1976
1988
|
const d = this.vNodes.get(l);
|
|
1977
1989
|
if (d) {
|
|
1978
1990
|
const { toolsType: w, opt: k, rect: S } = d, v = this.localWork.setFullWork({
|
|
@@ -2007,7 +2019,7 @@ class We {
|
|
|
2007
2019
|
};
|
|
2008
2020
|
}
|
|
2009
2021
|
createScene(t) {
|
|
2010
|
-
return new
|
|
2022
|
+
return new Y({
|
|
2011
2023
|
displayRatio: this.opt.displayer.dpr,
|
|
2012
2024
|
depth: !1,
|
|
2013
2025
|
desynchronized: !0,
|
|
@@ -2018,7 +2030,7 @@ class We {
|
|
|
2018
2030
|
});
|
|
2019
2031
|
}
|
|
2020
2032
|
createLayer(t, e, s) {
|
|
2021
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, { ...s, offscreen: !1 }), n = new
|
|
2033
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, { ...s, offscreen: !1 }), n = new Q({
|
|
2022
2034
|
anchor: [0.5, 0.5],
|
|
2023
2035
|
pos: [o * 0.5, r * 0.5],
|
|
2024
2036
|
size: [o, r],
|
|
@@ -2081,13 +2093,13 @@ class Ne {
|
|
|
2081
2093
|
async on(t) {
|
|
2082
2094
|
const { msgType: e, imageSrc: s, imageBitmap: o, workId: r } = t;
|
|
2083
2095
|
switch (e) {
|
|
2084
|
-
case
|
|
2096
|
+
case h.Snapshot:
|
|
2085
2097
|
await this.getSnapshot(t), this.destroy();
|
|
2086
2098
|
return;
|
|
2087
|
-
case
|
|
2099
|
+
case h.BoundingBox:
|
|
2088
2100
|
await this.getBoundingRect(t), this.destroy();
|
|
2089
2101
|
return;
|
|
2090
|
-
case
|
|
2102
|
+
case h.GetImageBitMap:
|
|
2091
2103
|
if (s && o && r) {
|
|
2092
2104
|
const i = r.toString();
|
|
2093
2105
|
this.deleteCachedImagesByWorkId(i), this.cacheImages.set(s, {
|
|
@@ -2110,13 +2122,13 @@ class Ne {
|
|
|
2110
2122
|
async loadImageBitMap(t) {
|
|
2111
2123
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
2112
2124
|
if (e === f.Image && s && o) {
|
|
2113
|
-
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor:
|
|
2125
|
+
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: p } = s;
|
|
2114
2126
|
if (!i || !c || !n || !a)
|
|
2115
2127
|
return;
|
|
2116
2128
|
let l = i;
|
|
2117
|
-
if (c ===
|
|
2129
|
+
if (c === X.Iconify) {
|
|
2118
2130
|
const [k, S] = this.getIconSize(n, a, this.opt.displayer.dpr);
|
|
2119
|
-
l = `${i}?width=${k}&height=${S}&color=${
|
|
2131
|
+
l = `${i}?width=${k}&height=${S}&color=${p}`;
|
|
2120
2132
|
}
|
|
2121
2133
|
if (this.cacheImages.has(l)) {
|
|
2122
2134
|
const k = this.getCachedImages(l);
|
|
@@ -2143,7 +2155,7 @@ class Ne {
|
|
|
2143
2155
|
viewId: this.viewId,
|
|
2144
2156
|
isgl: !!this.fullLayer.parent.gl,
|
|
2145
2157
|
isSubWorker: !0,
|
|
2146
|
-
type:
|
|
2158
|
+
type: h.GetImageBitMap
|
|
2147
2159
|
}]
|
|
2148
2160
|
});
|
|
2149
2161
|
});
|
|
@@ -2190,16 +2202,16 @@ class Ne {
|
|
|
2190
2202
|
if (e && s && o) {
|
|
2191
2203
|
this.setCameraOpt(o);
|
|
2192
2204
|
let c;
|
|
2193
|
-
for (const [a,
|
|
2194
|
-
if (
|
|
2195
|
-
switch (
|
|
2196
|
-
case
|
|
2197
|
-
case
|
|
2198
|
-
const { opt: l } =
|
|
2199
|
-
...
|
|
2205
|
+
for (const [a, p] of Object.entries(s))
|
|
2206
|
+
if (p != null && p.type)
|
|
2207
|
+
switch (p == null ? void 0 : p.type) {
|
|
2208
|
+
case h.UpdateNode:
|
|
2209
|
+
case h.FullWork: {
|
|
2210
|
+
const { opt: l } = p, m = {
|
|
2211
|
+
...p,
|
|
2200
2212
|
opt: l,
|
|
2201
2213
|
workId: a,
|
|
2202
|
-
msgType:
|
|
2214
|
+
msgType: h.FullWork,
|
|
2203
2215
|
dataType: g.Service,
|
|
2204
2216
|
viewId: this.viewId
|
|
2205
2217
|
}, d = await this.runFullWork(m);
|
|
@@ -2234,7 +2246,7 @@ class Ne {
|
|
|
2234
2246
|
const o = await this.getRectImageBitmap(this.getSceneRect(), s);
|
|
2235
2247
|
o && (this.post({
|
|
2236
2248
|
sp: [{
|
|
2237
|
-
type:
|
|
2249
|
+
type: h.Snapshot,
|
|
2238
2250
|
scenePath: e,
|
|
2239
2251
|
imageBitmap: o,
|
|
2240
2252
|
viewId: this.viewId
|
|
@@ -2249,12 +2261,12 @@ class Ne {
|
|
|
2249
2261
|
for (const [i, c] of Object.entries(s))
|
|
2250
2262
|
if (c != null && c.type)
|
|
2251
2263
|
switch (c == null ? void 0 : c.type) {
|
|
2252
|
-
case
|
|
2253
|
-
case
|
|
2264
|
+
case h.UpdateNode:
|
|
2265
|
+
case h.FullWork: {
|
|
2254
2266
|
const n = await this.runFullWork({
|
|
2255
2267
|
...c,
|
|
2256
2268
|
workId: i,
|
|
2257
|
-
msgType:
|
|
2269
|
+
msgType: h.FullWork,
|
|
2258
2270
|
dataType: g.Service,
|
|
2259
2271
|
viewId: this.viewId
|
|
2260
2272
|
});
|
|
@@ -2264,7 +2276,7 @@ class Ne {
|
|
|
2264
2276
|
}
|
|
2265
2277
|
r && this.post({
|
|
2266
2278
|
sp: [{
|
|
2267
|
-
type:
|
|
2279
|
+
type: h.BoundingBox,
|
|
2268
2280
|
scenePath: e,
|
|
2269
2281
|
rect: r
|
|
2270
2282
|
}]
|
|
@@ -2287,7 +2299,7 @@ class Ne {
|
|
|
2287
2299
|
for (const o of s.sp) {
|
|
2288
2300
|
let r = !1;
|
|
2289
2301
|
for (const i of t)
|
|
2290
|
-
if (
|
|
2302
|
+
if (ae(o, i)) {
|
|
2291
2303
|
r = !0;
|
|
2292
2304
|
break;
|
|
2293
2305
|
}
|
|
@@ -2299,11 +2311,11 @@ class Ne {
|
|
|
2299
2311
|
}
|
|
2300
2312
|
combinePost() {
|
|
2301
2313
|
var s, o;
|
|
2302
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !==
|
|
2314
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== h.None || r.isLockSentEventCursor);
|
|
2303
2315
|
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);
|
|
2304
2316
|
}
|
|
2305
2317
|
createScene(t) {
|
|
2306
|
-
return new
|
|
2318
|
+
return new Y({
|
|
2307
2319
|
displayRatio: this.opt.displayer.dpr,
|
|
2308
2320
|
depth: !1,
|
|
2309
2321
|
desynchronized: !0,
|
|
@@ -2313,7 +2325,7 @@ class Ne {
|
|
|
2313
2325
|
});
|
|
2314
2326
|
}
|
|
2315
2327
|
createLayer(t, e, s) {
|
|
2316
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, s), n = new
|
|
2328
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, s), n = new Q({
|
|
2317
2329
|
anchor: [0.5, 0.5],
|
|
2318
2330
|
pos: [o * 0.5, r * 0.5],
|
|
2319
2331
|
size: [o, r],
|
|
@@ -2358,12 +2370,12 @@ class xe {
|
|
|
2358
2370
|
async consume(t) {
|
|
2359
2371
|
var e, s, o, r;
|
|
2360
2372
|
for (const i of t.values()) {
|
|
2361
|
-
const { msgType: c, viewId: n, tasksqueue: a, mainTasksqueueCount:
|
|
2362
|
-
if (c ===
|
|
2373
|
+
const { msgType: c, viewId: n, tasksqueue: a, mainTasksqueueCount: p, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: w } = i;
|
|
2374
|
+
if (c === h.Console) {
|
|
2363
2375
|
console.log(this);
|
|
2364
2376
|
continue;
|
|
2365
2377
|
}
|
|
2366
|
-
if (c ===
|
|
2378
|
+
if (c === h.Init) {
|
|
2367
2379
|
const S = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, v = S == null ? void 0 : S.canvasContainerRef.current;
|
|
2368
2380
|
if (S && v && l && m) {
|
|
2369
2381
|
const I = this.createMainThread(n, {
|
|
@@ -2378,7 +2390,7 @@ class xe {
|
|
|
2378
2390
|
}
|
|
2379
2391
|
continue;
|
|
2380
2392
|
}
|
|
2381
|
-
if ((c ===
|
|
2393
|
+
if ((c === h.Snapshot || c === h.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2382
2394
|
const S = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, v = (r = S.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2383
2395
|
if (S && v && d) {
|
|
2384
2396
|
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
@@ -2405,24 +2417,24 @@ class xe {
|
|
|
2405
2417
|
continue;
|
|
2406
2418
|
}
|
|
2407
2419
|
}
|
|
2408
|
-
if (c ===
|
|
2420
|
+
if (c === h.GetImageBitMap && w && this.snapshotThread) {
|
|
2409
2421
|
this.snapshotThread.on(i);
|
|
2410
2422
|
continue;
|
|
2411
2423
|
}
|
|
2412
|
-
if (c ===
|
|
2424
|
+
if (c === h.TasksQueue && (a != null && a.size)) {
|
|
2413
2425
|
for (const [S, v] of this.mainThreadMap.entries()) {
|
|
2414
2426
|
const I = a.get(S);
|
|
2415
|
-
I && (await v.on(I),
|
|
2427
|
+
I && (await v.on(I), p && this.post({ workerTasksqueueCount: p }));
|
|
2416
2428
|
}
|
|
2417
2429
|
continue;
|
|
2418
2430
|
}
|
|
2419
|
-
if (n ===
|
|
2431
|
+
if (n === ce) {
|
|
2420
2432
|
for (const S of this.mainThreadMap.values())
|
|
2421
|
-
S.on(i), c ===
|
|
2433
|
+
S.on(i), c === h.Destroy && this.mainThreadMap.delete(n);
|
|
2422
2434
|
continue;
|
|
2423
2435
|
}
|
|
2424
2436
|
const k = this.mainThreadMap.get(n);
|
|
2425
|
-
k && (k.on(i), c ===
|
|
2437
|
+
k && (k.on(i), c === h.Destroy && this.mainThreadMap.delete(n));
|
|
2426
2438
|
}
|
|
2427
2439
|
}
|
|
2428
2440
|
}
|