@netless/appliance-plugin 1.1.6 → 1.1.7-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 +58 -6
- package/cdn/cdn.js +1 -1
- package/cdn/{subWorker-C_XI7b.js → fullWorker-BGfri8.js} +88 -88
- package/cdn/{fullWorker-CIRArL.js → subWorker-XTl6EZ.js} +88 -88
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +18 -15
- package/dist/collector/types.d.ts +4 -4
- package/dist/component/autoDraw/index.d.ts +54 -0
- package/dist/core/enum.d.ts +7 -1
- package/dist/core/mainEngine.d.ts +15 -3
- package/dist/core/mainThread/base.d.ts +3 -0
- package/dist/core/mainThread/snapshotThread.d.ts +4 -1
- package/dist/core/mainThread/subLocalThread.d.ts +1 -1
- package/dist/core/mainThread/subTopThread.d.ts +2 -2
- package/dist/core/mainThread/workerMainThread.d.ts +1 -1
- package/dist/core/plugin.d.ts +49 -0
- package/dist/core/tools/image.d.ts +5 -3
- package/dist/core/tools/utils.d.ts +1 -1
- package/dist/core/types.d.ts +6 -6
- package/dist/core/worker/base.d.ts +9 -3
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -1
- package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
- package/dist/extend.d.ts +2 -0
- package/dist/fullWorker.js +88 -88
- package/dist/index-D3dyn50A.js +1 -0
- package/dist/{index-DeePQlzi.mjs → index-DfZ57j4r.mjs} +3637 -3345
- package/dist/{index-BkXgi5s7.mjs → index-TeQIkGn4.mjs} +591 -506
- package/dist/index-oo0mEhB3.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +5 -1
- package/dist/plugin/types.d.ts +47 -3
- package/dist/subWorker.js +88 -88
- package/package.json +1 -1
- package/dist/index-BNqxsoBb.js +0 -1
- package/dist/index-CVBczavT.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (N, t, e) =>
|
|
4
|
-
import { E as f, a as
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var se = (N, t, e) => t in N ? te(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
|
|
3
|
+
var d = (N, t, e) => se(N, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { E as f, a as W, c as R, b as oe, i as re, d as ie, e as U, g as ae, S as P, f as ce, D as A, h as v, j as B, t as x, k as p, l as L, m as q, n as ne, C as _, o as le, p as T, M as D, q as X, T as G, r as z, s as V, u as he, v as K, V as Z, w as pe } from "./index-DfZ57j4r.mjs";
|
|
5
|
+
import { Scene as Y, Group as Q } from "spritejs";
|
|
6
|
+
import { cloneDeep as J, xor as de, isEqual as j, isNumber as ue } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
8
8
|
import "white-web-sdk";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "react";
|
|
11
11
|
import "eventemitter2";
|
|
12
|
-
class
|
|
12
|
+
class fe {
|
|
13
13
|
constructor(t, e) {
|
|
14
14
|
d(this, "viewId");
|
|
15
15
|
d(this, "scene");
|
|
@@ -42,7 +42,7 @@ class ue {
|
|
|
42
42
|
getCanEraserNodes(t) {
|
|
43
43
|
const e = /* @__PURE__ */ new Map();
|
|
44
44
|
for (const [s, o] of t.entries())
|
|
45
|
-
o.toolsType === f.Image && o.opt.locked || o.toolsType === f.Text && (o.opt.workState ===
|
|
45
|
+
o.toolsType === f.Image && o.opt.locked || o.toolsType === f.Text && (o.opt.workState === W.Doing || o.opt.workState === W.Start) || this.isCanClearWorkId(s) && e.set(s, o);
|
|
46
46
|
return e;
|
|
47
47
|
}
|
|
48
48
|
getNodesByType(t) {
|
|
@@ -62,7 +62,7 @@ class ue {
|
|
|
62
62
|
name: t,
|
|
63
63
|
rect: e.rect
|
|
64
64
|
};
|
|
65
|
-
e.rect && (s.rect =
|
|
65
|
+
e.rect && (s.rect = R(e.rect)), e.op && oe(e.op) && (s.op = R(e.op)), e.canRotate && (s.canRotate = e.canRotate), e.scaleType && (s.scaleType = e.scaleType), e.opt && (s.opt = R(e.opt)), e.toolsType && (s.toolsType = e.toolsType), e.centerPos && (s.centerPos = R(e.centerPos)), re(e.isSelected) && (s.isSelected = e.isSelected), s.rect ? this.curNodeMap.set(t, s) : this.curNodeMap.delete(t);
|
|
66
66
|
}
|
|
67
67
|
selected(t) {
|
|
68
68
|
this.setInfo(t, { isSelected: !0 });
|
|
@@ -79,11 +79,11 @@ class ue {
|
|
|
79
79
|
getRectIntersectRange(t, e = !0, s = !0) {
|
|
80
80
|
let o;
|
|
81
81
|
const r = /* @__PURE__ */ new Map();
|
|
82
|
-
for (const [i,
|
|
83
|
-
if (
|
|
84
|
-
if (e &&
|
|
82
|
+
for (const [i, c] of this.curNodeMap.entries())
|
|
83
|
+
if (ie(t, c.rect)) {
|
|
84
|
+
if (e && c.toolsType === f.Image && c.opt.locked || s && c.toolsType === f.Text && (c.opt.workState === W.Doing || c.opt.workState === W.Start))
|
|
85
85
|
continue;
|
|
86
|
-
o = U(o,
|
|
86
|
+
o = U(o, c.rect), r.set(i, c);
|
|
87
87
|
}
|
|
88
88
|
return {
|
|
89
89
|
rectRange: o,
|
|
@@ -91,7 +91,7 @@ class ue {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
getNodeRectFormShape(t, e) {
|
|
94
|
-
const s =
|
|
94
|
+
const s = ae(e.toolsType);
|
|
95
95
|
return this.fullLayer && (s == null ? void 0 : s.getRectFromLayer(this.fullLayer, t));
|
|
96
96
|
}
|
|
97
97
|
updateNodeRect(t) {
|
|
@@ -122,12 +122,12 @@ class ue {
|
|
|
122
122
|
const e = /* @__PURE__ */ new Map();
|
|
123
123
|
for (const s of t) {
|
|
124
124
|
const o = this.curNodeMap.get(s);
|
|
125
|
-
o && e.set(s,
|
|
125
|
+
o && e.set(s, R(o));
|
|
126
126
|
}
|
|
127
|
-
return this.targetNodeMap.push(
|
|
127
|
+
return this.targetNodeMap.push(R(e)), this.targetNodeMap.length - 1;
|
|
128
128
|
}
|
|
129
129
|
setTarget() {
|
|
130
|
-
return this.targetNodeMap.push(
|
|
130
|
+
return this.targetNodeMap.push(R(this.curNodeMap)), this.targetNodeMap.length - 1;
|
|
131
131
|
}
|
|
132
132
|
getLastTarget() {
|
|
133
133
|
return this.targetNodeMap[this.targetNodeMap.length - 1];
|
|
@@ -150,7 +150,7 @@ class ue {
|
|
|
150
150
|
isCanClearWorkId(t) {
|
|
151
151
|
if (this.canClearUids === void 0 || this.canClearUids === !0)
|
|
152
152
|
return !0;
|
|
153
|
-
if (
|
|
153
|
+
if (ce(this.canClearUids)) {
|
|
154
154
|
const e = t.split(P);
|
|
155
155
|
if (e.length === 1)
|
|
156
156
|
return this.canClearUids.has("localSelf") || this.localUid && this.canClearUids.has(this.localUid);
|
|
@@ -160,7 +160,7 @@ class ue {
|
|
|
160
160
|
return !1;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
class
|
|
163
|
+
class me {
|
|
164
164
|
constructor(t) {
|
|
165
165
|
d(this, "vNodes");
|
|
166
166
|
d(this, "thread");
|
|
@@ -193,7 +193,7 @@ class fe {
|
|
|
193
193
|
return o && this.localWorkShapes.set(t, {
|
|
194
194
|
node: o,
|
|
195
195
|
toolsType: o.toolsType,
|
|
196
|
-
workState:
|
|
196
|
+
workState: W.Start
|
|
197
197
|
}), o;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -217,7 +217,7 @@ class fe {
|
|
|
217
217
|
if (!r)
|
|
218
218
|
return;
|
|
219
219
|
const i = r.node.consume({ data: t, isFullWork: !1, isSubWorker: !0 });
|
|
220
|
-
i.rect && (r.result = i, r.workState =
|
|
220
|
+
i.rect && (r.result = i, r.workState = W.Doing, o && this.localWorkShapes.set(o, r));
|
|
221
221
|
}
|
|
222
222
|
this.runAnimation();
|
|
223
223
|
}
|
|
@@ -237,25 +237,25 @@ class fe {
|
|
|
237
237
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
238
238
|
}
|
|
239
239
|
activeServiceWorkShape(t) {
|
|
240
|
-
var
|
|
241
|
-
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops:
|
|
240
|
+
var m, u;
|
|
241
|
+
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n } = t;
|
|
242
242
|
if (!e)
|
|
243
243
|
return;
|
|
244
|
-
const
|
|
245
|
-
if (!((u = this.serviceWorkShapes) != null && u.has(
|
|
246
|
-
let
|
|
244
|
+
const a = e.toString(), h = (m = this.vNodes.get(a)) == null ? void 0 : m.rect;
|
|
245
|
+
if (!((u = this.serviceWorkShapes) != null && u.has(a))) {
|
|
246
|
+
let w = {
|
|
247
247
|
toolsType: o,
|
|
248
248
|
animationWorkData: n || [],
|
|
249
249
|
animationIndex: 0,
|
|
250
250
|
type: r,
|
|
251
251
|
updateNodeOpt: i,
|
|
252
|
-
ops:
|
|
252
|
+
ops: c,
|
|
253
253
|
oldRect: h
|
|
254
254
|
};
|
|
255
|
-
o && s && (
|
|
255
|
+
o && s && (w = this.setNodeKey(a, w, o, s)), this.serviceWorkShapes.set(a, w);
|
|
256
256
|
}
|
|
257
|
-
const l = this.serviceWorkShapes.get(
|
|
258
|
-
r && (l.type = r),
|
|
257
|
+
const l = this.serviceWorkShapes.get(a);
|
|
258
|
+
r && (l.type = r), c && (l.animationWorkData = x(c), l.ops = c), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== a && l.node.setWorkId(a), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(a, l, o, s), l.node && l.node.setWorkOptions(s));
|
|
259
259
|
}
|
|
260
260
|
computNextAnimationIndex(t, e) {
|
|
261
261
|
var r;
|
|
@@ -263,48 +263,48 @@ class fe {
|
|
|
263
263
|
return Math.min((t.animationIndex || 0) + (o || e), (t.animationWorkData || []).length);
|
|
264
264
|
}
|
|
265
265
|
animationDraw() {
|
|
266
|
-
var o, r, i,
|
|
266
|
+
var o, r, i, c;
|
|
267
267
|
this.animationId = void 0;
|
|
268
268
|
let t = !1;
|
|
269
269
|
const e = /* @__PURE__ */ new Map(), s = [];
|
|
270
|
-
for (const [n,
|
|
271
|
-
switch (
|
|
270
|
+
for (const [n, a] of this.serviceWorkShapes.entries())
|
|
271
|
+
switch (a.toolsType) {
|
|
272
272
|
case f.LaserPen: {
|
|
273
|
-
const l = this.computNextAnimationIndex(
|
|
274
|
-
if ((
|
|
273
|
+
const l = this.computNextAnimationIndex(a, 8), m = Math.max(0, a.animationIndex || 0), u = (a.animationWorkData || []).slice(m, l);
|
|
274
|
+
if ((a.animationIndex || 0) < l && ((o = a.node) == null || o.consumeService({
|
|
275
275
|
op: u,
|
|
276
276
|
isFullWork: !1
|
|
277
|
-
}),
|
|
278
|
-
workState:
|
|
277
|
+
}), a.animationIndex = l, u.length && e.set(n, {
|
|
278
|
+
workState: m === 0 ? W.Start : l === ((r = a.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
|
|
279
279
|
op: u.slice(-2)
|
|
280
|
-
})),
|
|
281
|
-
(i =
|
|
280
|
+
})), a.isDel) {
|
|
281
|
+
(i = a.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
a.ops && a.animationIndex === ((c = a.animationWorkData) == null ? void 0 : c.length) && !a.isDel && (this.thread.topLayer.getElementsByName(n.toString())[0] || (a.isDel = !0, this.serviceWorkShapes.set(n, a))), t = !0;
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
for (const [n,
|
|
289
|
-
const { result: h, toolsType: l, isDel:
|
|
288
|
+
for (const [n, a] of this.localWorkShapes.entries()) {
|
|
289
|
+
const { result: h, toolsType: l, isDel: m, workState: u } = a;
|
|
290
290
|
switch (l) {
|
|
291
291
|
case f.LaserPen: {
|
|
292
|
-
if (
|
|
293
|
-
|
|
292
|
+
if (m) {
|
|
293
|
+
a.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
|
|
294
294
|
removeIds: [n.toString()],
|
|
295
295
|
type: p.RemoveNode
|
|
296
296
|
});
|
|
297
297
|
break;
|
|
298
298
|
}
|
|
299
|
-
h && ((h.op || h.ops) && s.push(h),
|
|
299
|
+
h && ((h.op || h.ops) && s.push(h), a.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && u === W.Done && (a.isDel = !0, this.localWorkShapes.set(n, a)), t = !0;
|
|
300
300
|
break;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
t && this.runAnimation(), e.size && e.forEach((n,
|
|
304
|
+
t && this.runAnimation(), e.size && e.forEach((n, a) => {
|
|
305
305
|
s.push({
|
|
306
306
|
type: p.Cursor,
|
|
307
|
-
uid:
|
|
307
|
+
uid: a.split(P)[0],
|
|
308
308
|
op: n.op,
|
|
309
309
|
workState: n.workState,
|
|
310
310
|
viewId: this.thread.viewId
|
|
@@ -322,7 +322,7 @@ class fe {
|
|
|
322
322
|
this.tmpOpt.toolsOpt = e, s = this.createWorkShapeNode({ workId: t, toolsType: r, toolsOpt: e }), s && this.localWorkShapes.set(t, {
|
|
323
323
|
node: s,
|
|
324
324
|
toolsType: r,
|
|
325
|
-
workState:
|
|
325
|
+
workState: W.Start
|
|
326
326
|
}), this.setToolsOpt(this.tmpOpt);
|
|
327
327
|
}
|
|
328
328
|
e != null && e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s && s.setWorkOptions(e);
|
|
@@ -336,7 +336,7 @@ class fe {
|
|
|
336
336
|
if (!r)
|
|
337
337
|
return;
|
|
338
338
|
const i = r.node.consumeAll({ data: t });
|
|
339
|
-
r.result = i, r.workState =
|
|
339
|
+
r.result = i, r.workState = W.Done, o && this.localWorkShapes.set(o, r);
|
|
340
340
|
}
|
|
341
341
|
this.runAnimation();
|
|
342
342
|
}
|
|
@@ -353,13 +353,13 @@ class ke {
|
|
|
353
353
|
d(this, "syncUnitTime", A.syncOpt.interval);
|
|
354
354
|
d(this, "drawCount", 0);
|
|
355
355
|
d(this, "drawWorkActiveId");
|
|
356
|
-
d(this, "batchEraserCombine",
|
|
356
|
+
d(this, "batchEraserCombine", le(() => {
|
|
357
357
|
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
358
358
|
}, 100, { leading: !1 }));
|
|
359
359
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
360
360
|
}
|
|
361
361
|
async loadImageBitMap(t) {
|
|
362
|
-
return this.thread.loadImageBitMap(t);
|
|
362
|
+
return await this.thread.loadImageBitMap(t);
|
|
363
363
|
}
|
|
364
364
|
createLocalWork(t) {
|
|
365
365
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -382,38 +382,38 @@ class ke {
|
|
|
382
382
|
}, e);
|
|
383
383
|
}
|
|
384
384
|
async updateSelector(t) {
|
|
385
|
-
var
|
|
385
|
+
var m;
|
|
386
386
|
const e = this.workShapes.get(L);
|
|
387
|
-
if (!((
|
|
388
|
-
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o,
|
|
387
|
+
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
388
|
+
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, c = await (e == null ? void 0 : e.updateSelector({
|
|
389
389
|
updateSelectorOpt: r,
|
|
390
|
-
selectIds:
|
|
390
|
+
selectIds: J(e.selectIds),
|
|
391
391
|
vNodes: this.vNodes,
|
|
392
392
|
willSerializeData: i,
|
|
393
393
|
worker: this
|
|
394
394
|
})), n = /* @__PURE__ */ new Map();
|
|
395
|
-
let
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const { toolsType:
|
|
395
|
+
let a;
|
|
396
|
+
c != null && c.selectIds && (a = de(e.selectIds, c.selectIds), c.selectIds.forEach((u) => {
|
|
397
|
+
const w = this.vNodes.get(u);
|
|
398
|
+
if (w) {
|
|
399
|
+
const { toolsType: k, op: S, opt: g } = w;
|
|
400
400
|
n.set(u, {
|
|
401
|
-
opt:
|
|
402
|
-
toolsType:
|
|
403
|
-
ops: (
|
|
401
|
+
opt: g,
|
|
402
|
+
toolsType: k,
|
|
403
|
+
ops: (S == null ? void 0 : S.length) && q(S) || void 0
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
-
}), e.selectIds =
|
|
406
|
+
}), e.selectIds = c.selectIds);
|
|
407
407
|
const h = [], l = s && s({
|
|
408
|
-
res:
|
|
408
|
+
res: c,
|
|
409
409
|
workShapeNode: e,
|
|
410
410
|
param: o,
|
|
411
411
|
postData: { sp: h },
|
|
412
412
|
newServiceStore: n
|
|
413
413
|
}) || { sp: h };
|
|
414
|
-
|
|
414
|
+
a && l.sp.push({
|
|
415
415
|
type: p.RemoveNode,
|
|
416
|
-
removeIds:
|
|
416
|
+
removeIds: a,
|
|
417
417
|
viewId: this.thread.viewId
|
|
418
418
|
}), l.sp.length && this.thread.post(l);
|
|
419
419
|
}
|
|
@@ -439,8 +439,8 @@ class ke {
|
|
|
439
439
|
if (e != null && e.length) {
|
|
440
440
|
let r;
|
|
441
441
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
442
|
-
const { rect:
|
|
443
|
-
if (
|
|
442
|
+
const { rect: c, name: n, toolsType: a, 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];
|
|
443
|
+
if (a === f.Text && ne([l, m], c) && h.workState === W.Done) {
|
|
444
444
|
r = n;
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
@@ -468,29 +468,29 @@ class ke {
|
|
|
468
468
|
r && o && r.cursorHover(o);
|
|
469
469
|
}
|
|
470
470
|
updateFullSelectWork(t) {
|
|
471
|
-
var o, r, i,
|
|
471
|
+
var o, r, i, c, n;
|
|
472
472
|
const e = this.workShapes.get(L), { selectIds: s } = t;
|
|
473
473
|
if (!(s != null && s.length)) {
|
|
474
474
|
this.blurSelector(t);
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
477
|
if (!e) {
|
|
478
|
-
const
|
|
479
|
-
!
|
|
478
|
+
const a = this.setFullWork(t);
|
|
479
|
+
!a && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(t.workId.toString(), t.opt || this.tmpOpt.toolsOpt), a && this.updateFullSelectWork(t);
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
482
|
if (e && (s != null && s.length)) {
|
|
483
|
-
const { selectRect:
|
|
483
|
+
const { selectRect: a } = e.updateSelectIds(s), h = [{
|
|
484
484
|
...t,
|
|
485
485
|
selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
|
|
486
486
|
strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
|
|
487
|
-
fillColor: ((
|
|
487
|
+
fillColor: ((c = t.opt) == null ? void 0 : c.fillColor) || e.fillColor,
|
|
488
488
|
textOpt: ((n = t.opt) == null ? void 0 : n.textOpt) || e.textOpt,
|
|
489
489
|
canTextEdit: e.canTextEdit,
|
|
490
490
|
canRotate: e.canRotate,
|
|
491
491
|
scaleType: e.scaleType,
|
|
492
492
|
type: p.Select,
|
|
493
|
-
selectRect:
|
|
493
|
+
selectRect: a,
|
|
494
494
|
points: e.getChildrenPoints(),
|
|
495
495
|
willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
|
|
496
496
|
opt: (t == null ? void 0 : t.willSyncService) && e.getWorkOptions() || void 0,
|
|
@@ -520,12 +520,12 @@ class ke {
|
|
|
520
520
|
if (!r)
|
|
521
521
|
return;
|
|
522
522
|
const i = r.selectIds && [...r.selectIds] || [];
|
|
523
|
-
for (const
|
|
524
|
-
if (this.vNodes.get(
|
|
525
|
-
const
|
|
526
|
-
|
|
523
|
+
for (const c of i) {
|
|
524
|
+
if (this.vNodes.get(c)) {
|
|
525
|
+
const a = this.commandDeleteText(c);
|
|
526
|
+
a && s.push(a);
|
|
527
527
|
}
|
|
528
|
-
this.removeNode(
|
|
528
|
+
this.removeNode(c), o.push(c);
|
|
529
529
|
}
|
|
530
530
|
o.length && s.push({
|
|
531
531
|
type: p.RemoveNode,
|
|
@@ -695,10 +695,10 @@ class ke {
|
|
|
695
695
|
t.op && e.push(t), e.length && this.thread.post({ sp: e });
|
|
696
696
|
}
|
|
697
697
|
async drawBitMapEraserFull(t, e, s) {
|
|
698
|
-
const { willUpdateNodes: o, scenePath: r, ...i } = e,
|
|
698
|
+
const { willUpdateNodes: o, scenePath: r, ...i } = e, c = t.getWorkId(), n = [
|
|
699
699
|
{
|
|
700
700
|
...i,
|
|
701
|
-
workId:
|
|
701
|
+
workId: c,
|
|
702
702
|
scenePath: r,
|
|
703
703
|
updateNodeOpt: {
|
|
704
704
|
useAnimation: !1
|
|
@@ -707,7 +707,7 @@ class ke {
|
|
|
707
707
|
nextTasks: [
|
|
708
708
|
{
|
|
709
709
|
type: p.RemoveNode,
|
|
710
|
-
removeIds: [
|
|
710
|
+
removeIds: [c],
|
|
711
711
|
viewId: this.thread.viewId
|
|
712
712
|
}
|
|
713
713
|
]
|
|
@@ -721,12 +721,12 @@ class ke {
|
|
|
721
721
|
willUpdateNodes: o,
|
|
722
722
|
worker: this
|
|
723
723
|
}));
|
|
724
|
-
for (const [
|
|
724
|
+
for (const [a, h] of o)
|
|
725
725
|
n.push({
|
|
726
726
|
type: p.UpdateNode,
|
|
727
727
|
dataType: v.Local,
|
|
728
728
|
opt: h.opt,
|
|
729
|
-
workId:
|
|
729
|
+
workId: a,
|
|
730
730
|
updateNodeOpt: {
|
|
731
731
|
useAnimation: !1
|
|
732
732
|
}
|
|
@@ -739,11 +739,11 @@ class ke {
|
|
|
739
739
|
const s = [];
|
|
740
740
|
if ((o = t.newWorkDatas) != null && o.size) {
|
|
741
741
|
for (const i of t.newWorkDatas.values()) {
|
|
742
|
-
const
|
|
743
|
-
this.batchEraserWorks.add(
|
|
742
|
+
const c = i.workId.toString();
|
|
743
|
+
this.batchEraserWorks.add(c), s.push({
|
|
744
744
|
type: p.FullWork,
|
|
745
|
-
workId:
|
|
746
|
-
ops:
|
|
745
|
+
workId: c,
|
|
746
|
+
ops: q(i.op),
|
|
747
747
|
opt: i.opt,
|
|
748
748
|
toolsType: i.toolsType,
|
|
749
749
|
updateNodeOpt: {
|
|
@@ -792,10 +792,10 @@ class ke {
|
|
|
792
792
|
consumeDraw(t, e) {
|
|
793
793
|
const { op: s, workId: o, scenePath: r } = t;
|
|
794
794
|
if (s != null && s.length && o) {
|
|
795
|
-
const i = o.toString(),
|
|
796
|
-
if (!
|
|
795
|
+
const i = o.toString(), c = this.workShapes.get(i);
|
|
796
|
+
if (!c)
|
|
797
797
|
return;
|
|
798
|
-
const n =
|
|
798
|
+
const n = c.toolsType;
|
|
799
799
|
if (n === f.LaserPen)
|
|
800
800
|
return;
|
|
801
801
|
switch (this.drawWorkActiveId && this.drawWorkActiveId !== i && (this.consumeDrawAll({
|
|
@@ -807,37 +807,37 @@ class ke {
|
|
|
807
807
|
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && i !== L && (this.drawWorkActiveId = i), n) {
|
|
808
808
|
case f.Selector:
|
|
809
809
|
{
|
|
810
|
-
const
|
|
810
|
+
const a = c.consume({
|
|
811
811
|
data: t,
|
|
812
812
|
isFullWork: !0
|
|
813
813
|
});
|
|
814
|
-
|
|
814
|
+
a.type === p.Select && (a.selectIds && e.runReverseSelectWork(a.selectIds), this.thread.post({ sp: [a] }));
|
|
815
815
|
}
|
|
816
816
|
break;
|
|
817
817
|
case f.PencilEraser:
|
|
818
818
|
{
|
|
819
|
-
const
|
|
819
|
+
const a = c.consume({
|
|
820
820
|
data: t,
|
|
821
821
|
isFullWork: !0
|
|
822
822
|
});
|
|
823
|
-
|
|
823
|
+
a != null && a.rect && this.drawPencilEraser(a);
|
|
824
824
|
}
|
|
825
825
|
break;
|
|
826
826
|
case f.BitMapEraser: {
|
|
827
|
-
const
|
|
827
|
+
const a = c.consume({
|
|
828
828
|
data: t,
|
|
829
829
|
isFullWork: !0
|
|
830
830
|
});
|
|
831
|
-
|
|
831
|
+
a != null && a.rect && this.drawBitMapEraser(a);
|
|
832
832
|
break;
|
|
833
833
|
}
|
|
834
834
|
case f.Eraser:
|
|
835
835
|
{
|
|
836
|
-
const
|
|
836
|
+
const a = c.consume({
|
|
837
837
|
data: t,
|
|
838
838
|
isFullWork: !0
|
|
839
839
|
});
|
|
840
|
-
|
|
840
|
+
a != null && a.rect && this.drawEraser(a);
|
|
841
841
|
}
|
|
842
842
|
break;
|
|
843
843
|
case f.Arrow:
|
|
@@ -849,14 +849,14 @@ class ke {
|
|
|
849
849
|
case f.SpeechBalloon:
|
|
850
850
|
case f.Pencil:
|
|
851
851
|
{
|
|
852
|
-
const
|
|
852
|
+
const a = c.consume({
|
|
853
853
|
data: t,
|
|
854
854
|
isFullWork: !1,
|
|
855
855
|
isMainThread: !0
|
|
856
856
|
});
|
|
857
|
-
|
|
857
|
+
a && (this.drawCount++, this.thread.post({
|
|
858
858
|
drawCount: this.drawCount,
|
|
859
|
-
sp:
|
|
859
|
+
sp: a.op && [{ ...a, scenePath: r }] || void 0
|
|
860
860
|
}));
|
|
861
861
|
}
|
|
862
862
|
break;
|
|
@@ -864,7 +864,7 @@ class ke {
|
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
consumeDrawAll(t, e) {
|
|
867
|
-
var i,
|
|
867
|
+
var i, c, n, a;
|
|
868
868
|
const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
|
|
869
869
|
if (s) {
|
|
870
870
|
const h = s.toString();
|
|
@@ -872,22 +872,22 @@ class ke {
|
|
|
872
872
|
const l = this.workShapes.get(h);
|
|
873
873
|
if (!l)
|
|
874
874
|
return;
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
875
|
+
const m = l.toolsType;
|
|
876
|
+
if (m === f.LaserPen)
|
|
877
877
|
return;
|
|
878
|
-
const u = this.workShapes.get(_),
|
|
879
|
-
switch (
|
|
878
|
+
const u = this.workShapes.get(_), w = (i = u == null ? void 0 : u.selectIds) == null ? void 0 : i[0], k = l.consumeAll({ data: t });
|
|
879
|
+
switch (m) {
|
|
880
880
|
case f.Selector:
|
|
881
|
-
|
|
881
|
+
k.selectIds && w && ((c = k.selectIds) != null && c.includes(w)) && u.cursorBlur(), k.type === p.Select && (k.selectIds && e.runReverseSelectWork(k.selectIds), this.thread.post({ sp: [{ ...k, scenePath: o }] })), (n = l.selectIds) != null && n.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(h);
|
|
882
882
|
break;
|
|
883
883
|
case f.PencilEraser:
|
|
884
|
-
this.drawPencilEraser({ ...
|
|
884
|
+
this.drawPencilEraser({ ...k, scenePath: o }, r), l.clearTmpPoints();
|
|
885
885
|
break;
|
|
886
886
|
case f.BitMapEraser:
|
|
887
|
-
(
|
|
887
|
+
(k.rect || (a = k.newWorkDatas) != null && a.size) && this.drawBitMapEraserFull(l, k, r);
|
|
888
888
|
break;
|
|
889
889
|
case f.Eraser:
|
|
890
|
-
this.drawEraser({ ...
|
|
890
|
+
this.drawEraser({ ...k, scenePath: o }, r), l.clearTmpPoints();
|
|
891
891
|
break;
|
|
892
892
|
case f.Arrow:
|
|
893
893
|
case f.Straight:
|
|
@@ -897,13 +897,13 @@ class ke {
|
|
|
897
897
|
case f.Polygon:
|
|
898
898
|
case f.SpeechBalloon:
|
|
899
899
|
case f.Pencil: {
|
|
900
|
-
const
|
|
901
|
-
r &&
|
|
900
|
+
const S = [];
|
|
901
|
+
r && S.push({
|
|
902
902
|
type: p.None,
|
|
903
903
|
isLockSentEventCursor: r
|
|
904
|
-
}),
|
|
904
|
+
}), k && (S.push(k), this.drawCount = 0, this.thread.post({
|
|
905
905
|
drawCount: this.drawCount,
|
|
906
|
-
sp:
|
|
906
|
+
sp: S
|
|
907
907
|
})), this.clearWorkShapeNodeCache(h);
|
|
908
908
|
break;
|
|
909
909
|
}
|
|
@@ -942,7 +942,7 @@ class Se {
|
|
|
942
942
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
943
943
|
}
|
|
944
944
|
async loadImageBitMap(t) {
|
|
945
|
-
return this.thread.loadImageBitMap(t);
|
|
945
|
+
return await this.thread.loadImageBitMap(t);
|
|
946
946
|
}
|
|
947
947
|
destroy() {
|
|
948
948
|
this.clearAll();
|
|
@@ -999,30 +999,30 @@ class Se {
|
|
|
999
999
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
1000
1000
|
}
|
|
1001
1001
|
async animationDraw() {
|
|
1002
|
-
var s, o, r, i,
|
|
1002
|
+
var s, o, r, i, c, n, a, h, l, m, u, w, k, S, g;
|
|
1003
1003
|
this.animationId = void 0;
|
|
1004
1004
|
let t = !1;
|
|
1005
1005
|
const e = /* @__PURE__ */ new Map();
|
|
1006
|
-
for (const [
|
|
1007
|
-
switch (
|
|
1006
|
+
for (const [I, y] of this.workShapes.entries())
|
|
1007
|
+
switch (y.toolsType) {
|
|
1008
1008
|
case f.Image: {
|
|
1009
|
-
await ((s =
|
|
1009
|
+
await ((s = y.node) == null ? void 0 : s.consumeServiceAsync({
|
|
1010
1010
|
isFullWork: !0,
|
|
1011
1011
|
worker: this
|
|
1012
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
1012
|
+
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
1013
1013
|
var M;
|
|
1014
|
-
(M = b.selectIds) != null && M.includes(
|
|
1015
|
-
}), this.workShapes.delete(
|
|
1014
|
+
(M = b.selectIds) != null && M.includes(I) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
1015
|
+
}), this.workShapes.delete(I);
|
|
1016
1016
|
break;
|
|
1017
1017
|
}
|
|
1018
1018
|
case f.Text: {
|
|
1019
|
-
|
|
1019
|
+
y.node && (await ((o = y.node) == null ? void 0 : o.consumeServiceAsync({
|
|
1020
1020
|
isFullWork: !0,
|
|
1021
|
-
replaceId:
|
|
1022
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
1021
|
+
replaceId: I
|
|
1022
|
+
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
1023
1023
|
var M;
|
|
1024
|
-
(M = b.selectIds) != null && M.includes(
|
|
1025
|
-
}), (r =
|
|
1024
|
+
(M = b.selectIds) != null && M.includes(I) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
1025
|
+
}), (r = y.node) == null || r.clearTmpPoints(), this.workShapes.delete(I));
|
|
1026
1026
|
break;
|
|
1027
1027
|
}
|
|
1028
1028
|
case f.Arrow:
|
|
@@ -1032,63 +1032,63 @@ class Se {
|
|
|
1032
1032
|
case f.Star:
|
|
1033
1033
|
case f.Polygon:
|
|
1034
1034
|
case f.SpeechBalloon: {
|
|
1035
|
-
const b = !!
|
|
1036
|
-
if ((i =
|
|
1037
|
-
const
|
|
1038
|
-
(
|
|
1039
|
-
op:
|
|
1035
|
+
const b = !!y.ops;
|
|
1036
|
+
if ((i = y.animationWorkData) != null && i.length) {
|
|
1037
|
+
const C = y.oldRect;
|
|
1038
|
+
(c = y.node) == null || c.consumeService({
|
|
1039
|
+
op: y.animationWorkData,
|
|
1040
1040
|
isFullWork: b
|
|
1041
|
-
}), b && (this.selectorWorkShapes.forEach((M,
|
|
1041
|
+
}), b && (this.selectorWorkShapes.forEach((M, E) => {
|
|
1042
1042
|
var F;
|
|
1043
|
-
(F = M.selectIds) != null && F.includes(
|
|
1044
|
-
}), (n =
|
|
1045
|
-
workState:
|
|
1046
|
-
op:
|
|
1047
|
-
if (
|
|
1043
|
+
(F = M.selectIds) != null && F.includes(I) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
|
|
1044
|
+
}), (n = y.node) == null || n.clearTmpPoints(), this.workShapes.delete(I)), e.set(I, {
|
|
1045
|
+
workState: C ? y.ops ? W.Done : W.Doing : W.Start,
|
|
1046
|
+
op: y.animationWorkData.filter((M, E) => {
|
|
1047
|
+
if (E % 3 !== 2)
|
|
1048
1048
|
return !0;
|
|
1049
1049
|
}).slice(-2)
|
|
1050
|
-
}),
|
|
1050
|
+
}), y.animationWorkData.length = 0;
|
|
1051
1051
|
}
|
|
1052
1052
|
break;
|
|
1053
1053
|
}
|
|
1054
1054
|
case f.Pencil: {
|
|
1055
|
-
if (!
|
|
1056
|
-
(
|
|
1057
|
-
op:
|
|
1055
|
+
if (!y.useAnimation && y.ops)
|
|
1056
|
+
(a = y.node) == null || a.consumeService({
|
|
1057
|
+
op: y.animationWorkData || [],
|
|
1058
1058
|
isFullWork: !0,
|
|
1059
|
-
replaceId:
|
|
1060
|
-
}), (h =
|
|
1059
|
+
replaceId: I
|
|
1060
|
+
}), (h = y.node) == null || h.updataOptService(y.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
|
|
1061
1061
|
var M;
|
|
1062
|
-
(M = b.selectIds) != null && M.includes(
|
|
1063
|
-
}), (l =
|
|
1064
|
-
else if (
|
|
1065
|
-
if (
|
|
1066
|
-
(
|
|
1062
|
+
(M = b.selectIds) != null && M.includes(I) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
1063
|
+
}), (l = y.node) == null || l.clearTmpPoints(), this.workShapes.delete(I);
|
|
1064
|
+
else if (y.useAnimation) {
|
|
1065
|
+
if (y.isDel) {
|
|
1066
|
+
(m = y.node) == null || m.clearTmpPoints(), this.workShapes.delete(I);
|
|
1067
1067
|
break;
|
|
1068
1068
|
}
|
|
1069
|
-
const b = 3,
|
|
1070
|
-
if ((
|
|
1071
|
-
if ((
|
|
1072
|
-
op:
|
|
1069
|
+
const b = 3, C = this.computNextAnimationIndex(y, b), M = y.isDiff ? 0 : Math.max(0, (y.animationIndex || 0) - b), E = (y.animationWorkData || []).slice(M, C), F = (w = (u = y.node) == null ? void 0 : u.getWorkId()) == null ? void 0 : w.toString();
|
|
1070
|
+
if ((y.animationIndex || 0) < C || y.isDiff) {
|
|
1071
|
+
if ((k = y.node) == null || k.consumeService({
|
|
1072
|
+
op: E,
|
|
1073
1073
|
isFullWork: !1
|
|
1074
|
-
}),
|
|
1075
|
-
const H =
|
|
1076
|
-
if (
|
|
1074
|
+
}), y.animationIndex = C, y.isDiff && (y.isDiff = !1), E.length) {
|
|
1075
|
+
const H = E.filter(($, ee) => {
|
|
1076
|
+
if (ee % b !== b - 1)
|
|
1077
1077
|
return !0;
|
|
1078
1078
|
}).slice(-2);
|
|
1079
|
-
e.set(
|
|
1080
|
-
workState: M === 0 ?
|
|
1079
|
+
e.set(I, {
|
|
1080
|
+
workState: M === 0 ? W.Start : C === ((S = y.animationWorkData) == null ? void 0 : S.length) ? W.Done : W.Doing,
|
|
1081
1081
|
op: H
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
1084
|
-
} else
|
|
1085
|
-
op:
|
|
1084
|
+
} else y.ops && ((g = y.node) == null || g.consumeService({
|
|
1085
|
+
op: y.animationWorkData || [],
|
|
1086
1086
|
isFullWork: !0,
|
|
1087
1087
|
replaceId: F
|
|
1088
|
-
}),
|
|
1089
|
-
workState:
|
|
1090
|
-
op:
|
|
1091
|
-
if (
|
|
1088
|
+
}), y.isDel = !0, e.set(I, {
|
|
1089
|
+
workState: W.Done,
|
|
1090
|
+
op: E.filter((H, $) => {
|
|
1091
|
+
if ($ % b !== b - 1)
|
|
1092
1092
|
return !0;
|
|
1093
1093
|
}).slice(-2)
|
|
1094
1094
|
}));
|
|
@@ -1099,16 +1099,16 @@ class Se {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
if (t && this.runAnimation(), e.size) {
|
|
1102
|
-
const
|
|
1103
|
-
e.forEach((
|
|
1104
|
-
|
|
1102
|
+
const I = [];
|
|
1103
|
+
e.forEach((y, b) => {
|
|
1104
|
+
I.push({
|
|
1105
1105
|
type: p.Cursor,
|
|
1106
1106
|
uid: b.split(P)[0],
|
|
1107
|
-
op:
|
|
1108
|
-
workState:
|
|
1107
|
+
op: y.op,
|
|
1108
|
+
workState: y.workState,
|
|
1109
1109
|
viewId: this.thread.viewId
|
|
1110
1110
|
});
|
|
1111
|
-
}), this.thread.post({ sp:
|
|
1111
|
+
}), this.thread.post({ sp: I });
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
runAnimation() {
|
|
@@ -1135,28 +1135,28 @@ class Se {
|
|
|
1135
1135
|
return !1;
|
|
1136
1136
|
}
|
|
1137
1137
|
activeWorkShape(t) {
|
|
1138
|
-
var
|
|
1139
|
-
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops:
|
|
1138
|
+
var w, k, S, g;
|
|
1139
|
+
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n, useAnimation: a, imageBitmap: h } = t;
|
|
1140
1140
|
if (!e)
|
|
1141
1141
|
return;
|
|
1142
|
-
const l = e.toString(),
|
|
1143
|
-
if (!((
|
|
1144
|
-
let
|
|
1142
|
+
const l = e.toString(), m = (w = this.vNodes.get(l)) == null ? void 0 : w.rect;
|
|
1143
|
+
if (!((k = this.workShapes) != null && k.has(l))) {
|
|
1144
|
+
let I = {
|
|
1145
1145
|
toolsType: o,
|
|
1146
1146
|
animationWorkData: n || [],
|
|
1147
1147
|
animationIndex: 0,
|
|
1148
1148
|
type: r,
|
|
1149
1149
|
updateNodeOpt: i,
|
|
1150
|
-
ops:
|
|
1151
|
-
useAnimation: typeof
|
|
1152
|
-
oldRect:
|
|
1150
|
+
ops: c,
|
|
1151
|
+
useAnimation: typeof a < "u" ? a : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1152
|
+
oldRect: m,
|
|
1153
1153
|
isDiff: !1,
|
|
1154
1154
|
imageBitmap: h
|
|
1155
1155
|
};
|
|
1156
|
-
o && s && (
|
|
1156
|
+
o && s && (I = this.setNodeKey(l, I, o, s)), (S = this.workShapes) == null || S.set(l, I);
|
|
1157
1157
|
}
|
|
1158
|
-
const u = (
|
|
1159
|
-
r && (u.type = r),
|
|
1158
|
+
const u = (g = this.workShapes) == null ? void 0 : g.get(l);
|
|
1159
|
+
r && (u.type = r), c && (u.animationWorkData = x(c), u.ops = c), i && (u.updateNodeOpt = i), n && (u.isDiff = this.hasDiffData(u.animationWorkData || [], n, u.toolsType), u.animationWorkData = n), u.node && u.node.getWorkId() !== l && u.node.setWorkId(l), m && (u.oldRect = m), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), u.toolsType !== o && o && s && this.setNodeKey(l, u, o, s), u.node && u.node.setWorkOptions(s)), h && (u.imageBitmap = h);
|
|
1160
1160
|
}
|
|
1161
1161
|
removeNode(t, e) {
|
|
1162
1162
|
t.indexOf(L) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1170,22 +1170,22 @@ class Se {
|
|
|
1170
1170
|
s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
|
|
1171
1171
|
}
|
|
1172
1172
|
activeSelectorShape(t) {
|
|
1173
|
-
var
|
|
1173
|
+
var a, h, l;
|
|
1174
1174
|
const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
|
|
1175
1175
|
if (!e)
|
|
1176
1176
|
return;
|
|
1177
|
-
const
|
|
1178
|
-
if (!((
|
|
1179
|
-
let
|
|
1177
|
+
const c = e.toString();
|
|
1178
|
+
if (!((a = this.selectorWorkShapes) != null && a.has(c))) {
|
|
1179
|
+
let m = {
|
|
1180
1180
|
toolsType: o,
|
|
1181
1181
|
selectIds: i,
|
|
1182
1182
|
type: r,
|
|
1183
1183
|
opt: s
|
|
1184
1184
|
};
|
|
1185
|
-
o && s && (
|
|
1185
|
+
o && s && (m = this.setNodeKey(c, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(c, m);
|
|
1186
1186
|
}
|
|
1187
|
-
const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(
|
|
1188
|
-
r && (n.type = r), n.node && n.node.getWorkId() !==
|
|
1187
|
+
const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(c);
|
|
1188
|
+
r && (n.type = r), n.node && n.node.getWorkId() !== c && n.node.setWorkId(c), n.selectIds = i || [];
|
|
1189
1189
|
}
|
|
1190
1190
|
setNodeKey(t, e, s, o) {
|
|
1191
1191
|
return e.toolsType = s, e.node = B({
|
|
@@ -1198,7 +1198,7 @@ class Se {
|
|
|
1198
1198
|
}, this), e;
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
|
-
class
|
|
1201
|
+
class O {
|
|
1202
1202
|
constructor() {
|
|
1203
1203
|
d(this, "localWork");
|
|
1204
1204
|
d(this, "serviceWork");
|
|
@@ -1208,10 +1208,10 @@ class E {
|
|
|
1208
1208
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1209
1209
|
}
|
|
1210
1210
|
}
|
|
1211
|
-
class
|
|
1211
|
+
class ye extends O {
|
|
1212
1212
|
constructor() {
|
|
1213
1213
|
super(...arguments);
|
|
1214
|
-
d(this, "emitEventType",
|
|
1214
|
+
d(this, "emitEventType", T.CopyNode);
|
|
1215
1215
|
}
|
|
1216
1216
|
async consume(e) {
|
|
1217
1217
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1224,10 +1224,10 @@ class me extends E {
|
|
|
1224
1224
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
|
-
class
|
|
1227
|
+
class we extends O {
|
|
1228
1228
|
constructor() {
|
|
1229
1229
|
super(...arguments);
|
|
1230
|
-
d(this, "emitEventType",
|
|
1230
|
+
d(this, "emitEventType", T.SetColorNode);
|
|
1231
1231
|
}
|
|
1232
1232
|
async consume(e) {
|
|
1233
1233
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1235,28 +1235,28 @@ class ye extends E {
|
|
|
1235
1235
|
return this.consumeForLocalWorker(e), !0;
|
|
1236
1236
|
}
|
|
1237
1237
|
async consumeForLocalWorker(e) {
|
|
1238
|
-
var
|
|
1239
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1240
|
-
s === L && o && await ((
|
|
1238
|
+
var a;
|
|
1239
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
|
|
1240
|
+
s === L && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1241
1241
|
updateSelectorOpt: o,
|
|
1242
1242
|
willRefreshSelector: r,
|
|
1243
1243
|
willSyncService: i,
|
|
1244
|
-
willSerializeData:
|
|
1244
|
+
willSerializeData: c,
|
|
1245
1245
|
textUpdateForWoker: n,
|
|
1246
1246
|
callback: this.updateSelectorCallback
|
|
1247
1247
|
}));
|
|
1248
1248
|
}
|
|
1249
1249
|
updateSelectorCallback(e) {
|
|
1250
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync:
|
|
1250
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c, textUpdateForWoker: n } = s, a = o.sp || [];
|
|
1251
1251
|
if (i)
|
|
1252
1252
|
for (const [h, l] of r.entries())
|
|
1253
|
-
n && l.toolsType === f.Text ?
|
|
1253
|
+
n && l.toolsType === f.Text ? a.push({
|
|
1254
1254
|
...l,
|
|
1255
1255
|
workId: h,
|
|
1256
1256
|
type: p.TextUpdate,
|
|
1257
1257
|
dataType: v.Local,
|
|
1258
1258
|
willSyncService: !0
|
|
1259
|
-
}) :
|
|
1259
|
+
}) : a.push(
|
|
1260
1260
|
{
|
|
1261
1261
|
...l,
|
|
1262
1262
|
workId: h,
|
|
@@ -1264,18 +1264,18 @@ class ye extends E {
|
|
|
1264
1264
|
updateNodeOpt: {
|
|
1265
1265
|
useAnimation: !1
|
|
1266
1266
|
},
|
|
1267
|
-
isSync:
|
|
1267
|
+
isSync: c
|
|
1268
1268
|
}
|
|
1269
1269
|
);
|
|
1270
1270
|
return {
|
|
1271
|
-
sp:
|
|
1271
|
+
sp: a
|
|
1272
1272
|
};
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
class
|
|
1275
|
+
class ge extends O {
|
|
1276
1276
|
constructor() {
|
|
1277
1277
|
super(...arguments);
|
|
1278
|
-
d(this, "emitEventType",
|
|
1278
|
+
d(this, "emitEventType", T.ZIndexNode);
|
|
1279
1279
|
}
|
|
1280
1280
|
async consume(e) {
|
|
1281
1281
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1284,28 +1284,28 @@ class we extends E {
|
|
|
1284
1284
|
}
|
|
1285
1285
|
async consumeForLocalWorker(e) {
|
|
1286
1286
|
var n;
|
|
1287
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1287
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
|
|
1288
1288
|
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1289
1289
|
updateSelectorOpt: o,
|
|
1290
1290
|
willRefreshSelector: r,
|
|
1291
1291
|
willSyncService: i,
|
|
1292
|
-
willSerializeData:
|
|
1292
|
+
willSerializeData: c,
|
|
1293
1293
|
callback: this.updateSelectorCallback
|
|
1294
1294
|
}));
|
|
1295
1295
|
}
|
|
1296
1296
|
updateSelectorCallback(e) {
|
|
1297
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync:
|
|
1297
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
|
|
1298
1298
|
if (i && n)
|
|
1299
|
-
for (const [
|
|
1299
|
+
for (const [a, h] of r.entries())
|
|
1300
1300
|
n.push(
|
|
1301
1301
|
{
|
|
1302
1302
|
...h,
|
|
1303
|
-
workId:
|
|
1303
|
+
workId: a,
|
|
1304
1304
|
type: p.UpdateNode,
|
|
1305
1305
|
updateNodeOpt: {
|
|
1306
1306
|
useAnimation: !1
|
|
1307
1307
|
},
|
|
1308
|
-
isSync:
|
|
1308
|
+
isSync: c
|
|
1309
1309
|
}
|
|
1310
1310
|
);
|
|
1311
1311
|
return {
|
|
@@ -1313,10 +1313,10 @@ class we extends E {
|
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
|
-
class ve extends
|
|
1316
|
+
class ve extends O {
|
|
1317
1317
|
constructor() {
|
|
1318
1318
|
super(...arguments);
|
|
1319
|
-
d(this, "emitEventType",
|
|
1319
|
+
d(this, "emitEventType", T.TranslateNode);
|
|
1320
1320
|
}
|
|
1321
1321
|
async consume(e) {
|
|
1322
1322
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1325,52 +1325,52 @@ class ve extends E {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
async consumeForLocalWorker(e) {
|
|
1327
1327
|
var h, l;
|
|
1328
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1329
|
-
s === L && o && (o.workState ===
|
|
1328
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n, emitEventType: a } = e;
|
|
1329
|
+
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({
|
|
1330
1330
|
updateSelectorOpt: o,
|
|
1331
1331
|
willRefreshSelector: r,
|
|
1332
1332
|
willSyncService: i,
|
|
1333
|
-
willSerializeData:
|
|
1333
|
+
willSerializeData: c,
|
|
1334
1334
|
isSync: !0,
|
|
1335
1335
|
textUpdateForWoker: n,
|
|
1336
|
-
emitEventType:
|
|
1336
|
+
emitEventType: a,
|
|
1337
1337
|
callback: this.updateSelectorCallback
|
|
1338
|
-
})) : o.workState ===
|
|
1338
|
+
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1339
1339
|
}
|
|
1340
1340
|
updateSelectorCallback(e) {
|
|
1341
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res:
|
|
1342
|
-
if (
|
|
1341
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = h.workState, u = o.sp || [];
|
|
1342
|
+
if (m === W.Start)
|
|
1343
1343
|
return {
|
|
1344
1344
|
sp: [],
|
|
1345
1345
|
render: []
|
|
1346
1346
|
};
|
|
1347
|
-
const
|
|
1347
|
+
const w = c == null ? void 0 : c.selectRect;
|
|
1348
1348
|
if (n) {
|
|
1349
|
-
|
|
1349
|
+
m === W.Doing && u.push({
|
|
1350
1350
|
type: p.Select,
|
|
1351
1351
|
selectIds: i.selectIds,
|
|
1352
|
-
selectRect:
|
|
1352
|
+
selectRect: w,
|
|
1353
1353
|
willSyncService: !0,
|
|
1354
1354
|
isSync: !0,
|
|
1355
1355
|
points: i.getChildrenPoints(),
|
|
1356
1356
|
textOpt: i.textOpt
|
|
1357
1357
|
});
|
|
1358
|
-
for (const [
|
|
1359
|
-
l &&
|
|
1360
|
-
...
|
|
1361
|
-
workId:
|
|
1358
|
+
for (const [k, S] of r.entries())
|
|
1359
|
+
l && S.toolsType === f.Text ? u.push({
|
|
1360
|
+
...S,
|
|
1361
|
+
workId: k,
|
|
1362
1362
|
type: p.TextUpdate,
|
|
1363
1363
|
dataType: v.Local,
|
|
1364
1364
|
willSyncService: !0
|
|
1365
1365
|
}) : u.push(
|
|
1366
1366
|
{
|
|
1367
|
-
...
|
|
1368
|
-
workId:
|
|
1367
|
+
...S,
|
|
1368
|
+
workId: k,
|
|
1369
1369
|
type: p.UpdateNode,
|
|
1370
1370
|
updateNodeOpt: {
|
|
1371
1371
|
useAnimation: !1
|
|
1372
1372
|
},
|
|
1373
|
-
isSync:
|
|
1373
|
+
isSync: a
|
|
1374
1374
|
}
|
|
1375
1375
|
);
|
|
1376
1376
|
}
|
|
@@ -1379,19 +1379,19 @@ class ve extends E {
|
|
|
1379
1379
|
};
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
|
-
class
|
|
1382
|
+
class Ie extends O {
|
|
1383
1383
|
constructor() {
|
|
1384
1384
|
super(...arguments);
|
|
1385
|
-
d(this, "emitEventType",
|
|
1385
|
+
d(this, "emitEventType", T.DeleteNode);
|
|
1386
1386
|
}
|
|
1387
1387
|
async consume() {
|
|
1388
1388
|
return !1;
|
|
1389
1389
|
}
|
|
1390
1390
|
}
|
|
1391
|
-
class
|
|
1391
|
+
class Te extends O {
|
|
1392
1392
|
constructor() {
|
|
1393
1393
|
super(...arguments);
|
|
1394
|
-
d(this, "emitEventType",
|
|
1394
|
+
d(this, "emitEventType", T.ScaleNode);
|
|
1395
1395
|
}
|
|
1396
1396
|
async consume(e) {
|
|
1397
1397
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1399,9 +1399,9 @@ class Ie extends E {
|
|
|
1399
1399
|
return await this.consumeForLocalWorker(e), !0;
|
|
1400
1400
|
}
|
|
1401
1401
|
async consumeForLocalWorker(e) {
|
|
1402
|
-
var
|
|
1402
|
+
var c;
|
|
1403
1403
|
const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
|
|
1404
|
-
s === L && o && await ((
|
|
1404
|
+
s === L && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1405
1405
|
updateSelectorOpt: o,
|
|
1406
1406
|
willSyncService: r,
|
|
1407
1407
|
willSerializeData: i,
|
|
@@ -1410,32 +1410,32 @@ class Ie extends E {
|
|
|
1410
1410
|
}));
|
|
1411
1411
|
}
|
|
1412
1412
|
updateSelectorCallback(e) {
|
|
1413
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore:
|
|
1414
|
-
if (h ===
|
|
1413
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a } = s, h = n.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
|
|
1414
|
+
if (h === W.Start)
|
|
1415
1415
|
return {
|
|
1416
1416
|
sp: [],
|
|
1417
1417
|
render: []
|
|
1418
1418
|
};
|
|
1419
|
-
if (
|
|
1419
|
+
if (a) {
|
|
1420
1420
|
l.push({
|
|
1421
1421
|
type: p.Select,
|
|
1422
1422
|
selectIds: r.selectIds,
|
|
1423
|
-
selectRect:
|
|
1423
|
+
selectRect: m,
|
|
1424
1424
|
willSyncService: !0,
|
|
1425
1425
|
isSync: !0,
|
|
1426
|
-
points: h ===
|
|
1426
|
+
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
1427
1427
|
textOpt: r.textOpt
|
|
1428
1428
|
});
|
|
1429
|
-
for (const [u,
|
|
1430
|
-
|
|
1431
|
-
...
|
|
1429
|
+
for (const [u, w] of c.entries())
|
|
1430
|
+
w.toolsType === f.Text ? l.push({
|
|
1431
|
+
...w,
|
|
1432
1432
|
workId: u,
|
|
1433
1433
|
type: p.TextUpdate,
|
|
1434
1434
|
dataType: v.Local,
|
|
1435
1435
|
willSyncService: !0
|
|
1436
1436
|
}) : l.push(
|
|
1437
1437
|
{
|
|
1438
|
-
...
|
|
1438
|
+
...w,
|
|
1439
1439
|
workId: u,
|
|
1440
1440
|
type: p.UpdateNode,
|
|
1441
1441
|
updateNodeOpt: {
|
|
@@ -1450,10 +1450,10 @@ class Ie extends E {
|
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
1452
|
}
|
|
1453
|
-
class
|
|
1453
|
+
class We extends O {
|
|
1454
1454
|
constructor() {
|
|
1455
1455
|
super(...arguments);
|
|
1456
|
-
d(this, "emitEventType",
|
|
1456
|
+
d(this, "emitEventType", T.RotateNode);
|
|
1457
1457
|
}
|
|
1458
1458
|
async consume(e) {
|
|
1459
1459
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1461,34 +1461,34 @@ class Te extends E {
|
|
|
1461
1461
|
return await this.consumeForLocalWorker(e), !0;
|
|
1462
1462
|
}
|
|
1463
1463
|
async consumeForLocalWorker(e) {
|
|
1464
|
-
var
|
|
1465
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1466
|
-
s === L && o && await ((
|
|
1464
|
+
var a;
|
|
1465
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, emitEventType: n } = e;
|
|
1466
|
+
s === L && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1467
1467
|
updateSelectorOpt: o,
|
|
1468
1468
|
willRefreshSelector: r,
|
|
1469
1469
|
willSyncService: i,
|
|
1470
|
-
willSerializeData:
|
|
1470
|
+
willSerializeData: c,
|
|
1471
1471
|
emitEventType: n,
|
|
1472
1472
|
isSync: !0,
|
|
1473
1473
|
callback: this.updateSelectorCallback
|
|
1474
1474
|
}));
|
|
1475
1475
|
}
|
|
1476
1476
|
updateSelectorCallback(e) {
|
|
1477
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore:
|
|
1478
|
-
if (
|
|
1479
|
-
h &&
|
|
1477
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a, willSerializeData: h, isSync: l } = s, m = n.workState, u = o.sp || [], w = i == null ? void 0 : i.selectRect;
|
|
1478
|
+
if (a) {
|
|
1479
|
+
h && m === W.Done && u.push({
|
|
1480
1480
|
type: p.Select,
|
|
1481
1481
|
selectIds: r.selectIds,
|
|
1482
|
-
selectRect:
|
|
1482
|
+
selectRect: w,
|
|
1483
1483
|
willSyncService: !0,
|
|
1484
1484
|
isSync: l,
|
|
1485
1485
|
points: r.getChildrenPoints()
|
|
1486
1486
|
});
|
|
1487
|
-
for (const [
|
|
1487
|
+
for (const [k, S] of c.entries())
|
|
1488
1488
|
u.push(
|
|
1489
1489
|
{
|
|
1490
|
-
...
|
|
1491
|
-
workId:
|
|
1490
|
+
...S,
|
|
1491
|
+
workId: k,
|
|
1492
1492
|
type: p.UpdateNode,
|
|
1493
1493
|
updateNodeOpt: {
|
|
1494
1494
|
useAnimation: !1
|
|
@@ -1502,10 +1502,10 @@ class Te extends E {
|
|
|
1502
1502
|
};
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
|
-
class
|
|
1505
|
+
class Ne extends O {
|
|
1506
1506
|
constructor() {
|
|
1507
1507
|
super(...arguments);
|
|
1508
|
-
d(this, "emitEventType",
|
|
1508
|
+
d(this, "emitEventType", T.SetFontStyle);
|
|
1509
1509
|
}
|
|
1510
1510
|
async consume(e) {
|
|
1511
1511
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1513,56 +1513,56 @@ class We extends E {
|
|
|
1513
1513
|
return await this.consumeForLocalWorker(e), !0;
|
|
1514
1514
|
}
|
|
1515
1515
|
async consumeForLocalWorker(e) {
|
|
1516
|
-
var
|
|
1517
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1518
|
-
s === L && o && await ((
|
|
1516
|
+
var a;
|
|
1517
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
|
|
1518
|
+
s === L && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1519
1519
|
updateSelectorOpt: o,
|
|
1520
1520
|
willRefreshSelector: r,
|
|
1521
1521
|
willSyncService: i,
|
|
1522
|
-
willSerializeData:
|
|
1522
|
+
willSerializeData: c,
|
|
1523
1523
|
textUpdateForWoker: n,
|
|
1524
1524
|
callback: this.updateSelectorCallback
|
|
1525
1525
|
}));
|
|
1526
1526
|
}
|
|
1527
1527
|
updateSelectorCallback(e) {
|
|
1528
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res:
|
|
1529
|
-
if (n &&
|
|
1530
|
-
h.fontSize &&
|
|
1528
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = o.sp || [], u = c == null ? void 0 : c.selectRect;
|
|
1529
|
+
if (n && m) {
|
|
1530
|
+
h.fontSize && m.push({
|
|
1531
1531
|
type: p.Select,
|
|
1532
1532
|
selectIds: i.selectIds,
|
|
1533
1533
|
selectRect: u,
|
|
1534
1534
|
willSyncService: n,
|
|
1535
|
-
isSync:
|
|
1535
|
+
isSync: a,
|
|
1536
1536
|
points: i.getChildrenPoints()
|
|
1537
1537
|
});
|
|
1538
|
-
for (const [
|
|
1539
|
-
l &&
|
|
1540
|
-
...
|
|
1541
|
-
workId:
|
|
1538
|
+
for (const [w, k] of r.entries())
|
|
1539
|
+
l && k.toolsType === f.Text ? m.push({
|
|
1540
|
+
...k,
|
|
1541
|
+
workId: w,
|
|
1542
1542
|
type: p.TextUpdate,
|
|
1543
1543
|
dataType: v.Local,
|
|
1544
1544
|
willSyncService: !0
|
|
1545
|
-
}) :
|
|
1545
|
+
}) : m.push(
|
|
1546
1546
|
{
|
|
1547
|
-
...
|
|
1548
|
-
workId:
|
|
1547
|
+
...k,
|
|
1548
|
+
workId: w,
|
|
1549
1549
|
type: p.UpdateNode,
|
|
1550
1550
|
updateNodeOpt: {
|
|
1551
1551
|
useAnimation: !1
|
|
1552
1552
|
},
|
|
1553
|
-
isSync:
|
|
1553
|
+
isSync: a
|
|
1554
1554
|
}
|
|
1555
1555
|
);
|
|
1556
1556
|
}
|
|
1557
1557
|
return {
|
|
1558
|
-
sp:
|
|
1558
|
+
sp: m
|
|
1559
1559
|
};
|
|
1560
1560
|
}
|
|
1561
1561
|
}
|
|
1562
|
-
class
|
|
1562
|
+
class Le extends O {
|
|
1563
1563
|
constructor() {
|
|
1564
1564
|
super(...arguments);
|
|
1565
|
-
d(this, "emitEventType",
|
|
1565
|
+
d(this, "emitEventType", T.SetPoint);
|
|
1566
1566
|
}
|
|
1567
1567
|
async consume(e) {
|
|
1568
1568
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1570,32 +1570,32 @@ class Ne extends E {
|
|
|
1570
1570
|
return this.consumeForLocalWorker(e), !0;
|
|
1571
1571
|
}
|
|
1572
1572
|
async consumeForLocalWorker(e) {
|
|
1573
|
-
var
|
|
1574
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1575
|
-
s === L && o && await ((
|
|
1573
|
+
var a;
|
|
1574
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
|
|
1575
|
+
s === L && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1576
1576
|
updateSelectorOpt: o,
|
|
1577
1577
|
willRefreshSelector: r,
|
|
1578
1578
|
willSyncService: i,
|
|
1579
1579
|
emitEventType: this.emitEventType,
|
|
1580
|
-
willSerializeData:
|
|
1580
|
+
willSerializeData: c,
|
|
1581
1581
|
isSync: !0,
|
|
1582
1582
|
textUpdateForWoker: n,
|
|
1583
1583
|
callback: this.updateSelectorCallback
|
|
1584
1584
|
}));
|
|
1585
1585
|
}
|
|
1586
1586
|
updateSelectorCallback(e) {
|
|
1587
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res:
|
|
1587
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a } = s, h = o.sp || [], l = c == null ? void 0 : c.selectRect;
|
|
1588
1588
|
if (n && h) {
|
|
1589
|
-
for (const [
|
|
1589
|
+
for (const [m, u] of r.entries())
|
|
1590
1590
|
h.push(
|
|
1591
1591
|
{
|
|
1592
1592
|
...u,
|
|
1593
|
-
workId:
|
|
1593
|
+
workId: m,
|
|
1594
1594
|
type: p.UpdateNode,
|
|
1595
1595
|
updateNodeOpt: {
|
|
1596
1596
|
useAnimation: !1
|
|
1597
1597
|
},
|
|
1598
|
-
isSync:
|
|
1598
|
+
isSync: a
|
|
1599
1599
|
}
|
|
1600
1600
|
);
|
|
1601
1601
|
h.push({
|
|
@@ -1603,7 +1603,7 @@ class Ne extends E {
|
|
|
1603
1603
|
selectIds: i.selectIds,
|
|
1604
1604
|
selectRect: l,
|
|
1605
1605
|
willSyncService: n,
|
|
1606
|
-
isSync:
|
|
1606
|
+
isSync: a,
|
|
1607
1607
|
points: i.getChildrenPoints()
|
|
1608
1608
|
});
|
|
1609
1609
|
}
|
|
@@ -1612,10 +1612,10 @@ class Ne extends E {
|
|
|
1612
1612
|
};
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
1615
|
-
class
|
|
1615
|
+
class be extends O {
|
|
1616
1616
|
constructor() {
|
|
1617
1617
|
super(...arguments);
|
|
1618
|
-
d(this, "emitEventType",
|
|
1618
|
+
d(this, "emitEventType", T.SetLock);
|
|
1619
1619
|
}
|
|
1620
1620
|
async consume(e) {
|
|
1621
1621
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1624,28 +1624,28 @@ class Le extends E {
|
|
|
1624
1624
|
}
|
|
1625
1625
|
async consumeForLocalWorker(e) {
|
|
1626
1626
|
var n;
|
|
1627
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1627
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
|
|
1628
1628
|
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1629
1629
|
updateSelectorOpt: o,
|
|
1630
1630
|
willRefreshSelector: r,
|
|
1631
1631
|
willSyncService: i,
|
|
1632
|
-
willSerializeData:
|
|
1632
|
+
willSerializeData: c,
|
|
1633
1633
|
callback: this.updateSelectorCallback
|
|
1634
1634
|
}));
|
|
1635
1635
|
}
|
|
1636
1636
|
updateSelectorCallback(e) {
|
|
1637
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res:
|
|
1637
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: h } = s, l = o.sp || [], m = c == null ? void 0 : c.selectRect;
|
|
1638
1638
|
if (n && l) {
|
|
1639
|
-
for (const [u,
|
|
1639
|
+
for (const [u, w] of r.entries())
|
|
1640
1640
|
l.push(
|
|
1641
1641
|
{
|
|
1642
|
-
...
|
|
1642
|
+
...w,
|
|
1643
1643
|
workId: u,
|
|
1644
1644
|
type: p.UpdateNode,
|
|
1645
1645
|
updateNodeOpt: {
|
|
1646
1646
|
useAnimation: !1
|
|
1647
1647
|
},
|
|
1648
|
-
isSync:
|
|
1648
|
+
isSync: a
|
|
1649
1649
|
}
|
|
1650
1650
|
);
|
|
1651
1651
|
l.push({
|
|
@@ -1655,9 +1655,9 @@ class Le extends E {
|
|
|
1655
1655
|
canRotate: i.canRotate,
|
|
1656
1656
|
type: p.Select,
|
|
1657
1657
|
selectIds: i.selectIds,
|
|
1658
|
-
selectRect:
|
|
1658
|
+
selectRect: m,
|
|
1659
1659
|
willSyncService: n,
|
|
1660
|
-
isSync:
|
|
1660
|
+
isSync: a
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
1663
1663
|
return {
|
|
@@ -1665,10 +1665,10 @@ class Le extends E {
|
|
|
1665
1665
|
};
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
|
-
class
|
|
1668
|
+
class Me extends O {
|
|
1669
1669
|
constructor() {
|
|
1670
1670
|
super(...arguments);
|
|
1671
|
-
d(this, "emitEventType",
|
|
1671
|
+
d(this, "emitEventType", T.SetShapeOpt);
|
|
1672
1672
|
}
|
|
1673
1673
|
async consume(e) {
|
|
1674
1674
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
@@ -1677,28 +1677,28 @@ class be extends E {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
async consumeForLocalWorker(e) {
|
|
1679
1679
|
var n;
|
|
1680
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData:
|
|
1680
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
|
|
1681
1681
|
s === L && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1682
1682
|
updateSelectorOpt: o,
|
|
1683
1683
|
willRefreshSelector: r,
|
|
1684
1684
|
willSyncService: i,
|
|
1685
|
-
willSerializeData:
|
|
1685
|
+
willSerializeData: c,
|
|
1686
1686
|
callback: this.updateSelectorCallback
|
|
1687
1687
|
}));
|
|
1688
1688
|
}
|
|
1689
1689
|
updateSelectorCallback(e) {
|
|
1690
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync:
|
|
1690
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
|
|
1691
1691
|
if (i && n)
|
|
1692
|
-
for (const [
|
|
1692
|
+
for (const [a, h] of r.entries())
|
|
1693
1693
|
n.push(
|
|
1694
1694
|
{
|
|
1695
1695
|
...h,
|
|
1696
|
-
workId:
|
|
1696
|
+
workId: a,
|
|
1697
1697
|
type: p.UpdateNode,
|
|
1698
1698
|
updateNodeOpt: {
|
|
1699
1699
|
useAnimation: !1
|
|
1700
1700
|
},
|
|
1701
|
-
isSync:
|
|
1701
|
+
isSync: c
|
|
1702
1702
|
}
|
|
1703
1703
|
);
|
|
1704
1704
|
return {
|
|
@@ -1706,35 +1706,35 @@ class be extends E {
|
|
|
1706
1706
|
};
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
1709
|
-
class
|
|
1709
|
+
class Ce {
|
|
1710
1710
|
constructor(t) {
|
|
1711
1711
|
d(this, "builders", /* @__PURE__ */ new Map());
|
|
1712
1712
|
this.builders = new Map(t.map((e) => [e, this.build(e)]));
|
|
1713
1713
|
}
|
|
1714
1714
|
build(t) {
|
|
1715
1715
|
switch (t) {
|
|
1716
|
-
case
|
|
1716
|
+
case T.TranslateNode:
|
|
1717
1717
|
return new ve();
|
|
1718
|
-
case
|
|
1719
|
-
return new we();
|
|
1720
|
-
case I.CopyNode:
|
|
1721
|
-
return new me();
|
|
1722
|
-
case I.SetColorNode:
|
|
1723
|
-
return new ye();
|
|
1724
|
-
case I.DeleteNode:
|
|
1718
|
+
case T.ZIndexNode:
|
|
1725
1719
|
return new ge();
|
|
1726
|
-
case
|
|
1720
|
+
case T.CopyNode:
|
|
1721
|
+
return new ye();
|
|
1722
|
+
case T.SetColorNode:
|
|
1723
|
+
return new we();
|
|
1724
|
+
case T.DeleteNode:
|
|
1727
1725
|
return new Ie();
|
|
1728
|
-
case
|
|
1726
|
+
case T.ScaleNode:
|
|
1729
1727
|
return new Te();
|
|
1730
|
-
case
|
|
1728
|
+
case T.RotateNode:
|
|
1731
1729
|
return new We();
|
|
1732
|
-
case
|
|
1730
|
+
case T.SetFontStyle:
|
|
1733
1731
|
return new Ne();
|
|
1734
|
-
case
|
|
1732
|
+
case T.SetPoint:
|
|
1735
1733
|
return new Le();
|
|
1736
|
-
case
|
|
1734
|
+
case T.SetLock:
|
|
1737
1735
|
return new be();
|
|
1736
|
+
case T.SetShapeOpt:
|
|
1737
|
+
return new Me();
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
1740
|
registerForMainThread(t) {
|
|
@@ -1775,30 +1775,40 @@ class Oe {
|
|
|
1775
1775
|
d(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1776
1776
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1777
1777
|
const s = A.bufferSize.full, o = A.bufferSize.sub;
|
|
1778
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
1778
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === D ? s : o }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === D, o) }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === D, o) }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === D, o) }), this.vNodes = new fe(t, this.scene);
|
|
1779
1779
|
const r = {
|
|
1780
1780
|
thread: this,
|
|
1781
1781
|
vNodes: this.vNodes
|
|
1782
1782
|
};
|
|
1783
|
-
this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1783
|
+
this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new me(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ce([
|
|
1784
|
+
T.CopyNode,
|
|
1785
|
+
T.SetColorNode,
|
|
1786
|
+
T.DeleteNode,
|
|
1787
|
+
T.RotateNode,
|
|
1788
|
+
T.ScaleNode,
|
|
1789
|
+
T.TranslateNode,
|
|
1790
|
+
T.ZIndexNode,
|
|
1791
|
+
T.SetFontStyle,
|
|
1792
|
+
T.SetPoint,
|
|
1793
|
+
T.SetLock,
|
|
1794
|
+
T.SetShapeOpt
|
|
1795
1795
|
]).registerForMainThread(this);
|
|
1796
1796
|
}
|
|
1797
1797
|
getCachedImages(t) {
|
|
1798
|
-
|
|
1798
|
+
var e;
|
|
1799
|
+
return (e = this.cacheImages.get(t)) == null ? void 0 : e.imageBitmap;
|
|
1800
|
+
}
|
|
1801
|
+
getCachedImagesByWorkId(t) {
|
|
1802
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
1803
|
+
if (e === t && s.imageBitmap)
|
|
1804
|
+
return s.imageBitmap;
|
|
1805
|
+
}
|
|
1806
|
+
deleteCachedImagesByWorkId(t) {
|
|
1807
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
1808
|
+
s.workId === t && (s.imageBitmap.close(), this.cacheImages.delete(e));
|
|
1799
1809
|
}
|
|
1800
1810
|
clearCacheImages() {
|
|
1801
|
-
this.cacheImages.forEach((t) => t.close()), this.cacheImages.clear();
|
|
1811
|
+
this.cacheImages.forEach((t) => t.imageBitmap.close()), this.cacheImages.clear();
|
|
1802
1812
|
}
|
|
1803
1813
|
clearImageResolveMap() {
|
|
1804
1814
|
this.imageResolveMap.forEach(({ timer: t }) => {
|
|
@@ -1809,13 +1819,12 @@ class Oe {
|
|
|
1809
1819
|
this.combinePostMsg.add(t), this.runBatchPostData();
|
|
1810
1820
|
}
|
|
1811
1821
|
async on(t) {
|
|
1812
|
-
var e;
|
|
1813
1822
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1814
|
-
const { msgType:
|
|
1815
|
-
switch (
|
|
1823
|
+
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: c, imageSrc: n, imageBitmap: a, workIds: h } = t, l = i == null ? void 0 : i.toString();
|
|
1824
|
+
switch (e) {
|
|
1816
1825
|
case p.AuthClear: {
|
|
1817
|
-
const { clearUids:
|
|
1818
|
-
this.vNodes.setCanClearUids(
|
|
1826
|
+
const { clearUids: m, localUid: u } = t;
|
|
1827
|
+
this.vNodes.setCanClearUids(m), this.vNodes.setLocalUid(u);
|
|
1819
1828
|
break;
|
|
1820
1829
|
}
|
|
1821
1830
|
case p.Destroy:
|
|
@@ -1828,88 +1837,129 @@ class Oe {
|
|
|
1828
1837
|
await this.updateCamera(t);
|
|
1829
1838
|
break;
|
|
1830
1839
|
case p.UpdateTools:
|
|
1831
|
-
if (
|
|
1832
|
-
const
|
|
1833
|
-
toolsType:
|
|
1834
|
-
toolsOpt:
|
|
1840
|
+
if (s && o) {
|
|
1841
|
+
const m = {
|
|
1842
|
+
toolsType: s,
|
|
1843
|
+
toolsOpt: o
|
|
1835
1844
|
};
|
|
1836
|
-
this.topWork.canUseTopLayer(
|
|
1845
|
+
this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(m) : this.localWork.setToolsOpt(m);
|
|
1837
1846
|
}
|
|
1838
1847
|
break;
|
|
1839
1848
|
case p.CreateWork:
|
|
1840
|
-
if (l &&
|
|
1841
|
-
if (this.topWork.canUseTopLayer(
|
|
1849
|
+
if (l && o && s) {
|
|
1850
|
+
if (this.topWork.canUseTopLayer(s)) {
|
|
1842
1851
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
1843
|
-
toolsType:
|
|
1844
|
-
toolsOpt:
|
|
1845
|
-
}), this.topWork.setWorkOptions(l,
|
|
1852
|
+
toolsType: s,
|
|
1853
|
+
toolsOpt: o
|
|
1854
|
+
}), this.topWork.setWorkOptions(l, o);
|
|
1846
1855
|
break;
|
|
1847
1856
|
}
|
|
1848
1857
|
this.localWork.getToolsOpt() || this.localWork.setToolsOpt({
|
|
1849
|
-
toolsType:
|
|
1850
|
-
toolsOpt:
|
|
1851
|
-
}), this.localWork.setWorkOptions(l,
|
|
1858
|
+
toolsType: s,
|
|
1859
|
+
toolsOpt: o
|
|
1860
|
+
}), this.localWork.setWorkOptions(l, o);
|
|
1852
1861
|
}
|
|
1853
1862
|
break;
|
|
1854
1863
|
case p.DrawWork:
|
|
1855
|
-
|
|
1864
|
+
c === W.Done && r === v.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
|
|
1856
1865
|
break;
|
|
1857
1866
|
case p.UpdateNode:
|
|
1858
1867
|
case p.FullWork:
|
|
1859
|
-
if (
|
|
1860
|
-
this.consumeDrawAll(
|
|
1868
|
+
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1869
|
+
this.consumeDrawAll(r, t);
|
|
1861
1870
|
break;
|
|
1862
1871
|
}
|
|
1863
|
-
this.consumeFull(
|
|
1872
|
+
this.consumeFull(r, t);
|
|
1864
1873
|
break;
|
|
1865
1874
|
case p.RemoveNode:
|
|
1866
1875
|
await this.removeNode(t);
|
|
1867
1876
|
return;
|
|
1868
1877
|
case p.Select:
|
|
1869
|
-
|
|
1878
|
+
r === v.Service && (i === L ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
|
|
1870
1879
|
break;
|
|
1871
1880
|
case p.CursorHover:
|
|
1872
1881
|
this.localWork.cursorHover(t);
|
|
1873
1882
|
break;
|
|
1874
1883
|
case p.GetTextActive:
|
|
1875
|
-
|
|
1884
|
+
r === v.Local && this.localWork.checkTextActive(t);
|
|
1876
1885
|
break;
|
|
1877
1886
|
case p.GetImageBitMap:
|
|
1878
|
-
if (
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1887
|
+
if (n && a && i) {
|
|
1888
|
+
const m = i.toString();
|
|
1889
|
+
this.deleteCachedImagesByWorkId(m), this.cacheImages.set(n, {
|
|
1890
|
+
imageBitmap: a,
|
|
1891
|
+
workId: m
|
|
1892
|
+
});
|
|
1893
|
+
const u = this.imageResolveMap.get(n);
|
|
1894
|
+
if (u) {
|
|
1895
|
+
const { resolve: w, timer: k } = u;
|
|
1896
|
+
k && clearTimeout(k), w && w(n);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
break;
|
|
1900
|
+
case p.GetVNodeInfo:
|
|
1901
|
+
if (i && h) {
|
|
1902
|
+
const m = h.map((u) => this.vNodes.get(u));
|
|
1903
|
+
this.post({
|
|
1904
|
+
sp: [
|
|
1905
|
+
{
|
|
1906
|
+
type: p.GetVNodeInfo,
|
|
1907
|
+
dataType: v.Local,
|
|
1908
|
+
workId: i,
|
|
1909
|
+
vInfo: m
|
|
1910
|
+
}
|
|
1911
|
+
]
|
|
1912
|
+
});
|
|
1881
1913
|
}
|
|
1882
1914
|
break;
|
|
1883
1915
|
}
|
|
1884
1916
|
}
|
|
1885
1917
|
}
|
|
1918
|
+
getIconSize(t, e) {
|
|
1919
|
+
const s = t * 3, o = e * 3;
|
|
1920
|
+
return s <= 50 || o <= 50 ? [50, 50] : s <= 100 || o <= 100 ? [100, 100] : s <= 400 || o <= 400 ? [400, 400] : s <= 800 || o <= 800 ? [800, 800] : s <= 1600 || o <= 1600 ? [1600, 1600] : [2e3, 2e3];
|
|
1921
|
+
}
|
|
1886
1922
|
async loadImageBitMap(t) {
|
|
1887
1923
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
1888
|
-
if (e === f.Image && s &&
|
|
1889
|
-
const r =
|
|
1890
|
-
if (!i)
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
h.timer && clearTimeout(h.timer), h.resolve = c, h.timer = setTimeout(() => {
|
|
1897
|
-
const l = this.imageResolveMap.get(a);
|
|
1898
|
-
l != null && l.resolve && l.resolve(a);
|
|
1899
|
-
}, 5e3), this.imageResolveMap.set(a, h), this.opt.post({
|
|
1900
|
-
sp: [{
|
|
1901
|
-
imageSrc: r,
|
|
1902
|
-
workId: a,
|
|
1903
|
-
viewId: this.viewId,
|
|
1904
|
-
isgl: !!this.fullLayer.parent.gl,
|
|
1905
|
-
isSubWorker: !1,
|
|
1906
|
-
type: p.GetImageBitMap
|
|
1907
|
-
}]
|
|
1908
|
-
});
|
|
1909
|
-
});
|
|
1910
|
-
this.imageResolveMap.delete(n);
|
|
1924
|
+
if (e === f.Image && s && o) {
|
|
1925
|
+
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: h } = s;
|
|
1926
|
+
if (!i || !c || !n || !a)
|
|
1927
|
+
return;
|
|
1928
|
+
let l = i;
|
|
1929
|
+
if (c === X.Iconify) {
|
|
1930
|
+
const [k, S] = this.getIconSize(n, a);
|
|
1931
|
+
l = `${i}?width=${k}&height=${S}&color=${h}`;
|
|
1911
1932
|
}
|
|
1912
|
-
|
|
1933
|
+
if (this.cacheImages.has(l)) {
|
|
1934
|
+
const k = this.getCachedImages(l);
|
|
1935
|
+
if (k)
|
|
1936
|
+
return k;
|
|
1937
|
+
}
|
|
1938
|
+
if (this.imageResolveMap.has(l)) {
|
|
1939
|
+
const k = this.getCachedImagesByWorkId(r);
|
|
1940
|
+
if (k)
|
|
1941
|
+
return k;
|
|
1942
|
+
}
|
|
1943
|
+
const w = await new Promise((k) => {
|
|
1944
|
+
const S = this.imageResolveMap.get(l) || {
|
|
1945
|
+
resolve: void 0,
|
|
1946
|
+
timer: void 0
|
|
1947
|
+
};
|
|
1948
|
+
S.timer && clearTimeout(S.timer), S.resolve = k, S.timer = setTimeout(() => {
|
|
1949
|
+
const g = this.imageResolveMap.get(l);
|
|
1950
|
+
g != null && g.resolve && g.resolve(l);
|
|
1951
|
+
}, 5e3), this.imageResolveMap.set(l, S), this.opt.post({
|
|
1952
|
+
sp: [{
|
|
1953
|
+
imageSrc: l,
|
|
1954
|
+
workId: r,
|
|
1955
|
+
viewId: this.viewId,
|
|
1956
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
1957
|
+
isSubWorker: !1,
|
|
1958
|
+
type: p.GetImageBitMap
|
|
1959
|
+
}]
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
return this.imageResolveMap.delete(w), this.getCachedImages(l);
|
|
1913
1963
|
}
|
|
1914
1964
|
}
|
|
1915
1965
|
async removeNode(t) {
|
|
@@ -1944,14 +1994,14 @@ class Oe {
|
|
|
1944
1994
|
if ((s = o.sp) != null && s.length)
|
|
1945
1995
|
for (const r of o.sp) {
|
|
1946
1996
|
let i = !1;
|
|
1947
|
-
for (const
|
|
1948
|
-
if (j(r,
|
|
1997
|
+
for (const c of t)
|
|
1998
|
+
if (j(r, c)) {
|
|
1949
1999
|
i = !0;
|
|
1950
2000
|
break;
|
|
1951
2001
|
}
|
|
1952
2002
|
i || t.push(r);
|
|
1953
2003
|
}
|
|
1954
|
-
|
|
2004
|
+
ue(o.drawCount) && (e = o.drawCount);
|
|
1955
2005
|
}
|
|
1956
2006
|
return this.combinePostMsg.clear(), {
|
|
1957
2007
|
sp: t,
|
|
@@ -2000,7 +2050,7 @@ class Oe {
|
|
|
2000
2050
|
const { cameraOpt: e, scenePath: s } = t;
|
|
2001
2051
|
if (e && !j(this.cameraOpt, e)) {
|
|
2002
2052
|
if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
|
|
2003
|
-
let
|
|
2053
|
+
let a = !1;
|
|
2004
2054
|
for (const [h, l] of this.localWork.getWorkShapes().entries())
|
|
2005
2055
|
switch (l.toolsType) {
|
|
2006
2056
|
case f.Text:
|
|
@@ -2011,10 +2061,10 @@ class Oe {
|
|
|
2011
2061
|
case f.LaserPen:
|
|
2012
2062
|
break;
|
|
2013
2063
|
default:
|
|
2014
|
-
h !== _ && h !== L && (
|
|
2064
|
+
h !== _ && h !== L && (a = !0);
|
|
2015
2065
|
break;
|
|
2016
2066
|
}
|
|
2017
|
-
if (
|
|
2067
|
+
if (a) {
|
|
2018
2068
|
this.taskUpdateCameraId = setTimeout(() => {
|
|
2019
2069
|
this.taskUpdateCameraId = void 0, this.updateCamera(t);
|
|
2020
2070
|
}, G);
|
|
@@ -2022,24 +2072,24 @@ class Oe {
|
|
|
2022
2072
|
}
|
|
2023
2073
|
}
|
|
2024
2074
|
const r = /* @__PURE__ */ new Map();
|
|
2025
|
-
for (const [
|
|
2075
|
+
for (const [a, h] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
2026
2076
|
const l = h.rect;
|
|
2027
|
-
r.set(
|
|
2077
|
+
r.set(a, J(l));
|
|
2028
2078
|
}
|
|
2029
2079
|
const i = new Set(r.keys());
|
|
2030
|
-
let
|
|
2080
|
+
let c = !1;
|
|
2031
2081
|
if (this.localWork.hasSelector()) {
|
|
2032
|
-
const
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2035
|
-
for (const h of
|
|
2082
|
+
const a = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
|
|
2083
|
+
if (a) {
|
|
2084
|
+
c = !0;
|
|
2085
|
+
for (const h of a)
|
|
2036
2086
|
i.add(h);
|
|
2037
2087
|
}
|
|
2038
2088
|
}
|
|
2039
2089
|
let n = !1;
|
|
2040
2090
|
if (this.serviceWork.selectorWorkShapes.size)
|
|
2041
|
-
for (const
|
|
2042
|
-
const h =
|
|
2091
|
+
for (const a of this.serviceWork.selectorWorkShapes.values()) {
|
|
2092
|
+
const h = a.selectIds;
|
|
2043
2093
|
if (h) {
|
|
2044
2094
|
n = !0;
|
|
2045
2095
|
for (const l of h)
|
|
@@ -2048,21 +2098,21 @@ class Oe {
|
|
|
2048
2098
|
}
|
|
2049
2099
|
if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
|
|
2050
2100
|
this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(i), this.debounceUpdateCameraId && clearTimeout(this.debounceUpdateCameraId);
|
|
2051
|
-
for (const [
|
|
2052
|
-
const l = this.vNodes.get(
|
|
2101
|
+
for (const [a, h] of r.entries()) {
|
|
2102
|
+
const l = this.vNodes.get(a);
|
|
2053
2103
|
if (l) {
|
|
2054
|
-
const
|
|
2055
|
-
let
|
|
2056
|
-
if ((
|
|
2057
|
-
const { toolsType:
|
|
2058
|
-
|
|
2104
|
+
const m = h, u = l.rect, w = this.getSceneRect(), k = z(m, w), S = z(u, w);
|
|
2105
|
+
let g = !1;
|
|
2106
|
+
if ((k !== S || m.w !== u.w || m.h !== u.h || S === V.intersect) && (g = !0), g) {
|
|
2107
|
+
const { toolsType: I, opt: y } = l;
|
|
2108
|
+
I === f.Text && y.workState === W.Done && this.debounceUpdateCache.add(a);
|
|
2059
2109
|
}
|
|
2060
2110
|
}
|
|
2061
2111
|
}
|
|
2062
|
-
if (
|
|
2063
|
-
for (const [
|
|
2112
|
+
if (c && this.localWork.reRenderSelector(), n)
|
|
2113
|
+
for (const [a, h] of this.serviceWork.selectorWorkShapes.entries())
|
|
2064
2114
|
this.serviceWork.runSelectWork({
|
|
2065
|
-
workId:
|
|
2115
|
+
workId: a,
|
|
2066
2116
|
selectIds: h.selectIds,
|
|
2067
2117
|
msgType: p.Select,
|
|
2068
2118
|
dataType: v.Service,
|
|
@@ -2071,22 +2121,22 @@ class Oe {
|
|
|
2071
2121
|
this.debounceUpdateCameraId = setTimeout(() => {
|
|
2072
2122
|
var h;
|
|
2073
2123
|
this.debounceUpdateCameraId = void 0;
|
|
2074
|
-
const
|
|
2124
|
+
const a = [];
|
|
2075
2125
|
for (const l of this.debounceUpdateCache.values()) {
|
|
2076
2126
|
if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
|
|
2077
2127
|
const u = this.vNodes.get(l);
|
|
2078
2128
|
if (u) {
|
|
2079
|
-
const { toolsType:
|
|
2080
|
-
toolsType:
|
|
2081
|
-
opt:
|
|
2129
|
+
const { toolsType: w, opt: k, rect: S } = u, g = this.localWork.setFullWork({
|
|
2130
|
+
toolsType: w,
|
|
2131
|
+
opt: k,
|
|
2082
2132
|
workId: l
|
|
2083
2133
|
});
|
|
2084
|
-
if (
|
|
2085
|
-
const
|
|
2086
|
-
|
|
2134
|
+
if (g) {
|
|
2135
|
+
const I = this.getSceneRect(), y = z(S, I);
|
|
2136
|
+
a.push(g.consumeServiceAsync({
|
|
2087
2137
|
isFullWork: !0,
|
|
2088
2138
|
replaceId: l,
|
|
2089
|
-
isDrawLabel:
|
|
2139
|
+
isDrawLabel: y !== V.outside
|
|
2090
2140
|
}));
|
|
2091
2141
|
}
|
|
2092
2142
|
}
|
|
@@ -2108,7 +2158,7 @@ class Oe {
|
|
|
2108
2158
|
};
|
|
2109
2159
|
}
|
|
2110
2160
|
createScene(t) {
|
|
2111
|
-
return new
|
|
2161
|
+
return new Y({
|
|
2112
2162
|
displayRatio: this.opt.displayer.dpr,
|
|
2113
2163
|
depth: !1,
|
|
2114
2164
|
desynchronized: !0,
|
|
@@ -2119,14 +2169,14 @@ class Oe {
|
|
|
2119
2169
|
});
|
|
2120
2170
|
}
|
|
2121
2171
|
createLayer(t, e, s) {
|
|
2122
|
-
const { width: o, height: r } = s, i = `canvas-${t}`,
|
|
2172
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, { ...s, offscreen: !1 }), n = new Q({
|
|
2123
2173
|
anchor: [0.5, 0.5],
|
|
2124
2174
|
pos: [o * 0.5, r * 0.5],
|
|
2125
2175
|
size: [o, r],
|
|
2126
2176
|
name: "viewport",
|
|
2127
2177
|
id: t
|
|
2128
2178
|
});
|
|
2129
|
-
return
|
|
2179
|
+
return c.append(n), n;
|
|
2130
2180
|
}
|
|
2131
2181
|
updateScene(t) {
|
|
2132
2182
|
this.scene.attr({ ...t });
|
|
@@ -2153,13 +2203,23 @@ class Ee {
|
|
|
2153
2203
|
d(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2154
2204
|
d(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2155
2205
|
d(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
2156
|
-
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
2206
|
+
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === D ? 6e3 : 3e3 });
|
|
2157
2207
|
}
|
|
2158
2208
|
getCachedImages(t) {
|
|
2159
|
-
|
|
2209
|
+
var e;
|
|
2210
|
+
return (e = this.cacheImages.get(t)) == null ? void 0 : e.imageBitmap;
|
|
2211
|
+
}
|
|
2212
|
+
getCachedImagesByWorkId(t) {
|
|
2213
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
2214
|
+
if (e === t && s.imageBitmap)
|
|
2215
|
+
return s.imageBitmap;
|
|
2216
|
+
}
|
|
2217
|
+
deleteCachedImagesByWorkId(t) {
|
|
2218
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
2219
|
+
s.workId === t && (s.imageBitmap.close(), this.cacheImages.delete(e));
|
|
2160
2220
|
}
|
|
2161
2221
|
clearCacheImages() {
|
|
2162
|
-
this.cacheImages.forEach((t) => t.close()), this.cacheImages.clear();
|
|
2222
|
+
this.cacheImages.forEach((t) => t.imageBitmap.close()), this.cacheImages.clear();
|
|
2163
2223
|
}
|
|
2164
2224
|
clearImageResolveMap() {
|
|
2165
2225
|
this.imageResolveMap.forEach(({ timer: t }) => {
|
|
@@ -2170,7 +2230,6 @@ class Ee {
|
|
|
2170
2230
|
this.combinePostMsg.add(t), this.runBatchPostData();
|
|
2171
2231
|
}
|
|
2172
2232
|
async on(t) {
|
|
2173
|
-
var i;
|
|
2174
2233
|
const { msgType: e, imageSrc: s, imageBitmap: o, workId: r } = t;
|
|
2175
2234
|
switch (e) {
|
|
2176
2235
|
case p.Snapshot:
|
|
@@ -2180,40 +2239,66 @@ class Ee {
|
|
|
2180
2239
|
await this.getBoundingRect(t), this.destroy();
|
|
2181
2240
|
return;
|
|
2182
2241
|
case p.GetImageBitMap:
|
|
2183
|
-
if (s && o &&
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2242
|
+
if (s && o && r) {
|
|
2243
|
+
const i = r.toString();
|
|
2244
|
+
this.deleteCachedImagesByWorkId(i), this.cacheImages.set(s, {
|
|
2245
|
+
imageBitmap: o,
|
|
2246
|
+
workId: i
|
|
2247
|
+
});
|
|
2248
|
+
const c = this.imageResolveMap.get(s);
|
|
2249
|
+
if (c) {
|
|
2250
|
+
const { resolve: n, timer: a } = c;
|
|
2251
|
+
a && clearTimeout(a), n && n(s);
|
|
2252
|
+
}
|
|
2186
2253
|
}
|
|
2187
2254
|
break;
|
|
2188
2255
|
}
|
|
2189
2256
|
}
|
|
2257
|
+
getIconSize(t, e) {
|
|
2258
|
+
const s = t * 3, o = e * 3;
|
|
2259
|
+
return s <= 50 || o <= 50 ? [50, 50] : s <= 100 || o <= 100 ? [100, 100] : s <= 400 || o <= 400 ? [400, 400] : s <= 800 || o <= 800 ? [800, 800] : s <= 1600 || o <= 1600 ? [1600, 1600] : [2e3, 2e3];
|
|
2260
|
+
}
|
|
2190
2261
|
async loadImageBitMap(t) {
|
|
2191
2262
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
2192
|
-
if (e === f.Image && s &&
|
|
2193
|
-
const r =
|
|
2194
|
-
if (!i)
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
type: p.GetImageBitMap
|
|
2211
|
-
}]
|
|
2212
|
-
});
|
|
2213
|
-
});
|
|
2214
|
-
this.imageResolveMap.delete(n);
|
|
2263
|
+
if (e === f.Image && s && o) {
|
|
2264
|
+
const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: h } = s;
|
|
2265
|
+
if (!i || !c || !n || !a)
|
|
2266
|
+
return;
|
|
2267
|
+
let l = i;
|
|
2268
|
+
if (c === X.Iconify) {
|
|
2269
|
+
const [k, S] = this.getIconSize(n, a);
|
|
2270
|
+
l = `${i}?width=${k}&height=${S}&color=${h}`;
|
|
2271
|
+
}
|
|
2272
|
+
if (this.cacheImages.has(l)) {
|
|
2273
|
+
const k = this.getCachedImages(l);
|
|
2274
|
+
if (k)
|
|
2275
|
+
return k;
|
|
2276
|
+
}
|
|
2277
|
+
if (this.imageResolveMap.has(l)) {
|
|
2278
|
+
const k = this.getCachedImagesByWorkId(r);
|
|
2279
|
+
if (k)
|
|
2280
|
+
return k;
|
|
2215
2281
|
}
|
|
2216
|
-
|
|
2282
|
+
const w = await new Promise((k) => {
|
|
2283
|
+
const S = this.imageResolveMap.get(l) || {
|
|
2284
|
+
resolve: void 0,
|
|
2285
|
+
timer: void 0
|
|
2286
|
+
};
|
|
2287
|
+
S.timer && clearTimeout(S.timer), S.resolve = k, S.timer = setTimeout(() => {
|
|
2288
|
+
const g = this.imageResolveMap.get(l);
|
|
2289
|
+
g != null && g.resolve && g.resolve(l);
|
|
2290
|
+
}, 5e3), this.imageResolveMap.set(l, S), this.opt.post({
|
|
2291
|
+
sp: [{
|
|
2292
|
+
imageSrc: l,
|
|
2293
|
+
workId: r,
|
|
2294
|
+
viewId: this.viewId,
|
|
2295
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
2296
|
+
isSubWorker: !1,
|
|
2297
|
+
type: p.GetImageBitMap
|
|
2298
|
+
}]
|
|
2299
|
+
});
|
|
2300
|
+
});
|
|
2301
|
+
return this.imageResolveMap.delete(w), this.getCachedImages(l);
|
|
2217
2302
|
}
|
|
2218
2303
|
}
|
|
2219
2304
|
createWorkShapeNode(t) {
|
|
@@ -2236,18 +2321,18 @@ class Ee {
|
|
|
2236
2321
|
const e = this.setFullWork(t), s = t.ops && x(t.ops);
|
|
2237
2322
|
if (e) {
|
|
2238
2323
|
let r, i;
|
|
2239
|
-
const
|
|
2324
|
+
const c = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
2240
2325
|
return e.toolsType === f.Image ? r = await e.consumeServiceAsync({
|
|
2241
2326
|
isFullWork: !0,
|
|
2242
2327
|
worker: this
|
|
2243
2328
|
}) : e.toolsType === f.Text ? r = await e.consumeServiceAsync({
|
|
2244
2329
|
isFullWork: !0,
|
|
2245
|
-
replaceId:
|
|
2330
|
+
replaceId: c,
|
|
2246
2331
|
isDrawLabel: !0
|
|
2247
2332
|
}) : (r = e.consumeService({
|
|
2248
2333
|
op: s,
|
|
2249
2334
|
isFullWork: !0,
|
|
2250
|
-
replaceId:
|
|
2335
|
+
replaceId: c
|
|
2251
2336
|
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), U(r, i);
|
|
2252
2337
|
}
|
|
2253
2338
|
}
|
|
@@ -2255,21 +2340,21 @@ class Ee {
|
|
|
2255
2340
|
const { scenePath: e, scenes: s, cameraOpt: o, w: r, h: i } = t;
|
|
2256
2341
|
if (e && s && o) {
|
|
2257
2342
|
this.setCameraOpt(o);
|
|
2258
|
-
let
|
|
2259
|
-
for (const [
|
|
2343
|
+
let c;
|
|
2344
|
+
for (const [a, h] of Object.entries(s))
|
|
2260
2345
|
if (h != null && h.type)
|
|
2261
2346
|
switch (h == null ? void 0 : h.type) {
|
|
2262
2347
|
case p.UpdateNode:
|
|
2263
2348
|
case p.FullWork: {
|
|
2264
|
-
const { opt: l } = h,
|
|
2349
|
+
const { opt: l } = h, m = {
|
|
2265
2350
|
...h,
|
|
2266
2351
|
opt: l,
|
|
2267
|
-
workId:
|
|
2352
|
+
workId: a,
|
|
2268
2353
|
msgType: p.FullWork,
|
|
2269
2354
|
dataType: v.Service,
|
|
2270
2355
|
viewId: this.viewId
|
|
2271
|
-
}, u = await this.runFullWork(
|
|
2272
|
-
|
|
2356
|
+
}, u = await this.runFullWork(m);
|
|
2357
|
+
c = U(c, u);
|
|
2273
2358
|
break;
|
|
2274
2359
|
}
|
|
2275
2360
|
}
|
|
@@ -2312,13 +2397,13 @@ class Ee {
|
|
|
2312
2397
|
if (e && s && o) {
|
|
2313
2398
|
this.setCameraOpt(o);
|
|
2314
2399
|
let r;
|
|
2315
|
-
for (const [i,
|
|
2316
|
-
if (
|
|
2317
|
-
switch (
|
|
2400
|
+
for (const [i, c] of Object.entries(s))
|
|
2401
|
+
if (c != null && c.type)
|
|
2402
|
+
switch (c == null ? void 0 : c.type) {
|
|
2318
2403
|
case p.UpdateNode:
|
|
2319
2404
|
case p.FullWork: {
|
|
2320
2405
|
const n = await this.runFullWork({
|
|
2321
|
-
...
|
|
2406
|
+
...c,
|
|
2322
2407
|
workId: i,
|
|
2323
2408
|
msgType: p.FullWork,
|
|
2324
2409
|
dataType: v.Service,
|
|
@@ -2353,7 +2438,7 @@ class Ee {
|
|
|
2353
2438
|
for (const o of s.sp) {
|
|
2354
2439
|
let r = !1;
|
|
2355
2440
|
for (const i of t)
|
|
2356
|
-
if (
|
|
2441
|
+
if (he(o, i)) {
|
|
2357
2442
|
r = !0;
|
|
2358
2443
|
break;
|
|
2359
2444
|
}
|
|
@@ -2369,7 +2454,7 @@ class Ee {
|
|
|
2369
2454
|
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
|
|
2370
2455
|
}
|
|
2371
2456
|
createScene(t) {
|
|
2372
|
-
return new
|
|
2457
|
+
return new Y({
|
|
2373
2458
|
displayRatio: this.opt.displayer.dpr,
|
|
2374
2459
|
depth: !1,
|
|
2375
2460
|
desynchronized: !0,
|
|
@@ -2379,14 +2464,14 @@ class Ee {
|
|
|
2379
2464
|
});
|
|
2380
2465
|
}
|
|
2381
2466
|
createLayer(t, e, s) {
|
|
2382
|
-
const { width: o, height: r } = s, i = `canvas-${t}`,
|
|
2467
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, s), n = new Q({
|
|
2383
2468
|
anchor: [0.5, 0.5],
|
|
2384
2469
|
pos: [o * 0.5, r * 0.5],
|
|
2385
2470
|
size: [o, r],
|
|
2386
2471
|
name: "viewport",
|
|
2387
2472
|
id: t
|
|
2388
2473
|
});
|
|
2389
|
-
return
|
|
2474
|
+
return c.append(n), n;
|
|
2390
2475
|
}
|
|
2391
2476
|
updateScene(t) {
|
|
2392
2477
|
this.scene.attr({ ...t });
|
|
@@ -2401,7 +2486,7 @@ class Ee {
|
|
|
2401
2486
|
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), this.scene.remove();
|
|
2402
2487
|
}
|
|
2403
2488
|
}
|
|
2404
|
-
class
|
|
2489
|
+
class _e {
|
|
2405
2490
|
constructor(t) {
|
|
2406
2491
|
d(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
2407
2492
|
d(this, "snapshotThread");
|
|
@@ -2410,7 +2495,7 @@ class ze {
|
|
|
2410
2495
|
}
|
|
2411
2496
|
post(t) {
|
|
2412
2497
|
const { drawCount: e, sp: s, workerTasksqueueCount: o } = t;
|
|
2413
|
-
this.master.isBusy &&
|
|
2498
|
+
this.master.isBusy && K(o) && this.master.setWorkerTasksqueueCount(o), K(e) && this.master.setMaxDrawCount(e), s && this.master.collectorSyncData(s);
|
|
2414
2499
|
}
|
|
2415
2500
|
destroy() {
|
|
2416
2501
|
this.mainThreadMap.clear();
|
|
@@ -2424,74 +2509,74 @@ class ze {
|
|
|
2424
2509
|
async consume(t) {
|
|
2425
2510
|
var e, s, o, r;
|
|
2426
2511
|
for (const i of t.values()) {
|
|
2427
|
-
const { msgType:
|
|
2428
|
-
if (
|
|
2512
|
+
const { msgType: c, viewId: n, tasksqueue: a, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: u, isSubWorker: w } = i;
|
|
2513
|
+
if (c === p.Console) {
|
|
2429
2514
|
console.log(this);
|
|
2430
2515
|
continue;
|
|
2431
2516
|
}
|
|
2432
|
-
if (
|
|
2433
|
-
const
|
|
2434
|
-
if (
|
|
2435
|
-
const
|
|
2436
|
-
displayer:
|
|
2437
|
-
container:
|
|
2517
|
+
if (c === p.Init) {
|
|
2518
|
+
const S = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, g = S == null ? void 0 : S.canvasContainerRef.current;
|
|
2519
|
+
if (S && g && l && m) {
|
|
2520
|
+
const I = this.createMainThread(n, {
|
|
2521
|
+
displayer: S,
|
|
2522
|
+
container: g,
|
|
2438
2523
|
layerOpt: l,
|
|
2439
2524
|
master: this.master,
|
|
2440
|
-
canvasOpt:
|
|
2525
|
+
canvasOpt: m,
|
|
2441
2526
|
post: this.post.bind(this)
|
|
2442
2527
|
});
|
|
2443
|
-
this.mainThreadMap.set(n,
|
|
2528
|
+
this.mainThreadMap.set(n, I), I && u && I.setCameraOpt(u);
|
|
2444
2529
|
}
|
|
2445
2530
|
continue;
|
|
2446
2531
|
}
|
|
2447
|
-
if ((
|
|
2448
|
-
const
|
|
2449
|
-
if (
|
|
2450
|
-
|
|
2451
|
-
const
|
|
2532
|
+
if ((c === p.Snapshot || c === p.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2533
|
+
const S = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, g = (r = S.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2534
|
+
if (S && g && u) {
|
|
2535
|
+
g.style.width = `${u.width}px`, g.style.height = `${u.height}px`;
|
|
2536
|
+
const I = {
|
|
2452
2537
|
...Z.defaultLayerOpt,
|
|
2453
2538
|
offscreen: !1,
|
|
2454
2539
|
width: u.width,
|
|
2455
2540
|
height: u.height
|
|
2456
|
-
},
|
|
2541
|
+
}, y = {
|
|
2457
2542
|
...Z.defaultScreenCanvasOpt,
|
|
2458
2543
|
width: u.width,
|
|
2459
2544
|
height: u.height
|
|
2460
2545
|
};
|
|
2461
2546
|
this.snapshotThread = this.createSnapshotThread(n, {
|
|
2462
|
-
displayer:
|
|
2463
|
-
container:
|
|
2464
|
-
layerOpt:
|
|
2547
|
+
displayer: S,
|
|
2548
|
+
container: g,
|
|
2549
|
+
layerOpt: I,
|
|
2465
2550
|
master: this.master,
|
|
2466
|
-
canvasOpt:
|
|
2551
|
+
canvasOpt: y,
|
|
2467
2552
|
post: this.post.bind(this)
|
|
2468
2553
|
}), this.snapshotThread.on(i).then(() => {
|
|
2469
|
-
this.snapshotThread = void 0,
|
|
2554
|
+
this.snapshotThread = void 0, g.innerHTML = "", g.style.width = "", g.style.height = "";
|
|
2470
2555
|
});
|
|
2471
2556
|
continue;
|
|
2472
2557
|
}
|
|
2473
2558
|
}
|
|
2474
|
-
if (
|
|
2559
|
+
if (c === p.GetImageBitMap && w && this.snapshotThread) {
|
|
2475
2560
|
this.snapshotThread.on(i);
|
|
2476
2561
|
continue;
|
|
2477
2562
|
}
|
|
2478
|
-
if (
|
|
2479
|
-
for (const [
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2563
|
+
if (c === p.TasksQueue && (a != null && a.size)) {
|
|
2564
|
+
for (const [S, g] of this.mainThreadMap.entries()) {
|
|
2565
|
+
const I = a.get(S);
|
|
2566
|
+
I && (await g.on(I), h && this.post({ workerTasksqueueCount: h }));
|
|
2482
2567
|
}
|
|
2483
2568
|
continue;
|
|
2484
2569
|
}
|
|
2485
|
-
if (n ===
|
|
2486
|
-
for (const
|
|
2487
|
-
|
|
2570
|
+
if (n === pe) {
|
|
2571
|
+
for (const S of this.mainThreadMap.values())
|
|
2572
|
+
S.on(i), c === p.Destroy && this.mainThreadMap.delete(n);
|
|
2488
2573
|
continue;
|
|
2489
2574
|
}
|
|
2490
|
-
const
|
|
2491
|
-
|
|
2575
|
+
const k = this.mainThreadMap.get(n);
|
|
2576
|
+
k && (k.on(i), c === p.Destroy && this.mainThreadMap.delete(n));
|
|
2492
2577
|
}
|
|
2493
2578
|
}
|
|
2494
2579
|
}
|
|
2495
2580
|
export {
|
|
2496
|
-
|
|
2581
|
+
_e as MainThreadManagerImpl
|
|
2497
2582
|
};
|