@netless/appliance-plugin 1.1.18-beta.2 → 1.1.19-beta.1
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 +318 -260
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-3k30fq.js +439 -0
- package/cdn/subWorker-rWfN0e.js +439 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +7 -7
- package/dist/cdn.d.ts +2 -2
- package/dist/collector/index.d.ts +4 -4
- package/dist/collector/types.d.ts +2 -2
- package/dist/component/miniMap/index.d.ts +1 -1
- package/dist/component/miniMap/manager.d.ts +2 -2
- package/dist/component/miniMap/view.d.ts +1 -1
- package/dist/component/textEditor/index.d.ts +2 -2
- package/dist/component/textEditor/types.d.ts +2 -2
- package/dist/component/textEditor/view.d.ts +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/mainEngine.d.ts +7 -3
- package/dist/core/mainThread/base.d.ts +4 -4
- package/dist/core/mainThread/index.d.ts +2 -2
- package/dist/core/mainThread/snapshotThread.d.ts +3 -3
- package/dist/core/mainThread/subLocalThread.d.ts +11 -6
- package/dist/core/mainThread/subServiceThread.d.ts +1 -1
- package/dist/core/mainThread/workerMainThread.d.ts +2 -2
- package/dist/core/msgEvent/copyNode/forMain.d.ts +2 -2
- package/dist/core/msgEvent/forMainThread.d.ts +4 -4
- package/dist/core/msgEvent/forWorker.d.ts +4 -4
- package/dist/core/msgEvent/index.d.ts +4 -4
- package/dist/core/tools/base.d.ts +3 -3
- package/dist/core/tools/index.d.ts +14 -14
- package/dist/core/tools/laserPen.d.ts +1 -1
- package/dist/core/tools/pencilEraser.d.ts +4 -34
- package/dist/core/tools/pencilEraserBitMap.d.ts +7 -30
- package/dist/core/tools/selector.d.ts +1 -1
- package/dist/core/types.d.ts +11 -9
- package/dist/core/utils/clipper.d.ts +1 -1
- package/dist/core/utils/getSvgPathFromPoints.d.ts +1 -1
- package/dist/core/utils/index.d.ts +4 -4
- package/dist/core/utils/primitives/Box2d.d.ts +4 -4
- package/dist/core/utils/proxy.d.ts +3 -4
- package/dist/core/worker/base.d.ts +5 -2
- package/dist/core/worker/fullWorkerLocal.d.ts +5 -11
- package/dist/cursors/index.d.ts +1 -1
- package/dist/fullWorker.js +142 -203
- package/dist/index-B4Ld7AM5.js +1 -0
- package/dist/index-BS5_t4VL.mjs +21267 -0
- package/dist/index-CG1H4AUQ.js +1 -0
- package/dist/{index-BL-uNbea.mjs → index-yLOzxVyY.mjs} +901 -658
- package/dist/plugin/baseViewContainerManager.d.ts +3 -3
- package/dist/plugin/const.d.ts +1 -0
- package/dist/plugin/multi/containerManager.d.ts +1 -1
- package/dist/plugin/types.d.ts +20 -11
- package/dist/style.css +1 -1
- package/dist/subWorker.js +142 -203
- package/dist/undo/index.d.ts +1 -1
- package/package.json +7 -1
- package/cdn/fullWorker-XdWoUM.js +0 -500
- package/cdn/subWorker-wI5N8T.js +0 -500
- package/dist/index-CKpm84e8.js +0 -1
- package/dist/index-DThrnC5D.mjs +0 -17608
- package/dist/index-D_HrD9jF.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (
|
|
4
|
-
import { D as
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var ie = (N, t, e) => t in N ? re(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
|
|
3
|
+
var u = (N, t, e) => ie(N, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { D as x, E as W, a as f, r as B, b as v, g as z, t as F, c as p, S as Q, d as L, e as _, i as ae, C as E, f as R, h as ne, j as K, k as T, M as A, V as ce, l as J, T as Z, m as H, n as j, o as $, p as le, q, s as X, u as he } from "./index-BS5_t4VL.mjs";
|
|
5
|
+
import { Scene as ee, Group as te } from "spritejs";
|
|
6
|
+
import { cloneDeep as se, xor as pe, isNumber as U, isEqual as Y } from "lodash";
|
|
7
7
|
import "clipper-lib";
|
|
8
8
|
import "lineclip";
|
|
9
9
|
import "white-web-sdk";
|
|
10
10
|
import "react-dom";
|
|
11
11
|
import "react";
|
|
12
12
|
import "eventemitter2";
|
|
13
|
-
class
|
|
13
|
+
class de {
|
|
14
14
|
constructor(t) {
|
|
15
15
|
u(this, "vNodes");
|
|
16
16
|
u(this, "thread");
|
|
@@ -18,7 +18,7 @@ class fe {
|
|
|
18
18
|
u(this, "localWorkShapes", /* @__PURE__ */ new Map());
|
|
19
19
|
u(this, "tmpOpt");
|
|
20
20
|
u(this, "animationId");
|
|
21
|
-
u(this, "syncUnitTime",
|
|
21
|
+
u(this, "syncUnitTime", x.syncOpt.interval);
|
|
22
22
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
23
23
|
}
|
|
24
24
|
createLocalWork(t) {
|
|
@@ -56,17 +56,24 @@ class fe {
|
|
|
56
56
|
clearAll() {
|
|
57
57
|
this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
|
|
58
58
|
t.name !== "viewport" && t.remove();
|
|
59
|
-
}),
|
|
59
|
+
}), B(
|
|
60
|
+
this.thread.serviceLayer,
|
|
61
|
+
this.thread.serviceLayer.parent
|
|
62
|
+
)), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
|
|
60
63
|
}
|
|
61
64
|
consumeDraw(t) {
|
|
62
65
|
const { workId: e, dataType: s } = t;
|
|
63
|
-
if (s ===
|
|
66
|
+
if (s === v.Service)
|
|
64
67
|
this.activeServiceWorkShape(t);
|
|
65
68
|
else {
|
|
66
69
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
67
70
|
if (!r)
|
|
68
71
|
return;
|
|
69
|
-
const i = r.node.consume({
|
|
72
|
+
const i = r.node.consume({
|
|
73
|
+
data: t,
|
|
74
|
+
isFullWork: !1,
|
|
75
|
+
isSubWorker: !0
|
|
76
|
+
});
|
|
70
77
|
i.rect && (r.result = i, r.workState = W.Doing, o && this.localWorkShapes.set(o, r));
|
|
71
78
|
}
|
|
72
79
|
this.runAnimation();
|
|
@@ -81,10 +88,19 @@ class fe {
|
|
|
81
88
|
createWorkShapeNode(t) {
|
|
82
89
|
const { toolsType: e } = t;
|
|
83
90
|
if (e === f.LaserPen)
|
|
84
|
-
return
|
|
91
|
+
return z({
|
|
92
|
+
...t,
|
|
93
|
+
vNodes: this.vNodes,
|
|
94
|
+
fullLayer: this.thread.topLayer,
|
|
95
|
+
drawLayer: this.thread.topLayer
|
|
96
|
+
});
|
|
85
97
|
}
|
|
86
98
|
setNodeKey(t, e, s, o) {
|
|
87
|
-
return e.toolsType = s, e.node = this.createWorkShapeNode({
|
|
99
|
+
return e.toolsType = s, e.node = this.createWorkShapeNode({
|
|
100
|
+
workId: t,
|
|
101
|
+
toolsType: s,
|
|
102
|
+
toolsOpt: o
|
|
103
|
+
}), e;
|
|
88
104
|
}
|
|
89
105
|
activeServiceWorkShape(t) {
|
|
90
106
|
var m, d;
|
|
@@ -93,7 +109,7 @@ class fe {
|
|
|
93
109
|
return;
|
|
94
110
|
const n = e.toString(), h = (m = this.vNodes.get(n)) == null ? void 0 : m.rect;
|
|
95
111
|
if (!((d = this.serviceWorkShapes) != null && d.has(n))) {
|
|
96
|
-
let
|
|
112
|
+
let k = {
|
|
97
113
|
toolsType: o,
|
|
98
114
|
animationWorkData: c || [],
|
|
99
115
|
animationIndex: 0,
|
|
@@ -102,15 +118,20 @@ class fe {
|
|
|
102
118
|
ops: a,
|
|
103
119
|
oldRect: h
|
|
104
120
|
};
|
|
105
|
-
o && s && (
|
|
121
|
+
o && s && (k = this.setNodeKey(n, k, o, s)), this.serviceWorkShapes.set(n, k);
|
|
106
122
|
}
|
|
107
123
|
const l = this.serviceWorkShapes.get(n);
|
|
108
|
-
r && (l.type = r), a && (l.animationWorkData =
|
|
124
|
+
r && (l.type = r), a && (l.animationWorkData = F(a), l.ops = a), i && (l.updateNodeOpt = i), c && (l.animationWorkData = c), l.node && l.node.getWorkId() !== n && l.node.setWorkId(n), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(n, l, o, s), l.node && l.node.setWorkOptions(s));
|
|
109
125
|
}
|
|
110
126
|
computNextAnimationIndex(t, e) {
|
|
111
127
|
var r;
|
|
112
|
-
const s = ((r = t.node) == null ? void 0 : r.syncUnitTime) || this.syncUnitTime, o = Math.floor(
|
|
113
|
-
|
|
128
|
+
const s = ((r = t.node) == null ? void 0 : r.syncUnitTime) || this.syncUnitTime, o = Math.floor(
|
|
129
|
+
(t.animationWorkData || []).slice(t.animationIndex).length * 32 / e / s
|
|
130
|
+
) * e;
|
|
131
|
+
return Math.min(
|
|
132
|
+
(t.animationIndex || 0) + (o || e),
|
|
133
|
+
(t.animationWorkData || []).length
|
|
134
|
+
);
|
|
114
135
|
}
|
|
115
136
|
animationDraw() {
|
|
116
137
|
var o, r, i, a;
|
|
@@ -120,7 +141,13 @@ class fe {
|
|
|
120
141
|
for (const [c, n] of this.serviceWorkShapes.entries())
|
|
121
142
|
switch (n.toolsType) {
|
|
122
143
|
case f.LaserPen: {
|
|
123
|
-
const l = this.computNextAnimationIndex(
|
|
144
|
+
const l = this.computNextAnimationIndex(
|
|
145
|
+
n,
|
|
146
|
+
8
|
|
147
|
+
), m = Math.max(0, n.animationIndex || 0), d = (n.animationWorkData || []).slice(
|
|
148
|
+
m,
|
|
149
|
+
l
|
|
150
|
+
);
|
|
124
151
|
if ((n.animationIndex || 0) < l && ((o = n.node) == null || o.consumeService({
|
|
125
152
|
op: d,
|
|
126
153
|
isFullWork: !1
|
|
@@ -131,7 +158,9 @@ class fe {
|
|
|
131
158
|
(i = n.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(c);
|
|
132
159
|
break;
|
|
133
160
|
}
|
|
134
|
-
n.ops && n.animationIndex === ((a = n.animationWorkData) == null ? void 0 : a.length) && !n.isDel && (this.thread.topLayer.getElementsByName(
|
|
161
|
+
n.ops && n.animationIndex === ((a = n.animationWorkData) == null ? void 0 : a.length) && !n.isDel && (this.thread.topLayer.getElementsByName(
|
|
162
|
+
c.toString()
|
|
163
|
+
)[0] || (n.isDel = !0, this.serviceWorkShapes.set(c, n))), t = !0;
|
|
135
164
|
break;
|
|
136
165
|
}
|
|
137
166
|
}
|
|
@@ -146,7 +175,9 @@ class fe {
|
|
|
146
175
|
});
|
|
147
176
|
break;
|
|
148
177
|
}
|
|
149
|
-
h && ((h.op || h.ops) && s.push(h), n.result = void 0), !this.thread.topLayer.getElementsByName(
|
|
178
|
+
h && ((h.op || h.ops) && s.push(h), n.result = void 0), !this.thread.topLayer.getElementsByName(
|
|
179
|
+
c.toString()
|
|
180
|
+
)[0] && d === W.Done && (n.isDel = !0, this.localWorkShapes.set(c, n)), t = !0;
|
|
150
181
|
break;
|
|
151
182
|
}
|
|
152
183
|
}
|
|
@@ -154,7 +185,7 @@ class fe {
|
|
|
154
185
|
t && this.runAnimation(), e.size && e.forEach((c, n) => {
|
|
155
186
|
s.push({
|
|
156
187
|
type: p.Cursor,
|
|
157
|
-
uid: n.split(
|
|
188
|
+
uid: n.split(Q)[0],
|
|
158
189
|
op: c.op,
|
|
159
190
|
workState: c.workState,
|
|
160
191
|
viewId: this.thread.viewId
|
|
@@ -179,7 +210,7 @@ class fe {
|
|
|
179
210
|
}
|
|
180
211
|
consumeDrawAll(t) {
|
|
181
212
|
const { workId: e, dataType: s } = t;
|
|
182
|
-
if (s ===
|
|
213
|
+
if (s === v.Service)
|
|
183
214
|
this.activeServiceWorkShape(t);
|
|
184
215
|
else {
|
|
185
216
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
@@ -191,7 +222,7 @@ class fe {
|
|
|
191
222
|
this.runAnimation();
|
|
192
223
|
}
|
|
193
224
|
}
|
|
194
|
-
class
|
|
225
|
+
class ue {
|
|
195
226
|
constructor(t) {
|
|
196
227
|
u(this, "vNodes");
|
|
197
228
|
u(this, "thread");
|
|
@@ -200,10 +231,13 @@ class me {
|
|
|
200
231
|
u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
|
|
201
232
|
u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
|
|
202
233
|
u(this, "tmpOpt");
|
|
203
|
-
u(this, "syncUnitTime",
|
|
234
|
+
u(this, "syncUnitTime", x.syncOpt.interval);
|
|
204
235
|
u(this, "fullWorkerDrawCount", 0);
|
|
205
236
|
u(this, "drawWorkActiveId");
|
|
206
237
|
u(this, "consumeCount", 0);
|
|
238
|
+
u(this, "combineTimerId");
|
|
239
|
+
u(this, "combineDrawResolve");
|
|
240
|
+
u(this, "combineDrawActiveId");
|
|
207
241
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
208
242
|
}
|
|
209
243
|
async loadImageBitMap(t) {
|
|
@@ -232,24 +266,26 @@ class me {
|
|
|
232
266
|
// }
|
|
233
267
|
async updateSelector(t) {
|
|
234
268
|
var m;
|
|
235
|
-
const e = this.workShapes.get(
|
|
269
|
+
const e = this.workShapes.get(
|
|
270
|
+
L
|
|
271
|
+
);
|
|
236
272
|
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
237
273
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
|
|
238
274
|
updateSelectorOpt: r,
|
|
239
|
-
selectIds:
|
|
275
|
+
selectIds: se(e.selectIds),
|
|
240
276
|
vNodes: this.vNodes,
|
|
241
277
|
willSerializeData: i,
|
|
242
278
|
worker: this
|
|
243
279
|
})), c = /* @__PURE__ */ new Map();
|
|
244
280
|
let n;
|
|
245
|
-
a != null && a.selectIds && (n =
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
248
|
-
const { toolsType:
|
|
281
|
+
a != null && a.selectIds && (n = pe(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
|
|
282
|
+
const k = this.vNodes.get(d);
|
|
283
|
+
if (k) {
|
|
284
|
+
const { toolsType: S, op: y, opt: I } = k;
|
|
249
285
|
c.set(d, {
|
|
250
|
-
opt:
|
|
251
|
-
toolsType:
|
|
252
|
-
ops: (
|
|
286
|
+
opt: I,
|
|
287
|
+
toolsType: S,
|
|
288
|
+
ops: (y == null ? void 0 : y.length) && _(y) || void 0
|
|
253
289
|
});
|
|
254
290
|
}
|
|
255
291
|
}), e.selectIds = a.selectIds);
|
|
@@ -272,11 +308,16 @@ class me {
|
|
|
272
308
|
clearAll() {
|
|
273
309
|
if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
|
|
274
310
|
e.name !== "viewport" && e.remove();
|
|
275
|
-
}),
|
|
311
|
+
}), B(
|
|
312
|
+
this.thread.localLayer,
|
|
313
|
+
this.thread.localLayer.parent
|
|
314
|
+
)), this.workShapes.get(
|
|
315
|
+
L
|
|
316
|
+
)) {
|
|
276
317
|
const e = [];
|
|
277
318
|
e.push({
|
|
278
319
|
type: p.Select,
|
|
279
|
-
dataType:
|
|
320
|
+
dataType: v.Local,
|
|
280
321
|
selectIds: [],
|
|
281
322
|
willSyncService: !1
|
|
282
323
|
}), this.thread.post({ sp: e });
|
|
@@ -289,7 +330,7 @@ class me {
|
|
|
289
330
|
let r;
|
|
290
331
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
291
332
|
const { rect: a, name: c, toolsType: n, opt: h } = 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 (n === f.Text &&
|
|
333
|
+
if (n === f.Text && ae([l, m], a) && h.workState === W.Done) {
|
|
293
334
|
r = c;
|
|
294
335
|
break;
|
|
295
336
|
}
|
|
@@ -300,17 +341,19 @@ class me {
|
|
|
300
341
|
dataType: o,
|
|
301
342
|
isSync: !0
|
|
302
343
|
}), this.thread.post({
|
|
303
|
-
sp: [
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
344
|
+
sp: [
|
|
345
|
+
{
|
|
346
|
+
type: p.GetTextActive,
|
|
347
|
+
toolsType: f.Text,
|
|
348
|
+
workId: r
|
|
349
|
+
}
|
|
350
|
+
]
|
|
308
351
|
}));
|
|
309
352
|
}
|
|
310
353
|
}
|
|
311
354
|
cursorHover(t) {
|
|
312
355
|
const { opt: e, toolsType: s, point: o } = t, r = this.setFullWork({
|
|
313
|
-
workId:
|
|
356
|
+
workId: E,
|
|
314
357
|
toolsType: s,
|
|
315
358
|
opt: e
|
|
316
359
|
});
|
|
@@ -318,46 +361,53 @@ class me {
|
|
|
318
361
|
}
|
|
319
362
|
cursorBlur() {
|
|
320
363
|
var e;
|
|
321
|
-
const t = this.getWorkShape(
|
|
322
|
-
t && ((e = t.selectIds) != null && e.length) && (t.cursorBlur(), this.clearWorkShapeNodeCache(
|
|
364
|
+
const t = this.getWorkShape(E);
|
|
365
|
+
t && ((e = t.selectIds) != null && e.length) && (t.cursorBlur(), this.clearWorkShapeNodeCache(E)), this.thread.fullLayer.parent.children.forEach((s) => {
|
|
323
366
|
s.name === "Cursor_Hover_Id" && s.remove();
|
|
324
367
|
});
|
|
325
368
|
}
|
|
326
369
|
updateFullSelectWork(t) {
|
|
327
370
|
var o, r, i, a, c;
|
|
328
|
-
const e = this.workShapes.get(
|
|
371
|
+
const e = this.workShapes.get(
|
|
372
|
+
L
|
|
373
|
+
), { selectIds: s } = t;
|
|
329
374
|
if (!(s != null && s.length)) {
|
|
330
375
|
this.blurSelector(t);
|
|
331
376
|
return;
|
|
332
377
|
}
|
|
333
378
|
if (!e) {
|
|
334
379
|
const n = this.setFullWork(t);
|
|
335
|
-
!n && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(
|
|
380
|
+
!n && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(
|
|
381
|
+
t.workId.toString(),
|
|
382
|
+
t.opt || this.tmpOpt.toolsOpt
|
|
383
|
+
), n && this.updateFullSelectWork(t);
|
|
336
384
|
return;
|
|
337
385
|
}
|
|
338
386
|
if (e && (s != null && s.length)) {
|
|
339
|
-
const { selectRect: n } = e.updateSelectIds(s), h = [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
387
|
+
const { selectRect: n } = e.updateSelectIds(s), h = [
|
|
388
|
+
{
|
|
389
|
+
...t,
|
|
390
|
+
selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
|
|
391
|
+
strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
|
|
392
|
+
fillColor: ((a = t.opt) == null ? void 0 : a.fillColor) || e.fillColor,
|
|
393
|
+
textOpt: ((c = t.opt) == null ? void 0 : c.textOpt) || e.textOpt,
|
|
394
|
+
canTextEdit: e.canTextEdit,
|
|
395
|
+
canRotate: e.canRotate,
|
|
396
|
+
scaleType: e.scaleType,
|
|
397
|
+
type: p.Select,
|
|
398
|
+
selectRect: n,
|
|
399
|
+
points: e.getChildrenPoints(),
|
|
400
|
+
willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
|
|
401
|
+
opt: (t == null ? void 0 : t.willSyncService) && e.getWorkOptions() || void 0,
|
|
402
|
+
canLock: e.canLock,
|
|
403
|
+
isLocked: e.isLocked,
|
|
404
|
+
toolsTypes: e.toolsTypes,
|
|
405
|
+
shapeOpt: e.shapeOpt,
|
|
406
|
+
thickness: e.thickness,
|
|
407
|
+
useStroke: e.useStroke,
|
|
408
|
+
strokeType: e.strokeType
|
|
409
|
+
}
|
|
410
|
+
];
|
|
361
411
|
this.thread.post({ sp: h });
|
|
362
412
|
}
|
|
363
413
|
}
|
|
@@ -368,11 +418,13 @@ class me {
|
|
|
368
418
|
type: p.TextUpdate,
|
|
369
419
|
toolsType: f.Text,
|
|
370
420
|
workId: t,
|
|
371
|
-
dataType:
|
|
421
|
+
dataType: v.Local
|
|
372
422
|
};
|
|
373
423
|
}
|
|
374
424
|
async removeSelector(t) {
|
|
375
|
-
const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(
|
|
425
|
+
const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(
|
|
426
|
+
L
|
|
427
|
+
);
|
|
376
428
|
if (!r)
|
|
377
429
|
return;
|
|
378
430
|
const i = r.selectIds && [...r.selectIds] || [];
|
|
@@ -418,7 +470,7 @@ class me {
|
|
|
418
470
|
}
|
|
419
471
|
async consumeFull(t) {
|
|
420
472
|
var o;
|
|
421
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
473
|
+
const e = this.setFullWork(t), s = t.ops && F(t.ops);
|
|
422
474
|
if (e) {
|
|
423
475
|
const r = (o = t.workId) == null ? void 0 : o.toString();
|
|
424
476
|
e.toolsType === f.Image ? await e.consumeServiceAsync({
|
|
@@ -446,9 +498,13 @@ class me {
|
|
|
446
498
|
}
|
|
447
499
|
}
|
|
448
500
|
async colloctEffectSelectWork(t) {
|
|
449
|
-
const e = this.workShapes.get(
|
|
501
|
+
const e = this.workShapes.get(
|
|
502
|
+
L
|
|
503
|
+
), { workId: s, msgType: o } = t;
|
|
450
504
|
if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
|
|
451
|
-
o === p.RemoveNode ? e.selectIds = e.selectIds.filter(
|
|
505
|
+
o === p.RemoveNode ? e.selectIds = e.selectIds.filter(
|
|
506
|
+
(r) => r !== s.toString()
|
|
507
|
+
) : this.effectSelectNodeData.add(t), await new Promise((r) => {
|
|
452
508
|
setTimeout(() => {
|
|
453
509
|
r(!0);
|
|
454
510
|
}, 0);
|
|
@@ -478,7 +534,7 @@ class me {
|
|
|
478
534
|
replaceId: r
|
|
479
535
|
});
|
|
480
536
|
else {
|
|
481
|
-
const i = s.ops &&
|
|
537
|
+
const i = s.ops && F(s.ops);
|
|
482
538
|
o.consumeService({
|
|
483
539
|
op: i,
|
|
484
540
|
isFullWork: !0,
|
|
@@ -491,49 +547,55 @@ class me {
|
|
|
491
547
|
this.reRenderSelector(t);
|
|
492
548
|
}
|
|
493
549
|
hasSelector() {
|
|
494
|
-
return this.workShapes.has(
|
|
550
|
+
return this.workShapes.has(L);
|
|
495
551
|
}
|
|
496
552
|
getSelector() {
|
|
497
|
-
return this.workShapes.get(
|
|
553
|
+
return this.workShapes.get(L);
|
|
498
554
|
}
|
|
499
555
|
reRenderSelector(t = !1) {
|
|
500
556
|
var o;
|
|
501
|
-
const e = this.workShapes.get(
|
|
557
|
+
const e = this.workShapes.get(
|
|
558
|
+
L
|
|
559
|
+
);
|
|
502
560
|
if (!e) return;
|
|
503
561
|
if (e && !((o = e.selectIds) != null && o.length))
|
|
504
562
|
return this.blurSelector();
|
|
505
563
|
const s = e.reRenderSelector();
|
|
506
564
|
s && this.thread.post({
|
|
507
|
-
sp: [
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
565
|
+
sp: [
|
|
566
|
+
{
|
|
567
|
+
type: p.Select,
|
|
568
|
+
selectIds: e.selectIds,
|
|
569
|
+
selectRect: s,
|
|
570
|
+
willSyncService: t,
|
|
571
|
+
viewId: this.thread.viewId,
|
|
572
|
+
points: e.getChildrenPoints(),
|
|
573
|
+
textOpt: e.textOpt,
|
|
574
|
+
selectorColor: e.selectorColor,
|
|
575
|
+
strokeColor: e.strokeColor,
|
|
576
|
+
fillColor: e.fillColor,
|
|
577
|
+
canTextEdit: e.canTextEdit,
|
|
578
|
+
canRotate: e.canRotate,
|
|
579
|
+
scaleType: e.scaleType,
|
|
580
|
+
opt: e.getWorkOptions() || void 0,
|
|
581
|
+
canLock: e.canLock,
|
|
582
|
+
isLocked: e.isLocked,
|
|
583
|
+
toolsTypes: e.toolsTypes,
|
|
584
|
+
shapeOpt: e.shapeOpt,
|
|
585
|
+
thickness: e.thickness,
|
|
586
|
+
useStroke: e.useStroke,
|
|
587
|
+
strokeType: e.strokeType
|
|
588
|
+
}
|
|
589
|
+
]
|
|
530
590
|
});
|
|
531
591
|
}
|
|
532
592
|
async blurSelector(t) {
|
|
533
593
|
var o;
|
|
534
|
-
const e = this.workShapes.get(
|
|
535
|
-
|
|
536
|
-
|
|
594
|
+
const e = this.workShapes.get(
|
|
595
|
+
L
|
|
596
|
+
), s = e == null ? void 0 : e.blurSelector();
|
|
597
|
+
if (this.clearWorkShapeNodeCache(L), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
|
|
598
|
+
r.name === L && r.remove();
|
|
537
599
|
}), s) {
|
|
538
600
|
const r = [];
|
|
539
601
|
r.push({
|
|
@@ -562,7 +624,7 @@ class me {
|
|
|
562
624
|
for (const [c, n] of o)
|
|
563
625
|
a.push({
|
|
564
626
|
type: p.UpdateNode,
|
|
565
|
-
dataType:
|
|
627
|
+
dataType: v.Local,
|
|
566
628
|
opt: n.opt,
|
|
567
629
|
workId: c,
|
|
568
630
|
updateNodeOpt: {
|
|
@@ -593,8 +655,9 @@ class me {
|
|
|
593
655
|
for (const [c, n] of o)
|
|
594
656
|
a.push({
|
|
595
657
|
type: p.FullWork,
|
|
596
|
-
dataType:
|
|
597
|
-
|
|
658
|
+
dataType: v.Local,
|
|
659
|
+
toolsType: n.toolsType,
|
|
660
|
+
ops: _(n.op),
|
|
598
661
|
opt: n.opt,
|
|
599
662
|
workId: c,
|
|
600
663
|
updateNodeOpt: {
|
|
@@ -616,32 +679,6 @@ class me {
|
|
|
616
679
|
isLockSentEventCursor: e
|
|
617
680
|
}), this.thread.post({ sp: s, consumeCount: this.consumeCount });
|
|
618
681
|
}
|
|
619
|
-
// private updateBatchEraserCombineNode(inFullLayerIds:Set<string>,removeIds:Set<string>) {
|
|
620
|
-
// for (const key of removeIds.keys()) {
|
|
621
|
-
// this.thread.fullLayer.getElementsByName(key).forEach(node => {
|
|
622
|
-
// node.remove();
|
|
623
|
-
// removeTexture(node, this.thread.fullLayer.parent as Layer);
|
|
624
|
-
// });
|
|
625
|
-
// }
|
|
626
|
-
// inFullLayerIds.forEach(key=>{
|
|
627
|
-
// const info = this.vNodes.get(key);
|
|
628
|
-
// if (info && info.toolsType === EToolsKey.Pencil) {
|
|
629
|
-
// const node = this.thread.fullLayer.getElementsByName(key)[0];
|
|
630
|
-
// if (!node) {
|
|
631
|
-
// const workShape = this.setFullWork({...info, workId: key}) as PencilShape;
|
|
632
|
-
// workShape && workShape.consumeService({
|
|
633
|
-
// op: info.op,
|
|
634
|
-
// isFullWork: true
|
|
635
|
-
// });
|
|
636
|
-
// }
|
|
637
|
-
// }
|
|
638
|
-
// })
|
|
639
|
-
// }
|
|
640
|
-
// private batchEraserCombine = throttle(() => {
|
|
641
|
-
// this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes);
|
|
642
|
-
// this.batchEraserWorks.clear();
|
|
643
|
-
// this.batchEraserRemoveNodes.clear();
|
|
644
|
-
// }, 100, {'leading':false})
|
|
645
682
|
getWorkShape(t) {
|
|
646
683
|
return this.workShapes.get(t);
|
|
647
684
|
}
|
|
@@ -657,40 +694,59 @@ class me {
|
|
|
657
694
|
const n = c.toolsType;
|
|
658
695
|
if (n === f.LaserPen)
|
|
659
696
|
return;
|
|
660
|
-
switch (this.
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
697
|
+
switch (this.combineDrawActiveId && this.combineDrawActiveId !== a && (this.combineTimerId && (clearTimeout(this.combineTimerId), this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!1), this.combineDrawActiveId = void 0), this.consumeDrawAll(
|
|
698
|
+
{
|
|
699
|
+
workId: this.combineDrawActiveId,
|
|
700
|
+
scenePath: r,
|
|
701
|
+
viewId: this.thread.viewId,
|
|
702
|
+
msgType: p.DrawWork,
|
|
703
|
+
dataType: v.Local
|
|
704
|
+
},
|
|
705
|
+
e
|
|
706
|
+
)), this.drawWorkActiveId && this.drawWorkActiveId !== a && (this.consumeDrawAll(
|
|
707
|
+
{
|
|
708
|
+
workId: this.drawWorkActiveId,
|
|
709
|
+
scenePath: r,
|
|
710
|
+
viewId: this.thread.viewId,
|
|
711
|
+
msgType: p.DrawWork,
|
|
712
|
+
dataType: v.Local
|
|
713
|
+
},
|
|
714
|
+
e
|
|
715
|
+
), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== L && (this.drawWorkActiveId = a), U(i) && (this.consumeCount = i), n) {
|
|
716
|
+
case f.Selector: {
|
|
717
|
+
const h = c.consume({
|
|
718
|
+
data: t,
|
|
719
|
+
isFullWork: !0,
|
|
720
|
+
isMainThread: !0
|
|
721
|
+
});
|
|
722
|
+
this.fullWorkerDrawCount++;
|
|
723
|
+
const l = [];
|
|
724
|
+
h.type === p.Select && (h.selectIds && e.runReverseSelectWork(h.selectIds), l.push(h)), this.thread.post({
|
|
725
|
+
consumeCount: this.consumeCount,
|
|
726
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
727
|
+
sp: l
|
|
728
|
+
});
|
|
682
729
|
break;
|
|
730
|
+
}
|
|
683
731
|
case f.PencilEraser:
|
|
684
732
|
case f.BitMapEraser: {
|
|
685
|
-
|
|
733
|
+
c.consume({
|
|
686
734
|
data: t,
|
|
687
735
|
isFullWork: !1,
|
|
688
736
|
isMainThread: !0
|
|
689
|
-
})
|
|
690
|
-
|
|
737
|
+
}), this.fullWorkerDrawCount++, this.thread.post({
|
|
738
|
+
sp: void 0,
|
|
691
739
|
consumeCount: this.consumeCount,
|
|
692
|
-
fullWorkerDrawCount: this.fullWorkerDrawCount
|
|
693
|
-
|
|
740
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount
|
|
741
|
+
}), this.combineTimerId || new Promise((h) => {
|
|
742
|
+
this.combineDrawActiveId = a, this.combineDrawResolve = h, this.combineTimerId = requestIdleCallback(
|
|
743
|
+
() => {
|
|
744
|
+
this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!0);
|
|
745
|
+
},
|
|
746
|
+
{ timeout: this.thread.master.maxCombineEraserTime }
|
|
747
|
+
);
|
|
748
|
+
}).then((h) => {
|
|
749
|
+
h && this.drawEraserCombine(a), this.combineDrawResolve = void 0;
|
|
694
750
|
});
|
|
695
751
|
break;
|
|
696
752
|
}
|
|
@@ -727,10 +783,55 @@ class me {
|
|
|
727
783
|
}
|
|
728
784
|
}
|
|
729
785
|
}
|
|
786
|
+
drawEraserCombine(t) {
|
|
787
|
+
var s, o, r, i;
|
|
788
|
+
const e = (s = this.workShapes.get(t)) == null ? void 0 : s.combineConsume({ workerEngine: this });
|
|
789
|
+
if (e) {
|
|
790
|
+
const { willDeleteNodes: a, willNewNodes: c } = e, n = {
|
|
791
|
+
render: [],
|
|
792
|
+
sp: []
|
|
793
|
+
};
|
|
794
|
+
if (e != null && e.rect) {
|
|
795
|
+
const h = ne(e.rect);
|
|
796
|
+
(o = n.render) == null || o.push(
|
|
797
|
+
{
|
|
798
|
+
rect: h,
|
|
799
|
+
isClear: !0,
|
|
800
|
+
clearCanvas: K.Bg,
|
|
801
|
+
viewId: this.thread.viewId
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
rect: h,
|
|
805
|
+
drawCanvas: K.Bg,
|
|
806
|
+
viewId: this.thread.viewId
|
|
807
|
+
}
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
if (a != null && a.size && ((r = n.sp) == null || r.push({
|
|
811
|
+
type: p.RemoveNode,
|
|
812
|
+
removeIds: [...a],
|
|
813
|
+
viewId: this.thread.viewId
|
|
814
|
+
})), c != null && c.size)
|
|
815
|
+
for (const [h, l] of c)
|
|
816
|
+
(i = n.sp) == null || i.push({
|
|
817
|
+
type: p.FullWork,
|
|
818
|
+
dataType: v.Local,
|
|
819
|
+
toolsType: l.toolsType,
|
|
820
|
+
ops: _(l.op),
|
|
821
|
+
opt: l.opt,
|
|
822
|
+
workId: h,
|
|
823
|
+
updateNodeOpt: {
|
|
824
|
+
useAnimation: !1
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
this.thread.post(n);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
730
830
|
consumeDrawAll(t, e) {
|
|
731
831
|
var i, a, c;
|
|
732
832
|
const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
|
|
733
833
|
if (s) {
|
|
834
|
+
this.combineTimerId && (clearTimeout(this.combineTimerId), this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!1), this.combineDrawActiveId = void 0);
|
|
734
835
|
const n = s.toString();
|
|
735
836
|
this.drawWorkActiveId === n && (this.drawWorkActiveId = void 0);
|
|
736
837
|
const h = this.workShapes.get(n);
|
|
@@ -739,26 +840,34 @@ class me {
|
|
|
739
840
|
const l = h.toolsType;
|
|
740
841
|
if (l === f.LaserPen)
|
|
741
842
|
return;
|
|
742
|
-
const m = this.workShapes.get(
|
|
843
|
+
const m = this.workShapes.get(E), d = (i = m == null ? void 0 : m.selectIds) == null ? void 0 : i[0], k = h.consumeAll({ data: t, workerEngine: this });
|
|
743
844
|
switch (l) {
|
|
744
845
|
case f.Selector:
|
|
745
846
|
{
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
r &&
|
|
847
|
+
k.selectIds && d && ((a = k.selectIds) != null && a.includes(d)) && m.cursorBlur();
|
|
848
|
+
const S = [];
|
|
849
|
+
r && S.push({
|
|
749
850
|
type: p.None,
|
|
750
851
|
isLockSentEventCursor: r
|
|
751
|
-
}),
|
|
852
|
+
}), k.type === p.Select && (k.selectIds && e.runReverseSelectWork(k.selectIds), S.push({ ...k, scenePath: o })), S.length && this.thread.post({ sp: S }), (c = h.selectIds) != null && c.length ? h.clearTmpPoints() : this.clearWorkShapeNodeCache(n);
|
|
752
853
|
}
|
|
753
854
|
break;
|
|
754
855
|
case f.PencilEraser:
|
|
755
|
-
this.drawPencilEraserFull(
|
|
856
|
+
this.drawPencilEraserFull(
|
|
857
|
+
h,
|
|
858
|
+
k,
|
|
859
|
+
r
|
|
860
|
+
), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
756
861
|
break;
|
|
757
862
|
case f.BitMapEraser:
|
|
758
|
-
this.drawBitMapEraserFull(
|
|
863
|
+
this.drawBitMapEraserFull(
|
|
864
|
+
h,
|
|
865
|
+
k,
|
|
866
|
+
r
|
|
867
|
+
), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
759
868
|
break;
|
|
760
869
|
case f.Eraser:
|
|
761
|
-
this.drawEraser({ ...
|
|
870
|
+
this.drawEraser({ ...k, scenePath: o }, r), h.clearTmpPoints();
|
|
762
871
|
break;
|
|
763
872
|
case f.Arrow:
|
|
764
873
|
case f.Straight:
|
|
@@ -768,13 +877,13 @@ class me {
|
|
|
768
877
|
case f.Polygon:
|
|
769
878
|
case f.SpeechBalloon:
|
|
770
879
|
case f.Pencil: {
|
|
771
|
-
const
|
|
772
|
-
r &&
|
|
880
|
+
const S = [];
|
|
881
|
+
r && S.push({
|
|
773
882
|
type: p.None,
|
|
774
883
|
isLockSentEventCursor: r
|
|
775
|
-
}),
|
|
884
|
+
}), k && (S.push(k), this.fullWorkerDrawCount = 0, this.thread.post({
|
|
776
885
|
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
777
|
-
sp:
|
|
886
|
+
sp: S
|
|
778
887
|
})), this.clearWorkShapeNodeCache(n);
|
|
779
888
|
break;
|
|
780
889
|
}
|
|
@@ -797,10 +906,18 @@ class me {
|
|
|
797
906
|
e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(e);
|
|
798
907
|
}
|
|
799
908
|
createWorkShapeNode(t) {
|
|
800
|
-
return
|
|
909
|
+
return z(
|
|
910
|
+
{
|
|
911
|
+
...t,
|
|
912
|
+
vNodes: this.vNodes,
|
|
913
|
+
fullLayer: this.thread.fullLayer,
|
|
914
|
+
drawLayer: this.thread.localLayer
|
|
915
|
+
},
|
|
916
|
+
this.thread.serviceWork
|
|
917
|
+
);
|
|
801
918
|
}
|
|
802
919
|
}
|
|
803
|
-
class
|
|
920
|
+
class fe {
|
|
804
921
|
constructor(t) {
|
|
805
922
|
u(this, "vNodes");
|
|
806
923
|
u(this, "thread");
|
|
@@ -809,7 +926,7 @@ class ke {
|
|
|
809
926
|
u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
|
|
810
927
|
u(this, "runEffectId");
|
|
811
928
|
u(this, "animationId");
|
|
812
|
-
u(this, "syncUnitTime",
|
|
929
|
+
u(this, "syncUnitTime", x.syncOpt.interval);
|
|
813
930
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
814
931
|
}
|
|
815
932
|
async loadImageBitMap(t) {
|
|
@@ -821,16 +938,26 @@ class ke {
|
|
|
821
938
|
clearAll() {
|
|
822
939
|
this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((t) => {
|
|
823
940
|
t.name !== "viewport" && t.remove();
|
|
824
|
-
}),
|
|
941
|
+
}), B(
|
|
942
|
+
this.thread.serviceLayer,
|
|
943
|
+
this.thread.serviceLayer.parent
|
|
944
|
+
)), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
|
|
825
945
|
}
|
|
826
946
|
runEffect() {
|
|
827
|
-
this.runEffectId || (this.runEffectId = setTimeout(
|
|
947
|
+
this.runEffectId || (this.runEffectId = setTimeout(
|
|
948
|
+
this.effectRunSelector.bind(this),
|
|
949
|
+
0
|
|
950
|
+
));
|
|
828
951
|
}
|
|
829
952
|
effectRunSelector() {
|
|
830
953
|
this.runEffectId = void 0, this.willRunEffectSelectorIds.forEach((t) => {
|
|
831
954
|
var s, o;
|
|
832
955
|
const e = this.selectorWorkShapes.get(t);
|
|
833
|
-
e && e.selectIds && ((s = e.node) == null || s.selectServiceNode(
|
|
956
|
+
e && e.selectIds && ((s = e.node) == null || s.selectServiceNode(
|
|
957
|
+
t,
|
|
958
|
+
e,
|
|
959
|
+
!0
|
|
960
|
+
)), (o = e == null ? void 0 : e.selectIds) != null && o.length || this.selectorWorkShapes.delete(t);
|
|
834
961
|
}), this.willRunEffectSelectorIds.clear();
|
|
835
962
|
}
|
|
836
963
|
runSelectWork(t) {
|
|
@@ -866,34 +993,39 @@ class ke {
|
|
|
866
993
|
this.activeWorkShape(t), this.runAnimation();
|
|
867
994
|
}
|
|
868
995
|
computNextAnimationIndex(t, e) {
|
|
869
|
-
const s = Math.floor(
|
|
870
|
-
|
|
996
|
+
const s = Math.floor(
|
|
997
|
+
(t.animationWorkData || []).slice(t.animationIndex).length * 32 / e / this.syncUnitTime
|
|
998
|
+
) * e;
|
|
999
|
+
return Math.min(
|
|
1000
|
+
(t.animationIndex || 0) + (s || e),
|
|
1001
|
+
(t.animationWorkData || []).length
|
|
1002
|
+
);
|
|
871
1003
|
}
|
|
872
1004
|
async animationDraw() {
|
|
873
|
-
var s, o, r, i, a, c, n, h, l, m, d, S, y,
|
|
1005
|
+
var s, o, r, i, a, c, n, h, l, m, d, k, S, y, I;
|
|
874
1006
|
this.animationId = void 0;
|
|
875
1007
|
let t = !1;
|
|
876
1008
|
const e = /* @__PURE__ */ new Map();
|
|
877
|
-
for (const [
|
|
878
|
-
switch (
|
|
1009
|
+
for (const [g, w] of this.workShapes.entries())
|
|
1010
|
+
switch (w.toolsType) {
|
|
879
1011
|
case f.Image: {
|
|
880
|
-
await ((s =
|
|
1012
|
+
await ((s = w.node) == null ? void 0 : s.consumeServiceAsync({
|
|
881
1013
|
isFullWork: !0,
|
|
882
1014
|
worker: this
|
|
883
1015
|
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
884
|
-
var
|
|
885
|
-
(
|
|
886
|
-
}), this.workShapes.delete(
|
|
1016
|
+
var C;
|
|
1017
|
+
(C = b.selectIds) != null && C.includes(g) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
1018
|
+
}), this.workShapes.delete(g);
|
|
887
1019
|
break;
|
|
888
1020
|
}
|
|
889
1021
|
case f.Text: {
|
|
890
|
-
|
|
1022
|
+
w.node && (await ((o = w.node) == null ? void 0 : o.consumeServiceAsync({
|
|
891
1023
|
isFullWork: !0,
|
|
892
|
-
replaceId:
|
|
1024
|
+
replaceId: g
|
|
893
1025
|
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
894
|
-
var
|
|
895
|
-
(
|
|
896
|
-
}), (r =
|
|
1026
|
+
var C;
|
|
1027
|
+
(C = b.selectIds) != null && C.includes(g) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
1028
|
+
}), (r = w.node) == null || r.clearTmpPoints(), this.workShapes.delete(g));
|
|
897
1029
|
break;
|
|
898
1030
|
}
|
|
899
1031
|
case f.Arrow:
|
|
@@ -903,63 +1035,69 @@ class ke {
|
|
|
903
1035
|
case f.Star:
|
|
904
1036
|
case f.Polygon:
|
|
905
1037
|
case f.SpeechBalloon: {
|
|
906
|
-
const b = !!
|
|
907
|
-
if ((i =
|
|
908
|
-
const D =
|
|
909
|
-
(a =
|
|
910
|
-
op:
|
|
1038
|
+
const b = !!w.ops;
|
|
1039
|
+
if ((i = w.animationWorkData) != null && i.length) {
|
|
1040
|
+
const D = w.oldRect;
|
|
1041
|
+
(a = w.node) == null || a.consumeService({
|
|
1042
|
+
op: w.animationWorkData,
|
|
911
1043
|
isFullWork: b
|
|
912
|
-
}), b && (this.selectorWorkShapes.forEach((
|
|
913
|
-
var
|
|
914
|
-
(
|
|
915
|
-
}), (c =
|
|
916
|
-
workState: D ?
|
|
917
|
-
op:
|
|
1044
|
+
}), b && (this.selectorWorkShapes.forEach((C, M) => {
|
|
1045
|
+
var P;
|
|
1046
|
+
(P = C.selectIds) != null && P.includes(g) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
|
|
1047
|
+
}), (c = w.node) == null || c.clearTmpPoints(), this.workShapes.delete(g)), e.set(g, {
|
|
1048
|
+
workState: D ? w.ops ? W.Done : W.Doing : W.Start,
|
|
1049
|
+
op: w.animationWorkData.filter((C, M) => {
|
|
918
1050
|
if (M % 3 !== 2)
|
|
919
1051
|
return !0;
|
|
920
1052
|
}).slice(-2)
|
|
921
|
-
}),
|
|
1053
|
+
}), w.animationWorkData.length = 0;
|
|
922
1054
|
}
|
|
923
1055
|
break;
|
|
924
1056
|
}
|
|
925
1057
|
case f.Pencil: {
|
|
926
|
-
if (!
|
|
927
|
-
(n =
|
|
928
|
-
op:
|
|
1058
|
+
if (!w.useAnimation && w.ops)
|
|
1059
|
+
(n = w.node) == null || n.consumeService({
|
|
1060
|
+
op: w.animationWorkData || [],
|
|
929
1061
|
isFullWork: !0,
|
|
930
|
-
replaceId:
|
|
931
|
-
}), (h =
|
|
932
|
-
var
|
|
933
|
-
(
|
|
934
|
-
}), (l =
|
|
935
|
-
else if (
|
|
936
|
-
if (
|
|
937
|
-
(m =
|
|
1062
|
+
replaceId: g
|
|
1063
|
+
}), (h = w.node) == null || h.updataOptService(w.updateNodeOpt), this.selectorWorkShapes.forEach((b, D) => {
|
|
1064
|
+
var C;
|
|
1065
|
+
(C = b.selectIds) != null && C.includes(g) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
1066
|
+
}), (l = w.node) == null || l.clearTmpPoints(), this.workShapes.delete(g);
|
|
1067
|
+
else if (w.useAnimation) {
|
|
1068
|
+
if (w.isDel) {
|
|
1069
|
+
(m = w.node) == null || m.clearTmpPoints(), this.workShapes.delete(g);
|
|
938
1070
|
break;
|
|
939
1071
|
}
|
|
940
|
-
const b = 3, D = this.computNextAnimationIndex(
|
|
941
|
-
|
|
942
|
-
|
|
1072
|
+
const b = 3, D = this.computNextAnimationIndex(
|
|
1073
|
+
w,
|
|
1074
|
+
b
|
|
1075
|
+
), C = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - b), M = (w.animationWorkData || []).slice(
|
|
1076
|
+
C,
|
|
1077
|
+
D
|
|
1078
|
+
), P = (k = (d = w.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : k.toString();
|
|
1079
|
+
if ((w.animationIndex || 0) < D || w.isDiff) {
|
|
1080
|
+
if ((S = w.node) == null || S.consumeService({
|
|
943
1081
|
op: M,
|
|
944
1082
|
isFullWork: !1
|
|
945
|
-
}),
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
1083
|
+
}), w.animationIndex = D, w.isDiff && (w.isDiff = !1), M.length) {
|
|
1084
|
+
const G = M.filter((V, oe) => {
|
|
1085
|
+
if (oe % b !== b - 1)
|
|
948
1086
|
return !0;
|
|
949
1087
|
}).slice(-2);
|
|
950
|
-
e.set(
|
|
951
|
-
workState:
|
|
952
|
-
op:
|
|
1088
|
+
e.set(g, {
|
|
1089
|
+
workState: C === 0 ? W.Start : D === ((y = w.animationWorkData) == null ? void 0 : y.length) ? W.Done : W.Doing,
|
|
1090
|
+
op: G
|
|
953
1091
|
});
|
|
954
1092
|
}
|
|
955
|
-
} else
|
|
956
|
-
op:
|
|
1093
|
+
} else w.ops && ((I = w.node) == null || I.consumeService({
|
|
1094
|
+
op: w.animationWorkData || [],
|
|
957
1095
|
isFullWork: !0,
|
|
958
|
-
replaceId:
|
|
959
|
-
}),
|
|
1096
|
+
replaceId: P
|
|
1097
|
+
}), w.isDel = !0, e.set(g, {
|
|
960
1098
|
workState: W.Done,
|
|
961
|
-
op: M.filter((
|
|
962
|
-
if (
|
|
1099
|
+
op: M.filter((G, V) => {
|
|
1100
|
+
if (V % b !== b - 1)
|
|
963
1101
|
return !0;
|
|
964
1102
|
}).slice(-2)
|
|
965
1103
|
}));
|
|
@@ -968,52 +1106,18 @@ class ke {
|
|
|
968
1106
|
}
|
|
969
1107
|
break;
|
|
970
1108
|
}
|
|
971
|
-
case f.BitMapEraser:
|
|
972
|
-
case f.PencilEraser: {
|
|
973
|
-
if (k.isDel) {
|
|
974
|
-
(C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(N);
|
|
975
|
-
break;
|
|
976
|
-
}
|
|
977
|
-
if (k.ops && ((x = k.animationWorkData) != null && x.length)) {
|
|
978
|
-
const b = k.animationWorkData.slice(-3, -1);
|
|
979
|
-
e.set(N, {
|
|
980
|
-
workState: W.Done,
|
|
981
|
-
op: b
|
|
982
|
-
}), k.isDel = !0;
|
|
983
|
-
break;
|
|
984
|
-
}
|
|
985
|
-
if (k.useAnimation) {
|
|
986
|
-
const D = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), M = (k.animationWorkData || []).slice(O, D);
|
|
987
|
-
if (((k.animationIndex || 0) < D || k.isDiff) && ((Z = k.node) == null || Z.consumeService({
|
|
988
|
-
op: M,
|
|
989
|
-
isFullWork: !1
|
|
990
|
-
}), k.animationIndex = D, k.isDiff && (k.isDiff = !1), M.length)) {
|
|
991
|
-
const A = M.filter((q, _) => {
|
|
992
|
-
if (_ % 3 !== 2)
|
|
993
|
-
return !0;
|
|
994
|
-
}).slice(-2);
|
|
995
|
-
e.set(N, {
|
|
996
|
-
workState: O === 0 ? W.Start : D === ((j = k.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
997
|
-
op: A
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
t = !0;
|
|
1001
|
-
break;
|
|
1002
|
-
}
|
|
1003
|
-
break;
|
|
1004
|
-
}
|
|
1005
1109
|
}
|
|
1006
1110
|
if (t && this.runAnimation(), e.size) {
|
|
1007
|
-
const
|
|
1008
|
-
e.forEach((
|
|
1009
|
-
|
|
1111
|
+
const g = [];
|
|
1112
|
+
e.forEach((w, b) => {
|
|
1113
|
+
g.push({
|
|
1010
1114
|
type: p.Cursor,
|
|
1011
|
-
uid: b.split(
|
|
1012
|
-
op:
|
|
1013
|
-
workState:
|
|
1115
|
+
uid: b.split(Q)[0],
|
|
1116
|
+
op: w.op,
|
|
1117
|
+
workState: w.workState,
|
|
1014
1118
|
viewId: this.thread.viewId
|
|
1015
1119
|
});
|
|
1016
|
-
}), this.thread.post({ sp:
|
|
1120
|
+
}), this.thread.post({ sp: g });
|
|
1017
1121
|
}
|
|
1018
1122
|
}
|
|
1019
1123
|
runAnimation() {
|
|
@@ -1040,13 +1144,23 @@ class ke {
|
|
|
1040
1144
|
return !1;
|
|
1041
1145
|
}
|
|
1042
1146
|
activeWorkShape(t) {
|
|
1043
|
-
var S, y,
|
|
1044
|
-
const {
|
|
1147
|
+
var k, S, y, I;
|
|
1148
|
+
const {
|
|
1149
|
+
workId: e,
|
|
1150
|
+
opt: s,
|
|
1151
|
+
toolsType: o,
|
|
1152
|
+
type: r,
|
|
1153
|
+
updateNodeOpt: i,
|
|
1154
|
+
ops: a,
|
|
1155
|
+
op: c,
|
|
1156
|
+
useAnimation: n,
|
|
1157
|
+
imageBitmap: h
|
|
1158
|
+
} = t;
|
|
1045
1159
|
if (!e)
|
|
1046
1160
|
return;
|
|
1047
|
-
const l = e.toString(), m = (
|
|
1048
|
-
if (!((
|
|
1049
|
-
let
|
|
1161
|
+
const l = e.toString(), m = (k = this.vNodes.get(l)) == null ? void 0 : k.rect;
|
|
1162
|
+
if (!((S = this.workShapes) != null && S.has(l))) {
|
|
1163
|
+
let g = {
|
|
1050
1164
|
toolsType: o,
|
|
1051
1165
|
animationWorkData: c || [],
|
|
1052
1166
|
animationIndex: 0,
|
|
@@ -1058,13 +1172,17 @@ class ke {
|
|
|
1058
1172
|
isDiff: !1,
|
|
1059
1173
|
imageBitmap: h
|
|
1060
1174
|
};
|
|
1061
|
-
o && s && (
|
|
1175
|
+
o && s && (g = this.setNodeKey(l, g, o, s)), (y = this.workShapes) == null || y.set(l, g);
|
|
1062
1176
|
}
|
|
1063
|
-
const d = (
|
|
1064
|
-
r && (d.type = r), a && (d.animationWorkData =
|
|
1177
|
+
const d = (I = this.workShapes) == null ? void 0 : I.get(l);
|
|
1178
|
+
r && (d.type = r), a && (d.animationWorkData = F(a), d.ops = a), i && (d.updateNodeOpt = i), c && (d.isDiff = this.hasDiffData(
|
|
1179
|
+
d.animationWorkData || [],
|
|
1180
|
+
c,
|
|
1181
|
+
d.toolsType
|
|
1182
|
+
), d.animationWorkData = c), 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)), h && (d.imageBitmap = h);
|
|
1065
1183
|
}
|
|
1066
1184
|
removeNode(t, e) {
|
|
1067
|
-
t.indexOf(
|
|
1185
|
+
t.indexOf(L) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
1068
1186
|
s.remove(), R(s, this.thread.fullLayer.parent);
|
|
1069
1187
|
}), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
|
|
1070
1188
|
s.remove(), R(s, this.thread.serviceLayer.parent);
|
|
@@ -1093,17 +1211,20 @@ class ke {
|
|
|
1093
1211
|
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
1094
1212
|
}
|
|
1095
1213
|
setNodeKey(t, e, s, o) {
|
|
1096
|
-
return e.toolsType = s, e.node =
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1214
|
+
return e.toolsType = s, e.node = z(
|
|
1215
|
+
{
|
|
1216
|
+
toolsType: s,
|
|
1217
|
+
toolsOpt: o,
|
|
1218
|
+
vNodes: this.vNodes,
|
|
1219
|
+
fullLayer: this.thread.fullLayer,
|
|
1220
|
+
drawLayer: this.thread.serviceLayer,
|
|
1221
|
+
workId: t
|
|
1222
|
+
},
|
|
1223
|
+
this
|
|
1224
|
+
), e;
|
|
1104
1225
|
}
|
|
1105
1226
|
}
|
|
1106
|
-
class
|
|
1227
|
+
class O {
|
|
1107
1228
|
constructor() {
|
|
1108
1229
|
u(this, "localWork");
|
|
1109
1230
|
u(this, "serviceWork");
|
|
@@ -1113,14 +1234,14 @@ class E {
|
|
|
1113
1234
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1114
1235
|
}
|
|
1115
1236
|
}
|
|
1116
|
-
class
|
|
1237
|
+
class me extends O {
|
|
1117
1238
|
constructor() {
|
|
1118
1239
|
super(...arguments);
|
|
1119
|
-
u(this, "emitEventType",
|
|
1240
|
+
u(this, "emitEventType", T.CopyNode);
|
|
1120
1241
|
}
|
|
1121
1242
|
async consume(e) {
|
|
1122
1243
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1123
|
-
if (s === p.FullWork && o ===
|
|
1244
|
+
if (s === p.FullWork && o === v.Local && r === this.emitEventType)
|
|
1124
1245
|
return this.consumeForLocalWorker(e), !0;
|
|
1125
1246
|
}
|
|
1126
1247
|
async consumeForLocalWorker(e) {
|
|
@@ -1129,20 +1250,27 @@ class Se extends E {
|
|
|
1129
1250
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1130
1251
|
}
|
|
1131
1252
|
}
|
|
1132
|
-
class
|
|
1253
|
+
class ke extends O {
|
|
1133
1254
|
constructor() {
|
|
1134
1255
|
super(...arguments);
|
|
1135
|
-
u(this, "emitEventType",
|
|
1256
|
+
u(this, "emitEventType", T.SetColorNode);
|
|
1136
1257
|
}
|
|
1137
1258
|
async consume(e) {
|
|
1138
1259
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1139
|
-
if (s === p.UpdateNode && o ===
|
|
1260
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1140
1261
|
return this.consumeForLocalWorker(e), !0;
|
|
1141
1262
|
}
|
|
1142
1263
|
async consumeForLocalWorker(e) {
|
|
1143
1264
|
var n;
|
|
1144
|
-
const {
|
|
1145
|
-
|
|
1265
|
+
const {
|
|
1266
|
+
workId: s,
|
|
1267
|
+
updateNodeOpt: o,
|
|
1268
|
+
willRefreshSelector: r,
|
|
1269
|
+
willSyncService: i,
|
|
1270
|
+
willSerializeData: a,
|
|
1271
|
+
textUpdateForWoker: c
|
|
1272
|
+
} = e;
|
|
1273
|
+
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1146
1274
|
updateSelectorOpt: o,
|
|
1147
1275
|
willRefreshSelector: r,
|
|
1148
1276
|
willSyncService: i,
|
|
@@ -1159,38 +1287,42 @@ class ye extends E {
|
|
|
1159
1287
|
...l,
|
|
1160
1288
|
workId: h,
|
|
1161
1289
|
type: p.TextUpdate,
|
|
1162
|
-
dataType:
|
|
1290
|
+
dataType: v.Local,
|
|
1163
1291
|
willSyncService: !0
|
|
1164
|
-
}) : n.push(
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
}
|
|
1174
|
-
);
|
|
1292
|
+
}) : n.push({
|
|
1293
|
+
...l,
|
|
1294
|
+
workId: h,
|
|
1295
|
+
type: p.UpdateNode,
|
|
1296
|
+
updateNodeOpt: {
|
|
1297
|
+
useAnimation: !1
|
|
1298
|
+
},
|
|
1299
|
+
isSync: a
|
|
1300
|
+
});
|
|
1175
1301
|
return {
|
|
1176
1302
|
sp: n
|
|
1177
1303
|
};
|
|
1178
1304
|
}
|
|
1179
1305
|
}
|
|
1180
|
-
class
|
|
1306
|
+
class Se extends O {
|
|
1181
1307
|
constructor() {
|
|
1182
1308
|
super(...arguments);
|
|
1183
|
-
u(this, "emitEventType",
|
|
1309
|
+
u(this, "emitEventType", T.ZIndexNode);
|
|
1184
1310
|
}
|
|
1185
1311
|
async consume(e) {
|
|
1186
1312
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1187
|
-
if (s === p.UpdateNode && o ===
|
|
1313
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1188
1314
|
return this.consumeForLocalWorker(e), !0;
|
|
1189
1315
|
}
|
|
1190
1316
|
async consumeForLocalWorker(e) {
|
|
1191
1317
|
var c;
|
|
1192
|
-
const {
|
|
1193
|
-
|
|
1318
|
+
const {
|
|
1319
|
+
workId: s,
|
|
1320
|
+
updateNodeOpt: o,
|
|
1321
|
+
willRefreshSelector: r,
|
|
1322
|
+
willSyncService: i,
|
|
1323
|
+
willSerializeData: a
|
|
1324
|
+
} = e;
|
|
1325
|
+
s === L && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1194
1326
|
updateSelectorOpt: o,
|
|
1195
1327
|
willRefreshSelector: r,
|
|
1196
1328
|
willSyncService: i,
|
|
@@ -1202,36 +1334,42 @@ class we extends E {
|
|
|
1202
1334
|
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
|
|
1203
1335
|
if (i && c)
|
|
1204
1336
|
for (const [n, h] of r.entries())
|
|
1205
|
-
c.push(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}
|
|
1215
|
-
);
|
|
1337
|
+
c.push({
|
|
1338
|
+
...h,
|
|
1339
|
+
workId: n,
|
|
1340
|
+
type: p.UpdateNode,
|
|
1341
|
+
updateNodeOpt: {
|
|
1342
|
+
useAnimation: !1
|
|
1343
|
+
},
|
|
1344
|
+
isSync: a
|
|
1345
|
+
});
|
|
1216
1346
|
return {
|
|
1217
1347
|
sp: c
|
|
1218
1348
|
};
|
|
1219
1349
|
}
|
|
1220
1350
|
}
|
|
1221
|
-
class
|
|
1351
|
+
class ye extends O {
|
|
1222
1352
|
constructor() {
|
|
1223
1353
|
super(...arguments);
|
|
1224
|
-
u(this, "emitEventType",
|
|
1354
|
+
u(this, "emitEventType", T.TranslateNode);
|
|
1225
1355
|
}
|
|
1226
1356
|
async consume(e) {
|
|
1227
1357
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1228
|
-
if (s === p.UpdateNode && o ===
|
|
1358
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1229
1359
|
return await this.consumeForLocalWorker(e), !0;
|
|
1230
1360
|
}
|
|
1231
1361
|
async consumeForLocalWorker(e) {
|
|
1232
1362
|
var h, l;
|
|
1233
|
-
const {
|
|
1234
|
-
|
|
1363
|
+
const {
|
|
1364
|
+
workId: s,
|
|
1365
|
+
updateNodeOpt: o,
|
|
1366
|
+
willRefreshSelector: r,
|
|
1367
|
+
willSyncService: i,
|
|
1368
|
+
willSerializeData: a,
|
|
1369
|
+
textUpdateForWoker: c,
|
|
1370
|
+
emitEventType: n
|
|
1371
|
+
} = e;
|
|
1372
|
+
s === L && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((h = this.localWork) == null ? void 0 : h.updateSelector({
|
|
1235
1373
|
updateSelectorOpt: o,
|
|
1236
1374
|
willRefreshSelector: r,
|
|
1237
1375
|
willSyncService: i,
|
|
@@ -1249,64 +1387,62 @@ class ve extends E {
|
|
|
1249
1387
|
sp: [],
|
|
1250
1388
|
render: []
|
|
1251
1389
|
};
|
|
1252
|
-
const
|
|
1390
|
+
const k = a == null ? void 0 : a.selectRect;
|
|
1253
1391
|
if (c) {
|
|
1254
1392
|
m === W.Doing && d.push({
|
|
1255
1393
|
type: p.Select,
|
|
1256
1394
|
selectIds: i.selectIds,
|
|
1257
|
-
selectRect:
|
|
1395
|
+
selectRect: k,
|
|
1258
1396
|
willSyncService: !0,
|
|
1259
1397
|
isSync: !0,
|
|
1260
1398
|
points: i.getChildrenPoints(),
|
|
1261
1399
|
textOpt: i.textOpt
|
|
1262
1400
|
});
|
|
1263
|
-
for (const [
|
|
1264
|
-
l &&
|
|
1265
|
-
...
|
|
1266
|
-
workId:
|
|
1401
|
+
for (const [S, y] of r.entries())
|
|
1402
|
+
l && y.toolsType === f.Text ? d.push({
|
|
1403
|
+
...y,
|
|
1404
|
+
workId: S,
|
|
1267
1405
|
type: p.TextUpdate,
|
|
1268
|
-
dataType:
|
|
1406
|
+
dataType: v.Local,
|
|
1269
1407
|
willSyncService: !0
|
|
1270
|
-
}) : d.push(
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
}
|
|
1280
|
-
);
|
|
1408
|
+
}) : d.push({
|
|
1409
|
+
...y,
|
|
1410
|
+
workId: S,
|
|
1411
|
+
type: p.UpdateNode,
|
|
1412
|
+
updateNodeOpt: {
|
|
1413
|
+
useAnimation: !1
|
|
1414
|
+
},
|
|
1415
|
+
isSync: n
|
|
1416
|
+
});
|
|
1281
1417
|
}
|
|
1282
1418
|
return {
|
|
1283
1419
|
sp: d
|
|
1284
1420
|
};
|
|
1285
1421
|
}
|
|
1286
1422
|
}
|
|
1287
|
-
class
|
|
1423
|
+
class we extends O {
|
|
1288
1424
|
constructor() {
|
|
1289
1425
|
super(...arguments);
|
|
1290
|
-
u(this, "emitEventType",
|
|
1426
|
+
u(this, "emitEventType", T.DeleteNode);
|
|
1291
1427
|
}
|
|
1292
1428
|
async consume() {
|
|
1293
1429
|
return !1;
|
|
1294
1430
|
}
|
|
1295
1431
|
}
|
|
1296
|
-
class
|
|
1432
|
+
class ve extends O {
|
|
1297
1433
|
constructor() {
|
|
1298
1434
|
super(...arguments);
|
|
1299
|
-
u(this, "emitEventType",
|
|
1435
|
+
u(this, "emitEventType", T.ScaleNode);
|
|
1300
1436
|
}
|
|
1301
1437
|
async consume(e) {
|
|
1302
1438
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1303
|
-
if (s === p.UpdateNode && o ===
|
|
1439
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1304
1440
|
return await this.consumeForLocalWorker(e), !0;
|
|
1305
1441
|
}
|
|
1306
1442
|
async consumeForLocalWorker(e) {
|
|
1307
1443
|
var a;
|
|
1308
1444
|
const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
|
|
1309
|
-
s ===
|
|
1445
|
+
s === L && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1310
1446
|
updateSelectorOpt: o,
|
|
1311
1447
|
willSyncService: r,
|
|
1312
1448
|
willSerializeData: i,
|
|
@@ -1331,44 +1467,49 @@ class Ie extends E {
|
|
|
1331
1467
|
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
1332
1468
|
textOpt: r.textOpt
|
|
1333
1469
|
});
|
|
1334
|
-
for (const [d,
|
|
1335
|
-
|
|
1336
|
-
...
|
|
1470
|
+
for (const [d, k] of a.entries())
|
|
1471
|
+
k.toolsType === f.Text ? l.push({
|
|
1472
|
+
...k,
|
|
1337
1473
|
workId: d,
|
|
1338
1474
|
type: p.TextUpdate,
|
|
1339
|
-
dataType:
|
|
1475
|
+
dataType: v.Local,
|
|
1340
1476
|
willSyncService: !0
|
|
1341
|
-
}) : l.push(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
);
|
|
1477
|
+
}) : l.push({
|
|
1478
|
+
...k,
|
|
1479
|
+
workId: d,
|
|
1480
|
+
type: p.UpdateNode,
|
|
1481
|
+
updateNodeOpt: {
|
|
1482
|
+
useAnimation: !1
|
|
1483
|
+
},
|
|
1484
|
+
isSync: !0
|
|
1485
|
+
});
|
|
1352
1486
|
}
|
|
1353
1487
|
return {
|
|
1354
1488
|
sp: l
|
|
1355
1489
|
};
|
|
1356
1490
|
}
|
|
1357
1491
|
}
|
|
1358
|
-
class
|
|
1492
|
+
class Ie extends O {
|
|
1359
1493
|
constructor() {
|
|
1360
1494
|
super(...arguments);
|
|
1361
|
-
u(this, "emitEventType",
|
|
1495
|
+
u(this, "emitEventType", T.RotateNode);
|
|
1362
1496
|
}
|
|
1363
1497
|
async consume(e) {
|
|
1364
1498
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1365
|
-
if (s === p.UpdateNode && o ===
|
|
1499
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1366
1500
|
return await this.consumeForLocalWorker(e), !0;
|
|
1367
1501
|
}
|
|
1368
1502
|
async consumeForLocalWorker(e) {
|
|
1369
1503
|
var n;
|
|
1370
|
-
const {
|
|
1371
|
-
|
|
1504
|
+
const {
|
|
1505
|
+
workId: s,
|
|
1506
|
+
updateNodeOpt: o,
|
|
1507
|
+
willRefreshSelector: r,
|
|
1508
|
+
willSyncService: i,
|
|
1509
|
+
willSerializeData: a,
|
|
1510
|
+
emitEventType: c
|
|
1511
|
+
} = e;
|
|
1512
|
+
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1372
1513
|
updateSelectorOpt: o,
|
|
1373
1514
|
willRefreshSelector: r,
|
|
1374
1515
|
willSyncService: i,
|
|
@@ -1379,48 +1520,53 @@ class We extends E {
|
|
|
1379
1520
|
}));
|
|
1380
1521
|
}
|
|
1381
1522
|
updateSelectorCallback(e) {
|
|
1382
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, m = c.workState, d = o.sp || [],
|
|
1523
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, m = c.workState, d = o.sp || [], k = i == null ? void 0 : i.selectRect;
|
|
1383
1524
|
if (n) {
|
|
1384
1525
|
h && m === W.Done && d.push({
|
|
1385
1526
|
type: p.Select,
|
|
1386
1527
|
selectIds: r.selectIds,
|
|
1387
|
-
selectRect:
|
|
1528
|
+
selectRect: k,
|
|
1388
1529
|
willSyncService: !0,
|
|
1389
1530
|
isSync: l,
|
|
1390
1531
|
points: r.getChildrenPoints()
|
|
1391
1532
|
});
|
|
1392
|
-
for (const [
|
|
1393
|
-
d.push(
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
}
|
|
1403
|
-
);
|
|
1533
|
+
for (const [S, y] of a.entries())
|
|
1534
|
+
d.push({
|
|
1535
|
+
...y,
|
|
1536
|
+
workId: S,
|
|
1537
|
+
type: p.UpdateNode,
|
|
1538
|
+
updateNodeOpt: {
|
|
1539
|
+
useAnimation: !1
|
|
1540
|
+
},
|
|
1541
|
+
isSync: l
|
|
1542
|
+
});
|
|
1404
1543
|
}
|
|
1405
1544
|
return {
|
|
1406
1545
|
sp: d
|
|
1407
1546
|
};
|
|
1408
1547
|
}
|
|
1409
1548
|
}
|
|
1410
|
-
class
|
|
1549
|
+
class ge extends O {
|
|
1411
1550
|
constructor() {
|
|
1412
1551
|
super(...arguments);
|
|
1413
|
-
u(this, "emitEventType",
|
|
1552
|
+
u(this, "emitEventType", T.SetFontStyle);
|
|
1414
1553
|
}
|
|
1415
1554
|
async consume(e) {
|
|
1416
1555
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1417
|
-
if (s === p.UpdateNode && o ===
|
|
1556
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1418
1557
|
return await this.consumeForLocalWorker(e), !0;
|
|
1419
1558
|
}
|
|
1420
1559
|
async consumeForLocalWorker(e) {
|
|
1421
1560
|
var n;
|
|
1422
|
-
const {
|
|
1423
|
-
|
|
1561
|
+
const {
|
|
1562
|
+
workId: s,
|
|
1563
|
+
updateNodeOpt: o,
|
|
1564
|
+
willRefreshSelector: r,
|
|
1565
|
+
willSyncService: i,
|
|
1566
|
+
willSerializeData: a,
|
|
1567
|
+
textUpdateForWoker: c
|
|
1568
|
+
} = e;
|
|
1569
|
+
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1424
1570
|
updateSelectorOpt: o,
|
|
1425
1571
|
willRefreshSelector: r,
|
|
1426
1572
|
willSyncService: i,
|
|
@@ -1440,44 +1586,49 @@ class Te extends E {
|
|
|
1440
1586
|
isSync: n,
|
|
1441
1587
|
points: i.getChildrenPoints()
|
|
1442
1588
|
});
|
|
1443
|
-
for (const [
|
|
1444
|
-
l &&
|
|
1445
|
-
...
|
|
1446
|
-
workId:
|
|
1589
|
+
for (const [k, S] of r.entries())
|
|
1590
|
+
l && S.toolsType === f.Text ? m.push({
|
|
1591
|
+
...S,
|
|
1592
|
+
workId: k,
|
|
1447
1593
|
type: p.TextUpdate,
|
|
1448
|
-
dataType:
|
|
1594
|
+
dataType: v.Local,
|
|
1449
1595
|
willSyncService: !0
|
|
1450
|
-
}) : m.push(
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
);
|
|
1596
|
+
}) : m.push({
|
|
1597
|
+
...S,
|
|
1598
|
+
workId: k,
|
|
1599
|
+
type: p.UpdateNode,
|
|
1600
|
+
updateNodeOpt: {
|
|
1601
|
+
useAnimation: !1
|
|
1602
|
+
},
|
|
1603
|
+
isSync: n
|
|
1604
|
+
});
|
|
1461
1605
|
}
|
|
1462
1606
|
return {
|
|
1463
1607
|
sp: m
|
|
1464
1608
|
};
|
|
1465
1609
|
}
|
|
1466
1610
|
}
|
|
1467
|
-
class
|
|
1611
|
+
class Te extends O {
|
|
1468
1612
|
constructor() {
|
|
1469
1613
|
super(...arguments);
|
|
1470
|
-
u(this, "emitEventType",
|
|
1614
|
+
u(this, "emitEventType", T.SetPoint);
|
|
1471
1615
|
}
|
|
1472
1616
|
async consume(e) {
|
|
1473
1617
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1474
|
-
if (s === p.UpdateNode && o ===
|
|
1618
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1475
1619
|
return this.consumeForLocalWorker(e), !0;
|
|
1476
1620
|
}
|
|
1477
1621
|
async consumeForLocalWorker(e) {
|
|
1478
1622
|
var n;
|
|
1479
|
-
const {
|
|
1480
|
-
|
|
1623
|
+
const {
|
|
1624
|
+
workId: s,
|
|
1625
|
+
updateNodeOpt: o,
|
|
1626
|
+
willRefreshSelector: r,
|
|
1627
|
+
willSyncService: i,
|
|
1628
|
+
willSerializeData: a,
|
|
1629
|
+
textUpdateForWoker: c
|
|
1630
|
+
} = e;
|
|
1631
|
+
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1481
1632
|
updateSelectorOpt: o,
|
|
1482
1633
|
willRefreshSelector: r,
|
|
1483
1634
|
willSyncService: i,
|
|
@@ -1492,17 +1643,15 @@ class Le extends E {
|
|
|
1492
1643
|
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n } = s, h = o.sp || [], l = a == null ? void 0 : a.selectRect;
|
|
1493
1644
|
if (c && h) {
|
|
1494
1645
|
for (const [m, d] of r.entries())
|
|
1495
|
-
h.push(
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1505
|
-
);
|
|
1646
|
+
h.push({
|
|
1647
|
+
...d,
|
|
1648
|
+
workId: m,
|
|
1649
|
+
type: p.UpdateNode,
|
|
1650
|
+
updateNodeOpt: {
|
|
1651
|
+
useAnimation: !1
|
|
1652
|
+
},
|
|
1653
|
+
isSync: n
|
|
1654
|
+
});
|
|
1506
1655
|
h.push({
|
|
1507
1656
|
type: p.Select,
|
|
1508
1657
|
selectIds: i.selectIds,
|
|
@@ -1517,20 +1666,26 @@ class Le extends E {
|
|
|
1517
1666
|
};
|
|
1518
1667
|
}
|
|
1519
1668
|
}
|
|
1520
|
-
class
|
|
1669
|
+
class We extends O {
|
|
1521
1670
|
constructor() {
|
|
1522
1671
|
super(...arguments);
|
|
1523
|
-
u(this, "emitEventType",
|
|
1672
|
+
u(this, "emitEventType", T.SetLock);
|
|
1524
1673
|
}
|
|
1525
1674
|
async consume(e) {
|
|
1526
1675
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1527
|
-
if (s === p.UpdateNode && o ===
|
|
1676
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1528
1677
|
return this.consumeForLocalWorker(e), !0;
|
|
1529
1678
|
}
|
|
1530
1679
|
async consumeForLocalWorker(e) {
|
|
1531
1680
|
var c;
|
|
1532
|
-
const {
|
|
1533
|
-
|
|
1681
|
+
const {
|
|
1682
|
+
workId: s,
|
|
1683
|
+
updateNodeOpt: o,
|
|
1684
|
+
willRefreshSelector: r,
|
|
1685
|
+
willSyncService: i,
|
|
1686
|
+
willSerializeData: a
|
|
1687
|
+
} = e;
|
|
1688
|
+
s === L && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1534
1689
|
updateSelectorOpt: o,
|
|
1535
1690
|
willRefreshSelector: r,
|
|
1536
1691
|
willSyncService: i,
|
|
@@ -1541,18 +1696,16 @@ class Ne extends E {
|
|
|
1541
1696
|
updateSelectorCallback(e) {
|
|
1542
1697
|
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [], m = a == null ? void 0 : a.selectRect;
|
|
1543
1698
|
if (c && l) {
|
|
1544
|
-
for (const [d,
|
|
1545
|
-
l.push(
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1555
|
-
);
|
|
1699
|
+
for (const [d, k] of r.entries())
|
|
1700
|
+
l.push({
|
|
1701
|
+
...k,
|
|
1702
|
+
workId: d,
|
|
1703
|
+
type: p.UpdateNode,
|
|
1704
|
+
updateNodeOpt: {
|
|
1705
|
+
useAnimation: !1
|
|
1706
|
+
},
|
|
1707
|
+
isSync: n
|
|
1708
|
+
});
|
|
1556
1709
|
l.push({
|
|
1557
1710
|
isLocked: h.isLocked,
|
|
1558
1711
|
selectorColor: i.selectorColor,
|
|
@@ -1570,20 +1723,26 @@ class Ne extends E {
|
|
|
1570
1723
|
};
|
|
1571
1724
|
}
|
|
1572
1725
|
}
|
|
1573
|
-
class
|
|
1726
|
+
class Le extends O {
|
|
1574
1727
|
constructor() {
|
|
1575
1728
|
super(...arguments);
|
|
1576
|
-
u(this, "emitEventType",
|
|
1729
|
+
u(this, "emitEventType", T.SetShapeOpt);
|
|
1577
1730
|
}
|
|
1578
1731
|
async consume(e) {
|
|
1579
1732
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1580
|
-
if (s === p.UpdateNode && o ===
|
|
1733
|
+
if (s === p.UpdateNode && o === v.Local && r === this.emitEventType)
|
|
1581
1734
|
return this.consumeForLocalWorker(e), !0;
|
|
1582
1735
|
}
|
|
1583
1736
|
async consumeForLocalWorker(e) {
|
|
1584
1737
|
var c;
|
|
1585
|
-
const {
|
|
1586
|
-
|
|
1738
|
+
const {
|
|
1739
|
+
workId: s,
|
|
1740
|
+
updateNodeOpt: o,
|
|
1741
|
+
willRefreshSelector: r,
|
|
1742
|
+
willSyncService: i,
|
|
1743
|
+
willSerializeData: a
|
|
1744
|
+
} = e;
|
|
1745
|
+
s === L && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1587
1746
|
updateSelectorOpt: o,
|
|
1588
1747
|
willRefreshSelector: r,
|
|
1589
1748
|
willSyncService: i,
|
|
@@ -1595,51 +1754,49 @@ class be extends E {
|
|
|
1595
1754
|
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
|
|
1596
1755
|
if (i && c)
|
|
1597
1756
|
for (const [n, h] of r.entries())
|
|
1598
|
-
c.push(
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1608
|
-
);
|
|
1757
|
+
c.push({
|
|
1758
|
+
...h,
|
|
1759
|
+
workId: n,
|
|
1760
|
+
type: p.UpdateNode,
|
|
1761
|
+
updateNodeOpt: {
|
|
1762
|
+
useAnimation: !1
|
|
1763
|
+
},
|
|
1764
|
+
isSync: a
|
|
1765
|
+
});
|
|
1609
1766
|
return {
|
|
1610
1767
|
sp: c
|
|
1611
1768
|
};
|
|
1612
1769
|
}
|
|
1613
1770
|
}
|
|
1614
|
-
class
|
|
1771
|
+
class Ne {
|
|
1615
1772
|
constructor(t) {
|
|
1616
1773
|
u(this, "builders", /* @__PURE__ */ new Map());
|
|
1617
1774
|
this.builders = new Map(t.map((e) => [e, this.build(e)]));
|
|
1618
1775
|
}
|
|
1619
1776
|
build(t) {
|
|
1620
1777
|
switch (t) {
|
|
1621
|
-
case
|
|
1622
|
-
return new ve();
|
|
1623
|
-
case I.ZIndexNode:
|
|
1624
|
-
return new we();
|
|
1625
|
-
case I.CopyNode:
|
|
1626
|
-
return new Se();
|
|
1627
|
-
case I.SetColorNode:
|
|
1778
|
+
case T.TranslateNode:
|
|
1628
1779
|
return new ye();
|
|
1629
|
-
case
|
|
1630
|
-
return new
|
|
1631
|
-
case
|
|
1780
|
+
case T.ZIndexNode:
|
|
1781
|
+
return new Se();
|
|
1782
|
+
case T.CopyNode:
|
|
1783
|
+
return new me();
|
|
1784
|
+
case T.SetColorNode:
|
|
1785
|
+
return new ke();
|
|
1786
|
+
case T.DeleteNode:
|
|
1787
|
+
return new we();
|
|
1788
|
+
case T.ScaleNode:
|
|
1789
|
+
return new ve();
|
|
1790
|
+
case T.RotateNode:
|
|
1632
1791
|
return new Ie();
|
|
1633
|
-
case
|
|
1634
|
-
return new
|
|
1635
|
-
case
|
|
1792
|
+
case T.SetFontStyle:
|
|
1793
|
+
return new ge();
|
|
1794
|
+
case T.SetPoint:
|
|
1636
1795
|
return new Te();
|
|
1637
|
-
case
|
|
1796
|
+
case T.SetLock:
|
|
1797
|
+
return new We();
|
|
1798
|
+
case T.SetShapeOpt:
|
|
1638
1799
|
return new Le();
|
|
1639
|
-
case I.SetLock:
|
|
1640
|
-
return new Ne();
|
|
1641
|
-
case I.SetShapeOpt:
|
|
1642
|
-
return new be();
|
|
1643
1800
|
}
|
|
1644
1801
|
}
|
|
1645
1802
|
registerForMainThread(t) {
|
|
@@ -1654,7 +1811,7 @@ class Ce {
|
|
|
1654
1811
|
return !1;
|
|
1655
1812
|
}
|
|
1656
1813
|
}
|
|
1657
|
-
class
|
|
1814
|
+
class be {
|
|
1658
1815
|
constructor(t, e) {
|
|
1659
1816
|
u(this, "viewId");
|
|
1660
1817
|
u(this, "fullLayer");
|
|
@@ -1678,25 +1835,43 @@ class De {
|
|
|
1678
1835
|
u(this, "methodBuilder");
|
|
1679
1836
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
1680
1837
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1681
|
-
this.viewId = t, this.opt = e, this.scene = this.createScene({
|
|
1682
|
-
|
|
1683
|
-
|
|
1838
|
+
this.viewId = t, this.opt = e, this.scene = this.createScene({
|
|
1839
|
+
...e.canvasOpt,
|
|
1840
|
+
container: e.container
|
|
1841
|
+
}), this.master = e.master;
|
|
1842
|
+
const s = x.bufferSize.full, o = x.bufferSize.sub;
|
|
1843
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, {
|
|
1844
|
+
...e.layerOpt,
|
|
1845
|
+
bufferSize: this.viewId === A ? s : o * 2
|
|
1846
|
+
}), this.topLayer = this.createLayer("topLayer", this.scene, {
|
|
1847
|
+
...e.layerOpt,
|
|
1848
|
+
bufferSize: (this.viewId === A, o),
|
|
1849
|
+
contextType: "2d"
|
|
1850
|
+
}), this.localLayer = this.createLayer("localLayer", this.scene, {
|
|
1851
|
+
...e.layerOpt,
|
|
1852
|
+
bufferSize: (this.viewId === A, o),
|
|
1853
|
+
contextType: "2d"
|
|
1854
|
+
}), this.serviceLayer = this.createLayer("serviceLayer", this.scene, {
|
|
1855
|
+
...e.layerOpt,
|
|
1856
|
+
bufferSize: (this.viewId === A, o),
|
|
1857
|
+
contextType: "2d"
|
|
1858
|
+
}), this.vNodes = new ce(t, this.scene);
|
|
1684
1859
|
const r = {
|
|
1685
1860
|
thread: this,
|
|
1686
1861
|
vNodes: this.vNodes
|
|
1687
1862
|
};
|
|
1688
|
-
this.localWork = new
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1863
|
+
this.localWork = new ue(r), this.serviceWork = new fe(r), this.topWork = new de(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ne([
|
|
1864
|
+
T.CopyNode,
|
|
1865
|
+
T.SetColorNode,
|
|
1866
|
+
T.DeleteNode,
|
|
1867
|
+
T.RotateNode,
|
|
1868
|
+
T.ScaleNode,
|
|
1869
|
+
T.TranslateNode,
|
|
1870
|
+
T.ZIndexNode,
|
|
1871
|
+
T.SetFontStyle,
|
|
1872
|
+
T.SetPoint,
|
|
1873
|
+
T.SetLock,
|
|
1874
|
+
T.SetShapeOpt
|
|
1700
1875
|
]).registerForMainThread(this);
|
|
1701
1876
|
}
|
|
1702
1877
|
getCachedImages(t) {
|
|
@@ -1728,14 +1903,25 @@ class De {
|
|
|
1728
1903
|
}
|
|
1729
1904
|
async on(t) {
|
|
1730
1905
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1731
|
-
const {
|
|
1906
|
+
const {
|
|
1907
|
+
msgType: e,
|
|
1908
|
+
toolsType: s,
|
|
1909
|
+
opt: o,
|
|
1910
|
+
dataType: r,
|
|
1911
|
+
workId: i,
|
|
1912
|
+
workState: a,
|
|
1913
|
+
imageSrc: c,
|
|
1914
|
+
imageBitmap: n,
|
|
1915
|
+
workIds: h,
|
|
1916
|
+
isLockSentEventCursor: l
|
|
1917
|
+
} = t, m = i == null ? void 0 : i.toString();
|
|
1732
1918
|
switch (e) {
|
|
1733
1919
|
case p.UpdateDpr:
|
|
1734
|
-
|
|
1920
|
+
U(t.dpr) && this.updateDpr(t.dpr);
|
|
1735
1921
|
break;
|
|
1736
1922
|
case p.AuthClear: {
|
|
1737
|
-
const { clearUids: d, localUid:
|
|
1738
|
-
this.vNodes.setCanClearUids(d), this.vNodes.setLocalUid(
|
|
1923
|
+
const { clearUids: d, localUid: k } = t;
|
|
1924
|
+
this.vNodes.setCanClearUids(d), this.vNodes.setLocalUid(k);
|
|
1739
1925
|
break;
|
|
1740
1926
|
}
|
|
1741
1927
|
case p.Destroy:
|
|
@@ -1772,11 +1958,13 @@ class De {
|
|
|
1772
1958
|
}
|
|
1773
1959
|
break;
|
|
1774
1960
|
case p.DrawWork:
|
|
1775
|
-
a === W.Done && r ===
|
|
1776
|
-
sp: [
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1961
|
+
a === W.Done && r === v.Local ? (this.consumeDrawAll(r, t), s === f.LaserPen && l && this.post({
|
|
1962
|
+
sp: [
|
|
1963
|
+
{
|
|
1964
|
+
type: p.None,
|
|
1965
|
+
isLockSentEventCursor: l
|
|
1966
|
+
}
|
|
1967
|
+
]
|
|
1780
1968
|
})) : this.consumeDraw(r, t);
|
|
1781
1969
|
break;
|
|
1782
1970
|
case p.UpdateNode:
|
|
@@ -1791,7 +1979,7 @@ class De {
|
|
|
1791
1979
|
await this.removeNode(t);
|
|
1792
1980
|
return;
|
|
1793
1981
|
case p.Select:
|
|
1794
|
-
r ===
|
|
1982
|
+
r === v.Service && (i === L ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
|
|
1795
1983
|
break;
|
|
1796
1984
|
case p.CursorBlur:
|
|
1797
1985
|
this.localWork.cursorBlur();
|
|
@@ -1800,7 +1988,7 @@ class De {
|
|
|
1800
1988
|
this.localWork.cursorHover(t);
|
|
1801
1989
|
break;
|
|
1802
1990
|
case p.GetTextActive:
|
|
1803
|
-
r ===
|
|
1991
|
+
r === v.Local && this.localWork.checkTextActive(t);
|
|
1804
1992
|
break;
|
|
1805
1993
|
case p.GetImageBitMap:
|
|
1806
1994
|
if (c && n && i) {
|
|
@@ -1809,21 +1997,21 @@ class De {
|
|
|
1809
1997
|
imageBitmap: n,
|
|
1810
1998
|
workId: d
|
|
1811
1999
|
});
|
|
1812
|
-
const
|
|
1813
|
-
if (
|
|
1814
|
-
const { resolve:
|
|
1815
|
-
|
|
2000
|
+
const k = this.imageResolveMap.get(c);
|
|
2001
|
+
if (k) {
|
|
2002
|
+
const { resolve: S, timer: y } = k;
|
|
2003
|
+
y && clearTimeout(y), S && S(c);
|
|
1816
2004
|
}
|
|
1817
2005
|
}
|
|
1818
2006
|
break;
|
|
1819
2007
|
case p.GetVNodeInfo:
|
|
1820
2008
|
if (i && h) {
|
|
1821
|
-
const d = h.map((
|
|
2009
|
+
const d = h.map((k) => this.vNodes.get(k));
|
|
1822
2010
|
this.post({
|
|
1823
2011
|
sp: [
|
|
1824
2012
|
{
|
|
1825
2013
|
type: p.GetVNodeInfo,
|
|
1826
|
-
dataType:
|
|
2014
|
+
dataType: v.Local,
|
|
1827
2015
|
workId: i,
|
|
1828
2016
|
vInfo: d
|
|
1829
2017
|
}
|
|
@@ -1845,56 +2033,58 @@ class De {
|
|
|
1845
2033
|
if (!i || !a || !c || !n)
|
|
1846
2034
|
return;
|
|
1847
2035
|
let l = i;
|
|
1848
|
-
if (a ===
|
|
1849
|
-
const [
|
|
1850
|
-
l = `${i}?width=${
|
|
2036
|
+
if (a === J.Iconify) {
|
|
2037
|
+
const [S, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
2038
|
+
l = `${i}?width=${S}&height=${y}&color=${h}`;
|
|
1851
2039
|
}
|
|
1852
2040
|
if (this.cacheImages.has(l)) {
|
|
1853
|
-
const
|
|
1854
|
-
if (
|
|
1855
|
-
return
|
|
2041
|
+
const S = this.getCachedImages(l);
|
|
2042
|
+
if (S)
|
|
2043
|
+
return S;
|
|
1856
2044
|
}
|
|
1857
2045
|
if (this.imageResolveMap.has(l)) {
|
|
1858
|
-
const
|
|
1859
|
-
if (
|
|
1860
|
-
return
|
|
2046
|
+
const S = this.getCachedImagesByWorkId(r);
|
|
2047
|
+
if (S)
|
|
2048
|
+
return S;
|
|
1861
2049
|
}
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
2050
|
+
const k = await new Promise((S) => {
|
|
2051
|
+
const y = this.imageResolveMap.get(l) || {
|
|
1864
2052
|
resolve: void 0,
|
|
1865
2053
|
timer: void 0
|
|
1866
2054
|
};
|
|
1867
|
-
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
}, 5e3), this.imageResolveMap.set(l,
|
|
1871
|
-
sp: [
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
2055
|
+
y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
|
|
2056
|
+
const I = this.imageResolveMap.get(l);
|
|
2057
|
+
I != null && I.resolve && I.resolve(l);
|
|
2058
|
+
}, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
|
|
2059
|
+
sp: [
|
|
2060
|
+
{
|
|
2061
|
+
imageSrc: l,
|
|
2062
|
+
workId: r,
|
|
2063
|
+
viewId: this.viewId,
|
|
2064
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
2065
|
+
isSubWorker: !1,
|
|
2066
|
+
type: p.GetImageBitMap
|
|
2067
|
+
}
|
|
2068
|
+
]
|
|
1879
2069
|
});
|
|
1880
2070
|
});
|
|
1881
|
-
return this.imageResolveMap.delete(
|
|
2071
|
+
return this.imageResolveMap.delete(k), this.getCachedImages(l);
|
|
1882
2072
|
}
|
|
1883
2073
|
}
|
|
1884
2074
|
async removeNode(t) {
|
|
1885
2075
|
const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
|
|
1886
2076
|
if (s && r.push(s.toString()), r.length)
|
|
1887
2077
|
for (const i of r) {
|
|
1888
|
-
if (i ===
|
|
2078
|
+
if (i === L) {
|
|
1889
2079
|
await this.localWork.removeSelector(t);
|
|
1890
2080
|
continue;
|
|
1891
2081
|
}
|
|
1892
|
-
e ===
|
|
2082
|
+
e === v.Local ? this.localWork.removeWork(t) : e === v.Service && this.serviceWork.removeWork(t), await this.localWork.colloctEffectSelectWork(t);
|
|
1893
2083
|
}
|
|
1894
2084
|
}
|
|
1895
2085
|
async consumeFull(t, e) {
|
|
1896
2086
|
const s = await this.localWork.colloctEffectSelectWork(e);
|
|
1897
|
-
s && t ===
|
|
2087
|
+
s && t === v.Local && await this.localWork.consumeFull(s), s && t === v.Service && this.serviceWork.consumeFull(s);
|
|
1898
2088
|
}
|
|
1899
2089
|
setCameraOpt(t) {
|
|
1900
2090
|
this.cameraOpt = t;
|
|
@@ -1902,7 +2092,9 @@ class De {
|
|
|
1902
2092
|
(r !== this.scene.width || i !== this.scene.height) && this.updateScene({ width: r, height: i }), this.fullLayer.setAttribute("scale", [e, e]), this.fullLayer.setAttribute("translate", [-s, -o]), this.topLayer.setAttribute("scale", [e, e]), this.topLayer.setAttribute("translate", [-s, -o]), this.localLayer.setAttribute("scale", [e, e]), this.localLayer.setAttribute("translate", [-s, -o]), this.serviceLayer.setAttribute("scale", [e, e]), this.serviceLayer.setAttribute("translate", [-s, -o]);
|
|
1903
2093
|
}
|
|
1904
2094
|
runBatchPostData() {
|
|
1905
|
-
this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(
|
|
2095
|
+
this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(
|
|
2096
|
+
this.combinePost.bind(this)
|
|
2097
|
+
));
|
|
1906
2098
|
}
|
|
1907
2099
|
combinePostData() {
|
|
1908
2100
|
var o;
|
|
@@ -1914,13 +2106,13 @@ class De {
|
|
|
1914
2106
|
for (const i of r.sp) {
|
|
1915
2107
|
let a = !1;
|
|
1916
2108
|
for (const c of t)
|
|
1917
|
-
if (
|
|
2109
|
+
if (Y(i, c)) {
|
|
1918
2110
|
a = !0;
|
|
1919
2111
|
break;
|
|
1920
2112
|
}
|
|
1921
2113
|
a || t.push(i);
|
|
1922
2114
|
}
|
|
1923
|
-
|
|
2115
|
+
U(r.fullWorkerDrawCount) && (e = r.fullWorkerDrawCount), U(r.consumeCount) && (s = r.consumeCount);
|
|
1924
2116
|
}
|
|
1925
2117
|
return this.combinePostMsg.clear(), {
|
|
1926
2118
|
sp: t,
|
|
@@ -1930,16 +2122,20 @@ class De {
|
|
|
1930
2122
|
}
|
|
1931
2123
|
combinePost() {
|
|
1932
2124
|
var s, o;
|
|
1933
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter(
|
|
2125
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter(
|
|
2126
|
+
(r) => r.type !== p.None || r.isLockSentEventCursor
|
|
2127
|
+
);
|
|
1934
2128
|
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.consumeCount === void 0 && delete t.consumeCount, t.fullWorkerDrawCount === void 0 && delete t.fullWorkerDrawCount, (t != null && t.consumeCount || t != null && t.fullWorkerDrawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
|
|
1935
2129
|
}
|
|
1936
2130
|
clearAll() {
|
|
1937
2131
|
this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
|
|
1938
2132
|
t.name !== "viewport" && t.remove();
|
|
1939
|
-
}),
|
|
1940
|
-
sp: [
|
|
1941
|
-
|
|
1942
|
-
|
|
2133
|
+
}), B(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
|
|
2134
|
+
sp: [
|
|
2135
|
+
{
|
|
2136
|
+
type: p.Clear
|
|
2137
|
+
}
|
|
2138
|
+
]
|
|
1943
2139
|
});
|
|
1944
2140
|
}
|
|
1945
2141
|
consumeDrawAll(t, e) {
|
|
@@ -1947,10 +2143,12 @@ class De {
|
|
|
1947
2143
|
if (o) {
|
|
1948
2144
|
const r = o.toString();
|
|
1949
2145
|
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1950
|
-
t ===
|
|
2146
|
+
t === v.Local && (this.topWork.getLocalWorkShape(
|
|
2147
|
+
o.toString()
|
|
2148
|
+
) || this.topWork.createLocalWork(e)), this.topWork.consumeDrawAll(e);
|
|
1951
2149
|
return;
|
|
1952
2150
|
}
|
|
1953
|
-
t ===
|
|
2151
|
+
t === v.Local && (this.localWork.getWorkShape(r) || this.localWork.createLocalWork(e), this.localWork.consumeDrawAll(e, this.serviceWork));
|
|
1954
2152
|
}
|
|
1955
2153
|
}
|
|
1956
2154
|
consumeDraw(t, e) {
|
|
@@ -1958,17 +2156,17 @@ class De {
|
|
|
1958
2156
|
if (o && r && s) {
|
|
1959
2157
|
const i = o.toString();
|
|
1960
2158
|
if (this.topWork.canUseTopLayer(r)) {
|
|
1961
|
-
t ===
|
|
2159
|
+
t === v.Local && (this.topWork.getLocalWorkShape(i) || this.topWork.createLocalWork(e)), this.topWork.consumeDraw(e);
|
|
1962
2160
|
return;
|
|
1963
2161
|
}
|
|
1964
|
-
t ===
|
|
2162
|
+
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
2163
|
return;
|
|
1966
2164
|
}
|
|
1967
2165
|
}
|
|
1968
2166
|
async updateCamera(t) {
|
|
1969
2167
|
var o;
|
|
1970
2168
|
const { cameraOpt: e, scenePath: s } = t;
|
|
1971
|
-
if (e && !
|
|
2169
|
+
if (e && !Y(this.cameraOpt, e)) {
|
|
1972
2170
|
if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
|
|
1973
2171
|
let n = !1;
|
|
1974
2172
|
for (const [h, l] of this.localWork.getWorkShapes().entries())
|
|
@@ -1981,20 +2179,20 @@ class De {
|
|
|
1981
2179
|
case f.LaserPen:
|
|
1982
2180
|
break;
|
|
1983
2181
|
default:
|
|
1984
|
-
h !==
|
|
2182
|
+
h !== E && h !== L && (n = !0);
|
|
1985
2183
|
break;
|
|
1986
2184
|
}
|
|
1987
2185
|
if (n) {
|
|
1988
2186
|
this.taskUpdateCameraId = setTimeout(() => {
|
|
1989
2187
|
this.taskUpdateCameraId = void 0, this.updateCamera(t);
|
|
1990
|
-
},
|
|
2188
|
+
}, Z);
|
|
1991
2189
|
return;
|
|
1992
2190
|
}
|
|
1993
2191
|
}
|
|
1994
2192
|
const r = /* @__PURE__ */ new Map();
|
|
1995
2193
|
for (const [n, h] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
1996
2194
|
const l = h.rect;
|
|
1997
|
-
r.set(n,
|
|
2195
|
+
r.set(n, se(l));
|
|
1998
2196
|
}
|
|
1999
2197
|
const i = new Set(r.keys());
|
|
2000
2198
|
let a = !1;
|
|
@@ -2021,21 +2219,24 @@ class De {
|
|
|
2021
2219
|
for (const [n, h] of r.entries()) {
|
|
2022
2220
|
const l = this.vNodes.get(n);
|
|
2023
2221
|
if (l) {
|
|
2024
|
-
const m = h, d = l.rect,
|
|
2025
|
-
let
|
|
2026
|
-
if ((
|
|
2027
|
-
const { toolsType:
|
|
2028
|
-
|
|
2222
|
+
const m = h, d = l.rect, k = this.getSceneRect(), S = H(m, k), y = H(d, k);
|
|
2223
|
+
let I = !1;
|
|
2224
|
+
if ((S !== y || m.w !== d.w || m.h !== d.h || y === j.intersect) && (I = !0), I) {
|
|
2225
|
+
const { toolsType: g, opt: w } = l;
|
|
2226
|
+
g === f.Text && w.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
2029
2227
|
}
|
|
2030
2228
|
}
|
|
2031
2229
|
}
|
|
2032
2230
|
if (a && this.localWork.reRenderSelector(), c)
|
|
2033
|
-
for (const [
|
|
2231
|
+
for (const [
|
|
2232
|
+
n,
|
|
2233
|
+
h
|
|
2234
|
+
] of this.serviceWork.selectorWorkShapes.entries())
|
|
2034
2235
|
this.serviceWork.runSelectWork({
|
|
2035
2236
|
workId: n,
|
|
2036
2237
|
selectIds: h.selectIds,
|
|
2037
2238
|
msgType: p.Select,
|
|
2038
|
-
dataType:
|
|
2239
|
+
dataType: v.Service,
|
|
2039
2240
|
viewId: this.viewId
|
|
2040
2241
|
});
|
|
2041
2242
|
this.debounceUpdateCameraId = setTimeout(() => {
|
|
@@ -2046,25 +2247,27 @@ class De {
|
|
|
2046
2247
|
if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
|
|
2047
2248
|
const d = this.vNodes.get(l);
|
|
2048
2249
|
if (d) {
|
|
2049
|
-
const { toolsType:
|
|
2050
|
-
toolsType:
|
|
2051
|
-
opt:
|
|
2250
|
+
const { toolsType: k, opt: S, rect: y } = d, I = this.localWork.setFullWork({
|
|
2251
|
+
toolsType: k,
|
|
2252
|
+
opt: S,
|
|
2052
2253
|
workId: l
|
|
2053
2254
|
});
|
|
2054
|
-
if (
|
|
2055
|
-
const
|
|
2056
|
-
n.push(
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2255
|
+
if (I) {
|
|
2256
|
+
const g = this.getSceneRect(), w = H(y, g);
|
|
2257
|
+
n.push(
|
|
2258
|
+
I.consumeServiceAsync({
|
|
2259
|
+
isFullWork: !0,
|
|
2260
|
+
replaceId: l,
|
|
2261
|
+
isDrawLabel: w !== j.outside
|
|
2262
|
+
})
|
|
2263
|
+
);
|
|
2061
2264
|
}
|
|
2062
2265
|
}
|
|
2063
2266
|
}
|
|
2064
2267
|
this.debounceUpdateCache.delete(l);
|
|
2065
2268
|
}
|
|
2066
2269
|
this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
|
|
2067
|
-
},
|
|
2270
|
+
}, Z);
|
|
2068
2271
|
}
|
|
2069
2272
|
}
|
|
2070
2273
|
}
|
|
@@ -2078,7 +2281,7 @@ class De {
|
|
|
2078
2281
|
};
|
|
2079
2282
|
}
|
|
2080
2283
|
createScene(t) {
|
|
2081
|
-
return new
|
|
2284
|
+
return new ee({
|
|
2082
2285
|
displayRatio: this.opt.displayer.dpr,
|
|
2083
2286
|
depth: !1,
|
|
2084
2287
|
desynchronized: !0,
|
|
@@ -2089,7 +2292,7 @@ class De {
|
|
|
2089
2292
|
});
|
|
2090
2293
|
}
|
|
2091
2294
|
createLayer(t, e, s) {
|
|
2092
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new
|
|
2295
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new te({
|
|
2093
2296
|
anchor: [0.5, 0.5],
|
|
2094
2297
|
pos: [o * 0.5, r * 0.5],
|
|
2095
2298
|
size: [o, r],
|
|
@@ -2111,7 +2314,7 @@ class De {
|
|
|
2111
2314
|
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), R(this.fullLayer, this.fullLayer.parent), this.topLayer.remove(), R(this.topLayer, this.topLayer.parent), this.localLayer.remove(), R(this.localLayer, this.localLayer.parent), this.serviceLayer.remove(), R(this.serviceLayer, this.serviceLayer.parent), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
|
|
2112
2315
|
}
|
|
2113
2316
|
}
|
|
2114
|
-
class
|
|
2317
|
+
class Ce {
|
|
2115
2318
|
constructor(t, e) {
|
|
2116
2319
|
u(this, "viewId");
|
|
2117
2320
|
u(this, "fullLayer");
|
|
@@ -2123,7 +2326,14 @@ class Oe {
|
|
|
2123
2326
|
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2124
2327
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2125
2328
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
2126
|
-
this.viewId = t, this.opt = e, this.scene = this.createScene({
|
|
2329
|
+
this.viewId = t, this.opt = e, this.scene = this.createScene({
|
|
2330
|
+
...e.canvasOpt,
|
|
2331
|
+
container: e.container
|
|
2332
|
+
}), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, {
|
|
2333
|
+
...e.layerOpt,
|
|
2334
|
+
bufferSize: this.viewId === A ? 6e3 : 3e3,
|
|
2335
|
+
contextType: "2d"
|
|
2336
|
+
});
|
|
2127
2337
|
}
|
|
2128
2338
|
getCachedImages(t) {
|
|
2129
2339
|
var e;
|
|
@@ -2185,44 +2395,50 @@ class Oe {
|
|
|
2185
2395
|
if (!i || !a || !c || !n)
|
|
2186
2396
|
return;
|
|
2187
2397
|
let l = i;
|
|
2188
|
-
if (a ===
|
|
2189
|
-
const [
|
|
2190
|
-
l = `${i}?width=${
|
|
2398
|
+
if (a === J.Iconify) {
|
|
2399
|
+
const [S, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
2400
|
+
l = `${i}?width=${S}&height=${y}&color=${h}`;
|
|
2191
2401
|
}
|
|
2192
2402
|
if (this.cacheImages.has(l)) {
|
|
2193
|
-
const
|
|
2194
|
-
if (
|
|
2195
|
-
return
|
|
2403
|
+
const S = this.getCachedImages(l);
|
|
2404
|
+
if (S)
|
|
2405
|
+
return S;
|
|
2196
2406
|
}
|
|
2197
2407
|
if (this.imageResolveMap.has(l)) {
|
|
2198
|
-
const
|
|
2199
|
-
if (
|
|
2200
|
-
return
|
|
2408
|
+
const S = this.getCachedImagesByWorkId(r);
|
|
2409
|
+
if (S)
|
|
2410
|
+
return S;
|
|
2201
2411
|
}
|
|
2202
|
-
const
|
|
2203
|
-
const
|
|
2412
|
+
const k = await new Promise((S) => {
|
|
2413
|
+
const y = this.imageResolveMap.get(l) || {
|
|
2204
2414
|
resolve: void 0,
|
|
2205
2415
|
timer: void 0
|
|
2206
2416
|
};
|
|
2207
|
-
|
|
2208
|
-
const
|
|
2209
|
-
|
|
2210
|
-
}, 5e3), this.imageResolveMap.set(l,
|
|
2211
|
-
sp: [
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2417
|
+
y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
|
|
2418
|
+
const I = this.imageResolveMap.get(l);
|
|
2419
|
+
I != null && I.resolve && I.resolve(l);
|
|
2420
|
+
}, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
|
|
2421
|
+
sp: [
|
|
2422
|
+
{
|
|
2423
|
+
imageSrc: l,
|
|
2424
|
+
workId: r,
|
|
2425
|
+
viewId: this.viewId,
|
|
2426
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
2427
|
+
isSubWorker: !0,
|
|
2428
|
+
type: p.GetImageBitMap
|
|
2429
|
+
}
|
|
2430
|
+
]
|
|
2219
2431
|
});
|
|
2220
2432
|
});
|
|
2221
|
-
return this.imageResolveMap.delete(
|
|
2433
|
+
return this.imageResolveMap.delete(k), this.getCachedImages(l);
|
|
2222
2434
|
}
|
|
2223
2435
|
}
|
|
2224
2436
|
createWorkShapeNode(t) {
|
|
2225
|
-
return
|
|
2437
|
+
return z({
|
|
2438
|
+
...t,
|
|
2439
|
+
fullLayer: this.fullLayer,
|
|
2440
|
+
drawLayer: void 0
|
|
2441
|
+
});
|
|
2226
2442
|
}
|
|
2227
2443
|
setFullWork(t) {
|
|
2228
2444
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -2238,7 +2454,7 @@ class Oe {
|
|
|
2238
2454
|
}
|
|
2239
2455
|
async runFullWork(t) {
|
|
2240
2456
|
var o;
|
|
2241
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
2457
|
+
const e = this.setFullWork(t), s = t.ops && F(t.ops);
|
|
2242
2458
|
if (e) {
|
|
2243
2459
|
let r, i;
|
|
2244
2460
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
@@ -2253,7 +2469,7 @@ class Oe {
|
|
|
2253
2469
|
op: s,
|
|
2254
2470
|
isFullWork: !0,
|
|
2255
2471
|
replaceId: a
|
|
2256
|
-
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)),
|
|
2472
|
+
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), $(r, i);
|
|
2257
2473
|
}
|
|
2258
2474
|
}
|
|
2259
2475
|
async getSnapshot(t) {
|
|
@@ -2271,10 +2487,10 @@ class Oe {
|
|
|
2271
2487
|
opt: l,
|
|
2272
2488
|
workId: n,
|
|
2273
2489
|
msgType: p.FullWork,
|
|
2274
|
-
dataType:
|
|
2490
|
+
dataType: v.Service,
|
|
2275
2491
|
viewId: this.viewId
|
|
2276
2492
|
}, d = await this.runFullWork(m);
|
|
2277
|
-
a =
|
|
2493
|
+
a = $(a, d);
|
|
2278
2494
|
break;
|
|
2279
2495
|
}
|
|
2280
2496
|
}
|
|
@@ -2296,21 +2512,33 @@ class Oe {
|
|
|
2296
2512
|
}
|
|
2297
2513
|
getRectImageBitmap(t, e) {
|
|
2298
2514
|
const s = Math.floor(t.x * this.opt.displayer.dpr), o = Math.floor(t.y * this.opt.displayer.dpr), r = t.w > 0 && Math.floor(t.w * this.opt.displayer.dpr || 1) || 1, i = t.h > 0 && Math.floor(t.h * this.opt.displayer.dpr || 1) || 1;
|
|
2299
|
-
return createImageBitmap(
|
|
2515
|
+
return createImageBitmap(
|
|
2516
|
+
this.fullLayer.parent.canvas,
|
|
2517
|
+
s,
|
|
2518
|
+
o,
|
|
2519
|
+
r,
|
|
2520
|
+
i,
|
|
2521
|
+
e
|
|
2522
|
+
);
|
|
2300
2523
|
}
|
|
2301
2524
|
async getSnapshotRender(t) {
|
|
2302
2525
|
var r;
|
|
2303
2526
|
const { scenePath: e, options: s } = t;
|
|
2304
2527
|
((r = this.fullLayer) == null ? void 0 : r.parent).render();
|
|
2305
|
-
const o = await this.getRectImageBitmap(
|
|
2528
|
+
const o = await this.getRectImageBitmap(
|
|
2529
|
+
this.getSceneRect(),
|
|
2530
|
+
s
|
|
2531
|
+
);
|
|
2306
2532
|
o && (this.post({
|
|
2307
|
-
sp: [
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2533
|
+
sp: [
|
|
2534
|
+
{
|
|
2535
|
+
type: p.Snapshot,
|
|
2536
|
+
scenePath: e,
|
|
2537
|
+
imageBitmap: o,
|
|
2538
|
+
viewId: this.viewId
|
|
2539
|
+
}
|
|
2540
|
+
]
|
|
2541
|
+
}), this.fullLayer && B(this.fullLayer, this.fullLayer.parent));
|
|
2314
2542
|
}
|
|
2315
2543
|
async getBoundingRect(t) {
|
|
2316
2544
|
const { scenePath: e, scenes: s, cameraOpt: o } = t;
|
|
@@ -2326,19 +2554,21 @@ class Oe {
|
|
|
2326
2554
|
...a,
|
|
2327
2555
|
workId: i,
|
|
2328
2556
|
msgType: p.FullWork,
|
|
2329
|
-
dataType:
|
|
2557
|
+
dataType: v.Service,
|
|
2330
2558
|
viewId: this.viewId
|
|
2331
2559
|
});
|
|
2332
|
-
r =
|
|
2560
|
+
r = $(r, c);
|
|
2333
2561
|
break;
|
|
2334
2562
|
}
|
|
2335
2563
|
}
|
|
2336
2564
|
r && this.post({
|
|
2337
|
-
sp: [
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2565
|
+
sp: [
|
|
2566
|
+
{
|
|
2567
|
+
type: p.BoundingBox,
|
|
2568
|
+
scenePath: e,
|
|
2569
|
+
rect: r
|
|
2570
|
+
}
|
|
2571
|
+
]
|
|
2342
2572
|
});
|
|
2343
2573
|
}
|
|
2344
2574
|
}
|
|
@@ -2347,7 +2577,9 @@ class Oe {
|
|
|
2347
2577
|
this.updateScene({ width: r, height: i }), this.fullLayer.setAttribute("scale", [e, e]), this.fullLayer.setAttribute("translate", [-s, -o]);
|
|
2348
2578
|
}
|
|
2349
2579
|
runBatchPostData() {
|
|
2350
|
-
this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(
|
|
2580
|
+
this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(
|
|
2581
|
+
this.combinePost.bind(this)
|
|
2582
|
+
));
|
|
2351
2583
|
}
|
|
2352
2584
|
combinePostData() {
|
|
2353
2585
|
var e;
|
|
@@ -2358,7 +2590,7 @@ class Oe {
|
|
|
2358
2590
|
for (const o of s.sp) {
|
|
2359
2591
|
let r = !1;
|
|
2360
2592
|
for (const i of t)
|
|
2361
|
-
if (
|
|
2593
|
+
if (le(o, i)) {
|
|
2362
2594
|
r = !0;
|
|
2363
2595
|
break;
|
|
2364
2596
|
}
|
|
@@ -2370,11 +2602,13 @@ class Oe {
|
|
|
2370
2602
|
}
|
|
2371
2603
|
combinePost() {
|
|
2372
2604
|
var s, o;
|
|
2373
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter(
|
|
2605
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter(
|
|
2606
|
+
(r) => r.type !== p.None || r.isLockSentEventCursor
|
|
2607
|
+
);
|
|
2374
2608
|
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (o = t.sp) != null && o.length && this.opt.post(t);
|
|
2375
2609
|
}
|
|
2376
2610
|
createScene(t) {
|
|
2377
|
-
return new
|
|
2611
|
+
return new ee({
|
|
2378
2612
|
displayRatio: this.opt.displayer.dpr,
|
|
2379
2613
|
depth: !1,
|
|
2380
2614
|
desynchronized: !0,
|
|
@@ -2384,7 +2618,7 @@ class Oe {
|
|
|
2384
2618
|
});
|
|
2385
2619
|
}
|
|
2386
2620
|
createLayer(t, e, s) {
|
|
2387
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new
|
|
2621
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new te({
|
|
2388
2622
|
anchor: [0.5, 0.5],
|
|
2389
2623
|
pos: [o * 0.5, r * 0.5],
|
|
2390
2624
|
size: [o, r],
|
|
@@ -2406,7 +2640,7 @@ class Oe {
|
|
|
2406
2640
|
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), R(this.fullLayer, this.fullLayer.parent), this.scene.remove();
|
|
2407
2641
|
}
|
|
2408
2642
|
}
|
|
2409
|
-
class
|
|
2643
|
+
class Ue {
|
|
2410
2644
|
constructor(t) {
|
|
2411
2645
|
u(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
2412
2646
|
u(this, "snapshotThread");
|
|
@@ -2415,88 +2649,97 @@ class _e {
|
|
|
2415
2649
|
}
|
|
2416
2650
|
post(t) {
|
|
2417
2651
|
const { fullWorkerDrawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
|
|
2418
|
-
this.master.isBusy &&
|
|
2652
|
+
this.master.isBusy && q(o) && this.master.setWorkerTasksqueueCount(o), q(e) && this.master.setMaxDrawCount(e), q(r) && this.master.setConsumeCount(r), s && this.master.collectorSyncData(s);
|
|
2419
2653
|
}
|
|
2420
2654
|
destroy() {
|
|
2421
2655
|
this.mainThreadMap.clear();
|
|
2422
2656
|
}
|
|
2423
2657
|
createMainThread(t, e) {
|
|
2424
|
-
return new
|
|
2658
|
+
return new be(t, e);
|
|
2425
2659
|
}
|
|
2426
2660
|
createSnapshotThread(t, e) {
|
|
2427
|
-
return new
|
|
2661
|
+
return new Ce(t, e);
|
|
2428
2662
|
}
|
|
2429
2663
|
async consume(t) {
|
|
2430
2664
|
var e, s, o, r;
|
|
2431
2665
|
for (const i of t.values()) {
|
|
2432
|
-
const {
|
|
2666
|
+
const {
|
|
2667
|
+
msgType: a,
|
|
2668
|
+
viewId: c,
|
|
2669
|
+
tasksqueue: n,
|
|
2670
|
+
mainTasksqueueCount: h,
|
|
2671
|
+
layerOpt: l,
|
|
2672
|
+
offscreenCanvasOpt: m,
|
|
2673
|
+
cameraOpt: d,
|
|
2674
|
+
isSubWorker: k
|
|
2675
|
+
} = i;
|
|
2433
2676
|
if (a === p.Console) {
|
|
2434
2677
|
console.log(this);
|
|
2435
2678
|
continue;
|
|
2436
2679
|
}
|
|
2437
2680
|
if (a === p.Init) {
|
|
2438
|
-
const
|
|
2439
|
-
if (
|
|
2440
|
-
const
|
|
2441
|
-
displayer:
|
|
2442
|
-
container:
|
|
2681
|
+
const y = (e = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : e.displayer, I = y == null ? void 0 : y.canvasContainerRef.current;
|
|
2682
|
+
if (y && I && l && m) {
|
|
2683
|
+
const g = this.createMainThread(c, {
|
|
2684
|
+
displayer: y,
|
|
2685
|
+
container: I,
|
|
2443
2686
|
layerOpt: l,
|
|
2444
2687
|
master: this.master,
|
|
2445
2688
|
canvasOpt: m,
|
|
2446
2689
|
post: this.post.bind(this)
|
|
2447
2690
|
});
|
|
2448
|
-
this.mainThreadMap.set(c,
|
|
2691
|
+
this.mainThreadMap.set(c, g), g && d && g.setCameraOpt(d);
|
|
2449
2692
|
}
|
|
2450
2693
|
continue;
|
|
2451
2694
|
}
|
|
2452
2695
|
if ((a === p.Snapshot || a === p.BoundingBox) && c === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2453
|
-
const
|
|
2454
|
-
if (
|
|
2455
|
-
|
|
2456
|
-
const
|
|
2457
|
-
...
|
|
2696
|
+
const y = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, I = (r = y.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2697
|
+
if (y && I && d) {
|
|
2698
|
+
I.style.width = `${d.width}px`, I.style.height = `${d.height}px`;
|
|
2699
|
+
const g = {
|
|
2700
|
+
...X.defaultLayerOpt,
|
|
2458
2701
|
offscreen: !1,
|
|
2459
2702
|
width: d.width,
|
|
2460
2703
|
height: d.height
|
|
2461
|
-
},
|
|
2462
|
-
...
|
|
2704
|
+
}, w = {
|
|
2705
|
+
...X.defaultScreenCanvasOpt,
|
|
2463
2706
|
width: d.width,
|
|
2464
2707
|
height: d.height
|
|
2465
2708
|
};
|
|
2466
2709
|
this.snapshotThread = this.createSnapshotThread(c, {
|
|
2467
|
-
displayer:
|
|
2468
|
-
container:
|
|
2469
|
-
layerOpt:
|
|
2710
|
+
displayer: y,
|
|
2711
|
+
container: I,
|
|
2712
|
+
layerOpt: g,
|
|
2470
2713
|
master: this.master,
|
|
2471
|
-
canvasOpt:
|
|
2714
|
+
canvasOpt: w,
|
|
2472
2715
|
post: this.post.bind(this)
|
|
2473
2716
|
}), this.snapshotThread.on(i).then(() => {
|
|
2474
|
-
this.snapshotThread = void 0,
|
|
2717
|
+
this.snapshotThread = void 0, I.innerHTML = "", I.style.width = "", I.style.height = "";
|
|
2475
2718
|
});
|
|
2476
2719
|
continue;
|
|
2477
2720
|
}
|
|
2478
2721
|
}
|
|
2479
|
-
if (a === p.GetImageBitMap &&
|
|
2722
|
+
if (a === p.GetImageBitMap && k && this.snapshotThread) {
|
|
2480
2723
|
this.snapshotThread.on(i);
|
|
2481
2724
|
continue;
|
|
2482
2725
|
}
|
|
2483
2726
|
if (a === p.TasksQueue && (n != null && n.size)) {
|
|
2484
|
-
for (const [
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2727
|
+
for (const [y, I] of this.mainThreadMap.entries()) {
|
|
2728
|
+
const g = n.get(y);
|
|
2729
|
+
g && (await I.on(g), h && this.post({ workerTasksqueueCount: h }));
|
|
2487
2730
|
}
|
|
2488
2731
|
continue;
|
|
2489
2732
|
}
|
|
2490
|
-
if (c ===
|
|
2491
|
-
for (const
|
|
2492
|
-
|
|
2733
|
+
if (c === he) {
|
|
2734
|
+
for (const y of this.mainThreadMap.values())
|
|
2735
|
+
y.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2493
2736
|
continue;
|
|
2494
2737
|
}
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2738
|
+
const S = this.mainThreadMap.get(c);
|
|
2739
|
+
S && (S.on(i), a === p.Destroy && this.mainThreadMap.delete(c));
|
|
2497
2740
|
}
|
|
2498
2741
|
}
|
|
2499
2742
|
}
|
|
2500
2743
|
export {
|
|
2501
|
-
|
|
2744
|
+
Ue as MainThreadManagerImpl
|
|
2502
2745
|
};
|