@netless/appliance-plugin 1.1.17-beta.8 → 1.1.17-beta.9
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-p8Ghqw.js +502 -0
- package/cdn/subWorker-C1Gs0N.js +502 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +16 -15
- package/dist/core/mainEngine.d.ts +4 -0
- package/dist/core/mainThread/subLocalThread.d.ts +3 -5
- package/dist/core/tools/pencil.d.ts +5 -0
- package/dist/core/tools/pencilEraser.d.ts +63 -38
- package/dist/core/utils/clipper.d.ts +8 -0
- package/dist/core/utils/polygonUtils.d.ts +8 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -2
- package/dist/fullWorker.js +211 -150
- package/dist/index-BSGcWUci.js +1 -0
- package/dist/{index-DZmnrj_U.mjs → index-BianYC4r.mjs} +208 -202
- package/dist/{index-BwYgPPna.mjs → index-CZ7SSEYU.mjs} +3999 -3787
- package/dist/index-DDtbIS6S.js +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +0 -1
- package/dist/plugin/baseViewContainerManager.d.ts +9 -1
- package/dist/plugin/const.d.ts +1 -0
- package/dist/plugin/types.d.ts +11 -1
- package/dist/subWorker.js +211 -150
- package/package.json +2 -1
- package/cdn/fullWorker-Dma-pe.js +0 -441
- package/cdn/subWorker-1KsgJX.js +0 -441
- package/dist/index-D1nbiAD6.js +0 -1
- package/dist/index-DR0wLn0R.js +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
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 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
|
|
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 I, M as P, V as he, j as se, T as Y, k as G, l as Q, m as V, n as pe, o as K, p as J, q as de } from "./index-CZ7SSEYU.mjs";
|
|
5
5
|
import { Scene as oe, Group as re } from "spritejs";
|
|
6
|
-
import { cloneDeep as ie, xor as
|
|
6
|
+
import { cloneDeep as ie, xor as ue, isNumber as H, isEqual as ee } from "lodash";
|
|
7
|
+
import "clipper-lib";
|
|
7
8
|
import "lineclip";
|
|
8
9
|
import "white-web-sdk";
|
|
9
10
|
import "react-dom";
|
|
10
11
|
import "react";
|
|
11
12
|
import "eventemitter2";
|
|
12
|
-
class
|
|
13
|
+
class fe {
|
|
13
14
|
constructor(t) {
|
|
14
15
|
u(this, "vNodes");
|
|
15
16
|
u(this, "thread");
|
|
@@ -86,11 +87,11 @@ class me {
|
|
|
86
87
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
87
88
|
}
|
|
88
89
|
activeServiceWorkShape(t) {
|
|
89
|
-
var
|
|
90
|
+
var m, d;
|
|
90
91
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c } = t;
|
|
91
92
|
if (!e)
|
|
92
93
|
return;
|
|
93
|
-
const n = e.toString(), h = (
|
|
94
|
+
const n = e.toString(), h = (m = this.vNodes.get(n)) == null ? void 0 : m.rect;
|
|
94
95
|
if (!((d = this.serviceWorkShapes) != null && d.has(n))) {
|
|
95
96
|
let S = {
|
|
96
97
|
toolsType: o,
|
|
@@ -119,12 +120,12 @@ class me {
|
|
|
119
120
|
for (const [c, n] of this.serviceWorkShapes.entries())
|
|
120
121
|
switch (n.toolsType) {
|
|
121
122
|
case f.LaserPen: {
|
|
122
|
-
const l = this.computNextAnimationIndex(n, 8),
|
|
123
|
+
const l = this.computNextAnimationIndex(n, 8), m = Math.max(0, n.animationIndex || 0), d = (n.animationWorkData || []).slice(m, l);
|
|
123
124
|
if ((n.animationIndex || 0) < l && ((o = n.node) == null || o.consumeService({
|
|
124
125
|
op: d,
|
|
125
126
|
isFullWork: !1
|
|
126
127
|
}), n.animationIndex = l, d.length && e.set(c, {
|
|
127
|
-
workState:
|
|
128
|
+
workState: m === 0 ? W.Start : l === ((r = n.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
|
|
128
129
|
op: d.slice(-2)
|
|
129
130
|
})), n.isDel) {
|
|
130
131
|
(i = n.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(c);
|
|
@@ -135,10 +136,10 @@ class me {
|
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
for (const [c, n] of this.localWorkShapes.entries()) {
|
|
138
|
-
const { result: h, toolsType: l, isDel:
|
|
139
|
+
const { result: h, toolsType: l, isDel: m, workState: d } = n;
|
|
139
140
|
switch (l) {
|
|
140
141
|
case f.LaserPen: {
|
|
141
|
-
if (
|
|
142
|
+
if (m) {
|
|
142
143
|
n.node.clearTmpPoints(), this.localWorkShapes.delete(c), s.push({
|
|
143
144
|
removeIds: [c.toString()],
|
|
144
145
|
type: p.RemoveNode
|
|
@@ -190,7 +191,7 @@ class me {
|
|
|
190
191
|
this.runAnimation();
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
|
-
class
|
|
194
|
+
class me {
|
|
194
195
|
constructor(t) {
|
|
195
196
|
u(this, "vNodes");
|
|
196
197
|
u(this, "thread");
|
|
@@ -203,9 +204,6 @@ class ke {
|
|
|
203
204
|
u(this, "fullWorkerDrawCount", 0);
|
|
204
205
|
u(this, "drawWorkActiveId");
|
|
205
206
|
u(this, "consumeCount", 0);
|
|
206
|
-
u(this, "batchEraserCombine", he(() => {
|
|
207
|
-
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
208
|
-
}, 100, { leading: !1 }));
|
|
209
207
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
210
208
|
}
|
|
211
209
|
async loadImageBitMap(t) {
|
|
@@ -233,9 +231,9 @@ class ke {
|
|
|
233
231
|
// }
|
|
234
232
|
// }
|
|
235
233
|
async updateSelector(t) {
|
|
236
|
-
var
|
|
234
|
+
var m;
|
|
237
235
|
const e = this.workShapes.get(T);
|
|
238
|
-
if (!((
|
|
236
|
+
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
239
237
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
|
|
240
238
|
updateSelectorOpt: r,
|
|
241
239
|
selectIds: ie(e.selectIds),
|
|
@@ -244,7 +242,7 @@ class ke {
|
|
|
244
242
|
worker: this
|
|
245
243
|
})), c = /* @__PURE__ */ new Map();
|
|
246
244
|
let n;
|
|
247
|
-
a != null && a.selectIds && (n =
|
|
245
|
+
a != null && a.selectIds && (n = ue(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
|
|
248
246
|
const S = this.vNodes.get(d);
|
|
249
247
|
if (S) {
|
|
250
248
|
const { toolsType: y, op: w, opt: v } = S;
|
|
@@ -290,8 +288,8 @@ class ke {
|
|
|
290
288
|
if (e != null && e.length) {
|
|
291
289
|
let r;
|
|
292
290
|
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,
|
|
291
|
+
const { rect: a, name: c, toolsType: n, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], m = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
292
|
+
if (n === f.Text && le([l, m], a) && h.workState === W.Done) {
|
|
295
293
|
r = c;
|
|
296
294
|
break;
|
|
297
295
|
}
|
|
@@ -579,31 +577,37 @@ class ke {
|
|
|
579
577
|
}
|
|
580
578
|
a.length && this.thread.post({ sp: a });
|
|
581
579
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
this.batchEraserWorks.add(a), s.push({
|
|
589
|
-
type: p.FullWork,
|
|
590
|
-
workId: a,
|
|
591
|
-
ops: X(i.op),
|
|
592
|
-
opt: i.opt,
|
|
593
|
-
toolsType: i.toolsType,
|
|
594
|
-
updateNodeOpt: {
|
|
595
|
-
useAnimation: !1
|
|
596
|
-
}
|
|
597
|
-
});
|
|
580
|
+
drawPencilEraserFull(t, e, s) {
|
|
581
|
+
const { willNewNodes: o, willDeleteNodes: r } = e, i = t.getWorkId(), a = [
|
|
582
|
+
{
|
|
583
|
+
type: p.RemoveNode,
|
|
584
|
+
removeIds: [i],
|
|
585
|
+
viewId: this.thread.viewId
|
|
598
586
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
(r = t.removeIds) == null || r.forEach((i) => {
|
|
602
|
-
this.batchEraserRemoveNodes.add(i);
|
|
603
|
-
}), e && s.push({
|
|
587
|
+
];
|
|
588
|
+
if (s && a.push({
|
|
604
589
|
type: p.None,
|
|
605
|
-
isLockSentEventCursor:
|
|
606
|
-
}),
|
|
590
|
+
isLockSentEventCursor: s
|
|
591
|
+
}), o != null && o.size || r != null && r.size) {
|
|
592
|
+
if (o != null && o.size)
|
|
593
|
+
for (const [c, n] of o)
|
|
594
|
+
a.push({
|
|
595
|
+
type: p.FullWork,
|
|
596
|
+
dataType: g.Local,
|
|
597
|
+
ops: X(n.op),
|
|
598
|
+
opt: n.opt,
|
|
599
|
+
workId: c,
|
|
600
|
+
updateNodeOpt: {
|
|
601
|
+
useAnimation: !1
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
r != null && r.size && a.push({
|
|
605
|
+
type: p.RemoveNode,
|
|
606
|
+
removeIds: [...r],
|
|
607
|
+
viewId: this.thread.viewId
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
a.length && this.thread.post({ sp: a });
|
|
607
611
|
}
|
|
608
612
|
drawEraser(t, e) {
|
|
609
613
|
const s = [];
|
|
@@ -612,22 +616,32 @@ class ke {
|
|
|
612
616
|
isLockSentEventCursor: e
|
|
613
617
|
}), this.thread.post({ sp: s, consumeCount: this.consumeCount });
|
|
614
618
|
}
|
|
615
|
-
updateBatchEraserCombineNode(
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
619
|
+
// private updateBatchEraserCombineNode(inFullLayerIds:Set<string>,removeIds:Set<string>) {
|
|
620
|
+
// for (const key of removeIds.keys()) {
|
|
621
|
+
// this.thread.fullLayer.getElementsByName(key).forEach(node => {
|
|
622
|
+
// node.remove();
|
|
623
|
+
// removeTexture(node, this.thread.fullLayer.parent as Layer);
|
|
624
|
+
// });
|
|
625
|
+
// }
|
|
626
|
+
// inFullLayerIds.forEach(key=>{
|
|
627
|
+
// const info = this.vNodes.get(key);
|
|
628
|
+
// if (info && info.toolsType === EToolsKey.Pencil) {
|
|
629
|
+
// const node = this.thread.fullLayer.getElementsByName(key)[0];
|
|
630
|
+
// if (!node) {
|
|
631
|
+
// const workShape = this.setFullWork({...info, workId: key}) as PencilShape;
|
|
632
|
+
// workShape && workShape.consumeService({
|
|
633
|
+
// op: info.op,
|
|
634
|
+
// isFullWork: true
|
|
635
|
+
// });
|
|
636
|
+
// }
|
|
637
|
+
// }
|
|
638
|
+
// })
|
|
639
|
+
// }
|
|
640
|
+
// private batchEraserCombine = throttle(() => {
|
|
641
|
+
// this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes);
|
|
642
|
+
// this.batchEraserWorks.clear();
|
|
643
|
+
// this.batchEraserRemoveNodes.clear();
|
|
644
|
+
// }, 100, {'leading':false})
|
|
631
645
|
getWorkShape(t) {
|
|
632
646
|
return this.workShapes.get(t);
|
|
633
647
|
}
|
|
@@ -660,14 +674,6 @@ class ke {
|
|
|
660
674
|
}
|
|
661
675
|
break;
|
|
662
676
|
case f.PencilEraser:
|
|
663
|
-
{
|
|
664
|
-
const h = c.consume({
|
|
665
|
-
data: t,
|
|
666
|
-
isFullWork: !0
|
|
667
|
-
});
|
|
668
|
-
this.drawPencilEraser(h);
|
|
669
|
-
}
|
|
670
|
-
break;
|
|
671
677
|
case f.BitMapEraser: {
|
|
672
678
|
const h = c.consume({
|
|
673
679
|
data: t,
|
|
@@ -726,11 +732,11 @@ class ke {
|
|
|
726
732
|
const l = h.toolsType;
|
|
727
733
|
if (l === f.LaserPen)
|
|
728
734
|
return;
|
|
729
|
-
const
|
|
735
|
+
const m = this.workShapes.get(F), d = (i = m == null ? void 0 : m.selectIds) == null ? void 0 : i[0], S = h.consumeAll({ data: t, workerEngine: this });
|
|
730
736
|
switch (l) {
|
|
731
737
|
case f.Selector:
|
|
732
738
|
{
|
|
733
|
-
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) &&
|
|
739
|
+
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && m.cursorBlur();
|
|
734
740
|
const y = [];
|
|
735
741
|
r && y.push({
|
|
736
742
|
type: p.None,
|
|
@@ -739,7 +745,7 @@ class ke {
|
|
|
739
745
|
}
|
|
740
746
|
break;
|
|
741
747
|
case f.PencilEraser:
|
|
742
|
-
this.
|
|
748
|
+
this.drawPencilEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
743
749
|
break;
|
|
744
750
|
case f.BitMapEraser:
|
|
745
751
|
this.drawBitMapEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
@@ -787,7 +793,7 @@ class ke {
|
|
|
787
793
|
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
|
|
788
794
|
}
|
|
789
795
|
}
|
|
790
|
-
class
|
|
796
|
+
class ke {
|
|
791
797
|
constructor(t) {
|
|
792
798
|
u(this, "vNodes");
|
|
793
799
|
u(this, "thread");
|
|
@@ -857,30 +863,30 @@ class Se {
|
|
|
857
863
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
858
864
|
}
|
|
859
865
|
async animationDraw() {
|
|
860
|
-
var s, o, r, i, a, c, n, h, l,
|
|
866
|
+
var s, o, r, i, a, c, n, h, l, m, d, S, y, w, v, C, x, Z, j;
|
|
861
867
|
this.animationId = void 0;
|
|
862
868
|
let t = !1;
|
|
863
869
|
const e = /* @__PURE__ */ new Map();
|
|
864
|
-
for (const [N,
|
|
865
|
-
switch (
|
|
870
|
+
for (const [N, k] of this.workShapes.entries())
|
|
871
|
+
switch (k.toolsType) {
|
|
866
872
|
case f.Image: {
|
|
867
|
-
await ((s =
|
|
873
|
+
await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
|
|
868
874
|
isFullWork: !0,
|
|
869
875
|
worker: this
|
|
870
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
876
|
+
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
871
877
|
var O;
|
|
872
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
878
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
873
879
|
}), this.workShapes.delete(N);
|
|
874
880
|
break;
|
|
875
881
|
}
|
|
876
882
|
case f.Text: {
|
|
877
|
-
|
|
883
|
+
k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
|
|
878
884
|
isFullWork: !0,
|
|
879
885
|
replaceId: N
|
|
880
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
886
|
+
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
881
887
|
var O;
|
|
882
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
883
|
-
}), (r =
|
|
888
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
889
|
+
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
|
|
884
890
|
break;
|
|
885
891
|
}
|
|
886
892
|
case f.Arrow:
|
|
@@ -890,62 +896,62 @@ class Se {
|
|
|
890
896
|
case f.Star:
|
|
891
897
|
case f.Polygon:
|
|
892
898
|
case f.SpeechBalloon: {
|
|
893
|
-
const b = !!
|
|
894
|
-
if ((i =
|
|
895
|
-
const
|
|
896
|
-
(a =
|
|
897
|
-
op:
|
|
899
|
+
const b = !!k.ops;
|
|
900
|
+
if ((i = k.animationWorkData) != null && i.length) {
|
|
901
|
+
const D = k.oldRect;
|
|
902
|
+
(a = k.node) == null || a.consumeService({
|
|
903
|
+
op: k.animationWorkData,
|
|
898
904
|
isFullWork: b
|
|
899
|
-
}), b && (this.selectorWorkShapes.forEach((O,
|
|
905
|
+
}), b && (this.selectorWorkShapes.forEach((O, M) => {
|
|
900
906
|
var A;
|
|
901
|
-
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
902
|
-
}), (c =
|
|
903
|
-
workState:
|
|
904
|
-
op:
|
|
905
|
-
if (
|
|
907
|
+
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
|
|
908
|
+
}), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(N)), e.set(N, {
|
|
909
|
+
workState: D ? k.ops ? W.Done : W.Doing : W.Start,
|
|
910
|
+
op: k.animationWorkData.filter((O, M) => {
|
|
911
|
+
if (M % 3 !== 2)
|
|
906
912
|
return !0;
|
|
907
913
|
}).slice(-2)
|
|
908
|
-
}),
|
|
914
|
+
}), k.animationWorkData.length = 0;
|
|
909
915
|
}
|
|
910
916
|
break;
|
|
911
917
|
}
|
|
912
918
|
case f.Pencil: {
|
|
913
|
-
if (!
|
|
914
|
-
(n =
|
|
915
|
-
op:
|
|
919
|
+
if (!k.useAnimation && k.ops)
|
|
920
|
+
(n = k.node) == null || n.consumeService({
|
|
921
|
+
op: k.animationWorkData || [],
|
|
916
922
|
isFullWork: !0,
|
|
917
923
|
replaceId: N
|
|
918
|
-
}), (h =
|
|
924
|
+
}), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, D) => {
|
|
919
925
|
var O;
|
|
920
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
921
|
-
}), (l =
|
|
922
|
-
else if (
|
|
923
|
-
if (
|
|
924
|
-
(
|
|
926
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
927
|
+
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(N);
|
|
928
|
+
else if (k.useAnimation) {
|
|
929
|
+
if (k.isDel) {
|
|
930
|
+
(m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(N);
|
|
925
931
|
break;
|
|
926
932
|
}
|
|
927
|
-
const b = 3,
|
|
928
|
-
if ((
|
|
929
|
-
if ((y =
|
|
930
|
-
op:
|
|
933
|
+
const b = 3, D = this.computNextAnimationIndex(k, b), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), M = (k.animationWorkData || []).slice(O, D), A = (S = (d = k.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : S.toString();
|
|
934
|
+
if ((k.animationIndex || 0) < D || k.isDiff) {
|
|
935
|
+
if ((y = k.node) == null || y.consumeService({
|
|
936
|
+
op: M,
|
|
931
937
|
isFullWork: !1
|
|
932
|
-
}),
|
|
933
|
-
const q =
|
|
938
|
+
}), k.animationIndex = D, k.isDiff && (k.isDiff = !1), M.length) {
|
|
939
|
+
const q = M.filter((_, ae) => {
|
|
934
940
|
if (ae % b !== b - 1)
|
|
935
941
|
return !0;
|
|
936
942
|
}).slice(-2);
|
|
937
943
|
e.set(N, {
|
|
938
|
-
workState: O === 0 ? W.Start :
|
|
944
|
+
workState: O === 0 ? W.Start : D === ((w = k.animationWorkData) == null ? void 0 : w.length) ? W.Done : W.Doing,
|
|
939
945
|
op: q
|
|
940
946
|
});
|
|
941
947
|
}
|
|
942
|
-
} else
|
|
943
|
-
op:
|
|
948
|
+
} else k.ops && ((v = k.node) == null || v.consumeService({
|
|
949
|
+
op: k.animationWorkData || [],
|
|
944
950
|
isFullWork: !0,
|
|
945
951
|
replaceId: A
|
|
946
|
-
}),
|
|
952
|
+
}), k.isDel = !0, e.set(N, {
|
|
947
953
|
workState: W.Done,
|
|
948
|
-
op:
|
|
954
|
+
op: M.filter((q, _) => {
|
|
949
955
|
if (_ % b !== b - 1)
|
|
950
956
|
return !0;
|
|
951
957
|
}).slice(-2)
|
|
@@ -957,30 +963,30 @@ class Se {
|
|
|
957
963
|
}
|
|
958
964
|
case f.BitMapEraser:
|
|
959
965
|
case f.PencilEraser: {
|
|
960
|
-
if (
|
|
961
|
-
(
|
|
966
|
+
if (k.isDel) {
|
|
967
|
+
(C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(N);
|
|
962
968
|
break;
|
|
963
969
|
}
|
|
964
|
-
if (
|
|
965
|
-
const b =
|
|
970
|
+
if (k.ops && ((x = k.animationWorkData) != null && x.length)) {
|
|
971
|
+
const b = k.animationWorkData.slice(-3, -1);
|
|
966
972
|
e.set(N, {
|
|
967
973
|
workState: W.Done,
|
|
968
974
|
op: b
|
|
969
|
-
}),
|
|
975
|
+
}), k.isDel = !0;
|
|
970
976
|
break;
|
|
971
977
|
}
|
|
972
|
-
if (
|
|
973
|
-
const
|
|
974
|
-
if (((
|
|
975
|
-
op:
|
|
976
|
-
isFullWork:
|
|
977
|
-
}),
|
|
978
|
-
const A =
|
|
978
|
+
if (k.useAnimation) {
|
|
979
|
+
const D = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), M = (k.animationWorkData || []).slice(O, D);
|
|
980
|
+
if (((k.animationIndex || 0) < D || k.isDiff) && ((Z = k.node) == null || Z.consumeService({
|
|
981
|
+
op: M,
|
|
982
|
+
isFullWork: !1
|
|
983
|
+
}), k.animationIndex = D, k.isDiff && (k.isDiff = !1), M.length)) {
|
|
984
|
+
const A = M.filter((q, _) => {
|
|
979
985
|
if (_ % 3 !== 2)
|
|
980
986
|
return !0;
|
|
981
987
|
}).slice(-2);
|
|
982
988
|
e.set(N, {
|
|
983
|
-
workState: O === 0 ? W.Start :
|
|
989
|
+
workState: O === 0 ? W.Start : D === ((j = k.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
984
990
|
op: A
|
|
985
991
|
});
|
|
986
992
|
}
|
|
@@ -992,12 +998,12 @@ class Se {
|
|
|
992
998
|
}
|
|
993
999
|
if (t && this.runAnimation(), e.size) {
|
|
994
1000
|
const N = [];
|
|
995
|
-
e.forEach((
|
|
1001
|
+
e.forEach((k, b) => {
|
|
996
1002
|
N.push({
|
|
997
1003
|
type: p.Cursor,
|
|
998
1004
|
uid: b.split(te)[0],
|
|
999
|
-
op:
|
|
1000
|
-
workState:
|
|
1005
|
+
op: k.op,
|
|
1006
|
+
workState: k.workState,
|
|
1001
1007
|
viewId: this.thread.viewId
|
|
1002
1008
|
});
|
|
1003
1009
|
}), this.thread.post({ sp: N });
|
|
@@ -1031,9 +1037,9 @@ class Se {
|
|
|
1031
1037
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
|
|
1032
1038
|
if (!e)
|
|
1033
1039
|
return;
|
|
1034
|
-
const l = e.toString(),
|
|
1040
|
+
const l = e.toString(), m = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
|
|
1035
1041
|
if (!((y = this.workShapes) != null && y.has(l))) {
|
|
1036
|
-
let
|
|
1042
|
+
let C = {
|
|
1037
1043
|
toolsType: o,
|
|
1038
1044
|
animationWorkData: c || [],
|
|
1039
1045
|
animationIndex: 0,
|
|
@@ -1041,14 +1047,14 @@ class Se {
|
|
|
1041
1047
|
updateNodeOpt: i,
|
|
1042
1048
|
ops: a,
|
|
1043
1049
|
useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1044
|
-
oldRect:
|
|
1050
|
+
oldRect: m,
|
|
1045
1051
|
isDiff: !1,
|
|
1046
1052
|
imageBitmap: h
|
|
1047
1053
|
};
|
|
1048
|
-
o && s && (
|
|
1054
|
+
o && s && (C = this.setNodeKey(l, C, o, s)), (w = this.workShapes) == null || w.set(l, C);
|
|
1049
1055
|
}
|
|
1050
1056
|
const d = (v = this.workShapes) == null ? void 0 : v.get(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),
|
|
1057
|
+
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), 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);
|
|
1052
1058
|
}
|
|
1053
1059
|
removeNode(t, e) {
|
|
1054
1060
|
t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1068,13 +1074,13 @@ class Se {
|
|
|
1068
1074
|
return;
|
|
1069
1075
|
const a = e.toString();
|
|
1070
1076
|
if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
|
|
1071
|
-
let
|
|
1077
|
+
let m = {
|
|
1072
1078
|
toolsType: o,
|
|
1073
1079
|
selectIds: i,
|
|
1074
1080
|
type: r,
|
|
1075
1081
|
opt: s
|
|
1076
1082
|
};
|
|
1077
|
-
o && s && (
|
|
1083
|
+
o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
|
|
1078
1084
|
}
|
|
1079
1085
|
const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
|
|
1080
1086
|
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
@@ -1090,7 +1096,7 @@ class Se {
|
|
|
1090
1096
|
}, this), e;
|
|
1091
1097
|
}
|
|
1092
1098
|
}
|
|
1093
|
-
class
|
|
1099
|
+
class E {
|
|
1094
1100
|
constructor() {
|
|
1095
1101
|
u(this, "localWork");
|
|
1096
1102
|
u(this, "serviceWork");
|
|
@@ -1100,7 +1106,7 @@ class M {
|
|
|
1100
1106
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1101
1107
|
}
|
|
1102
1108
|
}
|
|
1103
|
-
class
|
|
1109
|
+
class Se extends E {
|
|
1104
1110
|
constructor() {
|
|
1105
1111
|
super(...arguments);
|
|
1106
1112
|
u(this, "emitEventType", I.CopyNode);
|
|
@@ -1116,7 +1122,7 @@ class ye extends M {
|
|
|
1116
1122
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1117
1123
|
}
|
|
1118
1124
|
}
|
|
1119
|
-
class
|
|
1125
|
+
class ye extends E {
|
|
1120
1126
|
constructor() {
|
|
1121
1127
|
super(...arguments);
|
|
1122
1128
|
u(this, "emitEventType", I.SetColorNode);
|
|
@@ -1164,7 +1170,7 @@ class we extends M {
|
|
|
1164
1170
|
};
|
|
1165
1171
|
}
|
|
1166
1172
|
}
|
|
1167
|
-
class
|
|
1173
|
+
class we extends E {
|
|
1168
1174
|
constructor() {
|
|
1169
1175
|
super(...arguments);
|
|
1170
1176
|
u(this, "emitEventType", I.ZIndexNode);
|
|
@@ -1205,7 +1211,7 @@ class ve extends M {
|
|
|
1205
1211
|
};
|
|
1206
1212
|
}
|
|
1207
1213
|
}
|
|
1208
|
-
class
|
|
1214
|
+
class ve extends E {
|
|
1209
1215
|
constructor() {
|
|
1210
1216
|
super(...arguments);
|
|
1211
1217
|
u(this, "emitEventType", I.TranslateNode);
|
|
@@ -1230,15 +1236,15 @@ class ge extends M {
|
|
|
1230
1236
|
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1231
1237
|
}
|
|
1232
1238
|
updateSelectorCallback(e) {
|
|
1233
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1234
|
-
if (
|
|
1239
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = h.workState, d = o.sp || [];
|
|
1240
|
+
if (m === W.Start)
|
|
1235
1241
|
return {
|
|
1236
1242
|
sp: [],
|
|
1237
1243
|
render: []
|
|
1238
1244
|
};
|
|
1239
1245
|
const S = a == null ? void 0 : a.selectRect;
|
|
1240
1246
|
if (c) {
|
|
1241
|
-
|
|
1247
|
+
m === W.Doing && d.push({
|
|
1242
1248
|
type: p.Select,
|
|
1243
1249
|
selectIds: i.selectIds,
|
|
1244
1250
|
selectRect: S,
|
|
@@ -1271,7 +1277,7 @@ class ge extends M {
|
|
|
1271
1277
|
};
|
|
1272
1278
|
}
|
|
1273
1279
|
}
|
|
1274
|
-
class
|
|
1280
|
+
class ge extends E {
|
|
1275
1281
|
constructor() {
|
|
1276
1282
|
super(...arguments);
|
|
1277
1283
|
u(this, "emitEventType", I.DeleteNode);
|
|
@@ -1280,7 +1286,7 @@ class Ie extends M {
|
|
|
1280
1286
|
return !1;
|
|
1281
1287
|
}
|
|
1282
1288
|
}
|
|
1283
|
-
class
|
|
1289
|
+
class Ie extends E {
|
|
1284
1290
|
constructor() {
|
|
1285
1291
|
super(...arguments);
|
|
1286
1292
|
u(this, "emitEventType", I.ScaleNode);
|
|
@@ -1302,7 +1308,7 @@ class We extends M {
|
|
|
1302
1308
|
}));
|
|
1303
1309
|
}
|
|
1304
1310
|
updateSelectorCallback(e) {
|
|
1305
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n } = s, h = c.workState, l = o.sp || [],
|
|
1311
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n } = s, h = c.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
|
|
1306
1312
|
if (h === W.Start)
|
|
1307
1313
|
return {
|
|
1308
1314
|
sp: [],
|
|
@@ -1312,7 +1318,7 @@ class We extends M {
|
|
|
1312
1318
|
l.push({
|
|
1313
1319
|
type: p.Select,
|
|
1314
1320
|
selectIds: r.selectIds,
|
|
1315
|
-
selectRect:
|
|
1321
|
+
selectRect: m,
|
|
1316
1322
|
willSyncService: !0,
|
|
1317
1323
|
isSync: !0,
|
|
1318
1324
|
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
@@ -1342,7 +1348,7 @@ class We extends M {
|
|
|
1342
1348
|
};
|
|
1343
1349
|
}
|
|
1344
1350
|
}
|
|
1345
|
-
class
|
|
1351
|
+
class We extends E {
|
|
1346
1352
|
constructor() {
|
|
1347
1353
|
super(...arguments);
|
|
1348
1354
|
u(this, "emitEventType", I.RotateNode);
|
|
@@ -1366,9 +1372,9 @@ class Te extends M {
|
|
|
1366
1372
|
}));
|
|
1367
1373
|
}
|
|
1368
1374
|
updateSelectorCallback(e) {
|
|
1369
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s,
|
|
1375
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, m = c.workState, d = o.sp || [], S = i == null ? void 0 : i.selectRect;
|
|
1370
1376
|
if (n) {
|
|
1371
|
-
h &&
|
|
1377
|
+
h && m === W.Done && d.push({
|
|
1372
1378
|
type: p.Select,
|
|
1373
1379
|
selectIds: r.selectIds,
|
|
1374
1380
|
selectRect: S,
|
|
@@ -1394,7 +1400,7 @@ class Te extends M {
|
|
|
1394
1400
|
};
|
|
1395
1401
|
}
|
|
1396
1402
|
}
|
|
1397
|
-
class
|
|
1403
|
+
class Te extends E {
|
|
1398
1404
|
constructor() {
|
|
1399
1405
|
super(...arguments);
|
|
1400
1406
|
u(this, "emitEventType", I.SetFontStyle);
|
|
@@ -1417,9 +1423,9 @@ class Le extends M {
|
|
|
1417
1423
|
}));
|
|
1418
1424
|
}
|
|
1419
1425
|
updateSelectorCallback(e) {
|
|
1420
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s,
|
|
1421
|
-
if (c &&
|
|
1422
|
-
h.fontSize &&
|
|
1426
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = o.sp || [], d = a == null ? void 0 : a.selectRect;
|
|
1427
|
+
if (c && m) {
|
|
1428
|
+
h.fontSize && m.push({
|
|
1423
1429
|
type: p.Select,
|
|
1424
1430
|
selectIds: i.selectIds,
|
|
1425
1431
|
selectRect: d,
|
|
@@ -1428,13 +1434,13 @@ class Le extends M {
|
|
|
1428
1434
|
points: i.getChildrenPoints()
|
|
1429
1435
|
});
|
|
1430
1436
|
for (const [S, y] of r.entries())
|
|
1431
|
-
l && y.toolsType === f.Text ?
|
|
1437
|
+
l && y.toolsType === f.Text ? m.push({
|
|
1432
1438
|
...y,
|
|
1433
1439
|
workId: S,
|
|
1434
1440
|
type: p.TextUpdate,
|
|
1435
1441
|
dataType: g.Local,
|
|
1436
1442
|
willSyncService: !0
|
|
1437
|
-
}) :
|
|
1443
|
+
}) : m.push(
|
|
1438
1444
|
{
|
|
1439
1445
|
...y,
|
|
1440
1446
|
workId: S,
|
|
@@ -1447,11 +1453,11 @@ class Le extends M {
|
|
|
1447
1453
|
);
|
|
1448
1454
|
}
|
|
1449
1455
|
return {
|
|
1450
|
-
sp:
|
|
1456
|
+
sp: m
|
|
1451
1457
|
};
|
|
1452
1458
|
}
|
|
1453
1459
|
}
|
|
1454
|
-
class
|
|
1460
|
+
class Le extends E {
|
|
1455
1461
|
constructor() {
|
|
1456
1462
|
super(...arguments);
|
|
1457
1463
|
u(this, "emitEventType", I.SetPoint);
|
|
@@ -1478,11 +1484,11 @@ class Ne extends M {
|
|
|
1478
1484
|
updateSelectorCallback(e) {
|
|
1479
1485
|
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;
|
|
1480
1486
|
if (c && h) {
|
|
1481
|
-
for (const [
|
|
1487
|
+
for (const [m, d] of r.entries())
|
|
1482
1488
|
h.push(
|
|
1483
1489
|
{
|
|
1484
1490
|
...d,
|
|
1485
|
-
workId:
|
|
1491
|
+
workId: m,
|
|
1486
1492
|
type: p.UpdateNode,
|
|
1487
1493
|
updateNodeOpt: {
|
|
1488
1494
|
useAnimation: !1
|
|
@@ -1504,7 +1510,7 @@ class Ne extends M {
|
|
|
1504
1510
|
};
|
|
1505
1511
|
}
|
|
1506
1512
|
}
|
|
1507
|
-
class
|
|
1513
|
+
class Ne extends E {
|
|
1508
1514
|
constructor() {
|
|
1509
1515
|
super(...arguments);
|
|
1510
1516
|
u(this, "emitEventType", I.SetLock);
|
|
@@ -1526,7 +1532,7 @@ class be extends M {
|
|
|
1526
1532
|
}));
|
|
1527
1533
|
}
|
|
1528
1534
|
updateSelectorCallback(e) {
|
|
1529
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [],
|
|
1535
|
+
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [], m = a == null ? void 0 : a.selectRect;
|
|
1530
1536
|
if (c && l) {
|
|
1531
1537
|
for (const [d, S] of r.entries())
|
|
1532
1538
|
l.push(
|
|
@@ -1547,7 +1553,7 @@ class be extends M {
|
|
|
1547
1553
|
canRotate: i.canRotate,
|
|
1548
1554
|
type: p.Select,
|
|
1549
1555
|
selectIds: i.selectIds,
|
|
1550
|
-
selectRect:
|
|
1556
|
+
selectRect: m,
|
|
1551
1557
|
willSyncService: c,
|
|
1552
1558
|
isSync: n
|
|
1553
1559
|
});
|
|
@@ -1557,7 +1563,7 @@ class be extends M {
|
|
|
1557
1563
|
};
|
|
1558
1564
|
}
|
|
1559
1565
|
}
|
|
1560
|
-
class
|
|
1566
|
+
class be extends E {
|
|
1561
1567
|
constructor() {
|
|
1562
1568
|
super(...arguments);
|
|
1563
1569
|
u(this, "emitEventType", I.SetShapeOpt);
|
|
@@ -1606,27 +1612,27 @@ class Ce {
|
|
|
1606
1612
|
build(t) {
|
|
1607
1613
|
switch (t) {
|
|
1608
1614
|
case I.TranslateNode:
|
|
1609
|
-
return new ge();
|
|
1610
|
-
case I.ZIndexNode:
|
|
1611
1615
|
return new ve();
|
|
1616
|
+
case I.ZIndexNode:
|
|
1617
|
+
return new we();
|
|
1612
1618
|
case I.CopyNode:
|
|
1613
|
-
return new
|
|
1619
|
+
return new Se();
|
|
1614
1620
|
case I.SetColorNode:
|
|
1615
|
-
return new
|
|
1621
|
+
return new ye();
|
|
1616
1622
|
case I.DeleteNode:
|
|
1617
|
-
return new
|
|
1623
|
+
return new ge();
|
|
1618
1624
|
case I.ScaleNode:
|
|
1619
|
-
return new
|
|
1625
|
+
return new Ie();
|
|
1620
1626
|
case I.RotateNode:
|
|
1621
|
-
return new
|
|
1627
|
+
return new We();
|
|
1622
1628
|
case I.SetFontStyle:
|
|
1623
|
-
return new
|
|
1629
|
+
return new Te();
|
|
1624
1630
|
case I.SetPoint:
|
|
1625
|
-
return new
|
|
1631
|
+
return new Le();
|
|
1626
1632
|
case I.SetLock:
|
|
1627
|
-
return new
|
|
1633
|
+
return new Ne();
|
|
1628
1634
|
case I.SetShapeOpt:
|
|
1629
|
-
return new
|
|
1635
|
+
return new be();
|
|
1630
1636
|
}
|
|
1631
1637
|
}
|
|
1632
1638
|
registerForMainThread(t) {
|
|
@@ -1641,7 +1647,7 @@ class Ce {
|
|
|
1641
1647
|
return !1;
|
|
1642
1648
|
}
|
|
1643
1649
|
}
|
|
1644
|
-
class
|
|
1650
|
+
class De {
|
|
1645
1651
|
constructor(t, e) {
|
|
1646
1652
|
u(this, "viewId");
|
|
1647
1653
|
u(this, "fullLayer");
|
|
@@ -1667,12 +1673,12 @@ class Oe {
|
|
|
1667
1673
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1668
1674
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1669
1675
|
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
|
|
1676
|
+
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 he(t, this.scene);
|
|
1671
1677
|
const r = {
|
|
1672
1678
|
thread: this,
|
|
1673
1679
|
vNodes: this.vNodes
|
|
1674
1680
|
};
|
|
1675
|
-
this.localWork = new
|
|
1681
|
+
this.localWork = new me(r), this.serviceWork = new ke(r), this.topWork = new fe(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ce([
|
|
1676
1682
|
I.CopyNode,
|
|
1677
1683
|
I.SetColorNode,
|
|
1678
1684
|
I.DeleteNode,
|
|
@@ -1715,7 +1721,7 @@ class Oe {
|
|
|
1715
1721
|
}
|
|
1716
1722
|
async on(t) {
|
|
1717
1723
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1718
|
-
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h, isLockSentEventCursor: l } = t,
|
|
1724
|
+
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h, isLockSentEventCursor: l } = t, m = i == null ? void 0 : i.toString();
|
|
1719
1725
|
switch (e) {
|
|
1720
1726
|
case p.UpdateDpr:
|
|
1721
1727
|
H(t.dpr) && this.updateDpr(t.dpr);
|
|
@@ -1744,18 +1750,18 @@ class Oe {
|
|
|
1744
1750
|
}
|
|
1745
1751
|
break;
|
|
1746
1752
|
case p.CreateWork:
|
|
1747
|
-
if (
|
|
1753
|
+
if (m && o && s) {
|
|
1748
1754
|
if (this.topWork.canUseTopLayer(s)) {
|
|
1749
1755
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
1750
1756
|
toolsType: s,
|
|
1751
1757
|
toolsOpt: o
|
|
1752
|
-
}), this.topWork.setWorkOptions(
|
|
1758
|
+
}), this.topWork.setWorkOptions(m, o);
|
|
1753
1759
|
break;
|
|
1754
1760
|
}
|
|
1755
1761
|
this.localWork.getToolsOpt() || this.localWork.setToolsOpt({
|
|
1756
1762
|
toolsType: s,
|
|
1757
1763
|
toolsOpt: o
|
|
1758
|
-
}), this.localWork.setWorkOptions(
|
|
1764
|
+
}), this.localWork.setWorkOptions(m, o);
|
|
1759
1765
|
}
|
|
1760
1766
|
break;
|
|
1761
1767
|
case p.DrawWork:
|
|
@@ -2008,11 +2014,11 @@ class Oe {
|
|
|
2008
2014
|
for (const [n, h] of r.entries()) {
|
|
2009
2015
|
const l = this.vNodes.get(n);
|
|
2010
2016
|
if (l) {
|
|
2011
|
-
const
|
|
2017
|
+
const m = h, d = l.rect, S = this.getSceneRect(), y = G(m, S), w = G(d, S);
|
|
2012
2018
|
let v = !1;
|
|
2013
|
-
if ((y !== w ||
|
|
2014
|
-
const { toolsType:
|
|
2015
|
-
|
|
2019
|
+
if ((y !== w || m.w !== d.w || m.h !== d.h || w === Q.intersect) && (v = !0), v) {
|
|
2020
|
+
const { toolsType: C, opt: x } = l;
|
|
2021
|
+
C === f.Text && x.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
2016
2022
|
}
|
|
2017
2023
|
}
|
|
2018
2024
|
}
|
|
@@ -2039,7 +2045,7 @@ class Oe {
|
|
|
2039
2045
|
workId: l
|
|
2040
2046
|
});
|
|
2041
2047
|
if (v) {
|
|
2042
|
-
const
|
|
2048
|
+
const C = this.getSceneRect(), x = G(w, C);
|
|
2043
2049
|
n.push(v.consumeServiceAsync({
|
|
2044
2050
|
isFullWork: !0,
|
|
2045
2051
|
replaceId: l,
|
|
@@ -2098,7 +2104,7 @@ class Oe {
|
|
|
2098
2104
|
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();
|
|
2099
2105
|
}
|
|
2100
2106
|
}
|
|
2101
|
-
class
|
|
2107
|
+
class Oe {
|
|
2102
2108
|
constructor(t, e) {
|
|
2103
2109
|
u(this, "viewId");
|
|
2104
2110
|
u(this, "fullLayer");
|
|
@@ -2253,14 +2259,14 @@ class Ee {
|
|
|
2253
2259
|
switch (h == null ? void 0 : h.type) {
|
|
2254
2260
|
case p.UpdateNode:
|
|
2255
2261
|
case p.FullWork: {
|
|
2256
|
-
const { opt: l } = h,
|
|
2262
|
+
const { opt: l } = h, m = {
|
|
2257
2263
|
...h,
|
|
2258
2264
|
opt: l,
|
|
2259
2265
|
workId: n,
|
|
2260
2266
|
msgType: p.FullWork,
|
|
2261
2267
|
dataType: g.Service,
|
|
2262
2268
|
viewId: this.viewId
|
|
2263
|
-
}, d = await this.runFullWork(
|
|
2269
|
+
}, d = await this.runFullWork(m);
|
|
2264
2270
|
a = V(a, d);
|
|
2265
2271
|
break;
|
|
2266
2272
|
}
|
|
@@ -2345,7 +2351,7 @@ class Ee {
|
|
|
2345
2351
|
for (const o of s.sp) {
|
|
2346
2352
|
let r = !1;
|
|
2347
2353
|
for (const i of t)
|
|
2348
|
-
if (
|
|
2354
|
+
if (pe(o, i)) {
|
|
2349
2355
|
r = !0;
|
|
2350
2356
|
break;
|
|
2351
2357
|
}
|
|
@@ -2408,31 +2414,31 @@ class _e {
|
|
|
2408
2414
|
this.mainThreadMap.clear();
|
|
2409
2415
|
}
|
|
2410
2416
|
createMainThread(t, e) {
|
|
2411
|
-
return new
|
|
2417
|
+
return new De(t, e);
|
|
2412
2418
|
}
|
|
2413
2419
|
createSnapshotThread(t, e) {
|
|
2414
|
-
return new
|
|
2420
|
+
return new Oe(t, e);
|
|
2415
2421
|
}
|
|
2416
2422
|
async consume(t) {
|
|
2417
2423
|
var e, s, o, r;
|
|
2418
2424
|
for (const i of t.values()) {
|
|
2419
|
-
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt:
|
|
2425
|
+
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: S } = i;
|
|
2420
2426
|
if (a === p.Console) {
|
|
2421
2427
|
console.log(this);
|
|
2422
2428
|
continue;
|
|
2423
2429
|
}
|
|
2424
2430
|
if (a === p.Init) {
|
|
2425
2431
|
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 &&
|
|
2427
|
-
const
|
|
2432
|
+
if (w && v && l && m) {
|
|
2433
|
+
const C = this.createMainThread(c, {
|
|
2428
2434
|
displayer: w,
|
|
2429
2435
|
container: v,
|
|
2430
2436
|
layerOpt: l,
|
|
2431
2437
|
master: this.master,
|
|
2432
|
-
canvasOpt:
|
|
2438
|
+
canvasOpt: m,
|
|
2433
2439
|
post: this.post.bind(this)
|
|
2434
2440
|
});
|
|
2435
|
-
this.mainThreadMap.set(c,
|
|
2441
|
+
this.mainThreadMap.set(c, C), C && d && C.setCameraOpt(d);
|
|
2436
2442
|
}
|
|
2437
2443
|
continue;
|
|
2438
2444
|
}
|
|
@@ -2440,7 +2446,7 @@ class _e {
|
|
|
2440
2446
|
const w = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = w.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2441
2447
|
if (w && v && d) {
|
|
2442
2448
|
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
2443
|
-
const
|
|
2449
|
+
const C = {
|
|
2444
2450
|
...J.defaultLayerOpt,
|
|
2445
2451
|
offscreen: !1,
|
|
2446
2452
|
width: d.width,
|
|
@@ -2453,7 +2459,7 @@ class _e {
|
|
|
2453
2459
|
this.snapshotThread = this.createSnapshotThread(c, {
|
|
2454
2460
|
displayer: w,
|
|
2455
2461
|
container: v,
|
|
2456
|
-
layerOpt:
|
|
2462
|
+
layerOpt: C,
|
|
2457
2463
|
master: this.master,
|
|
2458
2464
|
canvasOpt: x,
|
|
2459
2465
|
post: this.post.bind(this)
|
|
@@ -2469,12 +2475,12 @@ class _e {
|
|
|
2469
2475
|
}
|
|
2470
2476
|
if (a === p.TasksQueue && (n != null && n.size)) {
|
|
2471
2477
|
for (const [w, v] of this.mainThreadMap.entries()) {
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2478
|
+
const C = n.get(w);
|
|
2479
|
+
C && (await v.on(C), h && this.post({ workerTasksqueueCount: h }));
|
|
2474
2480
|
}
|
|
2475
2481
|
continue;
|
|
2476
2482
|
}
|
|
2477
|
-
if (c ===
|
|
2483
|
+
if (c === de) {
|
|
2478
2484
|
for (const w of this.mainThreadMap.values())
|
|
2479
2485
|
w.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2480
2486
|
continue;
|