@netless/appliance-plugin 1.1.0 → 1.1.1-7.beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -9
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-DXT06v.js +441 -0
- package/cdn/subWorker-caziyz.js +441 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +23 -19
- package/dist/collector/base.d.ts +3 -0
- package/dist/collector/collector.d.ts +40 -3
- package/dist/collector/enum.d.ts +0 -3
- package/dist/collector/eventCollector.d.ts +1 -0
- package/dist/collector/magixEventCollector.d.ts +1 -0
- package/dist/collector/types.d.ts +61 -15
- package/dist/component/autoDraw/index.d.ts +54 -0
- package/dist/component/miniMap/index.d.ts +1 -0
- package/dist/component/miniMap/manager.d.ts +37 -0
- package/dist/component/miniMap/view.d.ts +14 -0
- package/dist/core/enum.d.ts +56 -6
- package/dist/core/mainEngine.d.ts +36 -15
- package/dist/core/mainThread/base.d.ts +4 -0
- package/dist/core/mainThread/snapshotThread.d.ts +4 -1
- package/dist/core/mainThread/subLocalThread.d.ts +6 -6
- package/dist/core/mainThread/subServiceThread.d.ts +1 -1
- package/dist/core/mainThread/subTopThread.d.ts +2 -2
- package/dist/core/mainThread/workerMainThread.d.ts +3 -2
- package/dist/core/plugin.d.ts +49 -0
- package/dist/core/renderCotrol.d.ts +108 -0
- package/dist/core/tools/arrow.d.ts +3 -2
- package/dist/core/tools/base.d.ts +39 -5
- package/dist/core/tools/ellipse.d.ts +3 -2
- package/dist/core/tools/eraser.d.ts +1 -1
- package/dist/core/tools/image.d.ts +9 -7
- package/dist/core/tools/pencil.d.ts +4 -3
- package/dist/core/tools/pencilEraser.d.ts +1 -1
- package/dist/core/tools/pencilEraserBitMap.d.ts +21 -6
- package/dist/core/tools/polygon.d.ts +3 -2
- package/dist/core/tools/rectangle.d.ts +3 -2
- package/dist/core/tools/selector.d.ts +2 -2
- package/dist/core/tools/speechBalloon.d.ts +3 -2
- package/dist/core/tools/star.d.ts +3 -2
- package/dist/core/tools/straight.d.ts +3 -2
- package/dist/core/tools/utils.d.ts +4 -3
- package/dist/core/types.d.ts +16 -11
- package/dist/core/utils/math.d.ts +1 -0
- package/dist/core/utils/spriteNode.d.ts +9 -3
- package/dist/core/vNodeManager.d.ts +14 -3
- package/dist/core/worker/base.d.ts +19 -9
- package/dist/core/worker/fullWorkerLocal.d.ts +9 -4
- package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
- package/dist/core/worker/workerManager.d.ts +2 -2
- package/dist/displayer/floatBar/index.d.ts +1 -0
- package/dist/extend.d.ts +2 -0
- package/dist/fullWorker.js +158 -156
- package/dist/{index-C4KNxHht.mjs → index-16eeAu4_.mjs} +874 -862
- package/dist/index-BgMemNid.mjs +16918 -0
- package/dist/index-Bpx1RNLY.js +1 -0
- package/dist/index-D0mDu2PZ.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/members/index.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +29 -2
- package/dist/plugin/baseViewContainerManager.d.ts +3 -2
- package/dist/plugin/const.d.ts +6 -4
- package/dist/plugin/displayerView.d.ts +2 -0
- package/dist/plugin/multi/applianceMultiManager.d.ts +0 -1
- package/dist/plugin/types.d.ts +116 -7
- package/dist/style.css +1 -1
- package/dist/subWorker.js +158 -156
- package/dist/undo/index.d.ts +2 -2
- package/package.json +6 -7
- package/cdn/fullWorker-CjGKnN.js +0 -439
- package/cdn/subWorker-DUJqv_.js +0 -439
- package/dist/index-C29o_HLi.js +0 -1
- package/dist/index-CIJP6_Qj.mjs +0 -14190
- package/dist/index-DmfRoAiB.js +0 -1
|
@@ -1,162 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { Scene as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var ce = (L, t, e) => t in L ? ne(L, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : L[t] = e;
|
|
3
|
+
var u = (L, t, e) => ce(L, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { D as P, E as W, a as f, r as 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 B, 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-BgMemNid.mjs";
|
|
5
|
+
import { Scene as oe, Group as re } from "spritejs";
|
|
6
|
+
import { cloneDeep as ie, xor as fe, isNumber as H, isEqual as ee } from "lodash";
|
|
7
7
|
import "lineclip";
|
|
8
8
|
import "white-web-sdk";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
import "react";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
d(this, "viewId");
|
|
14
|
-
d(this, "scene");
|
|
15
|
-
d(this, "fullLayer");
|
|
16
|
-
d(this, "curNodeMap", /* @__PURE__ */ new Map());
|
|
17
|
-
d(this, "targetNodeMap", []);
|
|
18
|
-
d(this, "highLevelIds");
|
|
19
|
-
this.viewId = t, this.scene = e;
|
|
20
|
-
}
|
|
21
|
-
init(t) {
|
|
22
|
-
this.fullLayer = t;
|
|
23
|
-
}
|
|
24
|
-
get(t) {
|
|
25
|
-
return this.curNodeMap.get(t);
|
|
26
|
-
}
|
|
27
|
-
getUnLockNodes() {
|
|
28
|
-
const t = /* @__PURE__ */ new Map();
|
|
29
|
-
for (const [e, s] of this.curNodeMap.entries())
|
|
30
|
-
s.toolsType === f.Image && s.opt.locked || s.toolsType === f.Text && (s.opt.workState === I.Doing || s.opt.workState === I.Start) || t.set(e, s);
|
|
31
|
-
return t;
|
|
32
|
-
}
|
|
33
|
-
getNodesByType(t) {
|
|
34
|
-
const e = /* @__PURE__ */ new Map();
|
|
35
|
-
return this.curNodeMap.forEach((s, o) => {
|
|
36
|
-
s.toolsType === t && e.set(o, s);
|
|
37
|
-
}), e;
|
|
38
|
-
}
|
|
39
|
-
hasRenderNodes() {
|
|
40
|
-
let t = !1;
|
|
41
|
-
for (const e of this.curNodeMap.values())
|
|
42
|
-
oe(e) && (t = !0);
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
has(t) {
|
|
46
|
-
return this.curNodeMap.has(t);
|
|
47
|
-
}
|
|
48
|
-
setInfo(t, e) {
|
|
49
|
-
const s = this.curNodeMap.get(t) || {
|
|
50
|
-
name: t,
|
|
51
|
-
rect: e.rect
|
|
52
|
-
};
|
|
53
|
-
e.rect && (s.rect = R(e.rect)), e.op && re(e.op) && (s.op = R(e.op)), e.canRotate && (s.canRotate = e.canRotate), e.scaleType && (s.scaleType = e.scaleType), e.opt && (s.opt = R(e.opt)), e.toolsType && (s.toolsType = e.toolsType), e.centerPos && (s.centerPos = R(e.centerPos)), ie(e.isSelected) && (s.isSelected = e.isSelected), s.rect ? this.curNodeMap.set(t, s) : this.curNodeMap.delete(t);
|
|
54
|
-
}
|
|
55
|
-
selected(t) {
|
|
56
|
-
this.setInfo(t, { isSelected: !0 });
|
|
57
|
-
}
|
|
58
|
-
unSelected(t) {
|
|
59
|
-
this.setInfo(t, { isSelected: !1 });
|
|
60
|
-
}
|
|
61
|
-
delete(t) {
|
|
62
|
-
this.curNodeMap.delete(t);
|
|
63
|
-
}
|
|
64
|
-
clear() {
|
|
65
|
-
this.curNodeMap.clear(), this.targetNodeMap.length = 0;
|
|
66
|
-
}
|
|
67
|
-
hasRectIntersectRange(t, e = !0) {
|
|
68
|
-
for (const s of this.curNodeMap.values())
|
|
69
|
-
if (B(t, s.rect)) {
|
|
70
|
-
if (e && s.toolsType === f.Image && s.opt.locked || e && s.toolsType === f.Text && (s.opt.workState === I.Doing || s.opt.workState === I.Start))
|
|
71
|
-
continue;
|
|
72
|
-
return !0;
|
|
73
|
-
}
|
|
74
|
-
return !1;
|
|
75
|
-
}
|
|
76
|
-
getRectIntersectRange(t, e = !0, s = !0) {
|
|
77
|
-
let o;
|
|
78
|
-
const r = /* @__PURE__ */ new Map();
|
|
79
|
-
for (const [i, a] of this.curNodeMap.entries())
|
|
80
|
-
if (B(t, a.rect)) {
|
|
81
|
-
if (e && a.toolsType === f.Image && a.opt.locked || s && a.toolsType === f.Text && (a.opt.workState === I.Doing || a.opt.workState === I.Start))
|
|
82
|
-
continue;
|
|
83
|
-
o = A(o, a.rect), r.set(i, a);
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
rectRange: o,
|
|
87
|
-
nodeRange: r
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
getNodeRectFormShape(t, e) {
|
|
91
|
-
const s = ae(e.toolsType);
|
|
92
|
-
return this.fullLayer && (s == null ? void 0 : s.getRectFromLayer(this.fullLayer, t));
|
|
93
|
-
}
|
|
94
|
-
updateNodeRect(t) {
|
|
95
|
-
const e = this.curNodeMap.get(t);
|
|
96
|
-
if (e) {
|
|
97
|
-
const s = this.getNodeRectFormShape(t, e);
|
|
98
|
-
if (!s) {
|
|
99
|
-
this.curNodeMap.delete(t);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
e.rect = s, this.curNodeMap.set(t, e);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
updateHighLevelNodesRect(t) {
|
|
106
|
-
this.highLevelIds = t;
|
|
107
|
-
for (const e of this.highLevelIds.keys())
|
|
108
|
-
this.updateNodeRect(e);
|
|
109
|
-
}
|
|
110
|
-
updateLowLevelNodesRect() {
|
|
111
|
-
var t;
|
|
112
|
-
for (const e of this.curNodeMap.keys())
|
|
113
|
-
(t = this.highLevelIds) != null && t.has(e) || this.updateNodeRect(e);
|
|
114
|
-
}
|
|
115
|
-
clearHighLevelIds() {
|
|
116
|
-
this.highLevelIds = void 0;
|
|
117
|
-
}
|
|
118
|
-
combineIntersectRect(t) {
|
|
119
|
-
let e = t;
|
|
120
|
-
return this.curNodeMap.forEach((s) => {
|
|
121
|
-
B(e, s.rect) && (e = A(e, s.rect));
|
|
122
|
-
}), e;
|
|
123
|
-
}
|
|
124
|
-
setTargetAssignKeys(t) {
|
|
125
|
-
const e = /* @__PURE__ */ new Map();
|
|
126
|
-
for (const s of t) {
|
|
127
|
-
const o = this.curNodeMap.get(s);
|
|
128
|
-
o && e.set(s, R(o));
|
|
129
|
-
}
|
|
130
|
-
return this.targetNodeMap.push(R(e)), this.targetNodeMap.length - 1;
|
|
131
|
-
}
|
|
132
|
-
setTarget() {
|
|
133
|
-
return this.targetNodeMap.push(R(this.curNodeMap)), this.targetNodeMap.length - 1;
|
|
134
|
-
}
|
|
135
|
-
getLastTarget() {
|
|
136
|
-
return this.targetNodeMap[this.targetNodeMap.length - 1];
|
|
137
|
-
}
|
|
138
|
-
deleteLastTarget() {
|
|
139
|
-
this.targetNodeMap.length && (this.targetNodeMap.length = this.targetNodeMap.length - 1);
|
|
140
|
-
}
|
|
141
|
-
getTarget(t) {
|
|
142
|
-
return this.targetNodeMap[t];
|
|
143
|
-
}
|
|
144
|
-
deleteTarget(t) {
|
|
145
|
-
this.targetNodeMap.length = t;
|
|
146
|
-
}
|
|
147
|
-
clearTarget() {
|
|
148
|
-
this.targetNodeMap.length = 0;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
class fe {
|
|
11
|
+
import "eventemitter2";
|
|
12
|
+
class me {
|
|
152
13
|
constructor(t) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
14
|
+
u(this, "vNodes");
|
|
15
|
+
u(this, "thread");
|
|
16
|
+
u(this, "serviceWorkShapes", /* @__PURE__ */ new Map());
|
|
17
|
+
u(this, "localWorkShapes", /* @__PURE__ */ new Map());
|
|
18
|
+
u(this, "tmpOpt");
|
|
19
|
+
u(this, "animationId");
|
|
20
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
160
21
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
161
22
|
}
|
|
162
23
|
createLocalWork(t) {
|
|
@@ -181,7 +42,7 @@ class fe {
|
|
|
181
42
|
return o && this.localWorkShapes.set(t, {
|
|
182
43
|
node: o,
|
|
183
44
|
toolsType: o.toolsType,
|
|
184
|
-
workState:
|
|
45
|
+
workState: W.Start
|
|
185
46
|
}), o;
|
|
186
47
|
}
|
|
187
48
|
}
|
|
@@ -194,18 +55,18 @@ class fe {
|
|
|
194
55
|
clearAll() {
|
|
195
56
|
this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
|
|
196
57
|
t.name !== "viewport" && t.remove();
|
|
197
|
-
}), this.thread.serviceLayer.
|
|
58
|
+
}), z(this.thread.serviceLayer, this.thread.serviceLayer.parent)), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
|
|
198
59
|
}
|
|
199
60
|
consumeDraw(t) {
|
|
200
61
|
const { workId: e, dataType: s } = t;
|
|
201
|
-
if (s ===
|
|
62
|
+
if (s === g.Service)
|
|
202
63
|
this.activeServiceWorkShape(t);
|
|
203
64
|
else {
|
|
204
65
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
205
66
|
if (!r)
|
|
206
67
|
return;
|
|
207
68
|
const i = r.node.consume({ data: t, isFullWork: !1, isSubWorker: !0 });
|
|
208
|
-
i.rect && (r.result = i, r.workState =
|
|
69
|
+
i.rect && (r.result = i, r.workState = W.Doing, o && this.localWorkShapes.set(o, r));
|
|
209
70
|
}
|
|
210
71
|
this.runAnimation();
|
|
211
72
|
}
|
|
@@ -219,31 +80,31 @@ class fe {
|
|
|
219
80
|
createWorkShapeNode(t) {
|
|
220
81
|
const { toolsType: e } = t;
|
|
221
82
|
if (e === f.LaserPen)
|
|
222
|
-
return
|
|
83
|
+
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.topLayer, drawLayer: this.thread.topLayer });
|
|
223
84
|
}
|
|
224
85
|
setNodeKey(t, e, s, o) {
|
|
225
86
|
return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
|
|
226
87
|
}
|
|
227
88
|
activeServiceWorkShape(t) {
|
|
228
|
-
var
|
|
229
|
-
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op:
|
|
89
|
+
var m, d;
|
|
90
|
+
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c } = t;
|
|
230
91
|
if (!e)
|
|
231
92
|
return;
|
|
232
|
-
const
|
|
233
|
-
if (!((
|
|
234
|
-
let
|
|
93
|
+
const n = e.toString(), h = (m = this.vNodes.get(n)) == null ? void 0 : m.rect;
|
|
94
|
+
if (!((d = this.serviceWorkShapes) != null && d.has(n))) {
|
|
95
|
+
let S = {
|
|
235
96
|
toolsType: o,
|
|
236
|
-
animationWorkData:
|
|
97
|
+
animationWorkData: c || [],
|
|
237
98
|
animationIndex: 0,
|
|
238
99
|
type: r,
|
|
239
100
|
updateNodeOpt: i,
|
|
240
101
|
ops: a,
|
|
241
102
|
oldRect: h
|
|
242
103
|
};
|
|
243
|
-
o && s && (
|
|
104
|
+
o && s && (S = this.setNodeKey(n, S, o, s)), this.serviceWorkShapes.set(n, S);
|
|
244
105
|
}
|
|
245
|
-
const l = this.serviceWorkShapes.get(
|
|
246
|
-
r && (l.type = r), a && (l.animationWorkData =
|
|
106
|
+
const l = this.serviceWorkShapes.get(n);
|
|
107
|
+
r && (l.type = r), a && (l.animationWorkData = U(a), l.ops = a), i && (l.updateNodeOpt = i), c && (l.animationWorkData = c), l.node && l.node.getWorkId() !== n && l.node.setWorkId(n), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(n, l, o, s), l.node && l.node.setWorkOptions(s));
|
|
247
108
|
}
|
|
248
109
|
computNextAnimationIndex(t, e) {
|
|
249
110
|
var r;
|
|
@@ -255,46 +116,46 @@ class fe {
|
|
|
255
116
|
this.animationId = void 0;
|
|
256
117
|
let t = !1;
|
|
257
118
|
const e = /* @__PURE__ */ new Map(), s = [];
|
|
258
|
-
for (const [
|
|
259
|
-
switch (
|
|
119
|
+
for (const [c, n] of this.serviceWorkShapes.entries())
|
|
120
|
+
switch (n.toolsType) {
|
|
260
121
|
case f.LaserPen: {
|
|
261
|
-
const l = this.computNextAnimationIndex(
|
|
262
|
-
if ((
|
|
263
|
-
op:
|
|
122
|
+
const l = this.computNextAnimationIndex(n, 8), m = Math.max(0, n.animationIndex || 0), d = (n.animationWorkData || []).slice(m, l);
|
|
123
|
+
if ((n.animationIndex || 0) < l && ((o = n.node) == null || o.consumeService({
|
|
124
|
+
op: d,
|
|
264
125
|
isFullWork: !1
|
|
265
|
-
}),
|
|
266
|
-
workState:
|
|
267
|
-
op:
|
|
268
|
-
})),
|
|
269
|
-
(i =
|
|
126
|
+
}), n.animationIndex = l, d.length && e.set(c, {
|
|
127
|
+
workState: m === 0 ? W.Start : l === ((r = n.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
|
|
128
|
+
op: d.slice(-2)
|
|
129
|
+
})), n.isDel) {
|
|
130
|
+
(i = n.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(c);
|
|
270
131
|
break;
|
|
271
132
|
}
|
|
272
|
-
|
|
133
|
+
n.ops && n.animationIndex === ((a = n.animationWorkData) == null ? void 0 : a.length) && !n.isDel && (this.thread.topLayer.getElementsByName(c.toString())[0] || (n.isDel = !0, this.serviceWorkShapes.set(c, n))), t = !0;
|
|
273
134
|
break;
|
|
274
135
|
}
|
|
275
136
|
}
|
|
276
|
-
for (const [
|
|
277
|
-
const { result: h, toolsType: l, isDel:
|
|
137
|
+
for (const [c, n] of this.localWorkShapes.entries()) {
|
|
138
|
+
const { result: h, toolsType: l, isDel: m, workState: d } = n;
|
|
278
139
|
switch (l) {
|
|
279
140
|
case f.LaserPen: {
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
removeIds: [
|
|
141
|
+
if (m) {
|
|
142
|
+
n.node.clearTmpPoints(), this.localWorkShapes.delete(c), s.push({
|
|
143
|
+
removeIds: [c.toString()],
|
|
283
144
|
type: p.RemoveNode
|
|
284
145
|
});
|
|
285
146
|
break;
|
|
286
147
|
}
|
|
287
|
-
h && ((h.op || h.ops) && s.push(h),
|
|
148
|
+
h && ((h.op || h.ops) && s.push(h), n.result = void 0), !this.thread.topLayer.getElementsByName(c.toString())[0] && d === W.Done && (n.isDel = !0, this.localWorkShapes.set(c, n)), t = !0;
|
|
288
149
|
break;
|
|
289
150
|
}
|
|
290
151
|
}
|
|
291
152
|
}
|
|
292
|
-
t && this.runAnimation(), e.size && e.forEach((
|
|
153
|
+
t && this.runAnimation(), e.size && e.forEach((c, n) => {
|
|
293
154
|
s.push({
|
|
294
155
|
type: p.Cursor,
|
|
295
|
-
uid:
|
|
296
|
-
op:
|
|
297
|
-
workState:
|
|
156
|
+
uid: n.split(te)[0],
|
|
157
|
+
op: c.op,
|
|
158
|
+
workState: c.workState,
|
|
298
159
|
viewId: this.thread.viewId
|
|
299
160
|
});
|
|
300
161
|
}), s.length && this.thread.post({ sp: s });
|
|
@@ -310,44 +171,45 @@ class fe {
|
|
|
310
171
|
this.tmpOpt.toolsOpt = e, s = this.createWorkShapeNode({ workId: t, toolsType: r, toolsOpt: e }), s && this.localWorkShapes.set(t, {
|
|
311
172
|
node: s,
|
|
312
173
|
toolsType: r,
|
|
313
|
-
workState:
|
|
174
|
+
workState: W.Start
|
|
314
175
|
}), this.setToolsOpt(this.tmpOpt);
|
|
315
176
|
}
|
|
316
177
|
e != null && e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s && s.setWorkOptions(e);
|
|
317
178
|
}
|
|
318
179
|
consumeDrawAll(t) {
|
|
319
180
|
const { workId: e, dataType: s } = t;
|
|
320
|
-
if (s ===
|
|
181
|
+
if (s === g.Service)
|
|
321
182
|
this.activeServiceWorkShape(t);
|
|
322
183
|
else {
|
|
323
184
|
const o = e == null ? void 0 : e.toString(), r = o && this.localWorkShapes.get(o);
|
|
324
185
|
if (!r)
|
|
325
186
|
return;
|
|
326
187
|
const i = r.node.consumeAll({ data: t });
|
|
327
|
-
r.result = i, r.workState =
|
|
188
|
+
r.result = i, r.workState = W.Done, o && this.localWorkShapes.set(o, r);
|
|
328
189
|
}
|
|
329
190
|
this.runAnimation();
|
|
330
191
|
}
|
|
331
192
|
}
|
|
332
|
-
class
|
|
193
|
+
class ke {
|
|
333
194
|
constructor(t) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
195
|
+
u(this, "vNodes");
|
|
196
|
+
u(this, "thread");
|
|
197
|
+
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
198
|
+
u(this, "effectSelectNodeData", /* @__PURE__ */ new Set());
|
|
199
|
+
u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
|
|
200
|
+
u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
|
|
201
|
+
u(this, "tmpOpt");
|
|
202
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
203
|
+
u(this, "fullWorkerDrawCount", 0);
|
|
204
|
+
u(this, "drawWorkActiveId");
|
|
205
|
+
u(this, "consumeCount", 0);
|
|
206
|
+
u(this, "batchEraserCombine", he(() => {
|
|
345
207
|
this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
|
|
346
208
|
}, 100, { leading: !1 }));
|
|
347
209
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
348
210
|
}
|
|
349
211
|
async loadImageBitMap(t) {
|
|
350
|
-
return this.thread.loadImageBitMap(t);
|
|
212
|
+
return await this.thread.loadImageBitMap(t);
|
|
351
213
|
}
|
|
352
214
|
createLocalWork(t) {
|
|
353
215
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -359,36 +221,37 @@ class Se {
|
|
|
359
221
|
}), this.setWorkOptions(r, s);
|
|
360
222
|
}
|
|
361
223
|
}
|
|
362
|
-
workShapesDone(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
224
|
+
// async workShapesDone(scenePath: string, serviceWork: SubServiceThread) {
|
|
225
|
+
// for (const key of this.workShapes.keys()) {
|
|
226
|
+
// await this.consumeDrawAll({
|
|
227
|
+
// workId: key,
|
|
228
|
+
// scenePath,
|
|
229
|
+
// viewId: this.thread.viewId,
|
|
230
|
+
// msgType: EPostMessageType.DrawWork,
|
|
231
|
+
// dataType: EDataType.Local
|
|
232
|
+
// }, serviceWork)
|
|
233
|
+
// }
|
|
234
|
+
// }
|
|
372
235
|
async updateSelector(t) {
|
|
373
|
-
var
|
|
374
|
-
const e = this.workShapes.get(
|
|
375
|
-
if (!((
|
|
236
|
+
var m;
|
|
237
|
+
const e = this.workShapes.get(T);
|
|
238
|
+
if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
|
|
376
239
|
const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
|
|
377
240
|
updateSelectorOpt: r,
|
|
378
|
-
selectIds:
|
|
241
|
+
selectIds: ie(e.selectIds),
|
|
379
242
|
vNodes: this.vNodes,
|
|
380
243
|
willSerializeData: i,
|
|
381
244
|
worker: this
|
|
382
|
-
})),
|
|
383
|
-
let
|
|
384
|
-
a != null && a.selectIds && (
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
const { toolsType:
|
|
388
|
-
|
|
389
|
-
opt:
|
|
390
|
-
toolsType:
|
|
391
|
-
ops: (
|
|
245
|
+
})), c = /* @__PURE__ */ new Map();
|
|
246
|
+
let n;
|
|
247
|
+
a != null && a.selectIds && (n = fe(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
|
|
248
|
+
const S = this.vNodes.get(d);
|
|
249
|
+
if (S) {
|
|
250
|
+
const { toolsType: w, op: y, opt: v } = S;
|
|
251
|
+
c.set(d, {
|
|
252
|
+
opt: v,
|
|
253
|
+
toolsType: w,
|
|
254
|
+
ops: (y == null ? void 0 : y.length) && X(y) || void 0
|
|
392
255
|
});
|
|
393
256
|
}
|
|
394
257
|
}), e.selectIds = a.selectIds);
|
|
@@ -397,11 +260,11 @@ class Se {
|
|
|
397
260
|
workShapeNode: e,
|
|
398
261
|
param: o,
|
|
399
262
|
postData: { sp: h },
|
|
400
|
-
newServiceStore:
|
|
263
|
+
newServiceStore: c
|
|
401
264
|
}) || { sp: h };
|
|
402
|
-
|
|
265
|
+
n && l.sp.push({
|
|
403
266
|
type: p.RemoveNode,
|
|
404
|
-
removeIds:
|
|
267
|
+
removeIds: n,
|
|
405
268
|
viewId: this.thread.viewId
|
|
406
269
|
}), l.sp.length && this.thread.post(l);
|
|
407
270
|
}
|
|
@@ -411,11 +274,11 @@ class Se {
|
|
|
411
274
|
clearAll() {
|
|
412
275
|
if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
|
|
413
276
|
e.name !== "viewport" && e.remove();
|
|
414
|
-
}), this.thread.localLayer.
|
|
277
|
+
}), z(this.thread.localLayer, this.thread.localLayer.parent)), this.workShapes.get(T)) {
|
|
415
278
|
const e = [];
|
|
416
279
|
e.push({
|
|
417
280
|
type: p.Select,
|
|
418
|
-
dataType:
|
|
281
|
+
dataType: g.Local,
|
|
419
282
|
selectIds: [],
|
|
420
283
|
willSyncService: !1
|
|
421
284
|
}), this.thread.post({ sp: e });
|
|
@@ -427,9 +290,9 @@ class Se {
|
|
|
427
290
|
if (e != null && e.length) {
|
|
428
291
|
let r;
|
|
429
292
|
for (const i of this.vNodes.curNodeMap.values()) {
|
|
430
|
-
const { rect: a, name:
|
|
431
|
-
if (
|
|
432
|
-
r =
|
|
293
|
+
const { rect: a, name: c, toolsType: n, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], m = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
294
|
+
if (n === f.Text && le([l, m], a) && h.workState === W.Done) {
|
|
295
|
+
r = c;
|
|
433
296
|
break;
|
|
434
297
|
}
|
|
435
298
|
}
|
|
@@ -449,36 +312,43 @@ class Se {
|
|
|
449
312
|
}
|
|
450
313
|
cursorHover(t) {
|
|
451
314
|
const { opt: e, toolsType: s, point: o } = t, r = this.setFullWork({
|
|
452
|
-
workId:
|
|
315
|
+
workId: F,
|
|
453
316
|
toolsType: s,
|
|
454
317
|
opt: e
|
|
455
318
|
});
|
|
456
319
|
r && o && r.cursorHover(o);
|
|
457
320
|
}
|
|
321
|
+
cursorBlur() {
|
|
322
|
+
var e;
|
|
323
|
+
const t = this.getWorkShape(F);
|
|
324
|
+
t && ((e = t.selectIds) != null && e.length) && (t.cursorBlur(), this.clearWorkShapeNodeCache(F)), this.thread.fullLayer.parent.children.forEach((s) => {
|
|
325
|
+
s.name === "Cursor_Hover_Id" && s.remove();
|
|
326
|
+
});
|
|
327
|
+
}
|
|
458
328
|
updateFullSelectWork(t) {
|
|
459
|
-
var o, r, i, a,
|
|
460
|
-
const e = this.workShapes.get(
|
|
329
|
+
var o, r, i, a, c;
|
|
330
|
+
const e = this.workShapes.get(T), { selectIds: s } = t;
|
|
461
331
|
if (!(s != null && s.length)) {
|
|
462
332
|
this.blurSelector(t);
|
|
463
333
|
return;
|
|
464
334
|
}
|
|
465
335
|
if (!e) {
|
|
466
|
-
const
|
|
467
|
-
!
|
|
336
|
+
const n = this.setFullWork(t);
|
|
337
|
+
!n && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(t.workId.toString(), t.opt || this.tmpOpt.toolsOpt), n && this.updateFullSelectWork(t);
|
|
468
338
|
return;
|
|
469
339
|
}
|
|
470
340
|
if (e && (s != null && s.length)) {
|
|
471
|
-
const { selectRect:
|
|
341
|
+
const { selectRect: n } = e.updateSelectIds(s), h = [{
|
|
472
342
|
...t,
|
|
473
343
|
selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
|
|
474
344
|
strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
|
|
475
345
|
fillColor: ((a = t.opt) == null ? void 0 : a.fillColor) || e.fillColor,
|
|
476
|
-
textOpt: ((
|
|
346
|
+
textOpt: ((c = t.opt) == null ? void 0 : c.textOpt) || e.textOpt,
|
|
477
347
|
canTextEdit: e.canTextEdit,
|
|
478
348
|
canRotate: e.canRotate,
|
|
479
349
|
scaleType: e.scaleType,
|
|
480
350
|
type: p.Select,
|
|
481
|
-
selectRect:
|
|
351
|
+
selectRect: n,
|
|
482
352
|
points: e.getChildrenPoints(),
|
|
483
353
|
willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
|
|
484
354
|
opt: (t == null ? void 0 : t.willSyncService) && e.getWorkOptions() || void 0,
|
|
@@ -500,18 +370,18 @@ class Se {
|
|
|
500
370
|
type: p.TextUpdate,
|
|
501
371
|
toolsType: f.Text,
|
|
502
372
|
workId: t,
|
|
503
|
-
dataType:
|
|
373
|
+
dataType: g.Local
|
|
504
374
|
};
|
|
505
375
|
}
|
|
506
376
|
async removeSelector(t) {
|
|
507
|
-
const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(
|
|
377
|
+
const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(T);
|
|
508
378
|
if (!r)
|
|
509
379
|
return;
|
|
510
380
|
const i = r.selectIds && [...r.selectIds] || [];
|
|
511
381
|
for (const a of i) {
|
|
512
382
|
if (this.vNodes.get(a)) {
|
|
513
|
-
const
|
|
514
|
-
|
|
383
|
+
const n = this.commandDeleteText(a);
|
|
384
|
+
n && s.push(n);
|
|
515
385
|
}
|
|
516
386
|
this.removeNode(a), o.push(a);
|
|
517
387
|
}
|
|
@@ -531,9 +401,9 @@ class Se {
|
|
|
531
401
|
removeNode(t) {
|
|
532
402
|
var o;
|
|
533
403
|
this.vNodes.get(t) && ((o = this.thread.fullLayer) == null || o.getElementsByName(t).forEach((r) => {
|
|
534
|
-
r.remove();
|
|
404
|
+
r.remove(), R(r, this.thread.fullLayer.parent);
|
|
535
405
|
}), this.vNodes.delete(t)), this.workShapes.has(t) && (this.thread.localLayer.getElementsByName(t).forEach((r) => {
|
|
536
|
-
r.remove();
|
|
406
|
+
r.remove(), R(r, this.thread.localLayer.parent);
|
|
537
407
|
}), this.clearWorkShapeNodeCache(t));
|
|
538
408
|
}
|
|
539
409
|
setFullWork(t) {
|
|
@@ -550,7 +420,7 @@ class Se {
|
|
|
550
420
|
}
|
|
551
421
|
async consumeFull(t) {
|
|
552
422
|
var o;
|
|
553
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
423
|
+
const e = this.setFullWork(t), s = t.ops && U(t.ops);
|
|
554
424
|
if (e) {
|
|
555
425
|
const r = (o = t.workId) == null ? void 0 : o.toString();
|
|
556
426
|
e.toolsType === f.Image ? await e.consumeServiceAsync({
|
|
@@ -578,7 +448,7 @@ class Se {
|
|
|
578
448
|
}
|
|
579
449
|
}
|
|
580
450
|
async colloctEffectSelectWork(t) {
|
|
581
|
-
const e = this.workShapes.get(
|
|
451
|
+
const e = this.workShapes.get(T), { workId: s, msgType: o } = t;
|
|
582
452
|
if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
|
|
583
453
|
o === p.RemoveNode ? e.selectIds = e.selectIds.filter((r) => r !== s.toString()) : this.effectSelectNodeData.add(t), await new Promise((r) => {
|
|
584
454
|
setTimeout(() => {
|
|
@@ -610,7 +480,7 @@ class Se {
|
|
|
610
480
|
replaceId: r
|
|
611
481
|
});
|
|
612
482
|
else {
|
|
613
|
-
const i = s.ops &&
|
|
483
|
+
const i = s.ops && U(s.ops);
|
|
614
484
|
o.consumeService({
|
|
615
485
|
op: i,
|
|
616
486
|
isFullWork: !0,
|
|
@@ -623,14 +493,14 @@ class Se {
|
|
|
623
493
|
this.reRenderSelector(t);
|
|
624
494
|
}
|
|
625
495
|
hasSelector() {
|
|
626
|
-
return this.workShapes.has(
|
|
496
|
+
return this.workShapes.has(T);
|
|
627
497
|
}
|
|
628
498
|
getSelector() {
|
|
629
|
-
return this.workShapes.get(
|
|
499
|
+
return this.workShapes.get(T);
|
|
630
500
|
}
|
|
631
501
|
reRenderSelector(t = !1) {
|
|
632
502
|
var o;
|
|
633
|
-
const e = this.workShapes.get(
|
|
503
|
+
const e = this.workShapes.get(T);
|
|
634
504
|
if (!e) return;
|
|
635
505
|
if (e && !((o = e.selectIds) != null && o.length))
|
|
636
506
|
return this.blurSelector();
|
|
@@ -663,9 +533,9 @@ class Se {
|
|
|
663
533
|
}
|
|
664
534
|
async blurSelector(t) {
|
|
665
535
|
var o;
|
|
666
|
-
const e = this.workShapes.get(
|
|
667
|
-
if (this.clearWorkShapeNodeCache(
|
|
668
|
-
r.name ===
|
|
536
|
+
const e = this.workShapes.get(T), s = e == null ? void 0 : e.blurSelector();
|
|
537
|
+
if (this.clearWorkShapeNodeCache(T), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
|
|
538
|
+
r.name === T && r.remove();
|
|
669
539
|
}), s) {
|
|
670
540
|
const r = [];
|
|
671
541
|
r.push({
|
|
@@ -678,60 +548,49 @@ class Se {
|
|
|
678
548
|
var e;
|
|
679
549
|
(e = this.getWorkShape(t)) == null || e.clearTmpPoints(), this.workShapes.delete(t);
|
|
680
550
|
}
|
|
681
|
-
|
|
682
|
-
const e = [
|
|
683
|
-
t.op && e.push(t), e.length && this.thread.post({ sp: e });
|
|
684
|
-
}
|
|
685
|
-
async drawBitMapEraserFull(t, e) {
|
|
686
|
-
const { willUpdateNodes: s, isLockSentEventCursor: o, scenePath: r, ...i } = e, a = t.getWorkId(), n = [
|
|
551
|
+
async drawBitMapEraserFull(t, e, s) {
|
|
552
|
+
const { willUpdateNodes: o, willDeleteNodes: r } = e, i = t.getWorkId(), a = [
|
|
687
553
|
{
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
scenePath: r,
|
|
692
|
-
updateNodeOpt: {
|
|
693
|
-
useAnimation: !1
|
|
694
|
-
},
|
|
695
|
-
isSync: !0,
|
|
696
|
-
nextTasks: [
|
|
697
|
-
{
|
|
698
|
-
type: p.RemoveNode,
|
|
699
|
-
removeIds: [a],
|
|
700
|
-
viewId: this.thread.viewId
|
|
701
|
-
}
|
|
702
|
-
]
|
|
554
|
+
type: p.RemoveNode,
|
|
555
|
+
removeIds: [i],
|
|
556
|
+
viewId: this.thread.viewId
|
|
703
557
|
}
|
|
704
558
|
];
|
|
705
|
-
if (s
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
559
|
+
if (s && a.push({
|
|
560
|
+
type: p.None,
|
|
561
|
+
isLockSentEventCursor: s
|
|
562
|
+
}), o != null && o.size || r != null && r.size) {
|
|
563
|
+
if (o != null && o.size)
|
|
564
|
+
for (const [c, n] of o)
|
|
565
|
+
a.push({
|
|
566
|
+
type: p.UpdateNode,
|
|
567
|
+
dataType: g.Local,
|
|
568
|
+
opt: n.opt,
|
|
569
|
+
workId: c,
|
|
570
|
+
updateNodeOpt: {
|
|
571
|
+
useAnimation: !1
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
r != null && r.size && a.push({
|
|
575
|
+
type: p.RemoveNode,
|
|
576
|
+
removeIds: [...r],
|
|
577
|
+
viewId: this.thread.viewId
|
|
578
|
+
});
|
|
720
579
|
}
|
|
721
|
-
|
|
722
|
-
}
|
|
723
|
-
drawPencilEraser(t) {
|
|
724
|
-
var
|
|
725
|
-
const
|
|
726
|
-
if ((
|
|
727
|
-
for (const
|
|
728
|
-
const
|
|
729
|
-
this.batchEraserWorks.add(
|
|
580
|
+
a.length && this.thread.post({ sp: a });
|
|
581
|
+
}
|
|
582
|
+
drawPencilEraser(t, e) {
|
|
583
|
+
var o, r;
|
|
584
|
+
const s = [];
|
|
585
|
+
if ((o = t.newWorkDatas) != null && o.size) {
|
|
586
|
+
for (const i of t.newWorkDatas.values()) {
|
|
587
|
+
const a = i.workId.toString();
|
|
588
|
+
this.batchEraserWorks.add(a), s.push({
|
|
730
589
|
type: p.FullWork,
|
|
731
|
-
workId:
|
|
732
|
-
ops:
|
|
733
|
-
opt:
|
|
734
|
-
toolsType:
|
|
590
|
+
workId: a,
|
|
591
|
+
ops: X(i.op),
|
|
592
|
+
opt: i.opt,
|
|
593
|
+
toolsType: i.toolsType,
|
|
735
594
|
updateNodeOpt: {
|
|
736
595
|
useAnimation: !1
|
|
737
596
|
}
|
|
@@ -739,18 +598,24 @@ class Se {
|
|
|
739
598
|
}
|
|
740
599
|
delete t.newWorkDatas;
|
|
741
600
|
}
|
|
742
|
-
(
|
|
743
|
-
this.batchEraserRemoveNodes.add(
|
|
744
|
-
}), e.push(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
601
|
+
(r = t.removeIds) == null || r.forEach((i) => {
|
|
602
|
+
this.batchEraserRemoveNodes.add(i);
|
|
603
|
+
}), e && s.push({
|
|
604
|
+
type: p.None,
|
|
605
|
+
isLockSentEventCursor: e
|
|
606
|
+
}), t.rect, this.thread.post({ sp: s, consumeCount: this.consumeCount }), this.batchEraserCombine();
|
|
607
|
+
}
|
|
608
|
+
drawEraser(t, e) {
|
|
609
|
+
const s = [];
|
|
610
|
+
t.removeIds && s.push(t), e && s.push({
|
|
611
|
+
type: p.None,
|
|
612
|
+
isLockSentEventCursor: e
|
|
613
|
+
}), this.thread.post({ sp: s, consumeCount: this.consumeCount });
|
|
749
614
|
}
|
|
750
615
|
updateBatchEraserCombineNode(t, e) {
|
|
751
616
|
for (const s of e.keys())
|
|
752
617
|
this.thread.fullLayer.getElementsByName(s).forEach((o) => {
|
|
753
|
-
o.remove();
|
|
618
|
+
o.remove(), R(o, this.thread.fullLayer.parent);
|
|
754
619
|
});
|
|
755
620
|
t.forEach((s) => {
|
|
756
621
|
const o = this.vNodes.get(s);
|
|
@@ -770,54 +635,59 @@ class Se {
|
|
|
770
635
|
return this.workShapes;
|
|
771
636
|
}
|
|
772
637
|
consumeDraw(t, e) {
|
|
773
|
-
const { op: s, workId: o, scenePath: r } = t;
|
|
638
|
+
const { op: s, workId: o, scenePath: r, postCount: i } = t;
|
|
774
639
|
if (s != null && s.length && o) {
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
640
|
+
const a = o.toString(), c = this.workShapes.get(a);
|
|
641
|
+
if (!c)
|
|
777
642
|
return;
|
|
778
|
-
const n =
|
|
643
|
+
const n = c.toolsType;
|
|
779
644
|
if (n === f.LaserPen)
|
|
780
645
|
return;
|
|
781
|
-
switch (this.drawWorkActiveId && this.drawWorkActiveId !==
|
|
646
|
+
switch (this.drawWorkActiveId && this.drawWorkActiveId !== a && (this.consumeDrawAll({
|
|
782
647
|
workId: this.drawWorkActiveId,
|
|
783
648
|
scenePath: r,
|
|
784
649
|
viewId: this.thread.viewId,
|
|
785
650
|
msgType: p.DrawWork,
|
|
786
|
-
dataType:
|
|
787
|
-
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId &&
|
|
651
|
+
dataType: g.Local
|
|
652
|
+
}, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== T && (this.drawWorkActiveId = a), H(i) && (this.consumeCount = i), n) {
|
|
788
653
|
case f.Selector:
|
|
789
654
|
{
|
|
790
|
-
const
|
|
655
|
+
const h = c.consume({
|
|
791
656
|
data: t,
|
|
792
657
|
isFullWork: !0
|
|
793
658
|
});
|
|
794
|
-
|
|
659
|
+
h.type === p.Select && (h.selectIds && e.runReverseSelectWork(h.selectIds), this.thread.post({ sp: [h] }));
|
|
795
660
|
}
|
|
796
661
|
break;
|
|
797
662
|
case f.PencilEraser:
|
|
798
663
|
{
|
|
799
|
-
const
|
|
664
|
+
const h = c.consume({
|
|
800
665
|
data: t,
|
|
801
666
|
isFullWork: !0
|
|
802
667
|
});
|
|
803
|
-
|
|
668
|
+
this.drawPencilEraser(h);
|
|
804
669
|
}
|
|
805
670
|
break;
|
|
806
671
|
case f.BitMapEraser: {
|
|
807
|
-
const
|
|
672
|
+
const h = c.consume({
|
|
808
673
|
data: t,
|
|
809
|
-
isFullWork: !
|
|
674
|
+
isFullWork: !1,
|
|
675
|
+
isMainThread: !0
|
|
676
|
+
});
|
|
677
|
+
this.fullWorkerDrawCount++, this.thread.post({
|
|
678
|
+
consumeCount: this.consumeCount,
|
|
679
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
680
|
+
sp: h.op && [{ ...h, scenePath: r }] || void 0
|
|
810
681
|
});
|
|
811
|
-
c != null && c.rect && this.drawBitMapEraser(c);
|
|
812
682
|
break;
|
|
813
683
|
}
|
|
814
684
|
case f.Eraser:
|
|
815
685
|
{
|
|
816
|
-
const
|
|
686
|
+
const h = c.consume({
|
|
817
687
|
data: t,
|
|
818
688
|
isFullWork: !0
|
|
819
689
|
});
|
|
820
|
-
|
|
690
|
+
this.drawEraser(h);
|
|
821
691
|
}
|
|
822
692
|
break;
|
|
823
693
|
case f.Arrow:
|
|
@@ -829,14 +699,15 @@ class Se {
|
|
|
829
699
|
case f.SpeechBalloon:
|
|
830
700
|
case f.Pencil:
|
|
831
701
|
{
|
|
832
|
-
const
|
|
702
|
+
const h = c.consume({
|
|
833
703
|
data: t,
|
|
834
704
|
isFullWork: !1,
|
|
835
705
|
isMainThread: !0
|
|
836
706
|
});
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
707
|
+
h && (this.fullWorkerDrawCount++, this.thread.post({
|
|
708
|
+
consumeCount: this.consumeCount,
|
|
709
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
710
|
+
sp: h.op && [{ ...h, scenePath: r }] || void 0
|
|
840
711
|
}));
|
|
841
712
|
}
|
|
842
713
|
break;
|
|
@@ -844,30 +715,30 @@ class Se {
|
|
|
844
715
|
}
|
|
845
716
|
}
|
|
846
717
|
consumeDrawAll(t, e) {
|
|
847
|
-
var i, a,
|
|
718
|
+
var i, a, c;
|
|
848
719
|
const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
|
|
849
720
|
if (s) {
|
|
850
|
-
const
|
|
851
|
-
this.drawWorkActiveId ===
|
|
852
|
-
const
|
|
853
|
-
if (!
|
|
721
|
+
const n = s.toString();
|
|
722
|
+
this.drawWorkActiveId === n && (this.drawWorkActiveId = void 0);
|
|
723
|
+
const h = this.workShapes.get(n);
|
|
724
|
+
if (!h)
|
|
854
725
|
return;
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
726
|
+
const l = h.toolsType;
|
|
727
|
+
if (l === f.LaserPen)
|
|
857
728
|
return;
|
|
858
|
-
const
|
|
859
|
-
switch (
|
|
729
|
+
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
|
+
switch (l) {
|
|
860
731
|
case f.Selector:
|
|
861
|
-
|
|
732
|
+
S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && m.cursorBlur(), S.type === p.Select && (S.selectIds && e.runReverseSelectWork(S.selectIds), this.thread.post({ sp: [{ ...S, scenePath: o }] })), (c = h.selectIds) != null && c.length ? h.clearTmpPoints() : this.clearWorkShapeNodeCache(n);
|
|
862
733
|
break;
|
|
863
734
|
case f.PencilEraser:
|
|
864
|
-
|
|
735
|
+
this.drawPencilEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
|
|
865
736
|
break;
|
|
866
737
|
case f.BitMapEraser:
|
|
867
|
-
|
|
738
|
+
this.drawBitMapEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
|
|
868
739
|
break;
|
|
869
740
|
case f.Eraser:
|
|
870
|
-
|
|
741
|
+
this.drawEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
|
|
871
742
|
break;
|
|
872
743
|
case f.Arrow:
|
|
873
744
|
case f.Straight:
|
|
@@ -876,12 +747,17 @@ class Se {
|
|
|
876
747
|
case f.Star:
|
|
877
748
|
case f.Polygon:
|
|
878
749
|
case f.SpeechBalloon:
|
|
879
|
-
case f.Pencil:
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
750
|
+
case f.Pencil: {
|
|
751
|
+
const w = [];
|
|
752
|
+
r && w.push({
|
|
753
|
+
type: p.None,
|
|
754
|
+
isLockSentEventCursor: r
|
|
755
|
+
}), S && (w.push(S), this.fullWorkerDrawCount = 0, this.thread.post({
|
|
756
|
+
fullWorkerDrawCount: this.fullWorkerDrawCount,
|
|
757
|
+
sp: w
|
|
758
|
+
})), this.clearWorkShapeNodeCache(n);
|
|
884
759
|
break;
|
|
760
|
+
}
|
|
885
761
|
}
|
|
886
762
|
}
|
|
887
763
|
}
|
|
@@ -901,23 +777,23 @@ class Se {
|
|
|
901
777
|
e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(e);
|
|
902
778
|
}
|
|
903
779
|
createWorkShapeNode(t) {
|
|
904
|
-
return
|
|
780
|
+
return $({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
|
|
905
781
|
}
|
|
906
782
|
}
|
|
907
|
-
class
|
|
783
|
+
class Se {
|
|
908
784
|
constructor(t) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
785
|
+
u(this, "vNodes");
|
|
786
|
+
u(this, "thread");
|
|
787
|
+
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
788
|
+
u(this, "selectorWorkShapes", /* @__PURE__ */ new Map());
|
|
789
|
+
u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
|
|
790
|
+
u(this, "runEffectId");
|
|
791
|
+
u(this, "animationId");
|
|
792
|
+
u(this, "syncUnitTime", P.syncOpt.interval);
|
|
917
793
|
this.vNodes = t.vNodes, this.thread = t.thread;
|
|
918
794
|
}
|
|
919
795
|
async loadImageBitMap(t) {
|
|
920
|
-
return this.thread.loadImageBitMap(t);
|
|
796
|
+
return await this.thread.loadImageBitMap(t);
|
|
921
797
|
}
|
|
922
798
|
destroy() {
|
|
923
799
|
this.clearAll();
|
|
@@ -925,7 +801,7 @@ class ke {
|
|
|
925
801
|
clearAll() {
|
|
926
802
|
this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((t) => {
|
|
927
803
|
t.name !== "viewport" && t.remove();
|
|
928
|
-
}), this.thread.serviceLayer.
|
|
804
|
+
}), z(this.thread.serviceLayer, this.thread.serviceLayer.parent)), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
|
|
929
805
|
}
|
|
930
806
|
runEffect() {
|
|
931
807
|
this.runEffectId || (this.runEffectId = setTimeout(this.effectRunSelector.bind(this), 0));
|
|
@@ -974,30 +850,30 @@ class ke {
|
|
|
974
850
|
return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
|
|
975
851
|
}
|
|
976
852
|
async animationDraw() {
|
|
977
|
-
var s, o, r, i, a,
|
|
853
|
+
var s, o, r, i, a, c, n, h, l, m, d, S, w, y, v, D, x, Z, j;
|
|
978
854
|
this.animationId = void 0;
|
|
979
855
|
let t = !1;
|
|
980
856
|
const e = /* @__PURE__ */ new Map();
|
|
981
|
-
for (const [
|
|
857
|
+
for (const [N, k] of this.workShapes.entries())
|
|
982
858
|
switch (k.toolsType) {
|
|
983
859
|
case f.Image: {
|
|
984
860
|
await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
|
|
985
861
|
isFullWork: !0,
|
|
986
862
|
worker: this
|
|
987
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
988
|
-
var
|
|
989
|
-
(
|
|
990
|
-
}), this.workShapes.delete(
|
|
863
|
+
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
864
|
+
var O;
|
|
865
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
866
|
+
}), this.workShapes.delete(N);
|
|
991
867
|
break;
|
|
992
868
|
}
|
|
993
869
|
case f.Text: {
|
|
994
870
|
k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
|
|
995
871
|
isFullWork: !0,
|
|
996
|
-
replaceId:
|
|
997
|
-
})), this.selectorWorkShapes.forEach((b,
|
|
998
|
-
var
|
|
999
|
-
(
|
|
1000
|
-
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(
|
|
872
|
+
replaceId: N
|
|
873
|
+
})), this.selectorWorkShapes.forEach((b, C) => {
|
|
874
|
+
var O;
|
|
875
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
876
|
+
}), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
|
|
1001
877
|
break;
|
|
1002
878
|
}
|
|
1003
879
|
case f.Arrow:
|
|
@@ -1009,17 +885,17 @@ class ke {
|
|
|
1009
885
|
case f.SpeechBalloon: {
|
|
1010
886
|
const b = !!k.ops;
|
|
1011
887
|
if ((i = k.animationWorkData) != null && i.length) {
|
|
1012
|
-
const
|
|
888
|
+
const C = k.oldRect;
|
|
1013
889
|
(a = k.node) == null || a.consumeService({
|
|
1014
890
|
op: k.animationWorkData,
|
|
1015
891
|
isFullWork: b
|
|
1016
|
-
}), b && (this.selectorWorkShapes.forEach((
|
|
1017
|
-
var
|
|
1018
|
-
(
|
|
1019
|
-
}), (
|
|
1020
|
-
workState:
|
|
1021
|
-
op: k.animationWorkData.filter((
|
|
1022
|
-
if (
|
|
892
|
+
}), b && (this.selectorWorkShapes.forEach((O, E) => {
|
|
893
|
+
var A;
|
|
894
|
+
(A = O.selectIds) != null && A.includes(N) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
|
|
895
|
+
}), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(N)), e.set(N, {
|
|
896
|
+
workState: C ? k.ops ? W.Done : W.Doing : W.Start,
|
|
897
|
+
op: k.animationWorkData.filter((O, E) => {
|
|
898
|
+
if (E % 3 !== 2)
|
|
1023
899
|
return !0;
|
|
1024
900
|
}).slice(-2)
|
|
1025
901
|
}), k.animationWorkData.length = 0;
|
|
@@ -1028,42 +904,42 @@ class ke {
|
|
|
1028
904
|
}
|
|
1029
905
|
case f.Pencil: {
|
|
1030
906
|
if (!k.useAnimation && k.ops)
|
|
1031
|
-
(
|
|
907
|
+
(n = k.node) == null || n.consumeService({
|
|
1032
908
|
op: k.animationWorkData || [],
|
|
1033
909
|
isFullWork: !0,
|
|
1034
|
-
replaceId:
|
|
1035
|
-
}), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b,
|
|
1036
|
-
var
|
|
1037
|
-
(
|
|
1038
|
-
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(
|
|
910
|
+
replaceId: N
|
|
911
|
+
}), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
|
|
912
|
+
var O;
|
|
913
|
+
(O = b.selectIds) != null && O.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
|
|
914
|
+
}), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(N);
|
|
1039
915
|
else if (k.useAnimation) {
|
|
1040
916
|
if (k.isDel) {
|
|
1041
|
-
(
|
|
917
|
+
(m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(N);
|
|
1042
918
|
break;
|
|
1043
919
|
}
|
|
1044
|
-
const b = 3,
|
|
1045
|
-
if ((k.animationIndex || 0) <
|
|
1046
|
-
if ((
|
|
1047
|
-
op:
|
|
920
|
+
const b = 3, C = this.computNextAnimationIndex(k, b), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), E = (k.animationWorkData || []).slice(O, C), A = (S = (d = k.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : S.toString();
|
|
921
|
+
if ((k.animationIndex || 0) < C || k.isDiff) {
|
|
922
|
+
if ((w = k.node) == null || w.consumeService({
|
|
923
|
+
op: E,
|
|
1048
924
|
isFullWork: !1
|
|
1049
|
-
}), k.animationIndex =
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
925
|
+
}), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length) {
|
|
926
|
+
const q = E.filter((_, ae) => {
|
|
927
|
+
if (ae % b !== b - 1)
|
|
1052
928
|
return !0;
|
|
1053
929
|
}).slice(-2);
|
|
1054
|
-
e.set(
|
|
1055
|
-
workState:
|
|
1056
|
-
op:
|
|
930
|
+
e.set(N, {
|
|
931
|
+
workState: O === 0 ? W.Start : C === ((y = k.animationWorkData) == null ? void 0 : y.length) ? W.Done : W.Doing,
|
|
932
|
+
op: q
|
|
1057
933
|
});
|
|
1058
934
|
}
|
|
1059
|
-
} else k.ops && ((
|
|
935
|
+
} else k.ops && ((v = k.node) == null || v.consumeService({
|
|
1060
936
|
op: k.animationWorkData || [],
|
|
1061
937
|
isFullWork: !0,
|
|
1062
|
-
replaceId:
|
|
1063
|
-
}), k.isDel = !0, e.set(
|
|
1064
|
-
workState:
|
|
1065
|
-
op:
|
|
1066
|
-
if (
|
|
938
|
+
replaceId: A
|
|
939
|
+
}), k.isDel = !0, e.set(N, {
|
|
940
|
+
workState: W.Done,
|
|
941
|
+
op: E.filter((q, _) => {
|
|
942
|
+
if (_ % b !== b - 1)
|
|
1067
943
|
return !0;
|
|
1068
944
|
}).slice(-2)
|
|
1069
945
|
}));
|
|
@@ -1072,18 +948,52 @@ class ke {
|
|
|
1072
948
|
}
|
|
1073
949
|
break;
|
|
1074
950
|
}
|
|
951
|
+
case f.BitMapEraser:
|
|
952
|
+
case f.PencilEraser: {
|
|
953
|
+
if (k.isDel) {
|
|
954
|
+
(D = k.node) == null || D.clearTmpPoints(), this.workShapes.delete(N);
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
if (k.ops && ((x = k.animationWorkData) != null && x.length)) {
|
|
958
|
+
const b = k.animationWorkData.slice(-3, -1);
|
|
959
|
+
e.set(N, {
|
|
960
|
+
workState: W.Done,
|
|
961
|
+
op: b
|
|
962
|
+
}), k.isDel = !0;
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
if (k.useAnimation) {
|
|
966
|
+
const C = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), E = (k.animationWorkData || []).slice(O, C);
|
|
967
|
+
if (((k.animationIndex || 0) < C || k.isDiff) && ((Z = k.node) == null || Z.consumeService({
|
|
968
|
+
op: E,
|
|
969
|
+
isFullWork: k.toolsType !== f.BitMapEraser
|
|
970
|
+
}), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length)) {
|
|
971
|
+
const A = E.filter((q, _) => {
|
|
972
|
+
if (_ % 3 !== 2)
|
|
973
|
+
return !0;
|
|
974
|
+
}).slice(-2);
|
|
975
|
+
e.set(N, {
|
|
976
|
+
workState: O === 0 ? W.Start : C === ((j = k.animationWorkData) == null ? void 0 : j.length) ? W.Done : W.Doing,
|
|
977
|
+
op: A
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
t = !0;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
1075
985
|
}
|
|
1076
986
|
if (t && this.runAnimation(), e.size) {
|
|
1077
|
-
const
|
|
987
|
+
const N = [];
|
|
1078
988
|
e.forEach((k, b) => {
|
|
1079
|
-
|
|
989
|
+
N.push({
|
|
1080
990
|
type: p.Cursor,
|
|
1081
|
-
uid: b.split(
|
|
991
|
+
uid: b.split(te)[0],
|
|
1082
992
|
op: k.op,
|
|
1083
993
|
workState: k.workState,
|
|
1084
994
|
viewId: this.thread.viewId
|
|
1085
995
|
});
|
|
1086
|
-
}), this.thread.post({ sp:
|
|
996
|
+
}), this.thread.post({ sp: N });
|
|
1087
997
|
}
|
|
1088
998
|
}
|
|
1089
999
|
runAnimation() {
|
|
@@ -1110,34 +1020,34 @@ class ke {
|
|
|
1110
1020
|
return !1;
|
|
1111
1021
|
}
|
|
1112
1022
|
activeWorkShape(t) {
|
|
1113
|
-
var
|
|
1114
|
-
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op:
|
|
1023
|
+
var S, w, y, v;
|
|
1024
|
+
const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
|
|
1115
1025
|
if (!e)
|
|
1116
1026
|
return;
|
|
1117
|
-
const l = e.toString(),
|
|
1118
|
-
if (!((
|
|
1119
|
-
let
|
|
1027
|
+
const l = e.toString(), m = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
|
|
1028
|
+
if (!((w = this.workShapes) != null && w.has(l))) {
|
|
1029
|
+
let D = {
|
|
1120
1030
|
toolsType: o,
|
|
1121
|
-
animationWorkData:
|
|
1031
|
+
animationWorkData: c || [],
|
|
1122
1032
|
animationIndex: 0,
|
|
1123
1033
|
type: r,
|
|
1124
1034
|
updateNodeOpt: i,
|
|
1125
1035
|
ops: a,
|
|
1126
|
-
useAnimation: typeof
|
|
1127
|
-
oldRect:
|
|
1036
|
+
useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
|
|
1037
|
+
oldRect: m,
|
|
1128
1038
|
isDiff: !1,
|
|
1129
1039
|
imageBitmap: h
|
|
1130
1040
|
};
|
|
1131
|
-
o && s && (
|
|
1041
|
+
o && s && (D = this.setNodeKey(l, D, o, s)), (y = this.workShapes) == null || y.set(l, D);
|
|
1132
1042
|
}
|
|
1133
|
-
const
|
|
1134
|
-
r && (
|
|
1043
|
+
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), 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);
|
|
1135
1045
|
}
|
|
1136
1046
|
removeNode(t, e) {
|
|
1137
|
-
t.indexOf(
|
|
1138
|
-
s.remove();
|
|
1047
|
+
t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
|
|
1048
|
+
s.remove(), R(s, this.thread.fullLayer.parent);
|
|
1139
1049
|
}), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
|
|
1140
|
-
s.remove();
|
|
1050
|
+
s.remove(), R(s, this.thread.serviceLayer.parent);
|
|
1141
1051
|
}), this.vNodes.delete(t);
|
|
1142
1052
|
}
|
|
1143
1053
|
removeSelectWork(t) {
|
|
@@ -1145,25 +1055,25 @@ class ke {
|
|
|
1145
1055
|
s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
|
|
1146
1056
|
}
|
|
1147
1057
|
activeSelectorShape(t) {
|
|
1148
|
-
var
|
|
1058
|
+
var n, h, l;
|
|
1149
1059
|
const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
|
|
1150
1060
|
if (!e)
|
|
1151
1061
|
return;
|
|
1152
1062
|
const a = e.toString();
|
|
1153
|
-
if (!((
|
|
1154
|
-
let
|
|
1063
|
+
if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
|
|
1064
|
+
let m = {
|
|
1155
1065
|
toolsType: o,
|
|
1156
1066
|
selectIds: i,
|
|
1157
1067
|
type: r,
|
|
1158
1068
|
opt: s
|
|
1159
1069
|
};
|
|
1160
|
-
o && s && (
|
|
1070
|
+
o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
|
|
1161
1071
|
}
|
|
1162
|
-
const
|
|
1163
|
-
r && (
|
|
1072
|
+
const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
|
|
1073
|
+
r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
|
|
1164
1074
|
}
|
|
1165
1075
|
setNodeKey(t, e, s, o) {
|
|
1166
|
-
return e.toolsType = s, e.node =
|
|
1076
|
+
return e.toolsType = s, e.node = $({
|
|
1167
1077
|
toolsType: s,
|
|
1168
1078
|
toolsOpt: o,
|
|
1169
1079
|
vNodes: this.vNodes,
|
|
@@ -1173,24 +1083,24 @@ class ke {
|
|
|
1173
1083
|
}, this), e;
|
|
1174
1084
|
}
|
|
1175
1085
|
}
|
|
1176
|
-
class
|
|
1086
|
+
class M {
|
|
1177
1087
|
constructor() {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1088
|
+
u(this, "localWork");
|
|
1089
|
+
u(this, "serviceWork");
|
|
1090
|
+
u(this, "threadEngine");
|
|
1181
1091
|
}
|
|
1182
1092
|
registerMainThread(t) {
|
|
1183
1093
|
return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
|
|
1184
1094
|
}
|
|
1185
1095
|
}
|
|
1186
|
-
class
|
|
1096
|
+
class ye extends M {
|
|
1187
1097
|
constructor() {
|
|
1188
1098
|
super(...arguments);
|
|
1189
|
-
|
|
1099
|
+
u(this, "emitEventType", I.CopyNode);
|
|
1190
1100
|
}
|
|
1191
1101
|
async consume(e) {
|
|
1192
1102
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1193
|
-
if (s === p.FullWork && o ===
|
|
1103
|
+
if (s === p.FullWork && o === g.Local && r === this.emitEventType)
|
|
1194
1104
|
return this.consumeForLocalWorker(e), !0;
|
|
1195
1105
|
}
|
|
1196
1106
|
async consumeForLocalWorker(e) {
|
|
@@ -1199,39 +1109,39 @@ class me extends E {
|
|
|
1199
1109
|
s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
|
|
1200
1110
|
}
|
|
1201
1111
|
}
|
|
1202
|
-
class
|
|
1112
|
+
class we extends M {
|
|
1203
1113
|
constructor() {
|
|
1204
1114
|
super(...arguments);
|
|
1205
|
-
|
|
1115
|
+
u(this, "emitEventType", I.SetColorNode);
|
|
1206
1116
|
}
|
|
1207
1117
|
async consume(e) {
|
|
1208
1118
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1209
|
-
if (s === p.UpdateNode && o ===
|
|
1119
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1210
1120
|
return this.consumeForLocalWorker(e), !0;
|
|
1211
1121
|
}
|
|
1212
1122
|
async consumeForLocalWorker(e) {
|
|
1213
|
-
var
|
|
1214
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker:
|
|
1215
|
-
s ===
|
|
1123
|
+
var n;
|
|
1124
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
|
|
1125
|
+
s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1216
1126
|
updateSelectorOpt: o,
|
|
1217
1127
|
willRefreshSelector: r,
|
|
1218
1128
|
willSyncService: i,
|
|
1219
1129
|
willSerializeData: a,
|
|
1220
|
-
textUpdateForWoker:
|
|
1130
|
+
textUpdateForWoker: c,
|
|
1221
1131
|
callback: this.updateSelectorCallback
|
|
1222
1132
|
}));
|
|
1223
1133
|
}
|
|
1224
1134
|
updateSelectorCallback(e) {
|
|
1225
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker:
|
|
1135
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: c } = s, n = o.sp || [];
|
|
1226
1136
|
if (i)
|
|
1227
1137
|
for (const [h, l] of r.entries())
|
|
1228
|
-
|
|
1138
|
+
c && l.toolsType === f.Text ? n.push({
|
|
1229
1139
|
...l,
|
|
1230
1140
|
workId: h,
|
|
1231
1141
|
type: p.TextUpdate,
|
|
1232
|
-
dataType:
|
|
1142
|
+
dataType: g.Local,
|
|
1233
1143
|
willSyncService: !0
|
|
1234
|
-
}) :
|
|
1144
|
+
}) : n.push(
|
|
1235
1145
|
{
|
|
1236
1146
|
...l,
|
|
1237
1147
|
workId: h,
|
|
@@ -1243,24 +1153,24 @@ class ye extends E {
|
|
|
1243
1153
|
}
|
|
1244
1154
|
);
|
|
1245
1155
|
return {
|
|
1246
|
-
sp:
|
|
1156
|
+
sp: n
|
|
1247
1157
|
};
|
|
1248
1158
|
}
|
|
1249
1159
|
}
|
|
1250
|
-
class
|
|
1160
|
+
class ve extends M {
|
|
1251
1161
|
constructor() {
|
|
1252
1162
|
super(...arguments);
|
|
1253
|
-
|
|
1163
|
+
u(this, "emitEventType", I.ZIndexNode);
|
|
1254
1164
|
}
|
|
1255
1165
|
async consume(e) {
|
|
1256
1166
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1257
|
-
if (s === p.UpdateNode && o ===
|
|
1167
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1258
1168
|
return this.consumeForLocalWorker(e), !0;
|
|
1259
1169
|
}
|
|
1260
1170
|
async consumeForLocalWorker(e) {
|
|
1261
|
-
var
|
|
1171
|
+
var c;
|
|
1262
1172
|
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
|
|
1263
|
-
s ===
|
|
1173
|
+
s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1264
1174
|
updateSelectorOpt: o,
|
|
1265
1175
|
willRefreshSelector: r,
|
|
1266
1176
|
willSyncService: i,
|
|
@@ -1269,13 +1179,13 @@ class we extends E {
|
|
|
1269
1179
|
}));
|
|
1270
1180
|
}
|
|
1271
1181
|
updateSelectorCallback(e) {
|
|
1272
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s,
|
|
1273
|
-
if (i &&
|
|
1274
|
-
for (const [
|
|
1275
|
-
|
|
1182
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
|
|
1183
|
+
if (i && c)
|
|
1184
|
+
for (const [n, h] of r.entries())
|
|
1185
|
+
c.push(
|
|
1276
1186
|
{
|
|
1277
1187
|
...h,
|
|
1278
|
-
workId:
|
|
1188
|
+
workId: n,
|
|
1279
1189
|
type: p.UpdateNode,
|
|
1280
1190
|
updateNodeOpt: {
|
|
1281
1191
|
useAnimation: !1
|
|
@@ -1284,99 +1194,99 @@ class we extends E {
|
|
|
1284
1194
|
}
|
|
1285
1195
|
);
|
|
1286
1196
|
return {
|
|
1287
|
-
sp:
|
|
1197
|
+
sp: c
|
|
1288
1198
|
};
|
|
1289
1199
|
}
|
|
1290
1200
|
}
|
|
1291
|
-
class
|
|
1201
|
+
class ge extends M {
|
|
1292
1202
|
constructor() {
|
|
1293
1203
|
super(...arguments);
|
|
1294
|
-
|
|
1204
|
+
u(this, "emitEventType", I.TranslateNode);
|
|
1295
1205
|
}
|
|
1296
1206
|
async consume(e) {
|
|
1297
1207
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1298
|
-
if (s === p.UpdateNode && o ===
|
|
1208
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1299
1209
|
return await this.consumeForLocalWorker(e), !0;
|
|
1300
1210
|
}
|
|
1301
1211
|
async consumeForLocalWorker(e) {
|
|
1302
1212
|
var h, l;
|
|
1303
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker:
|
|
1304
|
-
s ===
|
|
1213
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c, emitEventType: n } = e;
|
|
1214
|
+
s === T && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((h = this.localWork) == null ? void 0 : h.updateSelector({
|
|
1305
1215
|
updateSelectorOpt: o,
|
|
1306
1216
|
willRefreshSelector: r,
|
|
1307
1217
|
willSyncService: i,
|
|
1308
1218
|
willSerializeData: a,
|
|
1309
1219
|
isSync: !0,
|
|
1310
|
-
textUpdateForWoker:
|
|
1311
|
-
emitEventType:
|
|
1220
|
+
textUpdateForWoker: c,
|
|
1221
|
+
emitEventType: n,
|
|
1312
1222
|
callback: this.updateSelectorCallback
|
|
1313
|
-
})) : o.workState ===
|
|
1223
|
+
})) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
|
|
1314
1224
|
}
|
|
1315
1225
|
updateSelectorCallback(e) {
|
|
1316
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService:
|
|
1317
|
-
if (
|
|
1226
|
+
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 || [];
|
|
1227
|
+
if (m === W.Start)
|
|
1318
1228
|
return {
|
|
1319
1229
|
sp: [],
|
|
1320
1230
|
render: []
|
|
1321
1231
|
};
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1324
|
-
|
|
1232
|
+
const S = a == null ? void 0 : a.selectRect;
|
|
1233
|
+
if (c) {
|
|
1234
|
+
m === W.Doing && d.push({
|
|
1325
1235
|
type: p.Select,
|
|
1326
1236
|
selectIds: i.selectIds,
|
|
1327
|
-
selectRect:
|
|
1237
|
+
selectRect: S,
|
|
1328
1238
|
willSyncService: !0,
|
|
1329
1239
|
isSync: !0,
|
|
1330
1240
|
points: i.getChildrenPoints(),
|
|
1331
1241
|
textOpt: i.textOpt
|
|
1332
1242
|
});
|
|
1333
|
-
for (const [
|
|
1334
|
-
l &&
|
|
1335
|
-
...
|
|
1336
|
-
workId:
|
|
1243
|
+
for (const [w, y] of r.entries())
|
|
1244
|
+
l && y.toolsType === f.Text ? d.push({
|
|
1245
|
+
...y,
|
|
1246
|
+
workId: w,
|
|
1337
1247
|
type: p.TextUpdate,
|
|
1338
|
-
dataType:
|
|
1248
|
+
dataType: g.Local,
|
|
1339
1249
|
willSyncService: !0
|
|
1340
|
-
}) :
|
|
1250
|
+
}) : d.push(
|
|
1341
1251
|
{
|
|
1342
|
-
...
|
|
1343
|
-
workId:
|
|
1252
|
+
...y,
|
|
1253
|
+
workId: w,
|
|
1344
1254
|
type: p.UpdateNode,
|
|
1345
1255
|
updateNodeOpt: {
|
|
1346
1256
|
useAnimation: !1
|
|
1347
1257
|
},
|
|
1348
|
-
isSync:
|
|
1258
|
+
isSync: n
|
|
1349
1259
|
}
|
|
1350
1260
|
);
|
|
1351
1261
|
}
|
|
1352
1262
|
return {
|
|
1353
|
-
sp:
|
|
1263
|
+
sp: d
|
|
1354
1264
|
};
|
|
1355
1265
|
}
|
|
1356
1266
|
}
|
|
1357
|
-
class
|
|
1267
|
+
class Ie extends M {
|
|
1358
1268
|
constructor() {
|
|
1359
1269
|
super(...arguments);
|
|
1360
|
-
|
|
1270
|
+
u(this, "emitEventType", I.DeleteNode);
|
|
1361
1271
|
}
|
|
1362
1272
|
async consume() {
|
|
1363
1273
|
return !1;
|
|
1364
1274
|
}
|
|
1365
1275
|
}
|
|
1366
|
-
class
|
|
1276
|
+
class We extends M {
|
|
1367
1277
|
constructor() {
|
|
1368
1278
|
super(...arguments);
|
|
1369
|
-
|
|
1279
|
+
u(this, "emitEventType", I.ScaleNode);
|
|
1370
1280
|
}
|
|
1371
1281
|
async consume(e) {
|
|
1372
1282
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1373
|
-
if (s === p.UpdateNode && o ===
|
|
1283
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1374
1284
|
return await this.consumeForLocalWorker(e), !0;
|
|
1375
1285
|
}
|
|
1376
1286
|
async consumeForLocalWorker(e) {
|
|
1377
1287
|
var a;
|
|
1378
1288
|
const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
|
|
1379
|
-
s ===
|
|
1289
|
+
s === T && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
|
|
1380
1290
|
updateSelectorOpt: o,
|
|
1381
1291
|
willSyncService: r,
|
|
1382
1292
|
willSerializeData: i,
|
|
@@ -1385,33 +1295,33 @@ class Te extends E {
|
|
|
1385
1295
|
}));
|
|
1386
1296
|
}
|
|
1387
1297
|
updateSelectorCallback(e) {
|
|
1388
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt:
|
|
1389
|
-
if (h ===
|
|
1298
|
+
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;
|
|
1299
|
+
if (h === W.Start)
|
|
1390
1300
|
return {
|
|
1391
1301
|
sp: [],
|
|
1392
1302
|
render: []
|
|
1393
1303
|
};
|
|
1394
|
-
if (
|
|
1304
|
+
if (n) {
|
|
1395
1305
|
l.push({
|
|
1396
1306
|
type: p.Select,
|
|
1397
1307
|
selectIds: r.selectIds,
|
|
1398
|
-
selectRect:
|
|
1308
|
+
selectRect: m,
|
|
1399
1309
|
willSyncService: !0,
|
|
1400
1310
|
isSync: !0,
|
|
1401
|
-
points: h ===
|
|
1311
|
+
points: h === W.Done && r.getChildrenPoints() || void 0,
|
|
1402
1312
|
textOpt: r.textOpt
|
|
1403
1313
|
});
|
|
1404
|
-
for (const [
|
|
1405
|
-
|
|
1406
|
-
...
|
|
1407
|
-
workId:
|
|
1314
|
+
for (const [d, S] of a.entries())
|
|
1315
|
+
S.toolsType === f.Text ? l.push({
|
|
1316
|
+
...S,
|
|
1317
|
+
workId: d,
|
|
1408
1318
|
type: p.TextUpdate,
|
|
1409
|
-
dataType:
|
|
1319
|
+
dataType: g.Local,
|
|
1410
1320
|
willSyncService: !0
|
|
1411
1321
|
}) : l.push(
|
|
1412
1322
|
{
|
|
1413
|
-
...
|
|
1414
|
-
workId:
|
|
1323
|
+
...S,
|
|
1324
|
+
workId: d,
|
|
1415
1325
|
type: p.UpdateNode,
|
|
1416
1326
|
updateNodeOpt: {
|
|
1417
1327
|
useAnimation: !1
|
|
@@ -1425,45 +1335,45 @@ class Te extends E {
|
|
|
1425
1335
|
};
|
|
1426
1336
|
}
|
|
1427
1337
|
}
|
|
1428
|
-
class
|
|
1338
|
+
class Te extends M {
|
|
1429
1339
|
constructor() {
|
|
1430
1340
|
super(...arguments);
|
|
1431
|
-
|
|
1341
|
+
u(this, "emitEventType", I.RotateNode);
|
|
1432
1342
|
}
|
|
1433
1343
|
async consume(e) {
|
|
1434
1344
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1435
|
-
if (s === p.UpdateNode && o ===
|
|
1345
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1436
1346
|
return await this.consumeForLocalWorker(e), !0;
|
|
1437
1347
|
}
|
|
1438
1348
|
async consumeForLocalWorker(e) {
|
|
1439
|
-
var
|
|
1440
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, emitEventType:
|
|
1441
|
-
s ===
|
|
1349
|
+
var n;
|
|
1350
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, emitEventType: c } = e;
|
|
1351
|
+
s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1442
1352
|
updateSelectorOpt: o,
|
|
1443
1353
|
willRefreshSelector: r,
|
|
1444
1354
|
willSyncService: i,
|
|
1445
1355
|
willSerializeData: a,
|
|
1446
|
-
emitEventType:
|
|
1356
|
+
emitEventType: c,
|
|
1447
1357
|
isSync: !0,
|
|
1448
1358
|
callback: this.updateSelectorCallback
|
|
1449
1359
|
}));
|
|
1450
1360
|
}
|
|
1451
1361
|
updateSelectorCallback(e) {
|
|
1452
|
-
const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt:
|
|
1453
|
-
if (
|
|
1454
|
-
h &&
|
|
1362
|
+
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;
|
|
1363
|
+
if (n) {
|
|
1364
|
+
h && m === W.Done && d.push({
|
|
1455
1365
|
type: p.Select,
|
|
1456
1366
|
selectIds: r.selectIds,
|
|
1457
|
-
selectRect:
|
|
1367
|
+
selectRect: S,
|
|
1458
1368
|
willSyncService: !0,
|
|
1459
1369
|
isSync: l,
|
|
1460
1370
|
points: r.getChildrenPoints()
|
|
1461
1371
|
});
|
|
1462
|
-
for (const [
|
|
1463
|
-
|
|
1372
|
+
for (const [w, y] of a.entries())
|
|
1373
|
+
d.push(
|
|
1464
1374
|
{
|
|
1465
|
-
...
|
|
1466
|
-
workId:
|
|
1375
|
+
...y,
|
|
1376
|
+
workId: w,
|
|
1467
1377
|
type: p.UpdateNode,
|
|
1468
1378
|
updateNodeOpt: {
|
|
1469
1379
|
useAnimation: !1
|
|
@@ -1473,112 +1383,112 @@ class Ie extends E {
|
|
|
1473
1383
|
);
|
|
1474
1384
|
}
|
|
1475
1385
|
return {
|
|
1476
|
-
sp:
|
|
1386
|
+
sp: d
|
|
1477
1387
|
};
|
|
1478
1388
|
}
|
|
1479
1389
|
}
|
|
1480
|
-
class
|
|
1390
|
+
class Le extends M {
|
|
1481
1391
|
constructor() {
|
|
1482
1392
|
super(...arguments);
|
|
1483
|
-
|
|
1393
|
+
u(this, "emitEventType", I.SetFontStyle);
|
|
1484
1394
|
}
|
|
1485
1395
|
async consume(e) {
|
|
1486
1396
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1487
|
-
if (s === p.UpdateNode && o ===
|
|
1397
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1488
1398
|
return await this.consumeForLocalWorker(e), !0;
|
|
1489
1399
|
}
|
|
1490
1400
|
async consumeForLocalWorker(e) {
|
|
1491
|
-
var
|
|
1492
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker:
|
|
1493
|
-
s ===
|
|
1401
|
+
var n;
|
|
1402
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
|
|
1403
|
+
s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1494
1404
|
updateSelectorOpt: o,
|
|
1495
1405
|
willRefreshSelector: r,
|
|
1496
1406
|
willSyncService: i,
|
|
1497
1407
|
willSerializeData: a,
|
|
1498
|
-
textUpdateForWoker:
|
|
1408
|
+
textUpdateForWoker: c,
|
|
1499
1409
|
callback: this.updateSelectorCallback
|
|
1500
1410
|
}));
|
|
1501
1411
|
}
|
|
1502
1412
|
updateSelectorCallback(e) {
|
|
1503
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService:
|
|
1504
|
-
if (
|
|
1505
|
-
h.fontSize &&
|
|
1413
|
+
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;
|
|
1414
|
+
if (c && m) {
|
|
1415
|
+
h.fontSize && m.push({
|
|
1506
1416
|
type: p.Select,
|
|
1507
1417
|
selectIds: i.selectIds,
|
|
1508
|
-
selectRect:
|
|
1509
|
-
willSyncService:
|
|
1510
|
-
isSync:
|
|
1418
|
+
selectRect: d,
|
|
1419
|
+
willSyncService: c,
|
|
1420
|
+
isSync: n,
|
|
1511
1421
|
points: i.getChildrenPoints()
|
|
1512
1422
|
});
|
|
1513
|
-
for (const [
|
|
1514
|
-
l &&
|
|
1515
|
-
...
|
|
1516
|
-
workId:
|
|
1423
|
+
for (const [S, w] of r.entries())
|
|
1424
|
+
l && w.toolsType === f.Text ? m.push({
|
|
1425
|
+
...w,
|
|
1426
|
+
workId: S,
|
|
1517
1427
|
type: p.TextUpdate,
|
|
1518
|
-
dataType:
|
|
1428
|
+
dataType: g.Local,
|
|
1519
1429
|
willSyncService: !0
|
|
1520
|
-
}) :
|
|
1430
|
+
}) : m.push(
|
|
1521
1431
|
{
|
|
1522
|
-
...
|
|
1523
|
-
workId:
|
|
1432
|
+
...w,
|
|
1433
|
+
workId: S,
|
|
1524
1434
|
type: p.UpdateNode,
|
|
1525
1435
|
updateNodeOpt: {
|
|
1526
1436
|
useAnimation: !1
|
|
1527
1437
|
},
|
|
1528
|
-
isSync:
|
|
1438
|
+
isSync: n
|
|
1529
1439
|
}
|
|
1530
1440
|
);
|
|
1531
1441
|
}
|
|
1532
1442
|
return {
|
|
1533
|
-
sp:
|
|
1443
|
+
sp: m
|
|
1534
1444
|
};
|
|
1535
1445
|
}
|
|
1536
1446
|
}
|
|
1537
|
-
class Ne extends
|
|
1447
|
+
class Ne extends M {
|
|
1538
1448
|
constructor() {
|
|
1539
1449
|
super(...arguments);
|
|
1540
|
-
|
|
1450
|
+
u(this, "emitEventType", I.SetPoint);
|
|
1541
1451
|
}
|
|
1542
1452
|
async consume(e) {
|
|
1543
1453
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1544
|
-
if (s === p.UpdateNode && o ===
|
|
1454
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1545
1455
|
return this.consumeForLocalWorker(e), !0;
|
|
1546
1456
|
}
|
|
1547
1457
|
async consumeForLocalWorker(e) {
|
|
1548
|
-
var
|
|
1549
|
-
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker:
|
|
1550
|
-
s ===
|
|
1458
|
+
var n;
|
|
1459
|
+
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
|
|
1460
|
+
s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
|
|
1551
1461
|
updateSelectorOpt: o,
|
|
1552
1462
|
willRefreshSelector: r,
|
|
1553
1463
|
willSyncService: i,
|
|
1554
1464
|
emitEventType: this.emitEventType,
|
|
1555
1465
|
willSerializeData: a,
|
|
1556
1466
|
isSync: !0,
|
|
1557
|
-
textUpdateForWoker:
|
|
1467
|
+
textUpdateForWoker: c,
|
|
1558
1468
|
callback: this.updateSelectorCallback
|
|
1559
1469
|
}));
|
|
1560
1470
|
}
|
|
1561
1471
|
updateSelectorCallback(e) {
|
|
1562
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService:
|
|
1563
|
-
if (
|
|
1564
|
-
for (const [
|
|
1472
|
+
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
|
+
if (c && h) {
|
|
1474
|
+
for (const [m, d] of r.entries())
|
|
1565
1475
|
h.push(
|
|
1566
1476
|
{
|
|
1567
|
-
...
|
|
1568
|
-
workId:
|
|
1477
|
+
...d,
|
|
1478
|
+
workId: m,
|
|
1569
1479
|
type: p.UpdateNode,
|
|
1570
1480
|
updateNodeOpt: {
|
|
1571
1481
|
useAnimation: !1
|
|
1572
1482
|
},
|
|
1573
|
-
isSync:
|
|
1483
|
+
isSync: n
|
|
1574
1484
|
}
|
|
1575
1485
|
);
|
|
1576
1486
|
h.push({
|
|
1577
1487
|
type: p.Select,
|
|
1578
1488
|
selectIds: i.selectIds,
|
|
1579
1489
|
selectRect: l,
|
|
1580
|
-
willSyncService:
|
|
1581
|
-
isSync:
|
|
1490
|
+
willSyncService: c,
|
|
1491
|
+
isSync: n,
|
|
1582
1492
|
points: i.getChildrenPoints()
|
|
1583
1493
|
});
|
|
1584
1494
|
}
|
|
@@ -1587,20 +1497,20 @@ class Ne extends E {
|
|
|
1587
1497
|
};
|
|
1588
1498
|
}
|
|
1589
1499
|
}
|
|
1590
|
-
class
|
|
1500
|
+
class be extends M {
|
|
1591
1501
|
constructor() {
|
|
1592
1502
|
super(...arguments);
|
|
1593
|
-
|
|
1503
|
+
u(this, "emitEventType", I.SetLock);
|
|
1594
1504
|
}
|
|
1595
1505
|
async consume(e) {
|
|
1596
1506
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1597
|
-
if (s === p.UpdateNode && o ===
|
|
1507
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1598
1508
|
return this.consumeForLocalWorker(e), !0;
|
|
1599
1509
|
}
|
|
1600
1510
|
async consumeForLocalWorker(e) {
|
|
1601
|
-
var
|
|
1511
|
+
var c;
|
|
1602
1512
|
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
|
|
1603
|
-
s ===
|
|
1513
|
+
s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1604
1514
|
updateSelectorOpt: o,
|
|
1605
1515
|
willRefreshSelector: r,
|
|
1606
1516
|
willSyncService: i,
|
|
@@ -1609,18 +1519,18 @@ class Le extends E {
|
|
|
1609
1519
|
}));
|
|
1610
1520
|
}
|
|
1611
1521
|
updateSelectorCallback(e) {
|
|
1612
|
-
const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService:
|
|
1613
|
-
if (
|
|
1614
|
-
for (const [
|
|
1522
|
+
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;
|
|
1523
|
+
if (c && l) {
|
|
1524
|
+
for (const [d, S] of r.entries())
|
|
1615
1525
|
l.push(
|
|
1616
1526
|
{
|
|
1617
|
-
...
|
|
1618
|
-
workId:
|
|
1527
|
+
...S,
|
|
1528
|
+
workId: d,
|
|
1619
1529
|
type: p.UpdateNode,
|
|
1620
1530
|
updateNodeOpt: {
|
|
1621
1531
|
useAnimation: !1
|
|
1622
1532
|
},
|
|
1623
|
-
isSync:
|
|
1533
|
+
isSync: n
|
|
1624
1534
|
}
|
|
1625
1535
|
);
|
|
1626
1536
|
l.push({
|
|
@@ -1630,9 +1540,9 @@ class Le extends E {
|
|
|
1630
1540
|
canRotate: i.canRotate,
|
|
1631
1541
|
type: p.Select,
|
|
1632
1542
|
selectIds: i.selectIds,
|
|
1633
|
-
selectRect:
|
|
1634
|
-
willSyncService:
|
|
1635
|
-
isSync:
|
|
1543
|
+
selectRect: m,
|
|
1544
|
+
willSyncService: c,
|
|
1545
|
+
isSync: n
|
|
1636
1546
|
});
|
|
1637
1547
|
}
|
|
1638
1548
|
return {
|
|
@@ -1640,20 +1550,20 @@ class Le extends E {
|
|
|
1640
1550
|
};
|
|
1641
1551
|
}
|
|
1642
1552
|
}
|
|
1643
|
-
class
|
|
1553
|
+
class De extends M {
|
|
1644
1554
|
constructor() {
|
|
1645
1555
|
super(...arguments);
|
|
1646
|
-
|
|
1556
|
+
u(this, "emitEventType", I.SetShapeOpt);
|
|
1647
1557
|
}
|
|
1648
1558
|
async consume(e) {
|
|
1649
1559
|
const { msgType: s, dataType: o, emitEventType: r } = e;
|
|
1650
|
-
if (s === p.UpdateNode && o ===
|
|
1560
|
+
if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
|
|
1651
1561
|
return this.consumeForLocalWorker(e), !0;
|
|
1652
1562
|
}
|
|
1653
1563
|
async consumeForLocalWorker(e) {
|
|
1654
|
-
var
|
|
1564
|
+
var c;
|
|
1655
1565
|
const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
|
|
1656
|
-
s ===
|
|
1566
|
+
s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
|
|
1657
1567
|
updateSelectorOpt: o,
|
|
1658
1568
|
willRefreshSelector: r,
|
|
1659
1569
|
willSyncService: i,
|
|
@@ -1662,13 +1572,13 @@ class be extends E {
|
|
|
1662
1572
|
}));
|
|
1663
1573
|
}
|
|
1664
1574
|
updateSelectorCallback(e) {
|
|
1665
|
-
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s,
|
|
1666
|
-
if (i &&
|
|
1667
|
-
for (const [
|
|
1668
|
-
|
|
1575
|
+
const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
|
|
1576
|
+
if (i && c)
|
|
1577
|
+
for (const [n, h] of r.entries())
|
|
1578
|
+
c.push(
|
|
1669
1579
|
{
|
|
1670
1580
|
...h,
|
|
1671
|
-
workId:
|
|
1581
|
+
workId: n,
|
|
1672
1582
|
type: p.UpdateNode,
|
|
1673
1583
|
updateNodeOpt: {
|
|
1674
1584
|
useAnimation: !1
|
|
@@ -1677,39 +1587,39 @@ class be extends E {
|
|
|
1677
1587
|
}
|
|
1678
1588
|
);
|
|
1679
1589
|
return {
|
|
1680
|
-
sp:
|
|
1590
|
+
sp: c
|
|
1681
1591
|
};
|
|
1682
1592
|
}
|
|
1683
1593
|
}
|
|
1684
|
-
class
|
|
1594
|
+
class Ce {
|
|
1685
1595
|
constructor(t) {
|
|
1686
|
-
|
|
1596
|
+
u(this, "builders", /* @__PURE__ */ new Map());
|
|
1687
1597
|
this.builders = new Map(t.map((e) => [e, this.build(e)]));
|
|
1688
1598
|
}
|
|
1689
1599
|
build(t) {
|
|
1690
1600
|
switch (t) {
|
|
1691
|
-
case
|
|
1601
|
+
case I.TranslateNode:
|
|
1602
|
+
return new ge();
|
|
1603
|
+
case I.ZIndexNode:
|
|
1692
1604
|
return new ve();
|
|
1693
|
-
case
|
|
1694
|
-
return new we();
|
|
1695
|
-
case T.CopyNode:
|
|
1696
|
-
return new me();
|
|
1697
|
-
case T.SetColorNode:
|
|
1605
|
+
case I.CopyNode:
|
|
1698
1606
|
return new ye();
|
|
1699
|
-
case
|
|
1700
|
-
return new
|
|
1701
|
-
case
|
|
1702
|
-
return new Te();
|
|
1703
|
-
case T.RotateNode:
|
|
1607
|
+
case I.SetColorNode:
|
|
1608
|
+
return new we();
|
|
1609
|
+
case I.DeleteNode:
|
|
1704
1610
|
return new Ie();
|
|
1705
|
-
case
|
|
1611
|
+
case I.ScaleNode:
|
|
1706
1612
|
return new We();
|
|
1707
|
-
case
|
|
1708
|
-
return new
|
|
1709
|
-
case
|
|
1613
|
+
case I.RotateNode:
|
|
1614
|
+
return new Te();
|
|
1615
|
+
case I.SetFontStyle:
|
|
1710
1616
|
return new Le();
|
|
1711
|
-
case
|
|
1617
|
+
case I.SetPoint:
|
|
1618
|
+
return new Ne();
|
|
1619
|
+
case I.SetLock:
|
|
1712
1620
|
return new be();
|
|
1621
|
+
case I.SetShapeOpt:
|
|
1622
|
+
return new De();
|
|
1713
1623
|
}
|
|
1714
1624
|
}
|
|
1715
1625
|
registerForMainThread(t) {
|
|
@@ -1726,54 +1636,64 @@ class Me {
|
|
|
1726
1636
|
}
|
|
1727
1637
|
class Oe {
|
|
1728
1638
|
constructor(t, e) {
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1639
|
+
u(this, "viewId");
|
|
1640
|
+
u(this, "fullLayer");
|
|
1641
|
+
u(this, "topLayer");
|
|
1642
|
+
u(this, "localLayer");
|
|
1643
|
+
u(this, "serviceLayer");
|
|
1644
|
+
u(this, "snapshotFullLayer");
|
|
1645
|
+
u(this, "vNodes");
|
|
1646
|
+
u(this, "master");
|
|
1647
|
+
u(this, "opt");
|
|
1648
|
+
u(this, "cameraOpt");
|
|
1649
|
+
u(this, "scene");
|
|
1650
|
+
u(this, "localWork");
|
|
1651
|
+
u(this, "serviceWork");
|
|
1652
|
+
u(this, "topWork");
|
|
1653
|
+
u(this, "taskUpdateCameraId");
|
|
1654
|
+
u(this, "debounceUpdateCameraId");
|
|
1655
|
+
u(this, "debounceUpdateCache", /* @__PURE__ */ new Set());
|
|
1656
|
+
u(this, "mainThreadPostId");
|
|
1657
|
+
u(this, "combinePostMsg", /* @__PURE__ */ new Set());
|
|
1658
|
+
u(this, "methodBuilder");
|
|
1659
|
+
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
1660
|
+
u(this, "imageResolveMap", /* @__PURE__ */ new Map());
|
|
1751
1661
|
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
|
|
1752
|
-
const s =
|
|
1753
|
-
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
1662
|
+
const s = P.bufferSize.full, o = P.bufferSize.sub;
|
|
1663
|
+
this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === B ? s : o * 2 }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === B, o), contextType: "2d" }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === B, o), contextType: "2d" }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === B, o), contextType: "2d" }), this.vNodes = new pe(t, this.scene);
|
|
1754
1664
|
const r = {
|
|
1755
1665
|
thread: this,
|
|
1756
1666
|
vNodes: this.vNodes
|
|
1757
1667
|
};
|
|
1758
|
-
this.localWork = new
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1668
|
+
this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new me(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ce([
|
|
1669
|
+
I.CopyNode,
|
|
1670
|
+
I.SetColorNode,
|
|
1671
|
+
I.DeleteNode,
|
|
1672
|
+
I.RotateNode,
|
|
1673
|
+
I.ScaleNode,
|
|
1674
|
+
I.TranslateNode,
|
|
1675
|
+
I.ZIndexNode,
|
|
1676
|
+
I.SetFontStyle,
|
|
1677
|
+
I.SetPoint,
|
|
1678
|
+
I.SetLock,
|
|
1679
|
+
I.SetShapeOpt
|
|
1770
1680
|
]).registerForMainThread(this);
|
|
1771
1681
|
}
|
|
1772
1682
|
getCachedImages(t) {
|
|
1773
|
-
|
|
1683
|
+
var e;
|
|
1684
|
+
return (e = this.cacheImages.get(t)) == null ? void 0 : e.imageBitmap;
|
|
1685
|
+
}
|
|
1686
|
+
getCachedImagesByWorkId(t) {
|
|
1687
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
1688
|
+
if (e === t && s.imageBitmap)
|
|
1689
|
+
return s.imageBitmap;
|
|
1690
|
+
}
|
|
1691
|
+
deleteCachedImagesByWorkId(t) {
|
|
1692
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
1693
|
+
s.workId === t && (s.imageBitmap.close(), this.cacheImages.delete(e));
|
|
1774
1694
|
}
|
|
1775
1695
|
clearCacheImages() {
|
|
1776
|
-
this.cacheImages.forEach((t) => t.close()), this.cacheImages.clear();
|
|
1696
|
+
this.cacheImages.forEach((t) => t.imageBitmap.close()), this.cacheImages.clear();
|
|
1777
1697
|
}
|
|
1778
1698
|
clearImageResolveMap() {
|
|
1779
1699
|
this.imageResolveMap.forEach(({ timer: t }) => {
|
|
@@ -1783,11 +1703,21 @@ class Oe {
|
|
|
1783
1703
|
post(t) {
|
|
1784
1704
|
this.combinePostMsg.add(t), this.runBatchPostData();
|
|
1785
1705
|
}
|
|
1706
|
+
updateDpr(t) {
|
|
1707
|
+
this.scene.displayRatio = t;
|
|
1708
|
+
}
|
|
1786
1709
|
async on(t) {
|
|
1787
|
-
var e;
|
|
1788
1710
|
if (!await this.methodBuilder.consumeForMainThread(t)) {
|
|
1789
|
-
const { msgType:
|
|
1790
|
-
switch (
|
|
1711
|
+
const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h } = t, l = i == null ? void 0 : i.toString();
|
|
1712
|
+
switch (e) {
|
|
1713
|
+
case p.UpdateDpr:
|
|
1714
|
+
H(t.dpr) && this.updateDpr(t.dpr);
|
|
1715
|
+
break;
|
|
1716
|
+
case p.AuthClear: {
|
|
1717
|
+
const { clearUids: m, localUid: d } = t;
|
|
1718
|
+
this.vNodes.setCanClearUids(m), this.vNodes.setLocalUid(d);
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1791
1721
|
case p.Destroy:
|
|
1792
1722
|
this.destroy();
|
|
1793
1723
|
break;
|
|
@@ -1798,104 +1728,148 @@ class Oe {
|
|
|
1798
1728
|
await this.updateCamera(t);
|
|
1799
1729
|
break;
|
|
1800
1730
|
case p.UpdateTools:
|
|
1801
|
-
if (
|
|
1802
|
-
const
|
|
1803
|
-
toolsType:
|
|
1804
|
-
toolsOpt:
|
|
1731
|
+
if (s && o) {
|
|
1732
|
+
const m = {
|
|
1733
|
+
toolsType: s,
|
|
1734
|
+
toolsOpt: o
|
|
1805
1735
|
};
|
|
1806
|
-
this.topWork.canUseTopLayer(
|
|
1736
|
+
this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(m) : this.localWork.setToolsOpt(m);
|
|
1807
1737
|
}
|
|
1808
1738
|
break;
|
|
1809
1739
|
case p.CreateWork:
|
|
1810
|
-
if (l &&
|
|
1811
|
-
if (this.topWork.canUseTopLayer(
|
|
1740
|
+
if (l && o && s) {
|
|
1741
|
+
if (this.topWork.canUseTopLayer(s)) {
|
|
1812
1742
|
this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
|
|
1813
|
-
toolsType:
|
|
1814
|
-
toolsOpt:
|
|
1815
|
-
}), this.topWork.setWorkOptions(l,
|
|
1743
|
+
toolsType: s,
|
|
1744
|
+
toolsOpt: o
|
|
1745
|
+
}), this.topWork.setWorkOptions(l, o);
|
|
1816
1746
|
break;
|
|
1817
1747
|
}
|
|
1818
1748
|
this.localWork.getToolsOpt() || this.localWork.setToolsOpt({
|
|
1819
|
-
toolsType:
|
|
1820
|
-
toolsOpt:
|
|
1821
|
-
}), this.localWork.setWorkOptions(l,
|
|
1749
|
+
toolsType: s,
|
|
1750
|
+
toolsOpt: o
|
|
1751
|
+
}), this.localWork.setWorkOptions(l, o);
|
|
1822
1752
|
}
|
|
1823
1753
|
break;
|
|
1824
1754
|
case p.DrawWork:
|
|
1825
|
-
|
|
1755
|
+
a === W.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
|
|
1826
1756
|
break;
|
|
1827
1757
|
case p.UpdateNode:
|
|
1828
1758
|
case p.FullWork:
|
|
1829
|
-
if (
|
|
1830
|
-
this.consumeDrawAll(
|
|
1759
|
+
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1760
|
+
this.consumeDrawAll(r, t);
|
|
1831
1761
|
break;
|
|
1832
1762
|
}
|
|
1833
|
-
this.consumeFull(
|
|
1763
|
+
this.consumeFull(r, t);
|
|
1834
1764
|
break;
|
|
1835
1765
|
case p.RemoveNode:
|
|
1836
1766
|
await this.removeNode(t);
|
|
1837
1767
|
return;
|
|
1838
1768
|
case p.Select:
|
|
1839
|
-
|
|
1769
|
+
r === g.Service && (i === T ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
|
|
1840
1770
|
break;
|
|
1771
|
+
case p.CursorBlur:
|
|
1772
|
+
this.localWork.cursorBlur();
|
|
1773
|
+
return;
|
|
1841
1774
|
case p.CursorHover:
|
|
1842
1775
|
this.localWork.cursorHover(t);
|
|
1843
1776
|
break;
|
|
1844
1777
|
case p.GetTextActive:
|
|
1845
|
-
|
|
1778
|
+
r === g.Local && this.localWork.checkTextActive(t);
|
|
1846
1779
|
break;
|
|
1847
1780
|
case p.GetImageBitMap:
|
|
1848
|
-
if (c &&
|
|
1849
|
-
const
|
|
1850
|
-
|
|
1781
|
+
if (c && n && i) {
|
|
1782
|
+
const m = i.toString();
|
|
1783
|
+
this.deleteCachedImagesByWorkId(m), this.cacheImages.set(c, {
|
|
1784
|
+
imageBitmap: n,
|
|
1785
|
+
workId: m
|
|
1786
|
+
});
|
|
1787
|
+
const d = this.imageResolveMap.get(c);
|
|
1788
|
+
if (d) {
|
|
1789
|
+
const { resolve: S, timer: w } = d;
|
|
1790
|
+
w && clearTimeout(w), S && S(c);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
break;
|
|
1794
|
+
case p.GetVNodeInfo:
|
|
1795
|
+
if (i && h) {
|
|
1796
|
+
const m = h.map((d) => this.vNodes.get(d));
|
|
1797
|
+
this.post({
|
|
1798
|
+
sp: [
|
|
1799
|
+
{
|
|
1800
|
+
type: p.GetVNodeInfo,
|
|
1801
|
+
dataType: g.Local,
|
|
1802
|
+
workId: i,
|
|
1803
|
+
vInfo: m
|
|
1804
|
+
}
|
|
1805
|
+
]
|
|
1806
|
+
});
|
|
1851
1807
|
}
|
|
1852
1808
|
break;
|
|
1853
1809
|
}
|
|
1854
1810
|
}
|
|
1855
1811
|
}
|
|
1812
|
+
getIconSize(t, e, s) {
|
|
1813
|
+
const o = t * s, r = e * s;
|
|
1814
|
+
return o <= 50 || r <= 50 ? [50, 50] : o <= 100 || r <= 100 ? [100, 100] : o <= 200 || r <= 200 ? [200, 200] : o <= 400 || r <= 400 ? [400, 400] : o <= 800 || r <= 800 ? [800, 800] : [1600, 1600];
|
|
1815
|
+
}
|
|
1856
1816
|
async loadImageBitMap(t) {
|
|
1857
1817
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
1858
|
-
if (e === f.Image && s &&
|
|
1859
|
-
const r =
|
|
1860
|
-
if (!i)
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
type: p.GetImageBitMap
|
|
1877
|
-
}]
|
|
1878
|
-
});
|
|
1879
|
-
});
|
|
1880
|
-
this.imageResolveMap.delete(n);
|
|
1818
|
+
if (e === f.Image && s && o) {
|
|
1819
|
+
const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
|
|
1820
|
+
if (!i || !a || !c || !n)
|
|
1821
|
+
return;
|
|
1822
|
+
let l = i;
|
|
1823
|
+
if (a === se.Iconify) {
|
|
1824
|
+
const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
1825
|
+
l = `${i}?width=${w}&height=${y}&color=${h}`;
|
|
1826
|
+
}
|
|
1827
|
+
if (this.cacheImages.has(l)) {
|
|
1828
|
+
const w = this.getCachedImages(l);
|
|
1829
|
+
if (w)
|
|
1830
|
+
return w;
|
|
1831
|
+
}
|
|
1832
|
+
if (this.imageResolveMap.has(l)) {
|
|
1833
|
+
const w = this.getCachedImagesByWorkId(r);
|
|
1834
|
+
if (w)
|
|
1835
|
+
return w;
|
|
1881
1836
|
}
|
|
1882
|
-
|
|
1837
|
+
const S = await new Promise((w) => {
|
|
1838
|
+
const y = this.imageResolveMap.get(l) || {
|
|
1839
|
+
resolve: void 0,
|
|
1840
|
+
timer: void 0
|
|
1841
|
+
};
|
|
1842
|
+
y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
|
|
1843
|
+
const v = this.imageResolveMap.get(l);
|
|
1844
|
+
v != null && v.resolve && v.resolve(l);
|
|
1845
|
+
}, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
|
|
1846
|
+
sp: [{
|
|
1847
|
+
imageSrc: l,
|
|
1848
|
+
workId: r,
|
|
1849
|
+
viewId: this.viewId,
|
|
1850
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
1851
|
+
isSubWorker: !1,
|
|
1852
|
+
type: p.GetImageBitMap
|
|
1853
|
+
}]
|
|
1854
|
+
});
|
|
1855
|
+
});
|
|
1856
|
+
return this.imageResolveMap.delete(S), this.getCachedImages(l);
|
|
1883
1857
|
}
|
|
1884
1858
|
}
|
|
1885
1859
|
async removeNode(t) {
|
|
1886
1860
|
const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
|
|
1887
1861
|
if (s && r.push(s.toString()), r.length)
|
|
1888
1862
|
for (const i of r) {
|
|
1889
|
-
if (i ===
|
|
1863
|
+
if (i === T) {
|
|
1890
1864
|
await this.localWork.removeSelector(t);
|
|
1891
1865
|
continue;
|
|
1892
1866
|
}
|
|
1893
|
-
e ===
|
|
1867
|
+
e === g.Local ? this.localWork.removeWork(t) : e === g.Service && this.serviceWork.removeWork(t), await this.localWork.colloctEffectSelectWork(t);
|
|
1894
1868
|
}
|
|
1895
1869
|
}
|
|
1896
1870
|
async consumeFull(t, e) {
|
|
1897
1871
|
const s = await this.localWork.colloctEffectSelectWork(e);
|
|
1898
|
-
s && t ===
|
|
1872
|
+
s && t === g.Local && await this.localWork.consumeFull(s), s && t === g.Service && this.serviceWork.consumeFull(s);
|
|
1899
1873
|
}
|
|
1900
1874
|
setCameraOpt(t) {
|
|
1901
1875
|
this.cameraOpt = t;
|
|
@@ -1906,37 +1880,38 @@ class Oe {
|
|
|
1906
1880
|
this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(this.combinePost.bind(this)));
|
|
1907
1881
|
}
|
|
1908
1882
|
combinePostData() {
|
|
1909
|
-
var
|
|
1883
|
+
var o;
|
|
1910
1884
|
this.mainThreadPostId = void 0;
|
|
1911
1885
|
const t = [];
|
|
1912
|
-
let e;
|
|
1913
|
-
for (const
|
|
1914
|
-
if ((
|
|
1915
|
-
for (const
|
|
1916
|
-
let
|
|
1917
|
-
for (const
|
|
1918
|
-
if (
|
|
1919
|
-
|
|
1886
|
+
let e, s;
|
|
1887
|
+
for (const r of this.combinePostMsg.values()) {
|
|
1888
|
+
if ((o = r.sp) != null && o.length)
|
|
1889
|
+
for (const i of r.sp) {
|
|
1890
|
+
let a = !1;
|
|
1891
|
+
for (const c of t)
|
|
1892
|
+
if (ee(i, c)) {
|
|
1893
|
+
a = !0;
|
|
1920
1894
|
break;
|
|
1921
1895
|
}
|
|
1922
|
-
|
|
1896
|
+
a || t.push(i);
|
|
1923
1897
|
}
|
|
1924
|
-
|
|
1898
|
+
H(r.fullWorkerDrawCount) && (e = r.fullWorkerDrawCount), H(r.consumeCount) && (s = r.consumeCount);
|
|
1925
1899
|
}
|
|
1926
1900
|
return this.combinePostMsg.clear(), {
|
|
1927
1901
|
sp: t,
|
|
1928
|
-
|
|
1902
|
+
fullWorkerDrawCount: e,
|
|
1903
|
+
consumeCount: s
|
|
1929
1904
|
};
|
|
1930
1905
|
}
|
|
1931
1906
|
combinePost() {
|
|
1932
1907
|
var s, o;
|
|
1933
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None);
|
|
1934
|
-
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.
|
|
1908
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
|
|
1909
|
+
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.consumeCount === void 0 && delete t.consumeCount, t.fullWorkerDrawCount === void 0 && delete t.fullWorkerDrawCount, (t != null && t.consumeCount || t != null && t.fullWorkerDrawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
|
|
1935
1910
|
}
|
|
1936
1911
|
clearAll() {
|
|
1937
1912
|
this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
|
|
1938
1913
|
t.name !== "viewport" && t.remove();
|
|
1939
|
-
}), this.fullLayer.
|
|
1914
|
+
}), z(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
|
|
1940
1915
|
sp: [{
|
|
1941
1916
|
type: p.Clear
|
|
1942
1917
|
}]
|
|
@@ -1947,10 +1922,10 @@ class Oe {
|
|
|
1947
1922
|
if (o) {
|
|
1948
1923
|
const r = o.toString();
|
|
1949
1924
|
if (s && this.topWork.canUseTopLayer(s)) {
|
|
1950
|
-
t ===
|
|
1925
|
+
t === g.Local && (this.topWork.getLocalWorkShape(o.toString()) || this.topWork.createLocalWork(e)), this.topWork.consumeDrawAll(e);
|
|
1951
1926
|
return;
|
|
1952
1927
|
}
|
|
1953
|
-
t ===
|
|
1928
|
+
t === g.Local && (this.localWork.getWorkShape(r) || this.localWork.createLocalWork(e), this.localWork.consumeDrawAll(e, this.serviceWork));
|
|
1954
1929
|
}
|
|
1955
1930
|
}
|
|
1956
1931
|
consumeDraw(t, e) {
|
|
@@ -1958,19 +1933,19 @@ class Oe {
|
|
|
1958
1933
|
if (o && r && s) {
|
|
1959
1934
|
const i = o.toString();
|
|
1960
1935
|
if (this.topWork.canUseTopLayer(r)) {
|
|
1961
|
-
t ===
|
|
1936
|
+
t === g.Local && (this.topWork.getLocalWorkShape(i) || this.topWork.createLocalWork(e)), this.topWork.consumeDraw(e);
|
|
1962
1937
|
return;
|
|
1963
1938
|
}
|
|
1964
|
-
t ===
|
|
1939
|
+
t === g.Local ? (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(e), this.localWork.consumeDraw(e, this.serviceWork)) : t === g.Service && this.serviceWork.consumeDraw(e);
|
|
1965
1940
|
return;
|
|
1966
1941
|
}
|
|
1967
1942
|
}
|
|
1968
1943
|
async updateCamera(t) {
|
|
1969
1944
|
var o;
|
|
1970
1945
|
const { cameraOpt: e, scenePath: s } = t;
|
|
1971
|
-
if (e && !
|
|
1946
|
+
if (e && !ee(this.cameraOpt, e)) {
|
|
1972
1947
|
if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
|
|
1973
|
-
let
|
|
1948
|
+
let n = !1;
|
|
1974
1949
|
for (const [h, l] of this.localWork.getWorkShapes().entries())
|
|
1975
1950
|
switch (l.toolsType) {
|
|
1976
1951
|
case f.Text:
|
|
@@ -1981,82 +1956,82 @@ class Oe {
|
|
|
1981
1956
|
case f.LaserPen:
|
|
1982
1957
|
break;
|
|
1983
1958
|
default:
|
|
1984
|
-
h !==
|
|
1959
|
+
h !== F && h !== T && (n = !0);
|
|
1985
1960
|
break;
|
|
1986
1961
|
}
|
|
1987
|
-
if (
|
|
1962
|
+
if (n) {
|
|
1988
1963
|
this.taskUpdateCameraId = setTimeout(() => {
|
|
1989
1964
|
this.taskUpdateCameraId = void 0, this.updateCamera(t);
|
|
1990
|
-
},
|
|
1965
|
+
}, Y);
|
|
1991
1966
|
return;
|
|
1992
1967
|
}
|
|
1993
1968
|
}
|
|
1994
1969
|
const r = /* @__PURE__ */ new Map();
|
|
1995
|
-
for (const [
|
|
1970
|
+
for (const [n, h] of this.vNodes.getNodesByType(f.Text).entries()) {
|
|
1996
1971
|
const l = h.rect;
|
|
1997
|
-
r.set(
|
|
1972
|
+
r.set(n, ie(l));
|
|
1998
1973
|
}
|
|
1999
1974
|
const i = new Set(r.keys());
|
|
2000
1975
|
let a = !1;
|
|
2001
1976
|
if (this.localWork.hasSelector()) {
|
|
2002
|
-
const
|
|
2003
|
-
if (
|
|
1977
|
+
const n = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
|
|
1978
|
+
if (n) {
|
|
2004
1979
|
a = !0;
|
|
2005
|
-
for (const h of
|
|
1980
|
+
for (const h of n)
|
|
2006
1981
|
i.add(h);
|
|
2007
1982
|
}
|
|
2008
1983
|
}
|
|
2009
|
-
let
|
|
1984
|
+
let c = !1;
|
|
2010
1985
|
if (this.serviceWork.selectorWorkShapes.size)
|
|
2011
|
-
for (const
|
|
2012
|
-
const h =
|
|
1986
|
+
for (const n of this.serviceWork.selectorWorkShapes.values()) {
|
|
1987
|
+
const h = n.selectIds;
|
|
2013
1988
|
if (h) {
|
|
2014
|
-
|
|
1989
|
+
c = !0;
|
|
2015
1990
|
for (const l of h)
|
|
2016
1991
|
i.add(l);
|
|
2017
1992
|
}
|
|
2018
1993
|
}
|
|
2019
1994
|
if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
|
|
2020
1995
|
this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(i), this.debounceUpdateCameraId && clearTimeout(this.debounceUpdateCameraId);
|
|
2021
|
-
for (const [
|
|
2022
|
-
const l = this.vNodes.get(
|
|
1996
|
+
for (const [n, h] of r.entries()) {
|
|
1997
|
+
const l = this.vNodes.get(n);
|
|
2023
1998
|
if (l) {
|
|
2024
|
-
const
|
|
2025
|
-
let
|
|
2026
|
-
if ((
|
|
2027
|
-
const { toolsType:
|
|
2028
|
-
|
|
1999
|
+
const m = h, d = l.rect, S = this.getSceneRect(), w = G(m, S), y = G(d, S);
|
|
2000
|
+
let v = !1;
|
|
2001
|
+
if ((w !== y || m.w !== d.w || m.h !== d.h || y === Q.intersect) && (v = !0), v) {
|
|
2002
|
+
const { toolsType: D, opt: x } = l;
|
|
2003
|
+
D === f.Text && x.workState === W.Done && this.debounceUpdateCache.add(n);
|
|
2029
2004
|
}
|
|
2030
2005
|
}
|
|
2031
2006
|
}
|
|
2032
|
-
if (a && this.localWork.reRenderSelector(),
|
|
2033
|
-
for (const [
|
|
2007
|
+
if (a && this.localWork.reRenderSelector(), c)
|
|
2008
|
+
for (const [n, h] of this.serviceWork.selectorWorkShapes.entries())
|
|
2034
2009
|
this.serviceWork.runSelectWork({
|
|
2035
|
-
workId:
|
|
2010
|
+
workId: n,
|
|
2036
2011
|
selectIds: h.selectIds,
|
|
2037
2012
|
msgType: p.Select,
|
|
2038
|
-
dataType:
|
|
2013
|
+
dataType: g.Service,
|
|
2039
2014
|
viewId: this.viewId
|
|
2040
2015
|
});
|
|
2041
2016
|
this.debounceUpdateCameraId = setTimeout(() => {
|
|
2042
2017
|
var h;
|
|
2043
2018
|
this.debounceUpdateCameraId = void 0;
|
|
2044
|
-
const
|
|
2019
|
+
const n = [];
|
|
2045
2020
|
for (const l of this.debounceUpdateCache.values()) {
|
|
2046
2021
|
if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
|
|
2047
|
-
const
|
|
2048
|
-
if (
|
|
2049
|
-
const { toolsType:
|
|
2050
|
-
toolsType:
|
|
2051
|
-
opt:
|
|
2022
|
+
const d = this.vNodes.get(l);
|
|
2023
|
+
if (d) {
|
|
2024
|
+
const { toolsType: S, opt: w, rect: y } = d, v = this.localWork.setFullWork({
|
|
2025
|
+
toolsType: S,
|
|
2026
|
+
opt: w,
|
|
2052
2027
|
workId: l
|
|
2053
2028
|
});
|
|
2054
|
-
if (
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2029
|
+
if (v) {
|
|
2030
|
+
const D = this.getSceneRect(), x = G(y, D);
|
|
2031
|
+
n.push(v.consumeServiceAsync({
|
|
2057
2032
|
isFullWork: !0,
|
|
2058
2033
|
replaceId: l,
|
|
2059
|
-
isDrawLabel:
|
|
2034
|
+
isDrawLabel: x !== Q.outside
|
|
2060
2035
|
}));
|
|
2061
2036
|
}
|
|
2062
2037
|
}
|
|
@@ -2064,7 +2039,7 @@ class Oe {
|
|
|
2064
2039
|
this.debounceUpdateCache.delete(l);
|
|
2065
2040
|
}
|
|
2066
2041
|
this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
|
|
2067
|
-
},
|
|
2042
|
+
}, Y);
|
|
2068
2043
|
}
|
|
2069
2044
|
}
|
|
2070
2045
|
}
|
|
@@ -2078,24 +2053,25 @@ class Oe {
|
|
|
2078
2053
|
};
|
|
2079
2054
|
}
|
|
2080
2055
|
createScene(t) {
|
|
2081
|
-
return new
|
|
2056
|
+
return new oe({
|
|
2082
2057
|
displayRatio: this.opt.displayer.dpr,
|
|
2083
2058
|
depth: !1,
|
|
2084
2059
|
desynchronized: !0,
|
|
2085
2060
|
...t,
|
|
2086
2061
|
autoRender: !0,
|
|
2087
|
-
id: this.viewId
|
|
2062
|
+
id: this.viewId,
|
|
2063
|
+
contextType: "2d"
|
|
2088
2064
|
});
|
|
2089
2065
|
}
|
|
2090
2066
|
createLayer(t, e, s) {
|
|
2091
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }),
|
|
2067
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new re({
|
|
2092
2068
|
anchor: [0.5, 0.5],
|
|
2093
2069
|
pos: [o * 0.5, r * 0.5],
|
|
2094
2070
|
size: [o, r],
|
|
2095
2071
|
name: "viewport",
|
|
2096
2072
|
id: t
|
|
2097
2073
|
});
|
|
2098
|
-
return a.append(
|
|
2074
|
+
return a.append(c), c;
|
|
2099
2075
|
}
|
|
2100
2076
|
updateScene(t) {
|
|
2101
2077
|
this.scene.attr({ ...t });
|
|
@@ -2107,28 +2083,38 @@ class Oe {
|
|
|
2107
2083
|
this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.topLayer.parent.setAttribute("width", e), this.topLayer.parent.setAttribute("height", s), this.topLayer.setAttribute("size", [e, s]), this.topLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.localLayer.parent.setAttribute("width", e), this.localLayer.parent.setAttribute("height", s), this.localLayer.setAttribute("size", [e, s]), this.localLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.serviceLayer.parent.setAttribute("width", e), this.serviceLayer.parent.setAttribute("height", s), this.serviceLayer.setAttribute("size", [e, s]), this.serviceLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
|
|
2108
2084
|
}
|
|
2109
2085
|
destroy() {
|
|
2110
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), this.topLayer.remove(), this.localLayer.remove(), this.serviceLayer.remove(), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
|
|
2086
|
+
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();
|
|
2111
2087
|
}
|
|
2112
2088
|
}
|
|
2113
2089
|
class Ee {
|
|
2114
2090
|
constructor(t, e) {
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId ===
|
|
2091
|
+
u(this, "viewId");
|
|
2092
|
+
u(this, "fullLayer");
|
|
2093
|
+
u(this, "master");
|
|
2094
|
+
u(this, "opt");
|
|
2095
|
+
u(this, "scene");
|
|
2096
|
+
u(this, "mainThreadPostId");
|
|
2097
|
+
u(this, "combinePostMsg", /* @__PURE__ */ new Set());
|
|
2098
|
+
u(this, "workShapes", /* @__PURE__ */ new Map());
|
|
2099
|
+
u(this, "cacheImages", /* @__PURE__ */ new Map());
|
|
2100
|
+
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 === B ? 6e3 : 3e3, contextType: "2d" });
|
|
2126
2102
|
}
|
|
2127
2103
|
getCachedImages(t) {
|
|
2128
|
-
|
|
2104
|
+
var e;
|
|
2105
|
+
return (e = this.cacheImages.get(t)) == null ? void 0 : e.imageBitmap;
|
|
2106
|
+
}
|
|
2107
|
+
getCachedImagesByWorkId(t) {
|
|
2108
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
2109
|
+
if (e === t && s.imageBitmap)
|
|
2110
|
+
return s.imageBitmap;
|
|
2111
|
+
}
|
|
2112
|
+
deleteCachedImagesByWorkId(t) {
|
|
2113
|
+
for (const [e, s] of this.cacheImages.entries())
|
|
2114
|
+
s.workId === t && (s.imageBitmap.close(), this.cacheImages.delete(e));
|
|
2129
2115
|
}
|
|
2130
2116
|
clearCacheImages() {
|
|
2131
|
-
this.cacheImages.forEach((t) => t.close()), this.cacheImages.clear();
|
|
2117
|
+
this.cacheImages.forEach((t) => t.imageBitmap.close()), this.cacheImages.clear();
|
|
2132
2118
|
}
|
|
2133
2119
|
clearImageResolveMap() {
|
|
2134
2120
|
this.imageResolveMap.forEach(({ timer: t }) => {
|
|
@@ -2139,7 +2125,6 @@ class Ee {
|
|
|
2139
2125
|
this.combinePostMsg.add(t), this.runBatchPostData();
|
|
2140
2126
|
}
|
|
2141
2127
|
async on(t) {
|
|
2142
|
-
var i;
|
|
2143
2128
|
const { msgType: e, imageSrc: s, imageBitmap: o, workId: r } = t;
|
|
2144
2129
|
switch (e) {
|
|
2145
2130
|
case p.Snapshot:
|
|
@@ -2149,44 +2134,70 @@ class Ee {
|
|
|
2149
2134
|
await this.getBoundingRect(t), this.destroy();
|
|
2150
2135
|
return;
|
|
2151
2136
|
case p.GetImageBitMap:
|
|
2152
|
-
if (s && o &&
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2137
|
+
if (s && o && r) {
|
|
2138
|
+
const i = r.toString();
|
|
2139
|
+
this.deleteCachedImagesByWorkId(i), this.cacheImages.set(s, {
|
|
2140
|
+
imageBitmap: o,
|
|
2141
|
+
workId: i
|
|
2142
|
+
});
|
|
2143
|
+
const a = this.imageResolveMap.get(s);
|
|
2144
|
+
if (a) {
|
|
2145
|
+
const { resolve: c, timer: n } = a;
|
|
2146
|
+
n && clearTimeout(n), c && c(s);
|
|
2147
|
+
}
|
|
2155
2148
|
}
|
|
2156
2149
|
break;
|
|
2157
2150
|
}
|
|
2158
2151
|
}
|
|
2152
|
+
getIconSize(t, e, s) {
|
|
2153
|
+
const o = t * s, r = e * s;
|
|
2154
|
+
return o <= 50 || r <= 50 ? [50, 50] : o <= 100 || r <= 100 ? [100, 100] : o <= 200 || r <= 200 ? [200, 200] : o <= 400 || r <= 400 ? [400, 400] : o <= 800 || r <= 800 ? [800, 800] : [1600, 1600];
|
|
2155
|
+
}
|
|
2159
2156
|
async loadImageBitMap(t) {
|
|
2160
2157
|
const { toolsType: e, opt: s, workId: o } = t;
|
|
2161
|
-
if (e === f.Image && s &&
|
|
2162
|
-
const r =
|
|
2163
|
-
if (!i)
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
type: p.GetImageBitMap
|
|
2180
|
-
}]
|
|
2181
|
-
});
|
|
2182
|
-
});
|
|
2183
|
-
this.imageResolveMap.delete(n);
|
|
2158
|
+
if (e === f.Image && s && o) {
|
|
2159
|
+
const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
|
|
2160
|
+
if (!i || !a || !c || !n)
|
|
2161
|
+
return;
|
|
2162
|
+
let l = i;
|
|
2163
|
+
if (a === se.Iconify) {
|
|
2164
|
+
const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
|
|
2165
|
+
l = `${i}?width=${w}&height=${y}&color=${h}`;
|
|
2166
|
+
}
|
|
2167
|
+
if (this.cacheImages.has(l)) {
|
|
2168
|
+
const w = this.getCachedImages(l);
|
|
2169
|
+
if (w)
|
|
2170
|
+
return w;
|
|
2171
|
+
}
|
|
2172
|
+
if (this.imageResolveMap.has(l)) {
|
|
2173
|
+
const w = this.getCachedImagesByWorkId(r);
|
|
2174
|
+
if (w)
|
|
2175
|
+
return w;
|
|
2184
2176
|
}
|
|
2185
|
-
|
|
2177
|
+
const S = await new Promise((w) => {
|
|
2178
|
+
const y = this.imageResolveMap.get(l) || {
|
|
2179
|
+
resolve: void 0,
|
|
2180
|
+
timer: void 0
|
|
2181
|
+
};
|
|
2182
|
+
y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
|
|
2183
|
+
const v = this.imageResolveMap.get(l);
|
|
2184
|
+
v != null && v.resolve && v.resolve(l);
|
|
2185
|
+
}, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
|
|
2186
|
+
sp: [{
|
|
2187
|
+
imageSrc: l,
|
|
2188
|
+
workId: r,
|
|
2189
|
+
viewId: this.viewId,
|
|
2190
|
+
isgl: !!this.fullLayer.parent.gl,
|
|
2191
|
+
isSubWorker: !0,
|
|
2192
|
+
type: p.GetImageBitMap
|
|
2193
|
+
}]
|
|
2194
|
+
});
|
|
2195
|
+
});
|
|
2196
|
+
return this.imageResolveMap.delete(S), this.getCachedImages(l);
|
|
2186
2197
|
}
|
|
2187
2198
|
}
|
|
2188
2199
|
createWorkShapeNode(t) {
|
|
2189
|
-
return
|
|
2200
|
+
return $({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
|
|
2190
2201
|
}
|
|
2191
2202
|
setFullWork(t) {
|
|
2192
2203
|
const { workId: e, opt: s, toolsType: o } = t;
|
|
@@ -2202,7 +2213,7 @@ class Ee {
|
|
|
2202
2213
|
}
|
|
2203
2214
|
async runFullWork(t) {
|
|
2204
2215
|
var o;
|
|
2205
|
-
const e = this.setFullWork(t), s = t.ops &&
|
|
2216
|
+
const e = this.setFullWork(t), s = t.ops && U(t.ops);
|
|
2206
2217
|
if (e) {
|
|
2207
2218
|
let r, i;
|
|
2208
2219
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
@@ -2217,7 +2228,7 @@ class Ee {
|
|
|
2217
2228
|
op: s,
|
|
2218
2229
|
isFullWork: !0,
|
|
2219
2230
|
replaceId: a
|
|
2220
|
-
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)),
|
|
2231
|
+
}), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), V(r, i);
|
|
2221
2232
|
}
|
|
2222
2233
|
}
|
|
2223
2234
|
async getSnapshot(t) {
|
|
@@ -2225,28 +2236,28 @@ class Ee {
|
|
|
2225
2236
|
if (e && s && o) {
|
|
2226
2237
|
this.setCameraOpt(o);
|
|
2227
2238
|
let a;
|
|
2228
|
-
for (const [
|
|
2239
|
+
for (const [n, h] of Object.entries(s))
|
|
2229
2240
|
if (h != null && h.type)
|
|
2230
2241
|
switch (h == null ? void 0 : h.type) {
|
|
2231
2242
|
case p.UpdateNode:
|
|
2232
2243
|
case p.FullWork: {
|
|
2233
|
-
const { opt: l } = h,
|
|
2244
|
+
const { opt: l } = h, m = {
|
|
2234
2245
|
...h,
|
|
2235
2246
|
opt: l,
|
|
2236
|
-
workId:
|
|
2247
|
+
workId: n,
|
|
2237
2248
|
msgType: p.FullWork,
|
|
2238
|
-
dataType:
|
|
2249
|
+
dataType: g.Service,
|
|
2239
2250
|
viewId: this.viewId
|
|
2240
|
-
},
|
|
2241
|
-
a =
|
|
2251
|
+
}, d = await this.runFullWork(m);
|
|
2252
|
+
a = V(a, d);
|
|
2242
2253
|
break;
|
|
2243
2254
|
}
|
|
2244
2255
|
}
|
|
2245
|
-
let
|
|
2246
|
-
r && i && (
|
|
2256
|
+
let c;
|
|
2257
|
+
r && i && (c = {
|
|
2247
2258
|
resizeWidth: r,
|
|
2248
2259
|
resizeHeight: i
|
|
2249
|
-
}), await this.getSnapshotRender({ scenePath: e, options:
|
|
2260
|
+
}), await this.getSnapshotRender({ scenePath: e, options: c });
|
|
2250
2261
|
}
|
|
2251
2262
|
}
|
|
2252
2263
|
getSceneRect() {
|
|
@@ -2263,7 +2274,7 @@ class Ee {
|
|
|
2263
2274
|
return createImageBitmap(this.fullLayer.parent.canvas, s, o, r, i, e);
|
|
2264
2275
|
}
|
|
2265
2276
|
async getSnapshotRender(t) {
|
|
2266
|
-
var r
|
|
2277
|
+
var r;
|
|
2267
2278
|
const { scenePath: e, options: s } = t;
|
|
2268
2279
|
((r = this.fullLayer) == null ? void 0 : r.parent).render();
|
|
2269
2280
|
const o = await this.getRectImageBitmap(this.getSceneRect(), s);
|
|
@@ -2274,7 +2285,7 @@ class Ee {
|
|
|
2274
2285
|
imageBitmap: o,
|
|
2275
2286
|
viewId: this.viewId
|
|
2276
2287
|
}]
|
|
2277
|
-
}),
|
|
2288
|
+
}), this.fullLayer && z(this.fullLayer, this.fullLayer.parent));
|
|
2278
2289
|
}
|
|
2279
2290
|
async getBoundingRect(t) {
|
|
2280
2291
|
const { scenePath: e, scenes: s, cameraOpt: o } = t;
|
|
@@ -2286,14 +2297,14 @@ class Ee {
|
|
|
2286
2297
|
switch (a == null ? void 0 : a.type) {
|
|
2287
2298
|
case p.UpdateNode:
|
|
2288
2299
|
case p.FullWork: {
|
|
2289
|
-
const
|
|
2300
|
+
const c = await this.runFullWork({
|
|
2290
2301
|
...a,
|
|
2291
2302
|
workId: i,
|
|
2292
2303
|
msgType: p.FullWork,
|
|
2293
|
-
dataType:
|
|
2304
|
+
dataType: g.Service,
|
|
2294
2305
|
viewId: this.viewId
|
|
2295
2306
|
});
|
|
2296
|
-
r =
|
|
2307
|
+
r = V(r, c);
|
|
2297
2308
|
break;
|
|
2298
2309
|
}
|
|
2299
2310
|
}
|
|
@@ -2322,7 +2333,7 @@ class Ee {
|
|
|
2322
2333
|
for (const o of s.sp) {
|
|
2323
2334
|
let r = !1;
|
|
2324
2335
|
for (const i of t)
|
|
2325
|
-
if (
|
|
2336
|
+
if (de(o, i)) {
|
|
2326
2337
|
r = !0;
|
|
2327
2338
|
break;
|
|
2328
2339
|
}
|
|
@@ -2334,27 +2345,28 @@ class Ee {
|
|
|
2334
2345
|
}
|
|
2335
2346
|
combinePost() {
|
|
2336
2347
|
var s, o;
|
|
2337
|
-
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None);
|
|
2338
|
-
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (
|
|
2348
|
+
const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
|
|
2349
|
+
e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (o = t.sp) != null && o.length && this.opt.post(t);
|
|
2339
2350
|
}
|
|
2340
2351
|
createScene(t) {
|
|
2341
|
-
return new
|
|
2352
|
+
return new oe({
|
|
2342
2353
|
displayRatio: this.opt.displayer.dpr,
|
|
2343
2354
|
depth: !1,
|
|
2344
2355
|
desynchronized: !0,
|
|
2345
2356
|
...t,
|
|
2346
|
-
autoRender: !1
|
|
2357
|
+
autoRender: !1,
|
|
2358
|
+
contextType: "2d"
|
|
2347
2359
|
});
|
|
2348
2360
|
}
|
|
2349
2361
|
createLayer(t, e, s) {
|
|
2350
|
-
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s),
|
|
2362
|
+
const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new re({
|
|
2351
2363
|
anchor: [0.5, 0.5],
|
|
2352
2364
|
pos: [o * 0.5, r * 0.5],
|
|
2353
2365
|
size: [o, r],
|
|
2354
2366
|
name: "viewport",
|
|
2355
2367
|
id: t
|
|
2356
2368
|
});
|
|
2357
|
-
return a.append(
|
|
2369
|
+
return a.append(c), c;
|
|
2358
2370
|
}
|
|
2359
2371
|
updateScene(t) {
|
|
2360
2372
|
this.scene.attr({ ...t });
|
|
@@ -2366,19 +2378,19 @@ class Ee {
|
|
|
2366
2378
|
this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
|
|
2367
2379
|
}
|
|
2368
2380
|
destroy() {
|
|
2369
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), this.scene.remove();
|
|
2381
|
+
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), R(this.fullLayer, this.fullLayer.parent), this.scene.remove();
|
|
2370
2382
|
}
|
|
2371
2383
|
}
|
|
2372
|
-
class
|
|
2384
|
+
class _e {
|
|
2373
2385
|
constructor(t) {
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2386
|
+
u(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
2387
|
+
u(this, "snapshotThread");
|
|
2388
|
+
u(this, "master");
|
|
2377
2389
|
this.master = t;
|
|
2378
2390
|
}
|
|
2379
2391
|
post(t) {
|
|
2380
|
-
const {
|
|
2381
|
-
this.master.isBusy &&
|
|
2392
|
+
const { fullWorkerDrawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
|
|
2393
|
+
this.master.isBusy && K(o) && this.master.setWorkerTasksqueueCount(o), K(e) && this.master.setMaxDrawCount(e), K(r) && this.master.setConsumeCount(r), s && this.master.collectorSyncData(s);
|
|
2382
2394
|
}
|
|
2383
2395
|
destroy() {
|
|
2384
2396
|
this.mainThreadMap.clear();
|
|
@@ -2392,74 +2404,74 @@ class Be {
|
|
|
2392
2404
|
async consume(t) {
|
|
2393
2405
|
var e, s, o, r;
|
|
2394
2406
|
for (const i of t.values()) {
|
|
2395
|
-
const { msgType: a, viewId:
|
|
2407
|
+
const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: S } = i;
|
|
2396
2408
|
if (a === p.Console) {
|
|
2397
2409
|
console.log(this);
|
|
2398
2410
|
continue;
|
|
2399
2411
|
}
|
|
2400
2412
|
if (a === p.Init) {
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2403
|
-
const
|
|
2404
|
-
displayer:
|
|
2405
|
-
container:
|
|
2413
|
+
const y = (e = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : e.displayer, v = y == null ? void 0 : y.canvasContainerRef.current;
|
|
2414
|
+
if (y && v && l && m) {
|
|
2415
|
+
const D = this.createMainThread(c, {
|
|
2416
|
+
displayer: y,
|
|
2417
|
+
container: v,
|
|
2406
2418
|
layerOpt: l,
|
|
2407
2419
|
master: this.master,
|
|
2408
|
-
canvasOpt:
|
|
2420
|
+
canvasOpt: m,
|
|
2409
2421
|
post: this.post.bind(this)
|
|
2410
2422
|
});
|
|
2411
|
-
this.mainThreadMap.set(
|
|
2423
|
+
this.mainThreadMap.set(c, D), D && d && D.setCameraOpt(d);
|
|
2412
2424
|
}
|
|
2413
2425
|
continue;
|
|
2414
2426
|
}
|
|
2415
|
-
if ((a === p.Snapshot || a === p.BoundingBox) &&
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2418
|
-
|
|
2419
|
-
const
|
|
2420
|
-
...
|
|
2427
|
+
if ((a === p.Snapshot || a === p.BoundingBox) && c === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
|
|
2428
|
+
const y = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = y.snapshotContainerRef) == null ? void 0 : r.current;
|
|
2429
|
+
if (y && v && d) {
|
|
2430
|
+
v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
2431
|
+
const D = {
|
|
2432
|
+
...J.defaultLayerOpt,
|
|
2421
2433
|
offscreen: !1,
|
|
2422
|
-
width:
|
|
2423
|
-
height:
|
|
2424
|
-
},
|
|
2425
|
-
...
|
|
2426
|
-
width:
|
|
2427
|
-
height:
|
|
2434
|
+
width: d.width,
|
|
2435
|
+
height: d.height
|
|
2436
|
+
}, x = {
|
|
2437
|
+
...J.defaultScreenCanvasOpt,
|
|
2438
|
+
width: d.width,
|
|
2439
|
+
height: d.height
|
|
2428
2440
|
};
|
|
2429
|
-
this.snapshotThread = this.createSnapshotThread(
|
|
2430
|
-
displayer:
|
|
2431
|
-
container:
|
|
2432
|
-
layerOpt:
|
|
2441
|
+
this.snapshotThread = this.createSnapshotThread(c, {
|
|
2442
|
+
displayer: y,
|
|
2443
|
+
container: v,
|
|
2444
|
+
layerOpt: D,
|
|
2433
2445
|
master: this.master,
|
|
2434
|
-
canvasOpt:
|
|
2446
|
+
canvasOpt: x,
|
|
2435
2447
|
post: this.post.bind(this)
|
|
2436
2448
|
}), this.snapshotThread.on(i).then(() => {
|
|
2437
|
-
this.snapshotThread = void 0,
|
|
2449
|
+
this.snapshotThread = void 0, v.innerHTML = "", v.style.width = "", v.style.height = "";
|
|
2438
2450
|
});
|
|
2439
2451
|
continue;
|
|
2440
2452
|
}
|
|
2441
2453
|
}
|
|
2442
|
-
if (a === p.GetImageBitMap &&
|
|
2454
|
+
if (a === p.GetImageBitMap && S && this.snapshotThread) {
|
|
2443
2455
|
this.snapshotThread.on(i);
|
|
2444
2456
|
continue;
|
|
2445
2457
|
}
|
|
2446
|
-
if (a === p.TasksQueue && (
|
|
2447
|
-
for (const [
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2458
|
+
if (a === p.TasksQueue && (n != null && n.size)) {
|
|
2459
|
+
for (const [y, v] of this.mainThreadMap.entries()) {
|
|
2460
|
+
const D = n.get(y);
|
|
2461
|
+
D && (await v.on(D), h && this.post({ workerTasksqueueCount: h }));
|
|
2450
2462
|
}
|
|
2451
2463
|
continue;
|
|
2452
2464
|
}
|
|
2453
|
-
if (
|
|
2454
|
-
for (const
|
|
2455
|
-
|
|
2465
|
+
if (c === ue) {
|
|
2466
|
+
for (const y of this.mainThreadMap.values())
|
|
2467
|
+
y.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
|
|
2456
2468
|
continue;
|
|
2457
2469
|
}
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2470
|
+
const w = this.mainThreadMap.get(c);
|
|
2471
|
+
w && (w.on(i), a === p.Destroy && this.mainThreadMap.delete(c));
|
|
2460
2472
|
}
|
|
2461
2473
|
}
|
|
2462
2474
|
}
|
|
2463
2475
|
export {
|
|
2464
|
-
|
|
2476
|
+
_e as MainThreadManagerImpl
|
|
2465
2477
|
};
|