@netless/appliance-plugin 1.1.17-beta.8 → 1.1.17
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-CTwuMS.js +500 -0
- package/cdn/subWorker-D7gqd9.js +500 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +16 -15
- package/dist/collector/collector.d.ts +1 -0
- package/dist/component/textEditor/manager.d.ts +1 -0
- package/dist/component/textEditor/view.d.ts +27 -47
- package/dist/core/mainEngine.d.ts +7 -1
- 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/tools/selector.d.ts +29 -0
- package/dist/core/types.d.ts +1 -0
- package/dist/core/utils/clipper.d.ts +8 -0
- package/dist/core/utils/polygonUtils.d.ts +8 -0
- package/dist/core/worker/base.d.ts +5 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -3
- package/dist/core/worker/subWorkerLocal.d.ts +1 -0
- package/dist/cursors/index.d.ts +0 -4
- package/dist/displayer/const.d.ts +1 -0
- package/dist/displayer/floatBar/dragBox/index.d.ts +7 -1
- package/dist/displayer/floatBar/index.d.ts +1 -1
- package/dist/displayer/utils.d.ts +1 -0
- package/dist/fullWorker.js +211 -152
- package/dist/index-BqLItWo1.js +1 -0
- package/dist/{index-DZmnrj_U.mjs → index-D5p9NBLd.mjs} +217 -204
- package/dist/index-DGks_HwI.mjs +17530 -0
- package/dist/index-DI0wKkQa.js +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +7 -5
- package/dist/plugin/baseViewContainerManager.d.ts +14 -2
- package/dist/plugin/const.d.ts +6 -0
- package/dist/plugin/displayerView.d.ts +9 -2
- package/dist/plugin/types.d.ts +36 -7
- package/dist/style.css +1 -1
- package/dist/subWorker.js +211 -152
- package/package.json +5 -3
- package/cdn/fullWorker-Dma-pe.js +0 -441
- package/cdn/subWorker-1KsgJX.js +0 -441
- package/dist/collector/eventCollector.d.ts +0 -31
- package/dist/collector/magixEventCollector.d.ts +0 -31
- package/dist/index-BwYgPPna.mjs +0 -17069
- 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-DGks_HwI.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
|
}
|
|
@@ -654,20 +668,19 @@ class ke {
|
|
|
654
668
|
{
|
|
655
669
|
const h = c.consume({
|
|
656
670
|
data: t,
|
|
657
|
-
isFullWork: !0
|
|
671
|
+
isFullWork: !0,
|
|
672
|
+
isMainThread: !0
|
|
658
673
|
});
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
data: t,
|
|
666
|
-
isFullWork: !0
|
|
674
|
+
this.fullWorkerDrawCount++;
|
|
675
|
+
const l = [];
|
|
676
|
+
h.type === p.Select && (h.selectIds && e.runReverseSelectWork(h.selectIds), l.push(h)), this.thread.post({
|
|
677
|
+
consumeCount: this.consumeCount,
|
|
678
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
679
|
+
sp: l
|
|
667
680
|
});
|
|
668
|
-
this.drawPencilEraser(h);
|
|
669
681
|
}
|
|
670
682
|
break;
|
|
683
|
+
case f.PencilEraser:
|
|
671
684
|
case f.BitMapEraser: {
|
|
672
685
|
const h = c.consume({
|
|
673
686
|
data: t,
|
|
@@ -726,11 +739,11 @@ class ke {
|
|
|
726
739
|
const l = h.toolsType;
|
|
727
740
|
if (l === f.LaserPen)
|
|
728
741
|
return;
|
|
729
|
-
const
|
|
742
|
+
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
743
|
switch (l) {
|
|
731
744
|
case f.Selector:
|
|
732
745
|
{
|
|
733
|
-
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) &&
|
|
746
|
+
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && m.cursorBlur();
|
|
734
747
|
const y = [];
|
|
735
748
|
r && y.push({
|
|
736
749
|
type: p.None,
|
|
@@ -739,7 +752,7 @@ class ke {
|
|
|
739
752
|
}
|
|
740
753
|
break;
|
|
741
754
|
case f.PencilEraser:
|
|
742
|
-
this.
|
|
755
|
+
this.drawPencilEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
743
756
|
break;
|
|
744
757
|
case f.BitMapEraser:
|
|
745
758
|
this.drawBitMapEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
@@ -787,7 +800,7 @@ class ke {
|
|
|
787
800
|
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
|
|
788
801
|
}
|
|
789
802
|
}
|
|
790
|
-
class
|
|
803
|
+
class ke {
|
|
791
804
|
constructor(t) {
|
|
792
805
|
u(this, "vNodes");
|
|
793
806
|
u(this, "thread");
|
|
@@ -857,30 +870,30 @@ class Se {
|
|
|
857
870
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
858
871
|
}
|
|
859
872
|
async animationDraw() {
|
|
860
|
-
var s, o, r, i, a, c, n, h, l,
|
|
873
|
+
var s, o, r, i, a, c, n, h, l, m, d, S, y, w, v, C, x, Z, j;
|
|
861
874
|
this.animationId = void 0;
|
|
862
875
|
let t = !1;
|
|
863
876
|
const e = /* @__PURE__ */ new Map();
|
|
864
|
-
for (const [N,
|
|
865
|
-
switch (
|
|
877
|
+
for (const [N, k] of this.workShapes.entries())
|
|
878
|
+
switch (k.toolsType) {
|
|
866
879
|
case f.Image: {
|
|
867
|
-
await ((s =
|
|
880
|
+
await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
|
|
868
881
|
isFullWork: !0,
|
|
869
882
|
worker: this
|
|
870
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
883
|
+
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
871
884
|
var O;
|
|
872
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
885
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
873
886
|
}), this.workShapes.delete(N);
|
|
874
887
|
break;
|
|
875
888
|
}
|
|
876
889
|
case f.Text: {
|
|
877
|
-
|
|
890
|
+
k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
|
|
878
891
|
isFullWork: !0,
|
|
879
892
|
replaceId: N
|
|
880
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
893
|
+
})), this.selectorWorkShapes.forEach((b, D) => {
|
|
881
894
|
var O;
|
|
882
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
883
|
-
}), (r =
|
|
895
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
896
|
+
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
|
|
884
897
|
break;
|
|
885
898
|
}
|
|
886
899
|
case f.Arrow:
|
|
@@ -890,62 +903,62 @@ class Se {
|
|
|
890
903
|
case f.Star:
|
|
891
904
|
case f.Polygon:
|
|
892
905
|
case f.SpeechBalloon: {
|
|
893
|
-
const b = !!
|
|
894
|
-
if ((i =
|
|
895
|
-
const
|
|
896
|
-
(a =
|
|
897
|
-
op:
|
|
906
|
+
const b = !!k.ops;
|
|
907
|
+
if ((i = k.animationWorkData) != null && i.length) {
|
|
908
|
+
const D = k.oldRect;
|
|
909
|
+
(a = k.node) == null || a.consumeService({
|
|
910
|
+
op: k.animationWorkData,
|
|
898
911
|
isFullWork: b
|
|
899
|
-
}), b && (this.selectorWorkShapes.forEach((O,
|
|
912
|
+
}), b && (this.selectorWorkShapes.forEach((O, M) => {
|
|
900
913
|
var A;
|
|
901
|
-
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
902
|
-
}), (c =
|
|
903
|
-
workState:
|
|
904
|
-
op:
|
|
905
|
-
if (
|
|
914
|
+
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
|
|
915
|
+
}), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(N)), e.set(N, {
|
|
916
|
+
workState: D ? k.ops ? W.Done : W.Doing : W.Start,
|
|
917
|
+
op: k.animationWorkData.filter((O, M) => {
|
|
918
|
+
if (M % 3 !== 2)
|
|
906
919
|
return !0;
|
|
907
920
|
}).slice(-2)
|
|
908
|
-
}),
|
|
921
|
+
}), k.animationWorkData.length = 0;
|
|
909
922
|
}
|
|
910
923
|
break;
|
|
911
924
|
}
|
|
912
925
|
case f.Pencil: {
|
|
913
|
-
if (!
|
|
914
|
-
(n =
|
|
915
|
-
op:
|
|
926
|
+
if (!k.useAnimation && k.ops)
|
|
927
|
+
(n = k.node) == null || n.consumeService({
|
|
928
|
+
op: k.animationWorkData || [],
|
|
916
929
|
isFullWork: !0,
|
|
917
930
|
replaceId: N
|
|
918
|
-
}), (h =
|
|
931
|
+
}), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, D) => {
|
|
919
932
|
var O;
|
|
920
|
-
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(
|
|
921
|
-
}), (l =
|
|
922
|
-
else if (
|
|
923
|
-
if (
|
|
924
|
-
(
|
|
933
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
|
|
934
|
+
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(N);
|
|
935
|
+
else if (k.useAnimation) {
|
|
936
|
+
if (k.isDel) {
|
|
937
|
+
(m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(N);
|
|
925
938
|
break;
|
|
926
939
|
}
|
|
927
|
-
const b = 3,
|
|
928
|
-
if ((
|
|
929
|
-
if ((y =
|
|
930
|
-
op:
|
|
940
|
+
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();
|
|
941
|
+
if ((k.animationIndex || 0) < D || k.isDiff) {
|
|
942
|
+
if ((y = k.node) == null || y.consumeService({
|
|
943
|
+
op: M,
|
|
931
944
|
isFullWork: !1
|
|
932
|
-
}),
|
|
933
|
-
const q =
|
|
945
|
+
}), k.animationIndex = D, k.isDiff && (k.isDiff = !1), M.length) {
|
|
946
|
+
const q = M.filter((_, ae) => {
|
|
934
947
|
if (ae % b !== b - 1)
|
|
935
948
|
return !0;
|
|
936
949
|
}).slice(-2);
|
|
937
950
|
e.set(N, {
|
|
938
|
-
workState: O === 0 ? W.Start :
|
|
951
|
+
workState: O === 0 ? W.Start : D === ((w = k.animationWorkData) == null ? void 0 : w.length) ? W.Done : W.Doing,
|
|
939
952
|
op: q
|
|
940
953
|
});
|
|
941
954
|
}
|
|
942
|
-
} else
|
|
943
|
-
op:
|
|
955
|
+
} else k.ops && ((v = k.node) == null || v.consumeService({
|
|
956
|
+
op: k.animationWorkData || [],
|
|
944
957
|
isFullWork: !0,
|
|
945
958
|
replaceId: A
|
|
946
|
-
}),
|
|
959
|
+
}), k.isDel = !0, e.set(N, {
|
|
947
960
|
workState: W.Done,
|
|
948
|
-
op:
|
|
961
|
+
op: M.filter((q, _) => {
|
|
949
962
|
if (_ % b !== b - 1)
|
|
950
963
|
return !0;
|
|
951
964
|
}).slice(-2)
|
|
@@ -957,30 +970,30 @@ class Se {
|
|
|
957
970
|
}
|
|
958
971
|
case f.BitMapEraser:
|
|
959
972
|
case f.PencilEraser: {
|
|
960
|
-
if (
|
|
961
|
-
(
|
|
973
|
+
if (k.isDel) {
|
|
974
|
+
(C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(N);
|
|
962
975
|
break;
|
|
963
976
|
}
|
|
964
|
-
if (
|
|
965
|
-
const b =
|
|
977
|
+
if (k.ops && ((x = k.animationWorkData) != null && x.length)) {
|
|
978
|
+
const b = k.animationWorkData.slice(-3, -1);
|
|
966
979
|
e.set(N, {
|
|
967
980
|
workState: W.Done,
|
|
968
981
|
op: b
|
|
969
|
-
}),
|
|
982
|
+
}), k.isDel = !0;
|
|
970
983
|
break;
|
|
971
984
|
}
|
|
972
|
-
if (
|
|
973
|
-
const
|
|
974
|
-
if (((
|
|
975
|
-
op:
|
|
976
|
-
isFullWork:
|
|
977
|
-
}),
|
|
978
|
-
const A =
|
|
985
|
+
if (k.useAnimation) {
|
|
986
|
+
const D = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), M = (k.animationWorkData || []).slice(O, D);
|
|
987
|
+
if (((k.animationIndex || 0) < D || k.isDiff) && ((Z = k.node) == null || Z.consumeService({
|
|
988
|
+
op: M,
|
|
989
|
+
isFullWork: !1
|
|
990
|
+
}), k.animationIndex = D, k.isDiff && (k.isDiff = !1), M.length)) {
|
|
991
|
+
const A = M.filter((q, _) => {
|
|
979
992
|
if (_ % 3 !== 2)
|
|
980
993
|
return !0;
|
|
981
994
|
}).slice(-2);
|
|
982
995
|
e.set(N, {
|
|
983
|
-
workState: O === 0 ? W.Start :
|
|
996
|
+
workState: O === 0 ? W.Start : D === ((j = k.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
984
997
|
op: A
|
|
985
998
|
});
|
|
986
999
|
}
|
|
@@ -992,12 +1005,12 @@ class Se {
|
|
|
992
1005
|
}
|
|
993
1006
|
if (t && this.runAnimation(), e.size) {
|
|
994
1007
|
const N = [];
|
|
995
|
-
e.forEach((
|
|
1008
|
+
e.forEach((k, b) => {
|
|
996
1009
|
N.push({
|
|
997
1010
|
type: p.Cursor,
|
|
998
1011
|
uid: b.split(te)[0],
|
|
999
|
-
op:
|
|
1000
|
-
workState:
|
|
1012
|
+
op: k.op,
|
|
1013
|
+
workState: k.workState,
|
|
1001
1014
|
viewId: this.thread.viewId
|
|
1002
1015
|
});
|
|
1003
1016
|
}), this.thread.post({ sp: N });
|
|
@@ -1031,9 +1044,9 @@ class Se {
|
|
|
1031
1044
|
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
|
|
1032
1045
|
if (!e)
|
|
1033
1046
|
return;
|
|
1034
|
-
const l = e.toString(),
|
|
1047
|
+
const l = e.toString(), m = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
|
|
1035
1048
|
if (!((y = this.workShapes) != null && y.has(l))) {
|
|
1036
|
-
let
|
|
1049
|
+
let C = {
|
|
1037
1050
|
toolsType: o,
|
|
1038
1051
|
animationWorkData: c || [],
|
|
1039
1052
|
animationIndex: 0,
|
|
@@ -1041,14 +1054,14 @@ class Se {
|
|
|
1041
1054
|
updateNodeOpt: i,
|
|
1042
1055
|
ops: a,
|
|
1043
1056
|
useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1044
|
-
oldRect:
|
|
1057
|
+
oldRect: m,
|
|
1045
1058
|
isDiff: !1,
|
|
1046
1059
|
imageBitmap: h
|
|
1047
1060
|
};
|
|
1048
|
-
o && s && (
|
|
1061
|
+
o && s && (C = this.setNodeKey(l, C, o, s)), (w = this.workShapes) == null || w.set(l, C);
|
|
1049
1062
|
}
|
|
1050
1063
|
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),
|
|
1064
|
+
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
1065
|
}
|
|
1053
1066
|
removeNode(t, e) {
|
|
1054
1067
|
t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
@@ -1068,13 +1081,13 @@ class Se {
|
|
|
1068
1081
|
return;
|
|
1069
1082
|
const a = e.toString();
|
|
1070
1083
|
if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
|
|
1071
|
-
let
|
|
1084
|
+
let m = {
|
|
1072
1085
|
toolsType: o,
|
|
1073
1086
|
selectIds: i,
|
|
1074
1087
|
type: r,
|
|
1075
1088
|
opt: s
|
|
1076
1089
|
};
|
|
1077
|
-
o && s && (
|
|
1090
|
+
o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
|
|
1078
1091
|
}
|
|
1079
1092
|
const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
|
|
1080
1093
|
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
@@ -1090,7 +1103,7 @@ class Se {
|
|
|
1090
1103
|
}, this), e;
|
|
1091
1104
|
}
|
|
1092
1105
|
}
|
|
1093
|
-
class
|
|
1106
|
+
class E {
|
|
1094
1107
|
constructor() {
|
|
1095
1108
|
u(this, "localWork");
|
|
1096
1109
|
u(this, "serviceWork");
|
|
@@ -1100,7 +1113,7 @@ class M {
|
|
|
1100
1113
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1101
1114
|
}
|
|
1102
1115
|
}
|
|
1103
|
-
class
|
|
1116
|
+
class Se extends E {
|
|
1104
1117
|
constructor() {
|
|
1105
1118
|
super(...arguments);
|
|
1106
1119
|
u(this, "emitEventType", I.CopyNode);
|
|
@@ -1116,7 +1129,7 @@ class ye extends M {
|
|
|
1116
1129
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1117
1130
|
}
|
|
1118
1131
|
}
|
|
1119
|
-
class
|
|
1132
|
+
class ye extends E {
|
|
1120
1133
|
constructor() {
|
|
1121
1134
|
super(...arguments);
|
|
1122
1135
|
u(this, "emitEventType", I.SetColorNode);
|
|
@@ -1164,7 +1177,7 @@ class we extends M {
|
|
|
1164
1177
|
};
|
|
1165
1178
|
}
|
|
1166
1179
|
}
|
|
1167
|
-
class
|
|
1180
|
+
class we extends E {
|
|
1168
1181
|
constructor() {
|
|
1169
1182
|
super(...arguments);
|
|
1170
1183
|
u(this, "emitEventType", I.ZIndexNode);
|
|
@@ -1205,7 +1218,7 @@ class ve extends M {
|
|
|
1205
1218
|
};
|
|
1206
1219
|
}
|
|
1207
1220
|
}
|
|
1208
|
-
class
|
|
1221
|
+
class ve extends E {
|
|
1209
1222
|
constructor() {
|
|
1210
1223
|
super(...arguments);
|
|
1211
1224
|
u(this, "emitEventType", I.TranslateNode);
|
|
@@ -1230,15 +1243,15 @@ class ge extends M {
|
|
|
1230
1243
|
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1231
1244
|
}
|
|
1232
1245
|
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 (
|
|
1246
|
+
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 || [];
|
|
1247
|
+
if (m === W.Start)
|
|
1235
1248
|
return {
|
|
1236
1249
|
sp: [],
|
|
1237
1250
|
render: []
|
|
1238
1251
|
};
|
|
1239
1252
|
const S = a == null ? void 0 : a.selectRect;
|
|
1240
1253
|
if (c) {
|
|
1241
|
-
|
|
1254
|
+
m === W.Doing && d.push({
|
|
1242
1255
|
type: p.Select,
|
|
1243
1256
|
selectIds: i.selectIds,
|
|
1244
1257
|
selectRect: S,
|
|
@@ -1271,7 +1284,7 @@ class ge extends M {
|
|
|
1271
1284
|
};
|
|
1272
1285
|
}
|
|
1273
1286
|
}
|
|
1274
|
-
class
|
|
1287
|
+
class ge extends E {
|
|
1275
1288
|
constructor() {
|
|
1276
1289
|
super(...arguments);
|
|
1277
1290
|
u(this, "emitEventType", I.DeleteNode);
|
|
@@ -1280,7 +1293,7 @@ class Ie extends M {
|
|
|
1280
1293
|
return !1;
|
|
1281
1294
|
}
|
|
1282
1295
|
}
|
|
1283
|
-
class
|
|
1296
|
+
class Ie extends E {
|
|
1284
1297
|
constructor() {
|
|
1285
1298
|
super(...arguments);
|
|
1286
1299
|
u(this, "emitEventType", I.ScaleNode);
|
|
@@ -1302,7 +1315,7 @@ class We extends M {
|
|
|
1302
1315
|
}));
|
|
1303
1316
|
}
|
|
1304
1317
|
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 || [],
|
|
1318
|
+
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
1319
|
if (h === W.Start)
|
|
1307
1320
|
return {
|
|
1308
1321
|
sp: [],
|
|
@@ -1312,7 +1325,7 @@ class We extends M {
|
|
|
1312
1325
|
l.push({
|
|
1313
1326
|
type: p.Select,
|
|
1314
1327
|
selectIds: r.selectIds,
|
|
1315
|
-
selectRect:
|
|
1328
|
+
selectRect: m,
|
|
1316
1329
|
willSyncService: !0,
|
|
1317
1330
|
isSync: !0,
|
|
1318
1331
|
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
@@ -1342,7 +1355,7 @@ class We extends M {
|
|
|
1342
1355
|
};
|
|
1343
1356
|
}
|
|
1344
1357
|
}
|
|
1345
|
-
class
|
|
1358
|
+
class We extends E {
|
|
1346
1359
|
constructor() {
|
|
1347
1360
|
super(...arguments);
|
|
1348
1361
|
u(this, "emitEventType", I.RotateNode);
|
|
@@ -1366,9 +1379,9 @@ class Te extends M {
|
|
|
1366
1379
|
}));
|
|
1367
1380
|
}
|
|
1368
1381
|
updateSelectorCallback(e) {
|
|
1369
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s,
|
|
1382
|
+
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, m = c.workState, d = o.sp || [], S = i == null ? void 0 : i.selectRect;
|
|
1370
1383
|
if (n) {
|
|
1371
|
-
h &&
|
|
1384
|
+
h && m === W.Done && d.push({
|
|
1372
1385
|
type: p.Select,
|
|
1373
1386
|
selectIds: r.selectIds,
|
|
1374
1387
|
selectRect: S,
|
|
@@ -1394,7 +1407,7 @@ class Te extends M {
|
|
|
1394
1407
|
};
|
|
1395
1408
|
}
|
|
1396
1409
|
}
|
|
1397
|
-
class
|
|
1410
|
+
class Te extends E {
|
|
1398
1411
|
constructor() {
|
|
1399
1412
|
super(...arguments);
|
|
1400
1413
|
u(this, "emitEventType", I.SetFontStyle);
|
|
@@ -1417,9 +1430,9 @@ class Le extends M {
|
|
|
1417
1430
|
}));
|
|
1418
1431
|
}
|
|
1419
1432
|
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 &&
|
|
1433
|
+
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;
|
|
1434
|
+
if (c && m) {
|
|
1435
|
+
h.fontSize && m.push({
|
|
1423
1436
|
type: p.Select,
|
|
1424
1437
|
selectIds: i.selectIds,
|
|
1425
1438
|
selectRect: d,
|
|
@@ -1428,13 +1441,13 @@ class Le extends M {
|
|
|
1428
1441
|
points: i.getChildrenPoints()
|
|
1429
1442
|
});
|
|
1430
1443
|
for (const [S, y] of r.entries())
|
|
1431
|
-
l && y.toolsType === f.Text ?
|
|
1444
|
+
l && y.toolsType === f.Text ? m.push({
|
|
1432
1445
|
...y,
|
|
1433
1446
|
workId: S,
|
|
1434
1447
|
type: p.TextUpdate,
|
|
1435
1448
|
dataType: g.Local,
|
|
1436
1449
|
willSyncService: !0
|
|
1437
|
-
}) :
|
|
1450
|
+
}) : m.push(
|
|
1438
1451
|
{
|
|
1439
1452
|
...y,
|
|
1440
1453
|
workId: S,
|
|
@@ -1447,11 +1460,11 @@ class Le extends M {
|
|
|
1447
1460
|
);
|
|
1448
1461
|
}
|
|
1449
1462
|
return {
|
|
1450
|
-
sp:
|
|
1463
|
+
sp: m
|
|
1451
1464
|
};
|
|
1452
1465
|
}
|
|
1453
1466
|
}
|
|
1454
|
-
class
|
|
1467
|
+
class Le extends E {
|
|
1455
1468
|
constructor() {
|
|
1456
1469
|
super(...arguments);
|
|
1457
1470
|
u(this, "emitEventType", I.SetPoint);
|
|
@@ -1478,11 +1491,11 @@ class Ne extends M {
|
|
|
1478
1491
|
updateSelectorCallback(e) {
|
|
1479
1492
|
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
1493
|
if (c && h) {
|
|
1481
|
-
for (const [
|
|
1494
|
+
for (const [m, d] of r.entries())
|
|
1482
1495
|
h.push(
|
|
1483
1496
|
{
|
|
1484
1497
|
...d,
|
|
1485
|
-
workId:
|
|
1498
|
+
workId: m,
|
|
1486
1499
|
type: p.UpdateNode,
|
|
1487
1500
|
updateNodeOpt: {
|
|
1488
1501
|
useAnimation: !1
|
|
@@ -1504,7 +1517,7 @@ class Ne extends M {
|
|
|
1504
1517
|
};
|
|
1505
1518
|
}
|
|
1506
1519
|
}
|
|
1507
|
-
class
|
|
1520
|
+
class Ne extends E {
|
|
1508
1521
|
constructor() {
|
|
1509
1522
|
super(...arguments);
|
|
1510
1523
|
u(this, "emitEventType", I.SetLock);
|
|
@@ -1526,7 +1539,7 @@ class be extends M {
|
|
|
1526
1539
|
}));
|
|
1527
1540
|
}
|
|
1528
1541
|
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 || [],
|
|
1542
|
+
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
1543
|
if (c && l) {
|
|
1531
1544
|
for (const [d, S] of r.entries())
|
|
1532
1545
|
l.push(
|
|
@@ -1547,7 +1560,7 @@ class be extends M {
|
|
|
1547
1560
|
canRotate: i.canRotate,
|
|
1548
1561
|
type: p.Select,
|
|
1549
1562
|
selectIds: i.selectIds,
|
|
1550
|
-
selectRect:
|
|
1563
|
+
selectRect: m,
|
|
1551
1564
|
willSyncService: c,
|
|
1552
1565
|
isSync: n
|
|
1553
1566
|
});
|
|
@@ -1557,7 +1570,7 @@ class be extends M {
|
|
|
1557
1570
|
};
|
|
1558
1571
|
}
|
|
1559
1572
|
}
|
|
1560
|
-
class
|
|
1573
|
+
class be extends E {
|
|
1561
1574
|
constructor() {
|
|
1562
1575
|
super(...arguments);
|
|
1563
1576
|
u(this, "emitEventType", I.SetShapeOpt);
|
|
@@ -1606,27 +1619,27 @@ class Ce {
|
|
|
1606
1619
|
build(t) {
|
|
1607
1620
|
switch (t) {
|
|
1608
1621
|
case I.TranslateNode:
|
|
1609
|
-
return new ge();
|
|
1610
|
-
case I.ZIndexNode:
|
|
1611
1622
|
return new ve();
|
|
1623
|
+
case I.ZIndexNode:
|
|
1624
|
+
return new we();
|
|
1612
1625
|
case I.CopyNode:
|
|
1613
|
-
return new
|
|
1626
|
+
return new Se();
|
|
1614
1627
|
case I.SetColorNode:
|
|
1615
|
-
return new
|
|
1628
|
+
return new ye();
|
|
1616
1629
|
case I.DeleteNode:
|
|
1617
|
-
return new
|
|
1630
|
+
return new ge();
|
|
1618
1631
|
case I.ScaleNode:
|
|
1619
|
-
return new
|
|
1632
|
+
return new Ie();
|
|
1620
1633
|
case I.RotateNode:
|
|
1621
|
-
return new
|
|
1634
|
+
return new We();
|
|
1622
1635
|
case I.SetFontStyle:
|
|
1623
|
-
return new
|
|
1636
|
+
return new Te();
|
|
1624
1637
|
case I.SetPoint:
|
|
1625
|
-
return new
|
|
1638
|
+
return new Le();
|
|
1626
1639
|
case I.SetLock:
|
|
1627
|
-
return new
|
|
1640
|
+
return new Ne();
|
|
1628
1641
|
case I.SetShapeOpt:
|
|
1629
|
-
return new
|
|
1642
|
+
return new be();
|
|
1630
1643
|
}
|
|
1631
1644
|
}
|
|
1632
1645
|
registerForMainThread(t) {
|
|
@@ -1641,7 +1654,7 @@ class Ce {
|
|
|
1641
1654
|
return !1;
|
|
1642
1655
|
}
|
|
1643
1656
|
}
|
|
1644
|
-
class
|
|
1657
|
+
class De {
|
|
1645
1658
|
constructor(t, e) {
|
|
1646
1659
|
u(this, "viewId");
|
|
1647
1660
|
u(this, "fullLayer");
|
|
@@ -1667,12 +1680,12 @@ class Oe {
|
|
|
1667
1680
|
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1668
1681
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1669
1682
|
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
|
|
1683
|
+
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
1684
|
const r = {
|
|
1672
1685
|
thread: this,
|
|
1673
1686
|
vNodes: this.vNodes
|
|
1674
1687
|
};
|
|
1675
|
-
this.localWork = new
|
|
1688
|
+
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
1689
|
I.CopyNode,
|
|
1677
1690
|
I.SetColorNode,
|
|
1678
1691
|
I.DeleteNode,
|
|
@@ -1715,7 +1728,7 @@ class Oe {
|
|
|
1715
1728
|
}
|
|
1716
1729
|
async on(t) {
|
|
1717
1730
|
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,
|
|
1731
|
+
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
1732
|
switch (e) {
|
|
1720
1733
|
case p.UpdateDpr:
|
|
1721
1734
|
H(t.dpr) && this.updateDpr(t.dpr);
|
|
@@ -1744,18 +1757,18 @@ class Oe {
|
|
|
1744
1757
|
}
|
|
1745
1758
|
break;
|
|
1746
1759
|
case p.CreateWork:
|
|
1747
|
-
if (
|
|
1760
|
+
if (m && o && s) {
|
|
1748
1761
|
if (this.topWork.canUseTopLayer(s)) {
|
|
1749
1762
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
1750
1763
|
toolsType: s,
|
|
1751
1764
|
toolsOpt: o
|
|
1752
|
-
}), this.topWork.setWorkOptions(
|
|
1765
|
+
}), this.topWork.setWorkOptions(m, o);
|
|
1753
1766
|
break;
|
|
1754
1767
|
}
|
|
1755
1768
|
this.localWork.getToolsOpt() || this.localWork.setToolsOpt({
|
|
1756
1769
|
toolsType: s,
|
|
1757
1770
|
toolsOpt: o
|
|
1758
|
-
}), this.localWork.setWorkOptions(
|
|
1771
|
+
}), this.localWork.setWorkOptions(m, o);
|
|
1759
1772
|
}
|
|
1760
1773
|
break;
|
|
1761
1774
|
case p.DrawWork:
|
|
@@ -2008,11 +2021,11 @@ class Oe {
|
|
|
2008
2021
|
for (const [n, h] of r.entries()) {
|
|
2009
2022
|
const l = this.vNodes.get(n);
|
|
2010
2023
|
if (l) {
|
|
2011
|
-
const
|
|
2024
|
+
const m = h, d = l.rect, S = this.getSceneRect(), y = G(m, S), w = G(d, S);
|
|
2012
2025
|
let v = !1;
|
|
2013
|
-
if ((y !== w ||
|
|
2014
|
-
const { toolsType:
|
|
2015
|
-
|
|
2026
|
+
if ((y !== w || m.w !== d.w || m.h !== d.h || w === Q.intersect) && (v = !0), v) {
|
|
2027
|
+
const { toolsType: C, opt: x } = l;
|
|
2028
|
+
C === f.Text && x.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
2016
2029
|
}
|
|
2017
2030
|
}
|
|
2018
2031
|
}
|
|
@@ -2039,7 +2052,7 @@ class Oe {
|
|
|
2039
2052
|
workId: l
|
|
2040
2053
|
});
|
|
2041
2054
|
if (v) {
|
|
2042
|
-
const
|
|
2055
|
+
const C = this.getSceneRect(), x = G(w, C);
|
|
2043
2056
|
n.push(v.consumeServiceAsync({
|
|
2044
2057
|
isFullWork: !0,
|
|
2045
2058
|
replaceId: l,
|
|
@@ -2098,7 +2111,7 @@ class Oe {
|
|
|
2098
2111
|
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
2112
|
}
|
|
2100
2113
|
}
|
|
2101
|
-
class
|
|
2114
|
+
class Oe {
|
|
2102
2115
|
constructor(t, e) {
|
|
2103
2116
|
u(this, "viewId");
|
|
2104
2117
|
u(this, "fullLayer");
|
|
@@ -2253,14 +2266,14 @@ class Ee {
|
|
|
2253
2266
|
switch (h == null ? void 0 : h.type) {
|
|
2254
2267
|
case p.UpdateNode:
|
|
2255
2268
|
case p.FullWork: {
|
|
2256
|
-
const { opt: l } = h,
|
|
2269
|
+
const { opt: l } = h, m = {
|
|
2257
2270
|
...h,
|
|
2258
2271
|
opt: l,
|
|
2259
2272
|
workId: n,
|
|
2260
2273
|
msgType: p.FullWork,
|
|
2261
2274
|
dataType: g.Service,
|
|
2262
2275
|
viewId: this.viewId
|
|
2263
|
-
}, d = await this.runFullWork(
|
|
2276
|
+
}, d = await this.runFullWork(m);
|
|
2264
2277
|
a = V(a, d);
|
|
2265
2278
|
break;
|
|
2266
2279
|
}
|
|
@@ -2345,7 +2358,7 @@ class Ee {
|
|
|
2345
2358
|
for (const o of s.sp) {
|
|
2346
2359
|
let r = !1;
|
|
2347
2360
|
for (const i of t)
|
|
2348
|
-
if (
|
|
2361
|
+
if (pe(o, i)) {
|
|
2349
2362
|
r = !0;
|
|
2350
2363
|
break;
|
|
2351
2364
|
}
|
|
@@ -2408,31 +2421,31 @@ class _e {
|
|
|
2408
2421
|
this.mainThreadMap.clear();
|
|
2409
2422
|
}
|
|
2410
2423
|
createMainThread(t, e) {
|
|
2411
|
-
return new
|
|
2424
|
+
return new De(t, e);
|
|
2412
2425
|
}
|
|
2413
2426
|
createSnapshotThread(t, e) {
|
|
2414
|
-
return new
|
|
2427
|
+
return new Oe(t, e);
|
|
2415
2428
|
}
|
|
2416
2429
|
async consume(t) {
|
|
2417
2430
|
var e, s, o, r;
|
|
2418
2431
|
for (const i of t.values()) {
|
|
2419
|
-
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt:
|
|
2432
|
+
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: S } = i;
|
|
2420
2433
|
if (a === p.Console) {
|
|
2421
2434
|
console.log(this);
|
|
2422
2435
|
continue;
|
|
2423
2436
|
}
|
|
2424
2437
|
if (a === p.Init) {
|
|
2425
2438
|
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
|
|
2439
|
+
if (w && v && l && m) {
|
|
2440
|
+
const C = this.createMainThread(c, {
|
|
2428
2441
|
displayer: w,
|
|
2429
2442
|
container: v,
|
|
2430
2443
|
layerOpt: l,
|
|
2431
2444
|
master: this.master,
|
|
2432
|
-
canvasOpt:
|
|
2445
|
+
canvasOpt: m,
|
|
2433
2446
|
post: this.post.bind(this)
|
|
2434
2447
|
});
|
|
2435
|
-
this.mainThreadMap.set(c,
|
|
2448
|
+
this.mainThreadMap.set(c, C), C && d && C.setCameraOpt(d);
|
|
2436
2449
|
}
|
|
2437
2450
|
continue;
|
|
2438
2451
|
}
|
|
@@ -2440,7 +2453,7 @@ class _e {
|
|
|
2440
2453
|
const w = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = w.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2441
2454
|
if (w && v && d) {
|
|
2442
2455
|
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
2443
|
-
const
|
|
2456
|
+
const C = {
|
|
2444
2457
|
...J.defaultLayerOpt,
|
|
2445
2458
|
offscreen: !1,
|
|
2446
2459
|
width: d.width,
|
|
@@ -2453,7 +2466,7 @@ class _e {
|
|
|
2453
2466
|
this.snapshotThread = this.createSnapshotThread(c, {
|
|
2454
2467
|
displayer: w,
|
|
2455
2468
|
container: v,
|
|
2456
|
-
layerOpt:
|
|
2469
|
+
layerOpt: C,
|
|
2457
2470
|
master: this.master,
|
|
2458
2471
|
canvasOpt: x,
|
|
2459
2472
|
post: this.post.bind(this)
|
|
@@ -2469,12 +2482,12 @@ class _e {
|
|
|
2469
2482
|
}
|
|
2470
2483
|
if (a === p.TasksQueue && (n != null && n.size)) {
|
|
2471
2484
|
for (const [w, v] of this.mainThreadMap.entries()) {
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2485
|
+
const C = n.get(w);
|
|
2486
|
+
C && (await v.on(C), h && this.post({ workerTasksqueueCount: h }));
|
|
2474
2487
|
}
|
|
2475
2488
|
continue;
|
|
2476
2489
|
}
|
|
2477
|
-
if (c ===
|
|
2490
|
+
if (c === de) {
|
|
2478
2491
|
for (const w of this.mainThreadMap.values())
|
|
2479
2492
|
w.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2480
2493
|
continue;
|