@netless/appliance-plugin 1.1.17-beta.1 → 1.1.17-beta.3
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-COcIu4.js → fullWorker-BRSJpK.js} +14 -14
- package/cdn/{subWorker-CC2gsq.js → subWorker-C6USfH.js} +14 -14
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/fullWorker.js +14 -14
- package/dist/{index-iNpUjkVC.mjs → index-C7EVuWrK.mjs} +183 -171
- package/dist/index-CSX20e2f.js +1 -0
- package/dist/index-D0OLpXX8.js +1 -0
- package/dist/{index-DC-gnrrp.mjs → index-fDo00x3u.mjs} +1076 -1062
- package/dist/subWorker.js +14 -14
- package/package.json +1 -1
- package/dist/index-Byg3oTBp.js +0 -1
- package/dist/index-jPJ8k_RQ.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ne = Object.defineProperty;
|
|
2
2
|
var ce = (L, t, e) => t in L ? ne(L, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : L[t] = e;
|
|
3
3
|
var u = (L, t, e) => ce(L, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { D as
|
|
4
|
+
import { D as B, E as W, a as f, r as z, b as g, g as $, t as U, c as p, S as te, d as T, e as X, i as le, C as F, f as R, h as he, j as I, M as P, V as pe, k as se, T as Y, l as G, m as Q, n as V, o as de, p as K, q as J, s as ue } from "./index-fDo00x3u.mjs";
|
|
5
5
|
import { Scene as oe, Group as re } from "spritejs";
|
|
6
6
|
import { cloneDeep as ie, xor as fe, isNumber as H, isEqual as ee } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
@@ -17,7 +17,7 @@ class me {
|
|
|
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", B.syncOpt.interval);
|
|
21
21
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
22
22
|
}
|
|
23
23
|
createLocalWork(t) {
|
|
@@ -86,11 +86,11 @@ class me {
|
|
|
86
86
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
87
87
|
}
|
|
88
88
|
activeServiceWorkShape(t) {
|
|
89
|
-
var
|
|
89
|
+
var k, d;
|
|
90
90
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c } = t;
|
|
91
91
|
if (!e)
|
|
92
92
|
return;
|
|
93
|
-
const n = e.toString(), h = (
|
|
93
|
+
const n = e.toString(), h = (k = this.vNodes.get(n)) == null ? void 0 : k.rect;
|
|
94
94
|
if (!((d = this.serviceWorkShapes) != null && d.has(n))) {
|
|
95
95
|
let S = {
|
|
96
96
|
toolsType: o,
|
|
@@ -119,12 +119,12 @@ class me {
|
|
|
119
119
|
for (const [c, n] of this.serviceWorkShapes.entries())
|
|
120
120
|
switch (n.toolsType) {
|
|
121
121
|
case f.LaserPen: {
|
|
122
|
-
const l = this.computNextAnimationIndex(n, 8),
|
|
122
|
+
const l = this.computNextAnimationIndex(n, 8), k = Math.max(0, n.animationIndex || 0), d = (n.animationWorkData || []).slice(k, l);
|
|
123
123
|
if ((n.animationIndex || 0) < l && ((o = n.node) == null || o.consumeService({
|
|
124
124
|
op: d,
|
|
125
125
|
isFullWork: !1
|
|
126
126
|
}), n.animationIndex = l, d.length && e.set(c, {
|
|
127
|
-
workState:
|
|
127
|
+
workState: k === 0 ? W.Start : l === ((r = n.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
|
|
128
128
|
op: d.slice(-2)
|
|
129
129
|
})), n.isDel) {
|
|
130
130
|
(i = n.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(c);
|
|
@@ -135,10 +135,10 @@ class me {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
for (const [c, n] of this.localWorkShapes.entries()) {
|
|
138
|
-
const { result: h, toolsType: l, isDel:
|
|
138
|
+
const { result: h, toolsType: l, isDel: k, workState: d } = n;
|
|
139
139
|
switch (l) {
|
|
140
140
|
case f.LaserPen: {
|
|
141
|
-
if (
|
|
141
|
+
if (k) {
|
|
142
142
|
n.node.clearTmpPoints(), this.localWorkShapes.delete(c), s.push({
|
|
143
143
|
removeIds: [c.toString()],
|
|
144
144
|
type: p.RemoveNode
|
|
@@ -199,7 +199,7 @@ class ke {
|
|
|
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", B.syncOpt.interval);
|
|
203
203
|
u(this, "fullWorkerDrawCount", 0);
|
|
204
204
|
u(this, "drawWorkActiveId");
|
|
205
205
|
u(this, "consumeCount", 0);
|
|
@@ -233,9 +233,9 @@ class ke {
|
|
|
233
233
|
// }
|
|
234
234
|
// }
|
|
235
235
|
async updateSelector(t) {
|
|
236
|
-
var
|
|
236
|
+
var k;
|
|
237
237
|
const e = this.workShapes.get(T);
|
|
238
|
-
if (!((
|
|
238
|
+
if (!((k = e == null ? void 0 : e.selectIds) != null && k.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
241
|
selectIds: ie(e.selectIds),
|
|
@@ -247,11 +247,11 @@ class ke {
|
|
|
247
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
|
-
const { toolsType:
|
|
250
|
+
const { toolsType: y, op: w, opt: v } = S;
|
|
251
251
|
c.set(d, {
|
|
252
252
|
opt: v,
|
|
253
|
-
toolsType:
|
|
254
|
-
ops: (
|
|
253
|
+
toolsType: y,
|
|
254
|
+
ops: (w == null ? void 0 : w.length) && X(w) || void 0
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
}), e.selectIds = a.selectIds);
|
|
@@ -290,8 +290,8 @@ class ke {
|
|
|
290
290
|
if (e != null && e.length) {
|
|
291
291
|
let r;
|
|
292
292
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
293
|
-
const { rect: a, name: c, toolsType: n, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0],
|
|
294
|
-
if (n === f.Text && le([l,
|
|
293
|
+
const { rect: a, name: c, toolsType: n, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], k = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
294
|
+
if (n === f.Text && le([l, k], a) && h.workState === W.Done) {
|
|
295
295
|
r = c;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
@@ -726,10 +726,17 @@ class ke {
|
|
|
726
726
|
const l = h.toolsType;
|
|
727
727
|
if (l === f.LaserPen)
|
|
728
728
|
return;
|
|
729
|
-
const
|
|
729
|
+
const k = this.workShapes.get(F), d = (i = k == null ? void 0 : k.selectIds) == null ? void 0 : i[0], S = h.consumeAll({ data: t, workerEngine: this });
|
|
730
730
|
switch (l) {
|
|
731
731
|
case f.Selector:
|
|
732
|
-
|
|
732
|
+
{
|
|
733
|
+
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && k.cursorBlur();
|
|
734
|
+
const y = [];
|
|
735
|
+
r && y.push({
|
|
736
|
+
type: p.None,
|
|
737
|
+
isLockSentEventCursor: r
|
|
738
|
+
}), S.type === p.Select && (S.selectIds && e.runReverseSelectWork(S.selectIds), y.push({ ...S, scenePath: o })), y.length && this.thread.post({ sp: y }), (c = h.selectIds) != null && c.length ? h.clearTmpPoints() : this.clearWorkShapeNodeCache(n);
|
|
739
|
+
}
|
|
733
740
|
break;
|
|
734
741
|
case f.PencilEraser:
|
|
735
742
|
this.drawPencilEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
|
|
@@ -748,13 +755,13 @@ class ke {
|
|
|
748
755
|
case f.Polygon:
|
|
749
756
|
case f.SpeechBalloon:
|
|
750
757
|
case f.Pencil: {
|
|
751
|
-
const
|
|
752
|
-
r &&
|
|
758
|
+
const y = [];
|
|
759
|
+
r && y.push({
|
|
753
760
|
type: p.None,
|
|
754
761
|
isLockSentEventCursor: r
|
|
755
|
-
}), S && (
|
|
762
|
+
}), S && (y.push(S), this.fullWorkerDrawCount = 0, this.thread.post({
|
|
756
763
|
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
757
|
-
sp:
|
|
764
|
+
sp: y
|
|
758
765
|
})), this.clearWorkShapeNodeCache(n);
|
|
759
766
|
break;
|
|
760
767
|
}
|
|
@@ -789,7 +796,7 @@ class Se {
|
|
|
789
796
|
u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
|
|
790
797
|
u(this, "runEffectId");
|
|
791
798
|
u(this, "animationId");
|
|
792
|
-
u(this, "syncUnitTime",
|
|
799
|
+
u(this, "syncUnitTime", B.syncOpt.interval);
|
|
793
800
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
794
801
|
}
|
|
795
802
|
async loadImageBitMap(t) {
|
|
@@ -850,14 +857,14 @@ class Se {
|
|
|
850
857
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
851
858
|
}
|
|
852
859
|
async animationDraw() {
|
|
853
|
-
var s, o, r, i, a, c, n, h, l,
|
|
860
|
+
var s, o, r, i, a, c, n, h, l, k, d, S, y, w, v, D, x, Z, j;
|
|
854
861
|
this.animationId = void 0;
|
|
855
862
|
let t = !1;
|
|
856
863
|
const e = /* @__PURE__ */ new Map();
|
|
857
|
-
for (const [N,
|
|
858
|
-
switch (
|
|
864
|
+
for (const [N, m] of this.workShapes.entries())
|
|
865
|
+
switch (m.toolsType) {
|
|
859
866
|
case f.Image: {
|
|
860
|
-
await ((s =
|
|
867
|
+
await ((s = m.node) == null ? void 0 : s.consumeServiceAsync({
|
|
861
868
|
isFullWork: !0,
|
|
862
869
|
worker: this
|
|
863
870
|
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
@@ -867,13 +874,13 @@ class Se {
|
|
|
867
874
|
break;
|
|
868
875
|
}
|
|
869
876
|
case f.Text: {
|
|
870
|
-
|
|
877
|
+
m.node && (await ((o = m.node) == null ? void 0 : o.consumeServiceAsync({
|
|
871
878
|
isFullWork: !0,
|
|
872
879
|
replaceId: N
|
|
873
880
|
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
874
881
|
var O;
|
|
875
882
|
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
876
|
-
}), (r =
|
|
883
|
+
}), (r = m.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
|
|
877
884
|
break;
|
|
878
885
|
}
|
|
879
886
|
case f.Arrow:
|
|
@@ -883,60 +890,60 @@ class Se {
|
|
|
883
890
|
case f.Star:
|
|
884
891
|
case f.Polygon:
|
|
885
892
|
case f.SpeechBalloon: {
|
|
886
|
-
const b = !!
|
|
887
|
-
if ((i =
|
|
888
|
-
const C =
|
|
889
|
-
(a =
|
|
890
|
-
op:
|
|
893
|
+
const b = !!m.ops;
|
|
894
|
+
if ((i = m.animationWorkData) != null && i.length) {
|
|
895
|
+
const C = m.oldRect;
|
|
896
|
+
(a = m.node) == null || a.consumeService({
|
|
897
|
+
op: m.animationWorkData,
|
|
891
898
|
isFullWork: b
|
|
892
899
|
}), b && (this.selectorWorkShapes.forEach((O, E) => {
|
|
893
900
|
var A;
|
|
894
901
|
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
|
|
895
|
-
}), (c =
|
|
896
|
-
workState: C ?
|
|
897
|
-
op:
|
|
902
|
+
}), (c = m.node) == null || c.clearTmpPoints(), this.workShapes.delete(N)), e.set(N, {
|
|
903
|
+
workState: C ? m.ops ? W.Done : W.Doing : W.Start,
|
|
904
|
+
op: m.animationWorkData.filter((O, E) => {
|
|
898
905
|
if (E % 3 !== 2)
|
|
899
906
|
return !0;
|
|
900
907
|
}).slice(-2)
|
|
901
|
-
}),
|
|
908
|
+
}), m.animationWorkData.length = 0;
|
|
902
909
|
}
|
|
903
910
|
break;
|
|
904
911
|
}
|
|
905
912
|
case f.Pencil: {
|
|
906
|
-
if (!
|
|
907
|
-
(n =
|
|
908
|
-
op:
|
|
913
|
+
if (!m.useAnimation && m.ops)
|
|
914
|
+
(n = m.node) == null || n.consumeService({
|
|
915
|
+
op: m.animationWorkData || [],
|
|
909
916
|
isFullWork: !0,
|
|
910
917
|
replaceId: N
|
|
911
|
-
}), (h =
|
|
918
|
+
}), (h = m.node) == null || h.updataOptService(m.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
|
|
912
919
|
var O;
|
|
913
920
|
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
914
|
-
}), (l =
|
|
915
|
-
else if (
|
|
916
|
-
if (
|
|
917
|
-
(
|
|
921
|
+
}), (l = m.node) == null || l.clearTmpPoints(), this.workShapes.delete(N);
|
|
922
|
+
else if (m.useAnimation) {
|
|
923
|
+
if (m.isDel) {
|
|
924
|
+
(k = m.node) == null || k.clearTmpPoints(), this.workShapes.delete(N);
|
|
918
925
|
break;
|
|
919
926
|
}
|
|
920
|
-
const b = 3, C = this.computNextAnimationIndex(
|
|
921
|
-
if ((
|
|
922
|
-
if ((
|
|
927
|
+
const b = 3, C = this.computNextAnimationIndex(m, b), O = m.isDiff ? 0 : Math.max(0, (m.animationIndex || 0) - b), E = (m.animationWorkData || []).slice(O, C), A = (S = (d = m.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : S.toString();
|
|
928
|
+
if ((m.animationIndex || 0) < C || m.isDiff) {
|
|
929
|
+
if ((y = m.node) == null || y.consumeService({
|
|
923
930
|
op: E,
|
|
924
931
|
isFullWork: !1
|
|
925
|
-
}),
|
|
932
|
+
}), m.animationIndex = C, m.isDiff && (m.isDiff = !1), E.length) {
|
|
926
933
|
const q = E.filter((_, ae) => {
|
|
927
934
|
if (ae % b !== b - 1)
|
|
928
935
|
return !0;
|
|
929
936
|
}).slice(-2);
|
|
930
937
|
e.set(N, {
|
|
931
|
-
workState: O === 0 ? W.Start : C === ((
|
|
938
|
+
workState: O === 0 ? W.Start : C === ((w = m.animationWorkData) == null ? void 0 : w.length) ? W.Done : W.Doing,
|
|
932
939
|
op: q
|
|
933
940
|
});
|
|
934
941
|
}
|
|
935
|
-
} else
|
|
936
|
-
op:
|
|
942
|
+
} else m.ops && ((v = m.node) == null || v.consumeService({
|
|
943
|
+
op: m.animationWorkData || [],
|
|
937
944
|
isFullWork: !0,
|
|
938
945
|
replaceId: A
|
|
939
|
-
}),
|
|
946
|
+
}), m.isDel = !0, e.set(N, {
|
|
940
947
|
workState: W.Done,
|
|
941
948
|
op: E.filter((q, _) => {
|
|
942
949
|
if (_ % b !== b - 1)
|
|
@@ -950,30 +957,30 @@ class Se {
|
|
|
950
957
|
}
|
|
951
958
|
case f.BitMapEraser:
|
|
952
959
|
case f.PencilEraser: {
|
|
953
|
-
if (
|
|
954
|
-
(D =
|
|
960
|
+
if (m.isDel) {
|
|
961
|
+
(D = m.node) == null || D.clearTmpPoints(), this.workShapes.delete(N);
|
|
955
962
|
break;
|
|
956
963
|
}
|
|
957
|
-
if (
|
|
958
|
-
const b =
|
|
964
|
+
if (m.ops && ((x = m.animationWorkData) != null && x.length)) {
|
|
965
|
+
const b = m.animationWorkData.slice(-3, -1);
|
|
959
966
|
e.set(N, {
|
|
960
967
|
workState: W.Done,
|
|
961
968
|
op: b
|
|
962
|
-
}),
|
|
969
|
+
}), m.isDel = !0;
|
|
963
970
|
break;
|
|
964
971
|
}
|
|
965
|
-
if (
|
|
966
|
-
const C = this.computNextAnimationIndex(
|
|
967
|
-
if (((
|
|
972
|
+
if (m.useAnimation) {
|
|
973
|
+
const C = this.computNextAnimationIndex(m, 3), O = m.isDiff ? 0 : Math.max(0, (m.animationIndex || 0) - 3), E = (m.animationWorkData || []).slice(O, C);
|
|
974
|
+
if (((m.animationIndex || 0) < C || m.isDiff) && ((Z = m.node) == null || Z.consumeService({
|
|
968
975
|
op: E,
|
|
969
|
-
isFullWork:
|
|
970
|
-
}),
|
|
976
|
+
isFullWork: m.toolsType !== f.BitMapEraser
|
|
977
|
+
}), m.animationIndex = C, m.isDiff && (m.isDiff = !1), E.length)) {
|
|
971
978
|
const A = E.filter((q, _) => {
|
|
972
979
|
if (_ % 3 !== 2)
|
|
973
980
|
return !0;
|
|
974
981
|
}).slice(-2);
|
|
975
982
|
e.set(N, {
|
|
976
|
-
workState: O === 0 ? W.Start : C === ((j =
|
|
983
|
+
workState: O === 0 ? W.Start : C === ((j = m.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
977
984
|
op: A
|
|
978
985
|
});
|
|
979
986
|
}
|
|
@@ -985,12 +992,12 @@ class Se {
|
|
|
985
992
|
}
|
|
986
993
|
if (t && this.runAnimation(), e.size) {
|
|
987
994
|
const N = [];
|
|
988
|
-
e.forEach((
|
|
995
|
+
e.forEach((m, b) => {
|
|
989
996
|
N.push({
|
|
990
997
|
type: p.Cursor,
|
|
991
998
|
uid: b.split(te)[0],
|
|
992
|
-
op:
|
|
993
|
-
workState:
|
|
999
|
+
op: m.op,
|
|
1000
|
+
workState: m.workState,
|
|
994
1001
|
viewId: this.thread.viewId
|
|
995
1002
|
});
|
|
996
1003
|
}), this.thread.post({ sp: N });
|
|
@@ -1020,12 +1027,12 @@ class Se {
|
|
|
1020
1027
|
return !1;
|
|
1021
1028
|
}
|
|
1022
1029
|
activeWorkShape(t) {
|
|
1023
|
-
var S,
|
|
1030
|
+
var S, y, w, v;
|
|
1024
1031
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
|
|
1025
1032
|
if (!e)
|
|
1026
1033
|
return;
|
|
1027
|
-
const l = e.toString(),
|
|
1028
|
-
if (!((
|
|
1034
|
+
const l = e.toString(), k = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
|
|
1035
|
+
if (!((y = this.workShapes) != null && y.has(l))) {
|
|
1029
1036
|
let D = {
|
|
1030
1037
|
toolsType: o,
|
|
1031
1038
|
animationWorkData: c || [],
|
|
@@ -1034,14 +1041,14 @@ class Se {
|
|
|
1034
1041
|
updateNodeOpt: i,
|
|
1035
1042
|
ops: a,
|
|
1036
1043
|
useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1037
|
-
oldRect:
|
|
1044
|
+
oldRect: k,
|
|
1038
1045
|
isDiff: !1,
|
|
1039
1046
|
imageBitmap: h
|
|
1040
1047
|
};
|
|
1041
|
-
o && s && (D = this.setNodeKey(l, D, o, s)), (
|
|
1048
|
+
o && s && (D = this.setNodeKey(l, D, o, s)), (w = this.workShapes) == null || w.set(l, D);
|
|
1042
1049
|
}
|
|
1043
1050
|
const d = (v = this.workShapes) == null ? void 0 : v.get(l);
|
|
1044
|
-
r && (d.type = r), a && (d.animationWorkData = U(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),
|
|
1051
|
+
r && (d.type = r), a && (d.animationWorkData = U(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), k && (d.oldRect = k), 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);
|
|
1045
1052
|
}
|
|
1046
1053
|
removeNode(t, e) {
|
|
1047
1054
|
t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1061,13 +1068,13 @@ class Se {
|
|
|
1061
1068
|
return;
|
|
1062
1069
|
const a = e.toString();
|
|
1063
1070
|
if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
|
|
1064
|
-
let
|
|
1071
|
+
let k = {
|
|
1065
1072
|
toolsType: o,
|
|
1066
1073
|
selectIds: i,
|
|
1067
1074
|
type: r,
|
|
1068
1075
|
opt: s
|
|
1069
1076
|
};
|
|
1070
|
-
o && s && (
|
|
1077
|
+
o && s && (k = this.setNodeKey(a, k, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, k);
|
|
1071
1078
|
}
|
|
1072
1079
|
const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
|
|
1073
1080
|
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
@@ -1223,15 +1230,15 @@ class ge extends M {
|
|
|
1223
1230
|
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1224
1231
|
}
|
|
1225
1232
|
updateSelectorCallback(e) {
|
|
1226
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1227
|
-
if (
|
|
1233
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, k = h.workState, d = o.sp || [];
|
|
1234
|
+
if (k === W.Start)
|
|
1228
1235
|
return {
|
|
1229
1236
|
sp: [],
|
|
1230
1237
|
render: []
|
|
1231
1238
|
};
|
|
1232
1239
|
const S = a == null ? void 0 : a.selectRect;
|
|
1233
1240
|
if (c) {
|
|
1234
|
-
|
|
1241
|
+
k === W.Doing && d.push({
|
|
1235
1242
|
type: p.Select,
|
|
1236
1243
|
selectIds: i.selectIds,
|
|
1237
1244
|
selectRect: S,
|
|
@@ -1240,17 +1247,17 @@ class ge extends M {
|
|
|
1240
1247
|
points: i.getChildrenPoints(),
|
|
1241
1248
|
textOpt: i.textOpt
|
|
1242
1249
|
});
|
|
1243
|
-
for (const [
|
|
1244
|
-
l &&
|
|
1245
|
-
...
|
|
1246
|
-
workId:
|
|
1250
|
+
for (const [y, w] of r.entries())
|
|
1251
|
+
l && w.toolsType === f.Text ? d.push({
|
|
1252
|
+
...w,
|
|
1253
|
+
workId: y,
|
|
1247
1254
|
type: p.TextUpdate,
|
|
1248
1255
|
dataType: g.Local,
|
|
1249
1256
|
willSyncService: !0
|
|
1250
1257
|
}) : d.push(
|
|
1251
1258
|
{
|
|
1252
|
-
...
|
|
1253
|
-
workId:
|
|
1259
|
+
...w,
|
|
1260
|
+
workId: y,
|
|
1254
1261
|
type: p.UpdateNode,
|
|
1255
1262
|
updateNodeOpt: {
|
|
1256
1263
|
useAnimation: !1
|
|
@@ -1295,7 +1302,7 @@ class We extends M {
|
|
|
1295
1302
|
}));
|
|
1296
1303
|
}
|
|
1297
1304
|
updateSelectorCallback(e) {
|
|
1298
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n } = s, h = c.workState, l = o.sp || [],
|
|
1305
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n } = s, h = c.workState, l = o.sp || [], k = i == null ? void 0 : i.selectRect;
|
|
1299
1306
|
if (h === W.Start)
|
|
1300
1307
|
return {
|
|
1301
1308
|
sp: [],
|
|
@@ -1305,7 +1312,7 @@ class We extends M {
|
|
|
1305
1312
|
l.push({
|
|
1306
1313
|
type: p.Select,
|
|
1307
1314
|
selectIds: r.selectIds,
|
|
1308
|
-
selectRect:
|
|
1315
|
+
selectRect: k,
|
|
1309
1316
|
willSyncService: !0,
|
|
1310
1317
|
isSync: !0,
|
|
1311
1318
|
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
@@ -1359,9 +1366,9 @@ class Te extends M {
|
|
|
1359
1366
|
}));
|
|
1360
1367
|
}
|
|
1361
1368
|
updateSelectorCallback(e) {
|
|
1362
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s,
|
|
1369
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, k = c.workState, d = o.sp || [], S = i == null ? void 0 : i.selectRect;
|
|
1363
1370
|
if (n) {
|
|
1364
|
-
h &&
|
|
1371
|
+
h && k === W.Done && d.push({
|
|
1365
1372
|
type: p.Select,
|
|
1366
1373
|
selectIds: r.selectIds,
|
|
1367
1374
|
selectRect: S,
|
|
@@ -1369,11 +1376,11 @@ class Te extends M {
|
|
|
1369
1376
|
isSync: l,
|
|
1370
1377
|
points: r.getChildrenPoints()
|
|
1371
1378
|
});
|
|
1372
|
-
for (const [
|
|
1379
|
+
for (const [y, w] of a.entries())
|
|
1373
1380
|
d.push(
|
|
1374
1381
|
{
|
|
1375
|
-
...
|
|
1376
|
-
workId:
|
|
1382
|
+
...w,
|
|
1383
|
+
workId: y,
|
|
1377
1384
|
type: p.UpdateNode,
|
|
1378
1385
|
updateNodeOpt: {
|
|
1379
1386
|
useAnimation: !1
|
|
@@ -1410,9 +1417,9 @@ class Le extends M {
|
|
|
1410
1417
|
}));
|
|
1411
1418
|
}
|
|
1412
1419
|
updateSelectorCallback(e) {
|
|
1413
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1414
|
-
if (c &&
|
|
1415
|
-
h.fontSize &&
|
|
1420
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, k = o.sp || [], d = a == null ? void 0 : a.selectRect;
|
|
1421
|
+
if (c && k) {
|
|
1422
|
+
h.fontSize && k.push({
|
|
1416
1423
|
type: p.Select,
|
|
1417
1424
|
selectIds: i.selectIds,
|
|
1418
1425
|
selectRect: d,
|
|
@@ -1420,16 +1427,16 @@ class Le extends M {
|
|
|
1420
1427
|
isSync: n,
|
|
1421
1428
|
points: i.getChildrenPoints()
|
|
1422
1429
|
});
|
|
1423
|
-
for (const [S,
|
|
1424
|
-
l &&
|
|
1425
|
-
...
|
|
1430
|
+
for (const [S, y] of r.entries())
|
|
1431
|
+
l && y.toolsType === f.Text ? k.push({
|
|
1432
|
+
...y,
|
|
1426
1433
|
workId: S,
|
|
1427
1434
|
type: p.TextUpdate,
|
|
1428
1435
|
dataType: g.Local,
|
|
1429
1436
|
willSyncService: !0
|
|
1430
|
-
}) :
|
|
1437
|
+
}) : k.push(
|
|
1431
1438
|
{
|
|
1432
|
-
...
|
|
1439
|
+
...y,
|
|
1433
1440
|
workId: S,
|
|
1434
1441
|
type: p.UpdateNode,
|
|
1435
1442
|
updateNodeOpt: {
|
|
@@ -1440,7 +1447,7 @@ class Le extends M {
|
|
|
1440
1447
|
);
|
|
1441
1448
|
}
|
|
1442
1449
|
return {
|
|
1443
|
-
sp:
|
|
1450
|
+
sp: k
|
|
1444
1451
|
};
|
|
1445
1452
|
}
|
|
1446
1453
|
}
|
|
@@ -1471,11 +1478,11 @@ class Ne extends M {
|
|
|
1471
1478
|
updateSelectorCallback(e) {
|
|
1472
1479
|
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n } = s, h = o.sp || [], l = a == null ? void 0 : a.selectRect;
|
|
1473
1480
|
if (c && h) {
|
|
1474
|
-
for (const [
|
|
1481
|
+
for (const [k, d] of r.entries())
|
|
1475
1482
|
h.push(
|
|
1476
1483
|
{
|
|
1477
1484
|
...d,
|
|
1478
|
-
workId:
|
|
1485
|
+
workId: k,
|
|
1479
1486
|
type: p.UpdateNode,
|
|
1480
1487
|
updateNodeOpt: {
|
|
1481
1488
|
useAnimation: !1
|
|
@@ -1519,7 +1526,7 @@ class be extends M {
|
|
|
1519
1526
|
}));
|
|
1520
1527
|
}
|
|
1521
1528
|
updateSelectorCallback(e) {
|
|
1522
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [],
|
|
1529
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [], k = a == null ? void 0 : a.selectRect;
|
|
1523
1530
|
if (c && l) {
|
|
1524
1531
|
for (const [d, S] of r.entries())
|
|
1525
1532
|
l.push(
|
|
@@ -1540,7 +1547,7 @@ class be extends M {
|
|
|
1540
1547
|
canRotate: i.canRotate,
|
|
1541
1548
|
type: p.Select,
|
|
1542
1549
|
selectIds: i.selectIds,
|
|
1543
|
-
selectRect:
|
|
1550
|
+
selectRect: k,
|
|
1544
1551
|
willSyncService: c,
|
|
1545
1552
|
isSync: n
|
|
1546
1553
|
});
|
|
@@ -1659,8 +1666,8 @@ class Oe {
|
|
|
1659
1666
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
1660
1667
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1661
1668
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1662
|
-
const s =
|
|
1663
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
1669
|
+
const s = B.bufferSize.full, o = B.bufferSize.sub;
|
|
1670
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === P ? s : o * 2 }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === P, o), contextType: "2d" }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === P, o), contextType: "2d" }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === P, o), contextType: "2d" }), this.vNodes = new pe(t, this.scene);
|
|
1664
1671
|
const r = {
|
|
1665
1672
|
thread: this,
|
|
1666
1673
|
vNodes: this.vNodes
|
|
@@ -1708,14 +1715,14 @@ class Oe {
|
|
|
1708
1715
|
}
|
|
1709
1716
|
async on(t) {
|
|
1710
1717
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1711
|
-
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h } = t,
|
|
1718
|
+
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h, isLockSentEventCursor: l } = t, k = i == null ? void 0 : i.toString();
|
|
1712
1719
|
switch (e) {
|
|
1713
1720
|
case p.UpdateDpr:
|
|
1714
1721
|
H(t.dpr) && this.updateDpr(t.dpr);
|
|
1715
1722
|
break;
|
|
1716
1723
|
case p.AuthClear: {
|
|
1717
|
-
const { clearUids:
|
|
1718
|
-
this.vNodes.setCanClearUids(
|
|
1724
|
+
const { clearUids: d, localUid: S } = t;
|
|
1725
|
+
this.vNodes.setCanClearUids(d), this.vNodes.setLocalUid(S);
|
|
1719
1726
|
break;
|
|
1720
1727
|
}
|
|
1721
1728
|
case p.Destroy:
|
|
@@ -1729,30 +1736,35 @@ class Oe {
|
|
|
1729
1736
|
break;
|
|
1730
1737
|
case p.UpdateTools:
|
|
1731
1738
|
if (s && o) {
|
|
1732
|
-
const
|
|
1739
|
+
const d = {
|
|
1733
1740
|
toolsType: s,
|
|
1734
1741
|
toolsOpt: o
|
|
1735
1742
|
};
|
|
1736
|
-
this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(
|
|
1743
|
+
this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(d) : this.localWork.setToolsOpt(d);
|
|
1737
1744
|
}
|
|
1738
1745
|
break;
|
|
1739
1746
|
case p.CreateWork:
|
|
1740
|
-
if (
|
|
1747
|
+
if (k && o && s) {
|
|
1741
1748
|
if (this.topWork.canUseTopLayer(s)) {
|
|
1742
1749
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
1743
1750
|
toolsType: s,
|
|
1744
1751
|
toolsOpt: o
|
|
1745
|
-
}), this.topWork.setWorkOptions(
|
|
1752
|
+
}), this.topWork.setWorkOptions(k, o);
|
|
1746
1753
|
break;
|
|
1747
1754
|
}
|
|
1748
1755
|
this.localWork.getToolsOpt() || this.localWork.setToolsOpt({
|
|
1749
1756
|
toolsType: s,
|
|
1750
1757
|
toolsOpt: o
|
|
1751
|
-
}), this.localWork.setWorkOptions(
|
|
1758
|
+
}), this.localWork.setWorkOptions(k, o);
|
|
1752
1759
|
}
|
|
1753
1760
|
break;
|
|
1754
1761
|
case p.DrawWork:
|
|
1755
|
-
a === W.Done && r === g.Local ? this.consumeDrawAll(r, t)
|
|
1762
|
+
a === W.Done && r === g.Local ? (this.consumeDrawAll(r, t), s === f.LaserPen && l && this.post({
|
|
1763
|
+
sp: [{
|
|
1764
|
+
type: p.None,
|
|
1765
|
+
isLockSentEventCursor: l
|
|
1766
|
+
}]
|
|
1767
|
+
})) : this.consumeDraw(r, t);
|
|
1756
1768
|
break;
|
|
1757
1769
|
case p.UpdateNode:
|
|
1758
1770
|
case p.FullWork:
|
|
@@ -1779,28 +1791,28 @@ class Oe {
|
|
|
1779
1791
|
break;
|
|
1780
1792
|
case p.GetImageBitMap:
|
|
1781
1793
|
if (c && n && i) {
|
|
1782
|
-
const
|
|
1783
|
-
this.deleteCachedImagesByWorkId(
|
|
1794
|
+
const d = i.toString();
|
|
1795
|
+
this.deleteCachedImagesByWorkId(d), this.cacheImages.set(c, {
|
|
1784
1796
|
imageBitmap: n,
|
|
1785
|
-
workId:
|
|
1797
|
+
workId: d
|
|
1786
1798
|
});
|
|
1787
|
-
const
|
|
1788
|
-
if (
|
|
1789
|
-
const { resolve:
|
|
1790
|
-
w && clearTimeout(w),
|
|
1799
|
+
const S = this.imageResolveMap.get(c);
|
|
1800
|
+
if (S) {
|
|
1801
|
+
const { resolve: y, timer: w } = S;
|
|
1802
|
+
w && clearTimeout(w), y && y(c);
|
|
1791
1803
|
}
|
|
1792
1804
|
}
|
|
1793
1805
|
break;
|
|
1794
1806
|
case p.GetVNodeInfo:
|
|
1795
1807
|
if (i && h) {
|
|
1796
|
-
const
|
|
1808
|
+
const d = h.map((S) => this.vNodes.get(S));
|
|
1797
1809
|
this.post({
|
|
1798
1810
|
sp: [
|
|
1799
1811
|
{
|
|
1800
1812
|
type: p.GetVNodeInfo,
|
|
1801
1813
|
dataType: g.Local,
|
|
1802
1814
|
workId: i,
|
|
1803
|
-
vInfo:
|
|
1815
|
+
vInfo: d
|
|
1804
1816
|
}
|
|
1805
1817
|
]
|
|
1806
1818
|
});
|
|
@@ -1821,28 +1833,28 @@ class Oe {
|
|
|
1821
1833
|
return;
|
|
1822
1834
|
let l = i;
|
|
1823
1835
|
if (a === se.Iconify) {
|
|
1824
|
-
const [
|
|
1825
|
-
l = `${i}?width=${
|
|
1836
|
+
const [y, w] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
1837
|
+
l = `${i}?width=${y}&height=${w}&color=${h}`;
|
|
1826
1838
|
}
|
|
1827
1839
|
if (this.cacheImages.has(l)) {
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1830
|
-
return
|
|
1840
|
+
const y = this.getCachedImages(l);
|
|
1841
|
+
if (y)
|
|
1842
|
+
return y;
|
|
1831
1843
|
}
|
|
1832
1844
|
if (this.imageResolveMap.has(l)) {
|
|
1833
|
-
const
|
|
1834
|
-
if (
|
|
1835
|
-
return
|
|
1845
|
+
const y = this.getCachedImagesByWorkId(r);
|
|
1846
|
+
if (y)
|
|
1847
|
+
return y;
|
|
1836
1848
|
}
|
|
1837
|
-
const S = await new Promise((
|
|
1838
|
-
const
|
|
1849
|
+
const S = await new Promise((y) => {
|
|
1850
|
+
const w = this.imageResolveMap.get(l) || {
|
|
1839
1851
|
resolve: void 0,
|
|
1840
1852
|
timer: void 0
|
|
1841
1853
|
};
|
|
1842
|
-
|
|
1854
|
+
w.timer && clearTimeout(w.timer), w.resolve = y, w.timer = setTimeout(() => {
|
|
1843
1855
|
const v = this.imageResolveMap.get(l);
|
|
1844
1856
|
v != null && v.resolve && v.resolve(l);
|
|
1845
|
-
}, 5e3), this.imageResolveMap.set(l,
|
|
1857
|
+
}, 5e3), this.imageResolveMap.set(l, w), this.opt.post({
|
|
1846
1858
|
sp: [{
|
|
1847
1859
|
imageSrc: l,
|
|
1848
1860
|
workId: r,
|
|
@@ -1996,9 +2008,9 @@ class Oe {
|
|
|
1996
2008
|
for (const [n, h] of r.entries()) {
|
|
1997
2009
|
const l = this.vNodes.get(n);
|
|
1998
2010
|
if (l) {
|
|
1999
|
-
const
|
|
2011
|
+
const k = h, d = l.rect, S = this.getSceneRect(), y = G(k, S), w = G(d, S);
|
|
2000
2012
|
let v = !1;
|
|
2001
|
-
if ((
|
|
2013
|
+
if ((y !== w || k.w !== d.w || k.h !== d.h || w === Q.intersect) && (v = !0), v) {
|
|
2002
2014
|
const { toolsType: D, opt: x } = l;
|
|
2003
2015
|
D === f.Text && x.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
2004
2016
|
}
|
|
@@ -2021,13 +2033,13 @@ class Oe {
|
|
|
2021
2033
|
if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
|
|
2022
2034
|
const d = this.vNodes.get(l);
|
|
2023
2035
|
if (d) {
|
|
2024
|
-
const { toolsType: S, opt:
|
|
2036
|
+
const { toolsType: S, opt: y, rect: w } = d, v = this.localWork.setFullWork({
|
|
2025
2037
|
toolsType: S,
|
|
2026
|
-
opt:
|
|
2038
|
+
opt: y,
|
|
2027
2039
|
workId: l
|
|
2028
2040
|
});
|
|
2029
2041
|
if (v) {
|
|
2030
|
-
const D = this.getSceneRect(), x = G(
|
|
2042
|
+
const D = this.getSceneRect(), x = G(w, D);
|
|
2031
2043
|
n.push(v.consumeServiceAsync({
|
|
2032
2044
|
isFullWork: !0,
|
|
2033
2045
|
replaceId: l,
|
|
@@ -2098,7 +2110,7 @@ class Ee {
|
|
|
2098
2110
|
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2099
2111
|
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2100
2112
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
2101
|
-
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 ===
|
|
2113
|
+
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 === P ? 6e3 : 3e3, contextType: "2d" });
|
|
2102
2114
|
}
|
|
2103
2115
|
getCachedImages(t) {
|
|
2104
2116
|
var e;
|
|
@@ -2161,28 +2173,28 @@ class Ee {
|
|
|
2161
2173
|
return;
|
|
2162
2174
|
let l = i;
|
|
2163
2175
|
if (a === se.Iconify) {
|
|
2164
|
-
const [
|
|
2165
|
-
l = `${i}?width=${
|
|
2176
|
+
const [y, w] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
2177
|
+
l = `${i}?width=${y}&height=${w}&color=${h}`;
|
|
2166
2178
|
}
|
|
2167
2179
|
if (this.cacheImages.has(l)) {
|
|
2168
|
-
const
|
|
2169
|
-
if (
|
|
2170
|
-
return
|
|
2180
|
+
const y = this.getCachedImages(l);
|
|
2181
|
+
if (y)
|
|
2182
|
+
return y;
|
|
2171
2183
|
}
|
|
2172
2184
|
if (this.imageResolveMap.has(l)) {
|
|
2173
|
-
const
|
|
2174
|
-
if (
|
|
2175
|
-
return
|
|
2185
|
+
const y = this.getCachedImagesByWorkId(r);
|
|
2186
|
+
if (y)
|
|
2187
|
+
return y;
|
|
2176
2188
|
}
|
|
2177
|
-
const S = await new Promise((
|
|
2178
|
-
const
|
|
2189
|
+
const S = await new Promise((y) => {
|
|
2190
|
+
const w = this.imageResolveMap.get(l) || {
|
|
2179
2191
|
resolve: void 0,
|
|
2180
2192
|
timer: void 0
|
|
2181
2193
|
};
|
|
2182
|
-
|
|
2194
|
+
w.timer && clearTimeout(w.timer), w.resolve = y, w.timer = setTimeout(() => {
|
|
2183
2195
|
const v = this.imageResolveMap.get(l);
|
|
2184
2196
|
v != null && v.resolve && v.resolve(l);
|
|
2185
|
-
}, 5e3), this.imageResolveMap.set(l,
|
|
2197
|
+
}, 5e3), this.imageResolveMap.set(l, w), this.opt.post({
|
|
2186
2198
|
sp: [{
|
|
2187
2199
|
imageSrc: l,
|
|
2188
2200
|
workId: r,
|
|
@@ -2241,14 +2253,14 @@ class Ee {
|
|
|
2241
2253
|
switch (h == null ? void 0 : h.type) {
|
|
2242
2254
|
case p.UpdateNode:
|
|
2243
2255
|
case p.FullWork: {
|
|
2244
|
-
const { opt: l } = h,
|
|
2256
|
+
const { opt: l } = h, k = {
|
|
2245
2257
|
...h,
|
|
2246
2258
|
opt: l,
|
|
2247
2259
|
workId: n,
|
|
2248
2260
|
msgType: p.FullWork,
|
|
2249
2261
|
dataType: g.Service,
|
|
2250
2262
|
viewId: this.viewId
|
|
2251
|
-
}, d = await this.runFullWork(
|
|
2263
|
+
}, d = await this.runFullWork(k);
|
|
2252
2264
|
a = V(a, d);
|
|
2253
2265
|
break;
|
|
2254
2266
|
}
|
|
@@ -2404,20 +2416,20 @@ class _e {
|
|
|
2404
2416
|
async consume(t) {
|
|
2405
2417
|
var e, s, o, r;
|
|
2406
2418
|
for (const i of t.values()) {
|
|
2407
|
-
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt:
|
|
2419
|
+
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: k, cameraOpt: d, isSubWorker: S } = i;
|
|
2408
2420
|
if (a === p.Console) {
|
|
2409
2421
|
console.log(this);
|
|
2410
2422
|
continue;
|
|
2411
2423
|
}
|
|
2412
2424
|
if (a === p.Init) {
|
|
2413
|
-
const
|
|
2414
|
-
if (
|
|
2425
|
+
const w = (e = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : e.displayer, v = w == null ? void 0 : w.canvasContainerRef.current;
|
|
2426
|
+
if (w && v && l && k) {
|
|
2415
2427
|
const D = this.createMainThread(c, {
|
|
2416
|
-
displayer:
|
|
2428
|
+
displayer: w,
|
|
2417
2429
|
container: v,
|
|
2418
2430
|
layerOpt: l,
|
|
2419
2431
|
master: this.master,
|
|
2420
|
-
canvasOpt:
|
|
2432
|
+
canvasOpt: k,
|
|
2421
2433
|
post: this.post.bind(this)
|
|
2422
2434
|
});
|
|
2423
2435
|
this.mainThreadMap.set(c, D), D && d && D.setCameraOpt(d);
|
|
@@ -2425,8 +2437,8 @@ class _e {
|
|
|
2425
2437
|
continue;
|
|
2426
2438
|
}
|
|
2427
2439
|
if ((a === p.Snapshot || a === p.BoundingBox) && c === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2428
|
-
const
|
|
2429
|
-
if (
|
|
2440
|
+
const w = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = w.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2441
|
+
if (w && v && d) {
|
|
2430
2442
|
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
2431
2443
|
const D = {
|
|
2432
2444
|
...J.defaultLayerOpt,
|
|
@@ -2439,7 +2451,7 @@ class _e {
|
|
|
2439
2451
|
height: d.height
|
|
2440
2452
|
};
|
|
2441
2453
|
this.snapshotThread = this.createSnapshotThread(c, {
|
|
2442
|
-
displayer:
|
|
2454
|
+
displayer: w,
|
|
2443
2455
|
container: v,
|
|
2444
2456
|
layerOpt: D,
|
|
2445
2457
|
master: this.master,
|
|
@@ -2456,19 +2468,19 @@ class _e {
|
|
|
2456
2468
|
continue;
|
|
2457
2469
|
}
|
|
2458
2470
|
if (a === p.TasksQueue && (n != null && n.size)) {
|
|
2459
|
-
for (const [
|
|
2460
|
-
const D = n.get(
|
|
2471
|
+
for (const [w, v] of this.mainThreadMap.entries()) {
|
|
2472
|
+
const D = n.get(w);
|
|
2461
2473
|
D && (await v.on(D), h && this.post({ workerTasksqueueCount: h }));
|
|
2462
2474
|
}
|
|
2463
2475
|
continue;
|
|
2464
2476
|
}
|
|
2465
2477
|
if (c === ue) {
|
|
2466
|
-
for (const
|
|
2467
|
-
|
|
2478
|
+
for (const w of this.mainThreadMap.values())
|
|
2479
|
+
w.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2468
2480
|
continue;
|
|
2469
2481
|
}
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2482
|
+
const y = this.mainThreadMap.get(c);
|
|
2483
|
+
y && (y.on(i), a === p.Destroy && this.mainThreadMap.delete(c));
|
|
2472
2484
|
}
|
|
2473
2485
|
}
|
|
2474
2486
|
}
|