@netless/appliance-plugin 1.1.15-beta.1 → 1.1.15-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-BLBicx.js +459 -0
- package/cdn/subWorker-BWE2Rk.js +459 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +10 -10
- package/dist/core/enum.d.ts +3 -0
- package/dist/core/mainThread/snapshotThread.d.ts +1 -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/tools/arrow.d.ts +2 -1
- package/dist/core/tools/base.d.ts +29 -3
- package/dist/core/tools/ellipse.d.ts +2 -1
- package/dist/core/tools/pencil.d.ts +2 -1
- package/dist/core/tools/polygon.d.ts +2 -1
- package/dist/core/tools/rectangle.d.ts +2 -1
- package/dist/core/tools/speechBalloon.d.ts +2 -1
- package/dist/core/tools/star.d.ts +2 -1
- package/dist/core/tools/straight.d.ts +2 -1
- package/dist/core/tools/utils.d.ts +4 -3
- package/dist/core/types.d.ts +0 -1
- package/dist/core/utils/spriteNode.d.ts +7 -1
- package/dist/core/worker/base.d.ts +3 -1
- package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
- package/dist/core/worker/workerManager.d.ts +0 -2
- package/dist/fullWorker.js +143 -129
- package/dist/{index-BZMch2Ky.mjs → index-7Ny1Gedj.mjs} +6634 -6663
- package/dist/index-CtT1W9YT.js +1 -0
- package/dist/index-DZB9amqH.js +1 -0
- package/dist/{index-BY6CrjXe.mjs → index-D_0O2awx.mjs} +143 -143
- package/dist/plugin/const.d.ts +2 -0
- package/dist/subWorker.js +143 -129
- package/package.json +1 -1
- package/cdn/fullWorker-wywIMW.js +0 -445
- package/cdn/subWorker-Drm8g9.js +0 -445
- package/dist/index-BxwDnRsj.js +0 -1
- package/dist/index-CeIk1a6W.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (
|
|
4
|
-
import { D as
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var ce = (L, t, e) => t in L ? ne(L, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : L[t] = e;
|
|
3
|
+
var u = (L, t, e) => ce(L, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { D as P, E as W, a as f, r as U, b as g, g as $, t as B, c as p, S as te, d as T, e as X, i as le, C as K, f as R, h as he, j as I, M as F, V as pe, k as se, T as Y, l as q, m as Q, n as G, o as de, p as V, q as J, s as ue } from "./index-7Ny1Gedj.mjs";
|
|
5
|
+
import { Scene as oe, Group as re } from "spritejs";
|
|
6
|
+
import { cloneDeep as ie, xor as fe, isNumber as _, isEqual as ee } 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 me {
|
|
13
13
|
constructor(t) {
|
|
14
14
|
u(this, "vNodes");
|
|
15
15
|
u(this, "thread");
|
|
@@ -17,7 +17,7 @@ class ue {
|
|
|
17
17
|
u(this, "localWorkShapes", /* @__PURE__ */ new Map());
|
|
18
18
|
u(this, "tmpOpt");
|
|
19
19
|
u(this, "animationId");
|
|
20
|
-
u(this, "syncUnitTime",
|
|
20
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
21
21
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
22
22
|
}
|
|
23
23
|
createLocalWork(t) {
|
|
@@ -55,7 +55,7 @@ class ue {
|
|
|
55
55
|
clearAll() {
|
|
56
56
|
this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
|
|
57
57
|
t.name !== "viewport" && t.remove();
|
|
58
|
-
}), this.thread.serviceLayer.
|
|
58
|
+
}), U(this.thread.serviceLayer, this.thread.serviceLayer.parent)), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
|
|
59
59
|
}
|
|
60
60
|
consumeDraw(t) {
|
|
61
61
|
const { workId: e, dataType: s } = t;
|
|
@@ -80,7 +80,7 @@ class ue {
|
|
|
80
80
|
createWorkShapeNode(t) {
|
|
81
81
|
const { toolsType: e } = t;
|
|
82
82
|
if (e === f.LaserPen)
|
|
83
|
-
return
|
|
83
|
+
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.topLayer, drawLayer: this.thread.topLayer });
|
|
84
84
|
}
|
|
85
85
|
setNodeKey(t, e, s, o) {
|
|
86
86
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
@@ -104,7 +104,7 @@ class ue {
|
|
|
104
104
|
o && s && (S = this.setNodeKey(n, S, o, s)), this.serviceWorkShapes.set(n, S);
|
|
105
105
|
}
|
|
106
106
|
const l = this.serviceWorkShapes.get(n);
|
|
107
|
-
r && (l.type = r), a && (l.animationWorkData =
|
|
107
|
+
r && (l.type = r), a && (l.animationWorkData = B(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));
|
|
108
108
|
}
|
|
109
109
|
computNextAnimationIndex(t, e) {
|
|
110
110
|
var r;
|
|
@@ -153,7 +153,7 @@ class ue {
|
|
|
153
153
|
t && this.runAnimation(), e.size && e.forEach((c, n) => {
|
|
154
154
|
s.push({
|
|
155
155
|
type: p.Cursor,
|
|
156
|
-
uid: n.split(
|
|
156
|
+
uid: n.split(te)[0],
|
|
157
157
|
op: c.op,
|
|
158
158
|
workState: c.workState,
|
|
159
159
|
viewId: this.thread.viewId
|
|
@@ -190,7 +190,7 @@ class ue {
|
|
|
190
190
|
this.runAnimation();
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
class
|
|
193
|
+
class ke {
|
|
194
194
|
constructor(t) {
|
|
195
195
|
u(this, "vNodes");
|
|
196
196
|
u(this, "thread");
|
|
@@ -199,11 +199,11 @@ class fe {
|
|
|
199
199
|
u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
|
|
200
200
|
u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
|
|
201
201
|
u(this, "tmpOpt");
|
|
202
|
-
u(this, "syncUnitTime",
|
|
202
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
203
203
|
u(this, "fullWorkerDrawCount", 0);
|
|
204
204
|
u(this, "drawWorkActiveId");
|
|
205
205
|
u(this, "consumeCount", 0);
|
|
206
|
-
u(this, "batchEraserCombine",
|
|
206
|
+
u(this, "batchEraserCombine", he(() => {
|
|
207
207
|
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
208
208
|
}, 100, { leading: !1 }));
|
|
209
209
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
@@ -238,20 +238,20 @@ class fe {
|
|
|
238
238
|
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
239
239
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
|
|
240
240
|
updateSelectorOpt: r,
|
|
241
|
-
selectIds:
|
|
241
|
+
selectIds: ie(e.selectIds),
|
|
242
242
|
vNodes: this.vNodes,
|
|
243
243
|
willSerializeData: i,
|
|
244
244
|
worker: this
|
|
245
245
|
})), c = /* @__PURE__ */ new Map();
|
|
246
246
|
let n;
|
|
247
|
-
a != null && a.selectIds && (n =
|
|
247
|
+
a != null && a.selectIds && (n = fe(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
|
|
248
248
|
const S = this.vNodes.get(d);
|
|
249
249
|
if (S) {
|
|
250
250
|
const { toolsType: w, op: y, opt: v } = S;
|
|
251
251
|
c.set(d, {
|
|
252
252
|
opt: v,
|
|
253
253
|
toolsType: w,
|
|
254
|
-
ops: (y == null ? void 0 : y.length) &&
|
|
254
|
+
ops: (y == null ? void 0 : y.length) && X(y) || void 0
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
}), e.selectIds = a.selectIds);
|
|
@@ -274,7 +274,7 @@ class fe {
|
|
|
274
274
|
clearAll() {
|
|
275
275
|
if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
|
|
276
276
|
e.name !== "viewport" && e.remove();
|
|
277
|
-
}), this.thread.localLayer.
|
|
277
|
+
}), U(this.thread.localLayer, this.thread.localLayer.parent)), this.workShapes.get(T)) {
|
|
278
278
|
const e = [];
|
|
279
279
|
e.push({
|
|
280
280
|
type: p.Select,
|
|
@@ -291,7 +291,7 @@ class fe {
|
|
|
291
291
|
let r;
|
|
292
292
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
293
293
|
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];
|
|
294
|
-
if (n === f.Text &&
|
|
294
|
+
if (n === f.Text && le([l, m], a) && h.workState === W.Done) {
|
|
295
295
|
r = c;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
@@ -312,7 +312,7 @@ class fe {
|
|
|
312
312
|
}
|
|
313
313
|
cursorHover(t) {
|
|
314
314
|
const { opt: e, toolsType: s, point: o } = t, r = this.setFullWork({
|
|
315
|
-
workId:
|
|
315
|
+
workId: K,
|
|
316
316
|
toolsType: s,
|
|
317
317
|
opt: e
|
|
318
318
|
});
|
|
@@ -394,9 +394,9 @@ class fe {
|
|
|
394
394
|
removeNode(t) {
|
|
395
395
|
var o;
|
|
396
396
|
this.vNodes.get(t) && ((o = this.thread.fullLayer) == null || o.getElementsByName(t).forEach((r) => {
|
|
397
|
-
r.remove();
|
|
397
|
+
r.remove(), R(r, this.thread.fullLayer.parent);
|
|
398
398
|
}), this.vNodes.delete(t)), this.workShapes.has(t) && (this.thread.localLayer.getElementsByName(t).forEach((r) => {
|
|
399
|
-
r.remove();
|
|
399
|
+
r.remove(), R(r, this.thread.localLayer.parent);
|
|
400
400
|
}), this.clearWorkShapeNodeCache(t));
|
|
401
401
|
}
|
|
402
402
|
setFullWork(t) {
|
|
@@ -413,7 +413,7 @@ class fe {
|
|
|
413
413
|
}
|
|
414
414
|
async consumeFull(t) {
|
|
415
415
|
var o;
|
|
416
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
416
|
+
const e = this.setFullWork(t), s = t.ops && B(t.ops);
|
|
417
417
|
if (e) {
|
|
418
418
|
const r = (o = t.workId) == null ? void 0 : o.toString();
|
|
419
419
|
e.toolsType === f.Image ? await e.consumeServiceAsync({
|
|
@@ -473,7 +473,7 @@ class fe {
|
|
|
473
473
|
replaceId: r
|
|
474
474
|
});
|
|
475
475
|
else {
|
|
476
|
-
const i = s.ops &&
|
|
476
|
+
const i = s.ops && B(s.ops);
|
|
477
477
|
o.consumeService({
|
|
478
478
|
op: i,
|
|
479
479
|
isFullWork: !0,
|
|
@@ -581,7 +581,7 @@ class fe {
|
|
|
581
581
|
this.batchEraserWorks.add(a), s.push({
|
|
582
582
|
type: p.FullWork,
|
|
583
583
|
workId: a,
|
|
584
|
-
ops:
|
|
584
|
+
ops: X(i.op),
|
|
585
585
|
opt: i.opt,
|
|
586
586
|
toolsType: i.toolsType,
|
|
587
587
|
updateNodeOpt: {
|
|
@@ -608,7 +608,7 @@ class fe {
|
|
|
608
608
|
updateBatchEraserCombineNode(t, e) {
|
|
609
609
|
for (const s of e.keys())
|
|
610
610
|
this.thread.fullLayer.getElementsByName(s).forEach((o) => {
|
|
611
|
-
o.remove();
|
|
611
|
+
o.remove(), R(o, this.thread.fullLayer.parent);
|
|
612
612
|
});
|
|
613
613
|
t.forEach((s) => {
|
|
614
614
|
const o = this.vNodes.get(s);
|
|
@@ -642,7 +642,7 @@ class fe {
|
|
|
642
642
|
viewId: this.thread.viewId,
|
|
643
643
|
msgType: p.DrawWork,
|
|
644
644
|
dataType: g.Local
|
|
645
|
-
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== T && (this.drawWorkActiveId = a),
|
|
645
|
+
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== T && (this.drawWorkActiveId = a), _(i) && (this.consumeCount = i), n) {
|
|
646
646
|
case f.Selector:
|
|
647
647
|
{
|
|
648
648
|
const h = c.consume({
|
|
@@ -719,7 +719,7 @@ class fe {
|
|
|
719
719
|
const l = h.toolsType;
|
|
720
720
|
if (l === f.LaserPen)
|
|
721
721
|
return;
|
|
722
|
-
const m = this.workShapes.get(
|
|
722
|
+
const m = this.workShapes.get(K), d = (i = m == null ? void 0 : m.selectIds) == null ? void 0 : i[0], S = h.consumeAll({ data: t, workerEngine: this });
|
|
723
723
|
switch (l) {
|
|
724
724
|
case f.Selector:
|
|
725
725
|
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && m.cursorBlur(), S.type === p.Select && (S.selectIds && e.runReverseSelectWork(S.selectIds), this.thread.post({ sp: [{ ...S, scenePath: o }] })), (c = h.selectIds) != null && c.length ? h.clearTmpPoints() : this.clearWorkShapeNodeCache(n);
|
|
@@ -770,10 +770,10 @@ class fe {
|
|
|
770
770
|
e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(e);
|
|
771
771
|
}
|
|
772
772
|
createWorkShapeNode(t) {
|
|
773
|
-
return
|
|
773
|
+
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
|
-
class
|
|
776
|
+
class Se {
|
|
777
777
|
constructor(t) {
|
|
778
778
|
u(this, "vNodes");
|
|
779
779
|
u(this, "thread");
|
|
@@ -782,7 +782,7 @@ class me {
|
|
|
782
782
|
u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
|
|
783
783
|
u(this, "runEffectId");
|
|
784
784
|
u(this, "animationId");
|
|
785
|
-
u(this, "syncUnitTime",
|
|
785
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
786
786
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
787
787
|
}
|
|
788
788
|
async loadImageBitMap(t) {
|
|
@@ -794,7 +794,7 @@ class me {
|
|
|
794
794
|
clearAll() {
|
|
795
795
|
this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((t) => {
|
|
796
796
|
t.name !== "viewport" && t.remove();
|
|
797
|
-
}), this.thread.serviceLayer.
|
|
797
|
+
}), U(this.thread.serviceLayer, this.thread.serviceLayer.parent)), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
|
|
798
798
|
}
|
|
799
799
|
runEffect() {
|
|
800
800
|
this.runEffectId || (this.runEffectId = setTimeout(this.effectRunSelector.bind(this), 0));
|
|
@@ -843,11 +843,11 @@ class me {
|
|
|
843
843
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
844
844
|
}
|
|
845
845
|
async animationDraw() {
|
|
846
|
-
var s, o, r, i, a, c, n, h, l, m, d, S, w, y, v, D,
|
|
846
|
+
var s, o, r, i, a, c, n, h, l, m, d, S, w, y, v, D, x, Z, j;
|
|
847
847
|
this.animationId = void 0;
|
|
848
848
|
let t = !1;
|
|
849
849
|
const e = /* @__PURE__ */ new Map();
|
|
850
|
-
for (const [
|
|
850
|
+
for (const [N, k] of this.workShapes.entries())
|
|
851
851
|
switch (k.toolsType) {
|
|
852
852
|
case f.Image: {
|
|
853
853
|
await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
|
|
@@ -855,18 +855,18 @@ class me {
|
|
|
855
855
|
worker: this
|
|
856
856
|
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
857
857
|
var O;
|
|
858
|
-
(O = b.selectIds) != null && O.includes(
|
|
859
|
-
}), this.workShapes.delete(
|
|
858
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
859
|
+
}), this.workShapes.delete(N);
|
|
860
860
|
break;
|
|
861
861
|
}
|
|
862
862
|
case f.Text: {
|
|
863
863
|
k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
|
|
864
864
|
isFullWork: !0,
|
|
865
|
-
replaceId:
|
|
865
|
+
replaceId: N
|
|
866
866
|
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
867
867
|
var O;
|
|
868
|
-
(O = b.selectIds) != null && O.includes(
|
|
869
|
-
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(
|
|
868
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
869
|
+
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
|
|
870
870
|
break;
|
|
871
871
|
}
|
|
872
872
|
case f.Arrow:
|
|
@@ -883,9 +883,9 @@ class me {
|
|
|
883
883
|
op: k.animationWorkData,
|
|
884
884
|
isFullWork: b
|
|
885
885
|
}), b && (this.selectorWorkShapes.forEach((O, E) => {
|
|
886
|
-
var
|
|
887
|
-
(
|
|
888
|
-
}), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(
|
|
886
|
+
var A;
|
|
887
|
+
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
|
|
888
|
+
}), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(N)), e.set(N, {
|
|
889
889
|
workState: C ? k.ops ? W.Done : W.Doing : W.Start,
|
|
890
890
|
op: k.animationWorkData.filter((O, E) => {
|
|
891
891
|
if (E % 3 !== 2)
|
|
@@ -900,39 +900,39 @@ class me {
|
|
|
900
900
|
(n = k.node) == null || n.consumeService({
|
|
901
901
|
op: k.animationWorkData || [],
|
|
902
902
|
isFullWork: !0,
|
|
903
|
-
replaceId:
|
|
903
|
+
replaceId: N
|
|
904
904
|
}), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
|
|
905
905
|
var O;
|
|
906
|
-
(O = b.selectIds) != null && O.includes(
|
|
907
|
-
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(
|
|
906
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
907
|
+
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(N);
|
|
908
908
|
else if (k.useAnimation) {
|
|
909
909
|
if (k.isDel) {
|
|
910
|
-
(m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(
|
|
910
|
+
(m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(N);
|
|
911
911
|
break;
|
|
912
912
|
}
|
|
913
|
-
const b = 3, C = this.computNextAnimationIndex(k, b), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), E = (k.animationWorkData || []).slice(O, C),
|
|
913
|
+
const b = 3, C = this.computNextAnimationIndex(k, b), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), E = (k.animationWorkData || []).slice(O, C), A = (S = (d = k.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : S.toString();
|
|
914
914
|
if ((k.animationIndex || 0) < C || k.isDiff) {
|
|
915
915
|
if ((w = k.node) == null || w.consumeService({
|
|
916
916
|
op: E,
|
|
917
917
|
isFullWork: !1
|
|
918
918
|
}), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length) {
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
919
|
+
const H = E.filter((z, ae) => {
|
|
920
|
+
if (ae % b !== b - 1)
|
|
921
921
|
return !0;
|
|
922
922
|
}).slice(-2);
|
|
923
|
-
e.set(
|
|
923
|
+
e.set(N, {
|
|
924
924
|
workState: O === 0 ? W.Start : C === ((y = k.animationWorkData) == null ? void 0 : y.length) ? W.Done : W.Doing,
|
|
925
|
-
op:
|
|
925
|
+
op: H
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
928
|
} else k.ops && ((v = k.node) == null || v.consumeService({
|
|
929
929
|
op: k.animationWorkData || [],
|
|
930
930
|
isFullWork: !0,
|
|
931
|
-
replaceId:
|
|
932
|
-
}), k.isDel = !0, e.set(
|
|
931
|
+
replaceId: A
|
|
932
|
+
}), k.isDel = !0, e.set(N, {
|
|
933
933
|
workState: W.Done,
|
|
934
|
-
op: E.filter((
|
|
935
|
-
if (
|
|
934
|
+
op: E.filter((H, z) => {
|
|
935
|
+
if (z % b !== b - 1)
|
|
936
936
|
return !0;
|
|
937
937
|
}).slice(-2)
|
|
938
938
|
}));
|
|
@@ -944,12 +944,12 @@ class me {
|
|
|
944
944
|
case f.BitMapEraser:
|
|
945
945
|
case f.PencilEraser: {
|
|
946
946
|
if (k.isDel) {
|
|
947
|
-
(D = k.node) == null || D.clearTmpPoints(), this.workShapes.delete(
|
|
947
|
+
(D = k.node) == null || D.clearTmpPoints(), this.workShapes.delete(N);
|
|
948
948
|
break;
|
|
949
949
|
}
|
|
950
|
-
if (k.ops && ((
|
|
950
|
+
if (k.ops && ((x = k.animationWorkData) != null && x.length)) {
|
|
951
951
|
const b = k.animationWorkData.slice(-3, -1);
|
|
952
|
-
e.set(
|
|
952
|
+
e.set(N, {
|
|
953
953
|
workState: W.Done,
|
|
954
954
|
op: b
|
|
955
955
|
}), k.isDel = !0;
|
|
@@ -957,17 +957,17 @@ class me {
|
|
|
957
957
|
}
|
|
958
958
|
if (k.useAnimation) {
|
|
959
959
|
const C = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), E = (k.animationWorkData || []).slice(O, C);
|
|
960
|
-
if (((k.animationIndex || 0) < C || k.isDiff) && ((
|
|
960
|
+
if (((k.animationIndex || 0) < C || k.isDiff) && ((Z = k.node) == null || Z.consumeService({
|
|
961
961
|
op: E,
|
|
962
962
|
isFullWork: k.toolsType !== f.BitMapEraser
|
|
963
963
|
}), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length)) {
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
964
|
+
const A = E.filter((H, z) => {
|
|
965
|
+
if (z % 3 !== 2)
|
|
966
966
|
return !0;
|
|
967
967
|
}).slice(-2);
|
|
968
|
-
e.set(
|
|
969
|
-
workState: O === 0 ? W.Start : C === ((
|
|
970
|
-
op:
|
|
968
|
+
e.set(N, {
|
|
969
|
+
workState: O === 0 ? W.Start : C === ((j = k.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
970
|
+
op: A
|
|
971
971
|
});
|
|
972
972
|
}
|
|
973
973
|
t = !0;
|
|
@@ -977,16 +977,16 @@ class me {
|
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
if (t && this.runAnimation(), e.size) {
|
|
980
|
-
const
|
|
980
|
+
const N = [];
|
|
981
981
|
e.forEach((k, b) => {
|
|
982
|
-
|
|
982
|
+
N.push({
|
|
983
983
|
type: p.Cursor,
|
|
984
|
-
uid: b.split(
|
|
984
|
+
uid: b.split(te)[0],
|
|
985
985
|
op: k.op,
|
|
986
986
|
workState: k.workState,
|
|
987
987
|
viewId: this.thread.viewId
|
|
988
988
|
});
|
|
989
|
-
}), this.thread.post({ sp:
|
|
989
|
+
}), this.thread.post({ sp: N });
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
runAnimation() {
|
|
@@ -1034,13 +1034,13 @@ class me {
|
|
|
1034
1034
|
o && s && (D = this.setNodeKey(l, D, o, s)), (y = this.workShapes) == null || y.set(l, D);
|
|
1035
1035
|
}
|
|
1036
1036
|
const d = (v = this.workShapes) == null ? void 0 : v.get(l);
|
|
1037
|
-
r && (d.type = r), a && (d.animationWorkData =
|
|
1037
|
+
r && (d.type = r), a && (d.animationWorkData = B(a), d.ops = a), i && (d.updateNodeOpt = i), c && (d.isDiff = this.hasDiffData(d.animationWorkData || [], c, d.toolsType), 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);
|
|
1038
1038
|
}
|
|
1039
1039
|
removeNode(t, e) {
|
|
1040
1040
|
t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
1041
|
-
s.remove();
|
|
1041
|
+
s.remove(), R(s, this.thread.fullLayer.parent);
|
|
1042
1042
|
}), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
|
|
1043
|
-
s.remove();
|
|
1043
|
+
s.remove(), R(s, this.thread.serviceLayer.parent);
|
|
1044
1044
|
}), this.vNodes.delete(t);
|
|
1045
1045
|
}
|
|
1046
1046
|
removeSelectWork(t) {
|
|
@@ -1066,7 +1066,7 @@ class me {
|
|
|
1066
1066
|
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
1067
1067
|
}
|
|
1068
1068
|
setNodeKey(t, e, s, o) {
|
|
1069
|
-
return e.toolsType = s, e.node =
|
|
1069
|
+
return e.toolsType = s, e.node = $({
|
|
1070
1070
|
toolsType: s,
|
|
1071
1071
|
toolsOpt: o,
|
|
1072
1072
|
vNodes: this.vNodes,
|
|
@@ -1086,7 +1086,7 @@ class M {
|
|
|
1086
1086
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
|
-
class
|
|
1089
|
+
class ye extends M {
|
|
1090
1090
|
constructor() {
|
|
1091
1091
|
super(...arguments);
|
|
1092
1092
|
u(this, "emitEventType", I.CopyNode);
|
|
@@ -1102,7 +1102,7 @@ class ke extends M {
|
|
|
1102
1102
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
class
|
|
1105
|
+
class we extends M {
|
|
1106
1106
|
constructor() {
|
|
1107
1107
|
super(...arguments);
|
|
1108
1108
|
u(this, "emitEventType", I.SetColorNode);
|
|
@@ -1150,7 +1150,7 @@ class Se extends M {
|
|
|
1150
1150
|
};
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
|
-
class
|
|
1153
|
+
class ve extends M {
|
|
1154
1154
|
constructor() {
|
|
1155
1155
|
super(...arguments);
|
|
1156
1156
|
u(this, "emitEventType", I.ZIndexNode);
|
|
@@ -1191,7 +1191,7 @@ class ye extends M {
|
|
|
1191
1191
|
};
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
class
|
|
1194
|
+
class ge extends M {
|
|
1195
1195
|
constructor() {
|
|
1196
1196
|
super(...arguments);
|
|
1197
1197
|
u(this, "emitEventType", I.TranslateNode);
|
|
@@ -1257,7 +1257,7 @@ class we extends M {
|
|
|
1257
1257
|
};
|
|
1258
1258
|
}
|
|
1259
1259
|
}
|
|
1260
|
-
class
|
|
1260
|
+
class Ie extends M {
|
|
1261
1261
|
constructor() {
|
|
1262
1262
|
super(...arguments);
|
|
1263
1263
|
u(this, "emitEventType", I.DeleteNode);
|
|
@@ -1266,7 +1266,7 @@ class ve extends M {
|
|
|
1266
1266
|
return !1;
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
class
|
|
1269
|
+
class We extends M {
|
|
1270
1270
|
constructor() {
|
|
1271
1271
|
super(...arguments);
|
|
1272
1272
|
u(this, "emitEventType", I.ScaleNode);
|
|
@@ -1328,7 +1328,7 @@ class ge extends M {
|
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
class
|
|
1331
|
+
class Te extends M {
|
|
1332
1332
|
constructor() {
|
|
1333
1333
|
super(...arguments);
|
|
1334
1334
|
u(this, "emitEventType", I.RotateNode);
|
|
@@ -1380,7 +1380,7 @@ class Ie extends M {
|
|
|
1380
1380
|
};
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
|
-
class
|
|
1383
|
+
class Le extends M {
|
|
1384
1384
|
constructor() {
|
|
1385
1385
|
super(...arguments);
|
|
1386
1386
|
u(this, "emitEventType", I.SetFontStyle);
|
|
@@ -1437,7 +1437,7 @@ class We extends M {
|
|
|
1437
1437
|
};
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
class
|
|
1440
|
+
class Ne extends M {
|
|
1441
1441
|
constructor() {
|
|
1442
1442
|
super(...arguments);
|
|
1443
1443
|
u(this, "emitEventType", I.SetPoint);
|
|
@@ -1490,7 +1490,7 @@ class Te extends M {
|
|
|
1490
1490
|
};
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
|
-
class
|
|
1493
|
+
class be extends M {
|
|
1494
1494
|
constructor() {
|
|
1495
1495
|
super(...arguments);
|
|
1496
1496
|
u(this, "emitEventType", I.SetLock);
|
|
@@ -1543,7 +1543,7 @@ class Ne extends M {
|
|
|
1543
1543
|
};
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
|
-
class
|
|
1546
|
+
class De extends M {
|
|
1547
1547
|
constructor() {
|
|
1548
1548
|
super(...arguments);
|
|
1549
1549
|
u(this, "emitEventType", I.SetShapeOpt);
|
|
@@ -1584,7 +1584,7 @@ class Le extends M {
|
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
|
-
class
|
|
1587
|
+
class Ce {
|
|
1588
1588
|
constructor(t) {
|
|
1589
1589
|
u(this, "builders", /* @__PURE__ */ new Map());
|
|
1590
1590
|
this.builders = new Map(t.map((e) => [e, this.build(e)]));
|
|
@@ -1592,27 +1592,27 @@ class be {
|
|
|
1592
1592
|
build(t) {
|
|
1593
1593
|
switch (t) {
|
|
1594
1594
|
case I.TranslateNode:
|
|
1595
|
-
return new
|
|
1595
|
+
return new ge();
|
|
1596
1596
|
case I.ZIndexNode:
|
|
1597
|
-
return new
|
|
1597
|
+
return new ve();
|
|
1598
1598
|
case I.CopyNode:
|
|
1599
|
-
return new
|
|
1599
|
+
return new ye();
|
|
1600
1600
|
case I.SetColorNode:
|
|
1601
|
-
return new
|
|
1601
|
+
return new we();
|
|
1602
1602
|
case I.DeleteNode:
|
|
1603
|
-
return new
|
|
1603
|
+
return new Ie();
|
|
1604
1604
|
case I.ScaleNode:
|
|
1605
|
-
return new
|
|
1605
|
+
return new We();
|
|
1606
1606
|
case I.RotateNode:
|
|
1607
|
-
return new
|
|
1607
|
+
return new Te();
|
|
1608
1608
|
case I.SetFontStyle:
|
|
1609
|
-
return new
|
|
1609
|
+
return new Le();
|
|
1610
1610
|
case I.SetPoint:
|
|
1611
|
-
return new Te();
|
|
1612
|
-
case I.SetLock:
|
|
1613
1611
|
return new Ne();
|
|
1612
|
+
case I.SetLock:
|
|
1613
|
+
return new be();
|
|
1614
1614
|
case I.SetShapeOpt:
|
|
1615
|
-
return new
|
|
1615
|
+
return new De();
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
1618
1618
|
registerForMainThread(t) {
|
|
@@ -1627,7 +1627,7 @@ class be {
|
|
|
1627
1627
|
return !1;
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
|
-
class
|
|
1630
|
+
class Oe {
|
|
1631
1631
|
constructor(t, e) {
|
|
1632
1632
|
u(this, "viewId");
|
|
1633
1633
|
u(this, "fullLayer");
|
|
@@ -1652,13 +1652,13 @@ class De {
|
|
|
1652
1652
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
1653
1653
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1654
1654
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1655
|
-
const s =
|
|
1656
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
1655
|
+
const s = P.bufferSize.full, o = P.bufferSize.sub;
|
|
1656
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === F ? s : o * 2 }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === F, o), contextType: "2d" }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === F, o), contextType: "2d" }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === F, o), contextType: "2d" }), this.vNodes = new pe(t, this.scene);
|
|
1657
1657
|
const r = {
|
|
1658
1658
|
thread: this,
|
|
1659
1659
|
vNodes: this.vNodes
|
|
1660
1660
|
};
|
|
1661
|
-
this.localWork = new
|
|
1661
|
+
this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new me(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ce([
|
|
1662
1662
|
I.CopyNode,
|
|
1663
1663
|
I.SetColorNode,
|
|
1664
1664
|
I.DeleteNode,
|
|
@@ -1704,7 +1704,7 @@ class De {
|
|
|
1704
1704
|
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h } = t, l = i == null ? void 0 : i.toString();
|
|
1705
1705
|
switch (e) {
|
|
1706
1706
|
case p.UpdateDpr:
|
|
1707
|
-
|
|
1707
|
+
_(t.dpr) && this.updateDpr(t.dpr);
|
|
1708
1708
|
break;
|
|
1709
1709
|
case p.AuthClear: {
|
|
1710
1710
|
const { clearUids: m, localUid: d } = t;
|
|
@@ -1810,7 +1810,7 @@ class De {
|
|
|
1810
1810
|
if (!i || !a || !c || !n)
|
|
1811
1811
|
return;
|
|
1812
1812
|
let l = i;
|
|
1813
|
-
if (a ===
|
|
1813
|
+
if (a === se.Iconify) {
|
|
1814
1814
|
const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
1815
1815
|
l = `${i}?width=${w}&height=${y}&color=${h}`;
|
|
1816
1816
|
}
|
|
@@ -1879,13 +1879,13 @@ class De {
|
|
|
1879
1879
|
for (const i of r.sp) {
|
|
1880
1880
|
let a = !1;
|
|
1881
1881
|
for (const c of t)
|
|
1882
|
-
if (
|
|
1882
|
+
if (ee(i, c)) {
|
|
1883
1883
|
a = !0;
|
|
1884
1884
|
break;
|
|
1885
1885
|
}
|
|
1886
1886
|
a || t.push(i);
|
|
1887
1887
|
}
|
|
1888
|
-
|
|
1888
|
+
_(r.fullWorkerDrawCount) && (e = r.fullWorkerDrawCount), _(r.consumeCount) && (s = r.consumeCount);
|
|
1889
1889
|
}
|
|
1890
1890
|
return this.combinePostMsg.clear(), {
|
|
1891
1891
|
sp: t,
|
|
@@ -1901,7 +1901,7 @@ class De {
|
|
|
1901
1901
|
clearAll() {
|
|
1902
1902
|
this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
|
|
1903
1903
|
t.name !== "viewport" && t.remove();
|
|
1904
|
-
}), this.fullLayer.
|
|
1904
|
+
}), U(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
|
|
1905
1905
|
sp: [{
|
|
1906
1906
|
type: p.Clear
|
|
1907
1907
|
}]
|
|
@@ -1933,7 +1933,7 @@ class De {
|
|
|
1933
1933
|
async updateCamera(t) {
|
|
1934
1934
|
var o;
|
|
1935
1935
|
const { cameraOpt: e, scenePath: s } = t;
|
|
1936
|
-
if (e && !
|
|
1936
|
+
if (e && !ee(this.cameraOpt, e)) {
|
|
1937
1937
|
if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
|
|
1938
1938
|
let n = !1;
|
|
1939
1939
|
for (const [h, l] of this.localWork.getWorkShapes().entries())
|
|
@@ -1946,20 +1946,20 @@ class De {
|
|
|
1946
1946
|
case f.LaserPen:
|
|
1947
1947
|
break;
|
|
1948
1948
|
default:
|
|
1949
|
-
h !==
|
|
1949
|
+
h !== K && h !== T && (n = !0);
|
|
1950
1950
|
break;
|
|
1951
1951
|
}
|
|
1952
1952
|
if (n) {
|
|
1953
1953
|
this.taskUpdateCameraId = setTimeout(() => {
|
|
1954
1954
|
this.taskUpdateCameraId = void 0, this.updateCamera(t);
|
|
1955
|
-
},
|
|
1955
|
+
}, Y);
|
|
1956
1956
|
return;
|
|
1957
1957
|
}
|
|
1958
1958
|
}
|
|
1959
1959
|
const r = /* @__PURE__ */ new Map();
|
|
1960
1960
|
for (const [n, h] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
1961
1961
|
const l = h.rect;
|
|
1962
|
-
r.set(n,
|
|
1962
|
+
r.set(n, ie(l));
|
|
1963
1963
|
}
|
|
1964
1964
|
const i = new Set(r.keys());
|
|
1965
1965
|
let a = !1;
|
|
@@ -1986,11 +1986,11 @@ class De {
|
|
|
1986
1986
|
for (const [n, h] of r.entries()) {
|
|
1987
1987
|
const l = this.vNodes.get(n);
|
|
1988
1988
|
if (l) {
|
|
1989
|
-
const m = h, d = l.rect, S = this.getSceneRect(), w =
|
|
1989
|
+
const m = h, d = l.rect, S = this.getSceneRect(), w = q(m, S), y = q(d, S);
|
|
1990
1990
|
let v = !1;
|
|
1991
|
-
if ((w !== y || m.w !== d.w || m.h !== d.h || y ===
|
|
1992
|
-
const { toolsType: D, opt:
|
|
1993
|
-
D === f.Text &&
|
|
1991
|
+
if ((w !== y || m.w !== d.w || m.h !== d.h || y === Q.intersect) && (v = !0), v) {
|
|
1992
|
+
const { toolsType: D, opt: x } = l;
|
|
1993
|
+
D === f.Text && x.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
1994
1994
|
}
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
@@ -2017,11 +2017,11 @@ class De {
|
|
|
2017
2017
|
workId: l
|
|
2018
2018
|
});
|
|
2019
2019
|
if (v) {
|
|
2020
|
-
const D = this.getSceneRect(),
|
|
2020
|
+
const D = this.getSceneRect(), x = q(y, D);
|
|
2021
2021
|
n.push(v.consumeServiceAsync({
|
|
2022
2022
|
isFullWork: !0,
|
|
2023
2023
|
replaceId: l,
|
|
2024
|
-
isDrawLabel:
|
|
2024
|
+
isDrawLabel: x !== Q.outside
|
|
2025
2025
|
}));
|
|
2026
2026
|
}
|
|
2027
2027
|
}
|
|
@@ -2029,7 +2029,7 @@ class De {
|
|
|
2029
2029
|
this.debounceUpdateCache.delete(l);
|
|
2030
2030
|
}
|
|
2031
2031
|
this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
|
|
2032
|
-
},
|
|
2032
|
+
}, Y);
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
@@ -2043,7 +2043,7 @@ class De {
|
|
|
2043
2043
|
};
|
|
2044
2044
|
}
|
|
2045
2045
|
createScene(t) {
|
|
2046
|
-
return new
|
|
2046
|
+
return new oe({
|
|
2047
2047
|
displayRatio: this.opt.displayer.dpr,
|
|
2048
2048
|
depth: !1,
|
|
2049
2049
|
desynchronized: !0,
|
|
@@ -2054,7 +2054,7 @@ class De {
|
|
|
2054
2054
|
});
|
|
2055
2055
|
}
|
|
2056
2056
|
createLayer(t, e, s) {
|
|
2057
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new
|
|
2057
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new re({
|
|
2058
2058
|
anchor: [0.5, 0.5],
|
|
2059
2059
|
pos: [o * 0.5, r * 0.5],
|
|
2060
2060
|
size: [o, r],
|
|
@@ -2073,10 +2073,10 @@ class De {
|
|
|
2073
2073
|
this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.topLayer.parent.setAttribute("width", e), this.topLayer.parent.setAttribute("height", s), this.topLayer.setAttribute("size", [e, s]), this.topLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.localLayer.parent.setAttribute("width", e), this.localLayer.parent.setAttribute("height", s), this.localLayer.setAttribute("size", [e, s]), this.localLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.serviceLayer.parent.setAttribute("width", e), this.serviceLayer.parent.setAttribute("height", s), this.serviceLayer.setAttribute("size", [e, s]), this.serviceLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
|
|
2074
2074
|
}
|
|
2075
2075
|
destroy() {
|
|
2076
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), this.topLayer.remove(), this.localLayer.remove(), this.serviceLayer.remove(), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
|
|
2076
|
+
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();
|
|
2077
2077
|
}
|
|
2078
2078
|
}
|
|
2079
|
-
class
|
|
2079
|
+
class Ee {
|
|
2080
2080
|
constructor(t, e) {
|
|
2081
2081
|
u(this, "viewId");
|
|
2082
2082
|
u(this, "fullLayer");
|
|
@@ -2088,7 +2088,7 @@ class Ce {
|
|
|
2088
2088
|
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2089
2089
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2090
2090
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
2091
|
-
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 ===
|
|
2091
|
+
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 === F ? 6e3 : 3e3, contextType: "2d" });
|
|
2092
2092
|
}
|
|
2093
2093
|
getCachedImages(t) {
|
|
2094
2094
|
var e;
|
|
@@ -2150,7 +2150,7 @@ class Ce {
|
|
|
2150
2150
|
if (!i || !a || !c || !n)
|
|
2151
2151
|
return;
|
|
2152
2152
|
let l = i;
|
|
2153
|
-
if (a ===
|
|
2153
|
+
if (a === se.Iconify) {
|
|
2154
2154
|
const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
2155
2155
|
l = `${i}?width=${w}&height=${y}&color=${h}`;
|
|
2156
2156
|
}
|
|
@@ -2187,7 +2187,7 @@ class Ce {
|
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
2189
|
createWorkShapeNode(t) {
|
|
2190
|
-
return
|
|
2190
|
+
return $({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
|
|
2191
2191
|
}
|
|
2192
2192
|
setFullWork(t) {
|
|
2193
2193
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -2203,7 +2203,7 @@ class Ce {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
async runFullWork(t) {
|
|
2205
2205
|
var o;
|
|
2206
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
2206
|
+
const e = this.setFullWork(t), s = t.ops && B(t.ops);
|
|
2207
2207
|
if (e) {
|
|
2208
2208
|
let r, i;
|
|
2209
2209
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
@@ -2218,7 +2218,7 @@ class Ce {
|
|
|
2218
2218
|
op: s,
|
|
2219
2219
|
isFullWork: !0,
|
|
2220
2220
|
replaceId: a
|
|
2221
|
-
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)),
|
|
2221
|
+
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), G(r, i);
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
2224
|
async getSnapshot(t) {
|
|
@@ -2239,7 +2239,7 @@ class Ce {
|
|
|
2239
2239
|
dataType: g.Service,
|
|
2240
2240
|
viewId: this.viewId
|
|
2241
2241
|
}, d = await this.runFullWork(m);
|
|
2242
|
-
a =
|
|
2242
|
+
a = G(a, d);
|
|
2243
2243
|
break;
|
|
2244
2244
|
}
|
|
2245
2245
|
}
|
|
@@ -2264,7 +2264,7 @@ class Ce {
|
|
|
2264
2264
|
return createImageBitmap(this.fullLayer.parent.canvas, s, o, r, i, e);
|
|
2265
2265
|
}
|
|
2266
2266
|
async getSnapshotRender(t) {
|
|
2267
|
-
var r
|
|
2267
|
+
var r;
|
|
2268
2268
|
const { scenePath: e, options: s } = t;
|
|
2269
2269
|
((r = this.fullLayer) == null ? void 0 : r.parent).render();
|
|
2270
2270
|
const o = await this.getRectImageBitmap(this.getSceneRect(), s);
|
|
@@ -2275,7 +2275,7 @@ class Ce {
|
|
|
2275
2275
|
imageBitmap: o,
|
|
2276
2276
|
viewId: this.viewId
|
|
2277
2277
|
}]
|
|
2278
|
-
}),
|
|
2278
|
+
}), this.fullLayer && U(this.fullLayer, this.fullLayer.parent));
|
|
2279
2279
|
}
|
|
2280
2280
|
async getBoundingRect(t) {
|
|
2281
2281
|
const { scenePath: e, scenes: s, cameraOpt: o } = t;
|
|
@@ -2294,7 +2294,7 @@ class Ce {
|
|
|
2294
2294
|
dataType: g.Service,
|
|
2295
2295
|
viewId: this.viewId
|
|
2296
2296
|
});
|
|
2297
|
-
r =
|
|
2297
|
+
r = G(r, c);
|
|
2298
2298
|
break;
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
@@ -2323,7 +2323,7 @@ class Ce {
|
|
|
2323
2323
|
for (const o of s.sp) {
|
|
2324
2324
|
let r = !1;
|
|
2325
2325
|
for (const i of t)
|
|
2326
|
-
if (
|
|
2326
|
+
if (de(o, i)) {
|
|
2327
2327
|
r = !0;
|
|
2328
2328
|
break;
|
|
2329
2329
|
}
|
|
@@ -2339,7 +2339,7 @@ class Ce {
|
|
|
2339
2339
|
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);
|
|
2340
2340
|
}
|
|
2341
2341
|
createScene(t) {
|
|
2342
|
-
return new
|
|
2342
|
+
return new oe({
|
|
2343
2343
|
displayRatio: this.opt.displayer.dpr,
|
|
2344
2344
|
depth: !1,
|
|
2345
2345
|
desynchronized: !0,
|
|
@@ -2349,7 +2349,7 @@ class Ce {
|
|
|
2349
2349
|
});
|
|
2350
2350
|
}
|
|
2351
2351
|
createLayer(t, e, s) {
|
|
2352
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new
|
|
2352
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new re({
|
|
2353
2353
|
anchor: [0.5, 0.5],
|
|
2354
2354
|
pos: [o * 0.5, r * 0.5],
|
|
2355
2355
|
size: [o, r],
|
|
@@ -2368,10 +2368,10 @@ class Ce {
|
|
|
2368
2368
|
this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
|
|
2369
2369
|
}
|
|
2370
2370
|
destroy() {
|
|
2371
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), this.scene.remove();
|
|
2371
|
+
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), R(this.fullLayer, this.fullLayer.parent), this.scene.remove();
|
|
2372
2372
|
}
|
|
2373
2373
|
}
|
|
2374
|
-
class
|
|
2374
|
+
class _e {
|
|
2375
2375
|
constructor(t) {
|
|
2376
2376
|
u(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
2377
2377
|
u(this, "snapshotThread");
|
|
@@ -2380,16 +2380,16 @@ class Ue {
|
|
|
2380
2380
|
}
|
|
2381
2381
|
post(t) {
|
|
2382
2382
|
const { fullWorkerDrawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
|
|
2383
|
-
this.master.isBusy &&
|
|
2383
|
+
this.master.isBusy && V(o) && this.master.setWorkerTasksqueueCount(o), V(e) && this.master.setMaxDrawCount(e), V(r) && this.master.setConsumeCount(r), s && this.master.collectorSyncData(s);
|
|
2384
2384
|
}
|
|
2385
2385
|
destroy() {
|
|
2386
2386
|
this.mainThreadMap.clear();
|
|
2387
2387
|
}
|
|
2388
2388
|
createMainThread(t, e) {
|
|
2389
|
-
return new
|
|
2389
|
+
return new Oe(t, e);
|
|
2390
2390
|
}
|
|
2391
2391
|
createSnapshotThread(t, e) {
|
|
2392
|
-
return new
|
|
2392
|
+
return new Ee(t, e);
|
|
2393
2393
|
}
|
|
2394
2394
|
async consume(t) {
|
|
2395
2395
|
var e, s, o, r;
|
|
@@ -2419,12 +2419,12 @@ class Ue {
|
|
|
2419
2419
|
if (y && v && d) {
|
|
2420
2420
|
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
2421
2421
|
const D = {
|
|
2422
|
-
...
|
|
2422
|
+
...J.defaultLayerOpt,
|
|
2423
2423
|
offscreen: !1,
|
|
2424
2424
|
width: d.width,
|
|
2425
2425
|
height: d.height
|
|
2426
|
-
},
|
|
2427
|
-
...
|
|
2426
|
+
}, x = {
|
|
2427
|
+
...J.defaultScreenCanvasOpt,
|
|
2428
2428
|
width: d.width,
|
|
2429
2429
|
height: d.height
|
|
2430
2430
|
};
|
|
@@ -2433,7 +2433,7 @@ class Ue {
|
|
|
2433
2433
|
container: v,
|
|
2434
2434
|
layerOpt: D,
|
|
2435
2435
|
master: this.master,
|
|
2436
|
-
canvasOpt:
|
|
2436
|
+
canvasOpt: x,
|
|
2437
2437
|
post: this.post.bind(this)
|
|
2438
2438
|
}), this.snapshotThread.on(i).then(() => {
|
|
2439
2439
|
this.snapshotThread = void 0, v.innerHTML = "", v.style.width = "", v.style.height = "";
|
|
@@ -2452,7 +2452,7 @@ class Ue {
|
|
|
2452
2452
|
}
|
|
2453
2453
|
continue;
|
|
2454
2454
|
}
|
|
2455
|
-
if (c ===
|
|
2455
|
+
if (c === ue) {
|
|
2456
2456
|
for (const y of this.mainThreadMap.values())
|
|
2457
2457
|
y.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2458
2458
|
continue;
|
|
@@ -2463,5 +2463,5 @@ class Ue {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
}
|
|
2465
2465
|
export {
|
|
2466
|
-
|
|
2466
|
+
_e as MainThreadManagerImpl
|
|
2467
2467
|
};
|