@netless/appliance-plugin 1.1.34-beta.2 → 1.1.34
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/READMA.zh-CN.md +33 -1
- package/README.md +32 -0
- package/cdn/cdn.js +1 -1
- package/cdn/{subWorker-DhqUsi.js → fullWorker-oI42U9.js} +109 -109
- package/cdn/{fullWorker-CuVwdG.js → subWorker-Bk6qRb.js} +109 -109
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/collector/collector.d.ts +0 -1
- package/dist/core/autoShape/index.d.ts +12 -0
- package/dist/core/autoShape/mapper.d.ts +3 -0
- package/dist/core/autoShape/recognizer.d.ts +8 -0
- package/dist/core/autoShape/registry.d.ts +2 -0
- package/dist/core/autoShape/templates.d.ts +2 -0
- package/dist/core/autoShape/types.d.ts +78 -0
- package/dist/core/mainEngine.d.ts +9 -1
- package/dist/core/tools/pencil.d.ts +3 -0
- package/dist/core/types.d.ts +7 -0
- package/dist/fullWorker.js +109 -109
- package/dist/{index-DD4uosmt.mjs → index-BPFYMff6.mjs} +1040 -1012
- package/dist/{index-Djm-u9a7.mjs → index-BTxxBSIk.mjs} +214 -207
- package/dist/index-BzcHKXGG.js +1 -0
- package/dist/index-CFIySwek.js +1 -0
- package/dist/{index-CslUUlge.mjs → index-CIPJM93i.mjs} +2829 -2011
- package/dist/{index-CnVA96FG.js → index-DVZBBduh.js} +3 -3
- package/dist/plugin/baseApplianceManager.d.ts +1 -2
- package/dist/plugin/multi/containerManager.d.ts +7 -0
- package/dist/plugin/types.d.ts +24 -0
- package/dist/plugin/utils.d.ts +0 -8
- package/dist/subWorker.js +109 -109
- package/package.json +8 -18
- package/dist/assets/fullWorker-CItZoPtX.js +0 -593
- package/dist/assets/subWorker-DTQZDdFT.js +0 -593
- package/dist/bridge-C4n1zHQZ.mjs +0 -67
- package/dist/bridge-DCJjH18X.js +0 -1
- package/dist/bridge-runtime.d.ts +0 -11
- package/dist/bridge.d.ts +0 -5
- package/dist/bridge.js +0 -1
- package/dist/bridge.mjs +0 -7
- package/dist/index-BZopbcnP.js +0 -1
- package/dist/index-Bc6Cv0DB.mjs +0 -15802
- package/dist/index-CH_SAlCz.mjs +0 -1255
- package/dist/index-CR9Nc39_.js +0 -1
- package/dist/index-D8qxABte.mjs +0 -9855
- package/dist/index-DjNO25oE.js +0 -1
- package/dist/index-Dk4BLxV5.js +0 -3
- package/dist/index-DnccF_rY.js +0 -1
- package/dist/plugin/external.bridge.d.ts +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _e = Object.defineProperty;
|
|
2
2
|
var Ve = (T, i, t) => i in T ? _e(T, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : T[i] = t;
|
|
3
3
|
var y = (T, i, t) => Ve(T, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { g as Jt, _ as Pe, i as te, p as St, e as Tt, D as J, f as E, h as Rt, j as Vt, k as st, P as O, l as W, s as Ht, m as ee, n as Nt, o as se, r as He, q as qe, c as
|
|
4
|
+
import { g as Jt, _ as Pe, i as te, p as St, e as Tt, D as J, f as E, h as Rt, j as Vt, k as st, P as O, l as W, s as Ht, m as ee, n as Nt, o as se, r as He, q as qe, c as S, t as Mt, u as z, a as w, b as x, v as A, w as G, x as tt, y as $, z as Zt, A as je, B as Ze, C as Ke, F as Qe, G as Je, H as ts, I as es, J as ss, K as X, L as os, M as he, N as Wt, O as We, T as Bt, Q as yt, R as is, U as Le, W as rs, X as ns, Y as ct, Z as _, $ as ut, a0 as as, a1 as cs, a2 as ls, a3 as hs, a4 as bt, a5 as ps, E as Y, a6 as pe, V as de, S as ds } from "./index-CIPJM93i.mjs";
|
|
5
5
|
import { Group as j, Path as wt, Sprite as Ce, Rect as Kt, Polyline as ht, Ellipse as us, Label as fs, Scene as oe, Layer as ms } from "spritejs";
|
|
6
6
|
import it from "clipper-lib";
|
|
7
7
|
import ie from "lineclip";
|
|
@@ -17,7 +17,7 @@ function Ss(T) {
|
|
|
17
17
|
return typeof T == "number" || gs(T) && ws(T) == ks;
|
|
18
18
|
}
|
|
19
19
|
var Ts = Ss;
|
|
20
|
-
const
|
|
20
|
+
const q = /* @__PURE__ */ Jt(Ts);
|
|
21
21
|
function mt(T, i = !0) {
|
|
22
22
|
const t = T.length;
|
|
23
23
|
if (t < 2)
|
|
@@ -86,14 +86,14 @@ const et = class et {
|
|
|
86
86
|
const r = this.fullLayer.getElementsByName(e) || this.drawLayer && this.drawLayer.getElementsByName(e) || [];
|
|
87
87
|
if (r.length !== 1)
|
|
88
88
|
return;
|
|
89
|
-
const n = r[0], { pos: a, zIndex: c, scale: l, angle: h, translate: p } = i,
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
return
|
|
93
|
-
x: Math.floor(
|
|
94
|
-
y: Math.floor(
|
|
95
|
-
w: Math.floor(
|
|
96
|
-
h: Math.floor(
|
|
89
|
+
const n = r[0], { pos: a, zIndex: c, scale: l, angle: h, translate: p } = i, u = {};
|
|
90
|
+
q(c) && (u.zIndex = c), a && (u.pos = [a[0], a[1]]), l && (u.scale = l), h && (u.rotate = h), p && (u.translate = p), n.attr(u);
|
|
91
|
+
const d = n == null ? void 0 : n.getBoundingClientRect();
|
|
92
|
+
return d && (t = E(t, {
|
|
93
|
+
x: Math.floor(d.x - et.SafeBorderPadding),
|
|
94
|
+
y: Math.floor(d.y - et.SafeBorderPadding),
|
|
95
|
+
w: Math.floor(d.width + et.SafeBorderPadding * 2),
|
|
96
|
+
h: Math.floor(d.height + et.SafeBorderPadding * 2)
|
|
97
97
|
})), (o = this.vNodes) == null || o.setInfo(e, {
|
|
98
98
|
rect: t,
|
|
99
99
|
centerPos: a
|
|
@@ -105,13 +105,13 @@ const et = class et {
|
|
|
105
105
|
if (t)
|
|
106
106
|
try {
|
|
107
107
|
const c = (r.renderer.glRenderer || r.renderer.canvasRenderer).options.displayRatio, l = e.getBoundingClientRect(), h = l.width * c * r.worldScaling[0], p = l.height * c * r.worldScaling[1];
|
|
108
|
-
let
|
|
109
|
-
(h > this.maxImageWidth || p > this.maxImageHeight) && (
|
|
108
|
+
let u = 1;
|
|
109
|
+
(h > this.maxImageWidth || p > this.maxImageHeight) && (u = Math.min(
|
|
110
110
|
this.maxImageWidth / h,
|
|
111
111
|
this.maxImageHeight / p
|
|
112
112
|
));
|
|
113
|
-
let
|
|
114
|
-
|
|
113
|
+
let d = r.getAttribute("scale");
|
|
114
|
+
d = [d[0] * u, d[1] * u];
|
|
115
115
|
const f = r.parent.parent, m = r.getAttribute("translate"), g = this.createVmRenderNode(
|
|
116
116
|
`${this.workId}_bitMapLayer`,
|
|
117
117
|
f,
|
|
@@ -123,18 +123,18 @@ const et = class et {
|
|
|
123
123
|
autoRender: !1,
|
|
124
124
|
bufferSize: 500
|
|
125
125
|
},
|
|
126
|
-
|
|
126
|
+
d,
|
|
127
127
|
m
|
|
128
|
-
),
|
|
128
|
+
), v = e.cloneNode(!0);
|
|
129
129
|
if (!s || !s.length)
|
|
130
130
|
return;
|
|
131
|
-
this.addEraserlines(
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const
|
|
131
|
+
this.addEraserlines(v, s, o, !1), g.appendChild(v);
|
|
132
|
+
const k = g.parent;
|
|
133
|
+
k.render();
|
|
134
|
+
const I = g.renderer.canvasRenderer, L = I.context;
|
|
135
135
|
if (!L)
|
|
136
136
|
return;
|
|
137
|
-
const C =
|
|
137
|
+
const C = I.options.displayRatio, N = v.getBoundingClientRect(), R = {
|
|
138
138
|
x: N.x,
|
|
139
139
|
y: N.y,
|
|
140
140
|
w: N.width,
|
|
@@ -146,15 +146,15 @@ const et = class et {
|
|
|
146
146
|
h: f.height
|
|
147
147
|
};
|
|
148
148
|
if (Rt(R, P) === Vt.outside) {
|
|
149
|
-
Q(
|
|
149
|
+
Q(v, k), f.removeChild(k), this.isDelete = !0;
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
const D = st(R);
|
|
153
153
|
D.x = Math.floor(Math.max(R.x, 0)), D.y = Math.floor(Math.max(R.y, 0)), D.w = Math.min(R.x + R.w, f.width) - D.x, D.h = Math.min(R.y + R.h, f.height) - D.y;
|
|
154
|
-
const B = this.getGroupRect(D, C), F = B.x, U = B.y,
|
|
155
|
-
let K = L.getImageData(F, U,
|
|
154
|
+
const B = this.getGroupRect(D, C), F = B.x, U = B.y, H = B.w, Z = B.h;
|
|
155
|
+
let K = L.getImageData(F, U, H, Z);
|
|
156
156
|
if (this.isTransparentRectByCanvas(K)) {
|
|
157
|
-
Q(
|
|
157
|
+
Q(v, k), f.removeChild(k), this.isDelete = !0, K = null;
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
Q(e, n);
|
|
@@ -164,7 +164,7 @@ const et = class et {
|
|
|
164
164
|
originRect: R,
|
|
165
165
|
worldScaling: g.worldScaling
|
|
166
166
|
});
|
|
167
|
-
gt && e.append(gt), Q(
|
|
167
|
+
gt && e.append(gt), Q(v, k), f.removeChild(k), n.deleteTexture(K), K = null;
|
|
168
168
|
} catch (a) {
|
|
169
169
|
console.error("[BaseShapeTool] drawEraserlines error:", a);
|
|
170
170
|
return;
|
|
@@ -193,23 +193,23 @@ const et = class et {
|
|
|
193
193
|
for (const o of t) {
|
|
194
194
|
const { thickness: r, op: n } = o;
|
|
195
195
|
for (const a of n) {
|
|
196
|
-
const c = a.map((
|
|
196
|
+
const c = a.map((d, f) => f % 2 ? d - e[1] : d - e[0]), l = this.computEraserPoints(c, r), h = mt(l, !0), p = {
|
|
197
197
|
pos: [0, 0],
|
|
198
198
|
d: h,
|
|
199
199
|
fillColor: "rgba(0,0,0,1)"
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
const f =
|
|
200
|
+
}, u = new wt(p);
|
|
201
|
+
u.addEventListener("beforerender", ({ detail: d }) => {
|
|
202
|
+
const f = d.context;
|
|
203
203
|
s ? f.blendFuncSeparate(f.ZERO, f.ZERO, f.ZERO, f.ZERO) : f.globalCompositeOperation = "destination-out";
|
|
204
|
-
}),
|
|
205
|
-
const f =
|
|
204
|
+
}), u.addEventListener("afterrender", ({ detail: d }) => {
|
|
205
|
+
const f = d.context;
|
|
206
206
|
s ? f.blendFuncSeparate(
|
|
207
207
|
f.SRC_ALPHA,
|
|
208
208
|
f.ONE_MINUS_SRC_ALPHA,
|
|
209
209
|
f.ONE,
|
|
210
210
|
f.ONE_MINUS_SRC_ALPHA
|
|
211
211
|
) : f.globalCompositeOperation = "source-over";
|
|
212
|
-
}), i.append(
|
|
212
|
+
}), i.append(u);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -306,13 +306,13 @@ const et = class et {
|
|
|
306
306
|
const s = i.getElementsByName(t);
|
|
307
307
|
if (s.length)
|
|
308
308
|
for (const r of s)
|
|
309
|
-
e ? oo(e, r, i) : (r.remove(),
|
|
309
|
+
e ? oo(e, r, i) : (r.remove(), V(r, i.parent));
|
|
310
310
|
else e && i.append(e);
|
|
311
311
|
this.fullLayer !== this.drawLayer && (this.fullLayer === i ? (o = this.drawLayer) == null || o.getElementsByName(t).forEach((n) => {
|
|
312
312
|
var a;
|
|
313
|
-
n.remove(),
|
|
313
|
+
n.remove(), V(n, (a = this.drawLayer) == null ? void 0 : a.parent);
|
|
314
314
|
}) : this.fullLayer.getElementsByName(t).forEach((n) => {
|
|
315
|
-
n.remove(),
|
|
315
|
+
n.remove(), V(n, this.fullLayer.parent);
|
|
316
316
|
}));
|
|
317
317
|
}
|
|
318
318
|
removeDrawCountNodes(i, t) {
|
|
@@ -321,10 +321,10 @@ const et = class et {
|
|
|
321
321
|
s.id && t && Number(s.id) < t && e.push(s);
|
|
322
322
|
});
|
|
323
323
|
for (const s of e)
|
|
324
|
-
s.remove(),
|
|
324
|
+
s.remove(), V(s, i.parent);
|
|
325
325
|
}
|
|
326
326
|
static updateNodeOpt(i) {
|
|
327
|
-
var
|
|
327
|
+
var v;
|
|
328
328
|
const { node: t, opt: e, vNodes: s, willSerializeData: o, targetNode: r } = i, {
|
|
329
329
|
zIndex: n,
|
|
330
330
|
translate: a,
|
|
@@ -332,21 +332,21 @@ const et = class et {
|
|
|
332
332
|
originPoint: l,
|
|
333
333
|
scenePoint: h,
|
|
334
334
|
scale: p,
|
|
335
|
-
pointMap:
|
|
336
|
-
thickness:
|
|
335
|
+
pointMap: u,
|
|
336
|
+
thickness: d
|
|
337
337
|
} = e;
|
|
338
338
|
let f;
|
|
339
339
|
const m = r && st(r) || s.get(t.name);
|
|
340
340
|
if (!m) return;
|
|
341
|
-
|
|
341
|
+
q(n) && (t.setAttribute("zIndex", n), m.opt.zIndex = n);
|
|
342
342
|
const g = t.parent;
|
|
343
343
|
if (g) {
|
|
344
344
|
if (l && p && r) {
|
|
345
|
-
const
|
|
345
|
+
const k = [m.op[0], m.op[1]];
|
|
346
346
|
Ht(m.op, h, p, a);
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
const I = [m.op[0], m.op[1]], L = [
|
|
348
|
+
I[0] - k[0],
|
|
349
|
+
I[1] - k[1]
|
|
350
350
|
];
|
|
351
351
|
if (m.centerPos = [
|
|
352
352
|
m.centerPos[0] + L[0],
|
|
@@ -362,50 +362,50 @@ const et = class et {
|
|
|
362
362
|
}
|
|
363
363
|
} else if (a)
|
|
364
364
|
if (t.setAttribute("translate", a), m.opt.translate = a, r) {
|
|
365
|
-
const
|
|
365
|
+
const k = [
|
|
366
366
|
a[0] * g.worldScaling[0],
|
|
367
367
|
a[1] * g.worldScaling[1]
|
|
368
368
|
];
|
|
369
|
-
f = Nt(m.rect,
|
|
369
|
+
f = Nt(m.rect, k), m.rect = f;
|
|
370
370
|
} else {
|
|
371
|
-
const
|
|
372
|
-
m.rect =
|
|
371
|
+
const k = et.getRectFromLayer(g, t.name);
|
|
372
|
+
m.rect = k || m.rect;
|
|
373
373
|
}
|
|
374
|
-
else if (
|
|
374
|
+
else if (q(c))
|
|
375
375
|
if (t.setAttribute("rotate", c), m.opt.rotate = c, r)
|
|
376
376
|
f = se(m.rect, c), m.rect = f;
|
|
377
377
|
else {
|
|
378
|
-
const
|
|
379
|
-
m.rect =
|
|
378
|
+
const k = et.getRectFromLayer(g, t.name);
|
|
379
|
+
m.rect = k || m.rect;
|
|
380
380
|
}
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
for (let
|
|
385
|
-
m.op[
|
|
381
|
+
if (u) {
|
|
382
|
+
const k = u.get(t.name);
|
|
383
|
+
if (k)
|
|
384
|
+
for (let I = 0, L = 0; I < m.op.length; I += 3, L++)
|
|
385
|
+
m.op[I] = k[L][0], m.op[I + 1] = k[L][1];
|
|
386
386
|
}
|
|
387
|
-
if (
|
|
387
|
+
if (d && ((v = m == null ? void 0 : m.opt) != null && v.thickness) && (m.opt.thickness = d), o && !(l && p && r)) {
|
|
388
388
|
if (a) {
|
|
389
|
-
const
|
|
389
|
+
const k = m.op.map((I, L) => {
|
|
390
390
|
const C = L % 3;
|
|
391
|
-
return C === 0 ?
|
|
391
|
+
return C === 0 ? I + a[0] : C === 1 ? I + a[1] : I;
|
|
392
392
|
});
|
|
393
|
-
if (m.op =
|
|
393
|
+
if (m.op = k, m.centerPos = [
|
|
394
394
|
m.centerPos[0] + a[0],
|
|
395
395
|
m.centerPos[1] + a[1]
|
|
396
396
|
], m != null && m.opt && (m.opt.translate = void 0), m.opt.eraserlines)
|
|
397
|
-
for (let
|
|
398
|
-
const { op: L } = m.opt.eraserlines[
|
|
397
|
+
for (let I = 0; I < m.opt.eraserlines.length; I++) {
|
|
398
|
+
const { op: L } = m.opt.eraserlines[I];
|
|
399
399
|
for (let C = 0; C < L.length; C++) {
|
|
400
400
|
const N = L[C].map((R, P) => P % 2 ? R + a[1] : R + a[0]);
|
|
401
|
-
m.opt.eraserlines[
|
|
401
|
+
m.opt.eraserlines[I].op[C] = N;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
} else if (
|
|
405
|
-
const
|
|
406
|
-
if (He(
|
|
407
|
-
for (let
|
|
408
|
-
const { op: L } = m.opt.eraserlines[
|
|
404
|
+
} else if (q(c)) {
|
|
405
|
+
const k = m.op;
|
|
406
|
+
if (He(k, m.centerPos, c), m.op = k, m != null && m.opt && (m.opt.rotate = void 0), m.opt.eraserlines)
|
|
407
|
+
for (let I = 0; I < m.opt.eraserlines.length; I++) {
|
|
408
|
+
const { op: L } = m.opt.eraserlines[I];
|
|
409
409
|
for (let C = 0; C < L.length; C++)
|
|
410
410
|
qe(L[C], m.centerPos, c);
|
|
411
411
|
}
|
|
@@ -435,7 +435,7 @@ const et = class et {
|
|
|
435
435
|
}
|
|
436
436
|
static isWillRefresh(i) {
|
|
437
437
|
const { toolsType: t, opt: e, node: s, updateOpt: o, willSerializeData: r } = i;
|
|
438
|
-
return !!(r && (o.angle || o.translate) || o.thickness && e.thickness && e.thickness !== o.thickness || o.strokeType && e.strokeType && e.strokeType !== o.strokeType || o.originPoint && o.scenePoint && o.scale || o.pointMap && o.pointMap.has(s.name) || t ===
|
|
438
|
+
return !!(r && (o.angle || o.translate) || o.thickness && e.thickness && e.thickness !== o.thickness || o.strokeType && e.strokeType && e.strokeType !== o.strokeType || o.originPoint && o.scenePoint && o.scale || o.pointMap && o.pointMap.has(s.name) || t === S.Text && (o.fontSize || o.translate || o.textInfos && o.textInfos.get(s.name)) || t === S.BackgroundSVG && (o.translate || o.scale) || t === S.Image && (o.angle || o.translate || o.scale || o.strokeColor && e.type === Mt.Iconify) || t === o.toolsType && o.willRefresh || e.eraserlines && e.eraserlines.length && (o.strokeColor || o.fillColor));
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
y(et, "SafeBorderPadding", 10);
|
|
@@ -487,10 +487,10 @@ function Ls(T, i) {
|
|
|
487
487
|
const r = s.map((n) => {
|
|
488
488
|
let a = -1, c = 1 / 0, l = 0;
|
|
489
489
|
for (let h = 0; h < i.length; h++) {
|
|
490
|
-
const p = i[h],
|
|
490
|
+
const p = i[h], u = Math.sqrt(
|
|
491
491
|
Math.pow(p.x - n[0], 2) + Math.pow(p.y - n[1], 2)
|
|
492
492
|
);
|
|
493
|
-
|
|
493
|
+
u < c && (c = u, a = h, l = p.z);
|
|
494
494
|
}
|
|
495
495
|
return { point: n, index: a, bestZ: l };
|
|
496
496
|
}).sort((n, a) => n.index - a.index).map((n) => [...n.point, n.bestZ]);
|
|
@@ -501,9 +501,9 @@ function Ls(T, i) {
|
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
503
|
function Cs(T, i, t = 0.01) {
|
|
504
|
-
const s = T.map((h) => [h.x, h.y]), o = (h, p) => h.map(([
|
|
505
|
-
X: Math.round(
|
|
506
|
-
Y: Math.round(
|
|
504
|
+
const s = T.map((h) => [h.x, h.y]), o = (h, p) => h.map(([u, d]) => ({
|
|
505
|
+
X: Math.round(u * p),
|
|
506
|
+
Y: Math.round(d * p)
|
|
507
507
|
})), r = new it.ClipperOffset();
|
|
508
508
|
r.AddPath(
|
|
509
509
|
o(s, 1e3),
|
|
@@ -548,7 +548,7 @@ class Ne extends b {
|
|
|
548
548
|
super(t);
|
|
549
549
|
y(this, "canRotate", !0);
|
|
550
550
|
y(this, "scaleType", z.all);
|
|
551
|
-
y(this, "toolsType",
|
|
551
|
+
y(this, "toolsType", S.Pencil);
|
|
552
552
|
y(this, "syncTimestamp");
|
|
553
553
|
y(this, "syncIndex", 0);
|
|
554
554
|
y(this, "tmpPoints", []);
|
|
@@ -592,32 +592,34 @@ class Ne extends b {
|
|
|
592
592
|
isSimpleWorker: c
|
|
593
593
|
} = t, { workId: l, syncUnitTime: h } = e;
|
|
594
594
|
h && (this.syncUnitTime = h);
|
|
595
|
-
const { tasks: p, effects:
|
|
595
|
+
const { tasks: p, effects: u, consumeIndex: d } = this.transformData(e, !1);
|
|
596
596
|
this.syncIndex = Math.min(
|
|
597
597
|
this.syncIndex,
|
|
598
|
-
|
|
598
|
+
d,
|
|
599
599
|
Math.max(0, this.tmpPoints.length - 2)
|
|
600
600
|
);
|
|
601
601
|
const f = {
|
|
602
602
|
name: l,
|
|
603
|
-
id:
|
|
603
|
+
id: q(n) && n.toString() || void 0
|
|
604
604
|
};
|
|
605
605
|
let m, g = !1;
|
|
606
|
-
const
|
|
606
|
+
const v = this.syncIndex;
|
|
607
607
|
if (this.syncTimestamp === 0 && (this.syncTimestamp = Date.now()), p.length && (p[0].taskId - this.syncTimestamp > this.syncUnitTime && (g = !0, this.syncTimestamp = p[0].taskId, this.syncIndex = this.tmpPoints.length), o || r || c)) {
|
|
608
|
-
const
|
|
609
|
-
m = this.draw({ attrs: f, tasks: p, effects:
|
|
608
|
+
const L = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
609
|
+
m = this.draw({ attrs: f, tasks: p, effects: u, layer: L, removeDrawCount: a });
|
|
610
610
|
}
|
|
611
611
|
if (c) {
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
})
|
|
612
|
+
const L = [];
|
|
613
|
+
this.tmpPoints.slice(v).forEach((N) => {
|
|
614
|
+
L.push(N.x, N.y, this.computRadius(N.z, this.workOptions.thickness));
|
|
615
|
+
});
|
|
616
|
+
const C = !this.workOptions.previewLocalOnly && g;
|
|
617
|
+
return {
|
|
616
618
|
...this.baseConsumeResult,
|
|
617
619
|
type: w.DrawWork,
|
|
618
620
|
dataType: x.Local,
|
|
619
|
-
op:
|
|
620
|
-
index:
|
|
621
|
+
op: C ? L : void 0,
|
|
622
|
+
index: C ? v * 3 : void 0,
|
|
621
623
|
rect: m,
|
|
622
624
|
updateNodeOpt: {
|
|
623
625
|
useAnimation: !0
|
|
@@ -625,21 +627,23 @@ class Ne extends b {
|
|
|
625
627
|
};
|
|
626
628
|
}
|
|
627
629
|
if (o)
|
|
628
|
-
return
|
|
630
|
+
return d > 10 && this.tmpPoints.splice(0, d - 10), {
|
|
629
631
|
rect: m,
|
|
630
632
|
type: w.DrawWork,
|
|
631
633
|
dataType: x.Local
|
|
632
634
|
};
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
})
|
|
635
|
+
const k = [];
|
|
636
|
+
this.tmpPoints.slice(v).forEach((L) => {
|
|
637
|
+
k.push(L.x, L.y, this.computRadius(L.z, this.workOptions.thickness));
|
|
638
|
+
});
|
|
639
|
+
const I = !this.workOptions.previewLocalOnly && g;
|
|
640
|
+
return {
|
|
637
641
|
...this.baseConsumeResult,
|
|
638
642
|
type: w.DrawWork,
|
|
639
643
|
dataType: x.Local,
|
|
640
644
|
rect: m,
|
|
641
|
-
op:
|
|
642
|
-
index:
|
|
645
|
+
op: I ? k : void 0,
|
|
646
|
+
index: I ? v * 3 : void 0,
|
|
643
647
|
updateNodeOpt: {
|
|
644
648
|
useAnimation: !0
|
|
645
649
|
}
|
|
@@ -700,13 +704,13 @@ class Ne extends b {
|
|
|
700
704
|
workState: r = A.Done
|
|
701
705
|
} = t;
|
|
702
706
|
this.tmpPoints.length = 0;
|
|
703
|
-
for (let
|
|
704
|
-
const
|
|
707
|
+
for (let u = 0; u < e.length; u += 3) {
|
|
708
|
+
const d = new O(e[u], e[u + 1], e[u + 2]);
|
|
705
709
|
if (this.tmpPoints.length > 0) {
|
|
706
|
-
const f = this.tmpPoints[this.tmpPoints.length - 1], m = W.Sub(
|
|
707
|
-
|
|
710
|
+
const f = this.tmpPoints[this.tmpPoints.length - 1], m = W.Sub(d, f).uni();
|
|
711
|
+
d.setv(m);
|
|
708
712
|
}
|
|
709
|
-
this.tmpPoints.push(
|
|
713
|
+
this.tmpPoints.push(d);
|
|
710
714
|
}
|
|
711
715
|
if (this.tmpPoints.length < 2)
|
|
712
716
|
return;
|
|
@@ -715,12 +719,12 @@ class Ne extends b {
|
|
|
715
719
|
};
|
|
716
720
|
let l;
|
|
717
721
|
if (a && n.length) {
|
|
718
|
-
const
|
|
722
|
+
const u = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
719
723
|
l = this.draw({
|
|
720
724
|
attrs: c,
|
|
721
725
|
tasks: n,
|
|
722
726
|
replaceId: o,
|
|
723
|
-
layer:
|
|
727
|
+
layer: u,
|
|
724
728
|
isDrawEraserlines: r === A.Done
|
|
725
729
|
}), (p = this.vNodes) == null || p.setInfo(a, {
|
|
726
730
|
rect: l,
|
|
@@ -729,7 +733,7 @@ class Ne extends b {
|
|
|
729
733
|
toolsType: this.toolsType,
|
|
730
734
|
scaleType: this.scaleType,
|
|
731
735
|
canRotate: this.canRotate,
|
|
732
|
-
centerPos: l && b.getCenterPos(l,
|
|
736
|
+
centerPos: l && b.getCenterPos(l, u)
|
|
733
737
|
});
|
|
734
738
|
}
|
|
735
739
|
return l;
|
|
@@ -750,17 +754,17 @@ class Ne extends b {
|
|
|
750
754
|
const n = this.transformDataAll(!0);
|
|
751
755
|
if (n.length)
|
|
752
756
|
for (let a = 0; a < n.length; a++) {
|
|
753
|
-
const { pos: c, points: l } = n[a], h = l.map((
|
|
754
|
-
for (const
|
|
757
|
+
const { pos: c, points: l } = n[a], h = l.map((d) => d.point.addXY(c[0], c[1])), p = [];
|
|
758
|
+
for (const d of o) {
|
|
755
759
|
const f = [];
|
|
756
|
-
for (let g = 0; g <
|
|
757
|
-
const
|
|
760
|
+
for (let g = 0; g < d.length; g += 2) {
|
|
761
|
+
const v = new O(d[g], d[g + 1]);
|
|
758
762
|
if (f.length > 0) {
|
|
759
|
-
const
|
|
760
|
-
|
|
763
|
+
const k = f[f.length - 1].point, I = W.Sub(v, k).uni();
|
|
764
|
+
v.setv(I);
|
|
761
765
|
}
|
|
762
766
|
f.push({
|
|
763
|
-
point:
|
|
767
|
+
point: v,
|
|
764
768
|
radius: r
|
|
765
769
|
});
|
|
766
770
|
}
|
|
@@ -771,8 +775,8 @@ class Ne extends b {
|
|
|
771
775
|
h,
|
|
772
776
|
p,
|
|
773
777
|
0.01
|
|
774
|
-
).forEach((
|
|
775
|
-
e.push(
|
|
778
|
+
).forEach((d) => {
|
|
779
|
+
e.push(d.map((f) => [f[0], f[1], f[2]]).flat(1));
|
|
776
780
|
});
|
|
777
781
|
}
|
|
778
782
|
return e;
|
|
@@ -796,41 +800,41 @@ class Ne extends b {
|
|
|
796
800
|
strokeColor: l,
|
|
797
801
|
strokeType: h,
|
|
798
802
|
thickness: p,
|
|
799
|
-
zIndex:
|
|
800
|
-
scale:
|
|
803
|
+
zIndex: u,
|
|
804
|
+
scale: d,
|
|
801
805
|
rotate: f,
|
|
802
806
|
translate: m,
|
|
803
807
|
eraserlines: g,
|
|
804
|
-
lineCap:
|
|
805
|
-
lineDash:
|
|
808
|
+
lineCap: v,
|
|
809
|
+
lineDash: k
|
|
806
810
|
} = this.workOptions;
|
|
807
811
|
r != null && r.size && (r.forEach((P) => {
|
|
808
812
|
var M;
|
|
809
813
|
(M = n.getElementById(P + "")) == null || M.remove();
|
|
810
814
|
}), r.clear()), a && this.removeDrawCountNodes(n, a);
|
|
811
|
-
let
|
|
815
|
+
let I;
|
|
812
816
|
const L = [], C = n.worldPosition, N = n.worldScaling;
|
|
813
817
|
for (let P = 0; P < s.length; P++) {
|
|
814
818
|
const { pos: M, points: D } = s[P], { ps: B, rect: F } = this.computDrawPoints(D);
|
|
815
819
|
let U;
|
|
816
|
-
const
|
|
817
|
-
h === G.Stroke ||
|
|
820
|
+
const H = D.length === 1;
|
|
821
|
+
h === G.Stroke || H ? U = mt(B, !0) : U = mt(B, !1);
|
|
818
822
|
const Z = {
|
|
819
823
|
pos: M,
|
|
820
824
|
d: U,
|
|
821
|
-
fillColor: h === G.Stroke ||
|
|
822
|
-
lineDash:
|
|
823
|
-
|
|
824
|
-
(
|
|
825
|
+
fillColor: h === G.Stroke || H ? l : void 0,
|
|
826
|
+
lineDash: H ? void 0 : h === G.Dotted ? [
|
|
827
|
+
k && k[0] || 1,
|
|
828
|
+
(k && k[1] || 2) * p
|
|
825
829
|
] : h === G.LongDotted ? [
|
|
826
|
-
(
|
|
827
|
-
(
|
|
830
|
+
(k && k[0] || 1) * p,
|
|
831
|
+
(k && k[1] || 2) * p
|
|
828
832
|
] : void 0,
|
|
829
833
|
strokeColor: l,
|
|
830
|
-
lineCap:
|
|
831
|
-
lineWidth: h === G.Stroke ||
|
|
834
|
+
lineCap: H ? void 0 : v,
|
|
835
|
+
lineWidth: h === G.Stroke || H ? 0 : p
|
|
832
836
|
};
|
|
833
|
-
|
|
837
|
+
I = E(I, {
|
|
834
838
|
x: Math.floor(
|
|
835
839
|
(F.x + M[0]) * N[0] + C[0] - b.SafeBorderPadding
|
|
836
840
|
),
|
|
@@ -845,10 +849,10 @@ class Ne extends b {
|
|
|
845
849
|
)
|
|
846
850
|
}), L.push(Z);
|
|
847
851
|
}
|
|
848
|
-
|
|
852
|
+
d && (e.scale = d), f && (e.rotate = f), m && (e.translate = m);
|
|
849
853
|
const R = new j();
|
|
850
|
-
if (
|
|
851
|
-
this.centerPos = b.getCenterPos(
|
|
854
|
+
if (I) {
|
|
855
|
+
this.centerPos = b.getCenterPos(I, n);
|
|
852
856
|
const P = h === G.Stroke && !g;
|
|
853
857
|
R.attr({
|
|
854
858
|
...e,
|
|
@@ -857,10 +861,10 @@ class Ne extends b {
|
|
|
857
861
|
bgcolor: P ? l : void 0,
|
|
858
862
|
pos: this.centerPos,
|
|
859
863
|
size: [
|
|
860
|
-
(
|
|
861
|
-
(
|
|
864
|
+
(I.w - 2 * b.SafeBorderPadding) / N[0],
|
|
865
|
+
(I.h - 2 * b.SafeBorderPadding) / N[1]
|
|
862
866
|
],
|
|
863
|
-
zIndex:
|
|
867
|
+
zIndex: u
|
|
864
868
|
});
|
|
865
869
|
const M = L.map((D) => (D.pos = [
|
|
866
870
|
D.pos[0] - this.centerPos[0],
|
|
@@ -876,16 +880,16 @@ class Ne extends b {
|
|
|
876
880
|
c
|
|
877
881
|
)), this.replace(n, o, R);
|
|
878
882
|
}
|
|
879
|
-
if (
|
|
883
|
+
if (d || f || m) {
|
|
880
884
|
const P = R == null ? void 0 : R.getBoundingClientRect();
|
|
881
|
-
P && (
|
|
885
|
+
P && (I = {
|
|
882
886
|
x: Math.floor(P.x - b.SafeBorderPadding),
|
|
883
887
|
y: Math.floor(P.y - b.SafeBorderPadding),
|
|
884
888
|
w: Math.floor(P.width + b.SafeBorderPadding * 2),
|
|
885
889
|
h: Math.floor(P.height + b.SafeBorderPadding * 2)
|
|
886
890
|
});
|
|
887
891
|
}
|
|
888
|
-
return this.isDelete && R.setAttribute("opacity", 0),
|
|
892
|
+
return this.isDelete && R.setAttribute("opacity", 0), I;
|
|
889
893
|
}
|
|
890
894
|
computDrawPoints(t) {
|
|
891
895
|
return this.workOptions.strokeType === G.Stroke || t.length === 1 ? this.computStroke(t) : this.computNomal(t);
|
|
@@ -959,9 +963,9 @@ class Ne extends b {
|
|
|
959
963
|
return [];
|
|
960
964
|
let o = 0, r = t[0].x, n = t[0].y, a = [r, n], c = [], l = t[0].t;
|
|
961
965
|
for (; o < t.length; ) {
|
|
962
|
-
const p = t[o],
|
|
966
|
+
const p = t[o], u = p.x - r, d = p.y - n, f = p.z, m = e ? this.computRadius(f, e) : f;
|
|
963
967
|
if (c.push({
|
|
964
|
-
point: new O(
|
|
968
|
+
point: new O(u, d, f, t[o].v),
|
|
965
969
|
radius: m
|
|
966
970
|
}), o > 0 && o < t.length - 1) {
|
|
967
971
|
const g = t[o].getAngleByPoints(
|
|
@@ -969,22 +973,22 @@ class Ne extends b {
|
|
|
969
973
|
t[o + 1]
|
|
970
974
|
);
|
|
971
975
|
if (g < 60 || g > 300) {
|
|
972
|
-
const
|
|
973
|
-
|
|
976
|
+
const v = (h = c.pop()) == null ? void 0 : h.point.clone();
|
|
977
|
+
v && s.push({
|
|
974
978
|
taskId: l,
|
|
975
979
|
pos: a,
|
|
976
980
|
points: [
|
|
977
981
|
...c,
|
|
978
982
|
{
|
|
979
|
-
point:
|
|
983
|
+
point: v,
|
|
980
984
|
radius: m
|
|
981
985
|
}
|
|
982
986
|
]
|
|
983
987
|
}), r = t[o].x, n = t[o].y, a = [r, n];
|
|
984
|
-
const
|
|
988
|
+
const k = p.x - r, I = p.y - n;
|
|
985
989
|
c = [
|
|
986
990
|
{
|
|
987
|
-
point: new O(
|
|
991
|
+
point: new O(k, I, f),
|
|
988
992
|
radius: m
|
|
989
993
|
}
|
|
990
994
|
], l = Date.now();
|
|
@@ -1011,30 +1015,30 @@ class Ne extends b {
|
|
|
1011
1015
|
this.tmpPoints.push(h);
|
|
1012
1016
|
continue;
|
|
1013
1017
|
}
|
|
1014
|
-
const p = l - 1,
|
|
1015
|
-
if (h.isNear(
|
|
1016
|
-
if (
|
|
1017
|
-
if (
|
|
1018
|
+
const p = l - 1, u = this.tmpPoints[p], d = W.Sub(h, u).uni();
|
|
1019
|
+
if (h.isNear(u, e)) {
|
|
1020
|
+
if (u.z < this.MAX_REPEAR) {
|
|
1021
|
+
if (u.setz(Math.min(u.z + 1, this.MAX_REPEAR)), n = Math.min(n, p), l > 1) {
|
|
1018
1022
|
let g = l - 1;
|
|
1019
1023
|
for (; g > 0; ) {
|
|
1020
|
-
const
|
|
1024
|
+
const v = this.tmpPoints[g].distance(
|
|
1021
1025
|
this.tmpPoints[g - 1]
|
|
1022
|
-
),
|
|
1023
|
-
this.tmpPoints[g].z - this.uniThickness *
|
|
1026
|
+
), k = Math.max(
|
|
1027
|
+
this.tmpPoints[g].z - this.uniThickness * v,
|
|
1024
1028
|
0
|
|
1025
1029
|
);
|
|
1026
|
-
if (this.tmpPoints[g - 1].z >=
|
|
1030
|
+
if (this.tmpPoints[g - 1].z >= k)
|
|
1027
1031
|
break;
|
|
1028
|
-
this.tmpPoints[g - 1].setz(
|
|
1032
|
+
this.tmpPoints[g - 1].setz(k), n = Math.min(n, g - 1), g--;
|
|
1029
1033
|
}
|
|
1030
1034
|
}
|
|
1031
1035
|
} else
|
|
1032
1036
|
n = 1 / 0;
|
|
1033
1037
|
continue;
|
|
1034
1038
|
}
|
|
1035
|
-
h.setv(
|
|
1036
|
-
const f = h.distance(
|
|
1037
|
-
l > 1 && W.Equals(
|
|
1039
|
+
h.setv(d);
|
|
1040
|
+
const f = h.distance(u), m = Math.max(u.z - this.uniThickness * f, 0);
|
|
1041
|
+
l > 1 && W.Equals(d, u.v, 0.02) && (m > 0 || u.z <= 0) && (s && u.t && s.add(u.t), this.tmpPoints.pop(), n = Math.min(p, n)), h.setz(m), this.tmpPoints.push(h);
|
|
1038
1042
|
}
|
|
1039
1043
|
if (n === 1 / 0)
|
|
1040
1044
|
return this.tmpPoints.length;
|
|
@@ -1069,12 +1073,12 @@ class Ne extends b {
|
|
|
1069
1073
|
this.tmpPoints.push(p);
|
|
1070
1074
|
continue;
|
|
1071
1075
|
}
|
|
1072
|
-
const
|
|
1073
|
-
if (p.isNear(
|
|
1074
|
-
n = Math.min(
|
|
1076
|
+
const u = h - 1, d = this.tmpPoints[u], f = W.Sub(p, d).uni();
|
|
1077
|
+
if (p.isNear(d, e / 2)) {
|
|
1078
|
+
n = Math.min(u, n);
|
|
1075
1079
|
continue;
|
|
1076
1080
|
}
|
|
1077
|
-
W.Equals(f,
|
|
1081
|
+
W.Equals(f, d.v, 0.02) && (s && d.t && s.add(d.t), this.tmpPoints.pop(), n = Math.min(u, n)), p.setv(f), this.tmpPoints.push(p);
|
|
1078
1082
|
}
|
|
1079
1083
|
let a = r;
|
|
1080
1084
|
if (n === r) {
|
|
@@ -1110,38 +1114,38 @@ class Ne extends b {
|
|
|
1110
1114
|
break;
|
|
1111
1115
|
if (a.isNear(l, e / 2)) {
|
|
1112
1116
|
if (s < 3 && l.z < this.MAX_REPEAR && (l.setz(Math.min(l.z + 1, this.MAX_REPEAR)), n > 1)) {
|
|
1113
|
-
let
|
|
1114
|
-
for (;
|
|
1115
|
-
const f = this.tmpPoints[
|
|
1116
|
-
this.tmpPoints[
|
|
1117
|
+
let d = n - 1;
|
|
1118
|
+
for (; d > 0; ) {
|
|
1119
|
+
const f = this.tmpPoints[d].distance(
|
|
1120
|
+
this.tmpPoints[d - 1]
|
|
1117
1121
|
), m = Math.max(
|
|
1118
|
-
this.tmpPoints[
|
|
1122
|
+
this.tmpPoints[d].z - this.uniThickness * f,
|
|
1119
1123
|
-e / 4
|
|
1120
1124
|
);
|
|
1121
|
-
if (this.tmpPoints[
|
|
1125
|
+
if (this.tmpPoints[d - 1].z >= m)
|
|
1122
1126
|
break;
|
|
1123
|
-
this.tmpPoints[
|
|
1127
|
+
this.tmpPoints[d - 1].setz(m), d--;
|
|
1124
1128
|
}
|
|
1125
1129
|
}
|
|
1126
1130
|
continue;
|
|
1127
1131
|
}
|
|
1128
1132
|
a.setv(h);
|
|
1129
|
-
const
|
|
1130
|
-
n > 1 && W.Equals(h, l.v, 0.02) && l.z <= 0 && this.tmpPoints.pop(), a.setz(
|
|
1133
|
+
const u = Math.max(l.z - this.uniThickness * p, o);
|
|
1134
|
+
n > 1 && W.Equals(h, l.v, 0.02) && l.z <= 0 && this.tmpPoints.pop(), a.setz(u), this.tmpPoints.push(a);
|
|
1131
1135
|
}
|
|
1132
1136
|
}
|
|
1133
1137
|
static updateNodeOpt(t) {
|
|
1134
1138
|
var h, p;
|
|
1135
1139
|
const { node: e, opt: s, vNodes: o } = t, { strokeColor: r, strokeType: n, lineCap: a, lineDash: c } = s, l = o.get(e.name);
|
|
1136
|
-
return r && (e.tagName === "GROUP" ? so(e) ? e.setAttribute("bgcolor", r) : e.children.forEach((
|
|
1137
|
-
|
|
1140
|
+
return r && (e.tagName === "GROUP" ? so(e) ? e.setAttribute("bgcolor", r) : e.children.forEach((u) => {
|
|
1141
|
+
u.setAttribute("strokeColor", r), u.getAttribute("fillColor") && u.setAttribute("fillColor", r);
|
|
1138
1142
|
}) : (e.setAttribute("strokeColor", r), e.setAttribute("fillColor", r)), (h = l == null ? void 0 : l.opt) != null && h.strokeColor && (l.opt.strokeColor = r)), n && (l != null && l.opt) && ((p = l.opt) != null && p.strokeType) && (l.opt.strokeType = n), a && (l != null && l.opt) && (l.opt.lineCap = a), c && (l != null && l.opt) && (l.opt.lineDash = c), l && o.setInfo(e.name, l), b.updateNodeOpt(t);
|
|
1139
1143
|
}
|
|
1140
1144
|
}
|
|
1141
1145
|
class xe extends b {
|
|
1142
1146
|
constructor(t) {
|
|
1143
1147
|
super(t);
|
|
1144
|
-
y(this, "toolsType",
|
|
1148
|
+
y(this, "toolsType", S.LaserPen);
|
|
1145
1149
|
y(this, "canRotate", !1);
|
|
1146
1150
|
y(this, "scaleType", z.none);
|
|
1147
1151
|
y(this, "syncTimestamp");
|
|
@@ -1162,8 +1166,8 @@ class xe extends b {
|
|
|
1162
1166
|
return { type: w.None };
|
|
1163
1167
|
if (n && (this.syncUnitTime = n), this.updateTempPoints(r || []), this.consumeIndex > this.tmpPoints.length - 4)
|
|
1164
1168
|
return { type: w.None };
|
|
1165
|
-
const { strokeColor: a, thickness: c, strokeType: l, lineDash: h, lineCap: p } = this.workOptions,
|
|
1166
|
-
let
|
|
1169
|
+
const { strokeColor: a, thickness: c, strokeType: l, lineDash: h, lineCap: p } = this.workOptions, u = $(this.tmpPoints, c);
|
|
1170
|
+
let d = !1;
|
|
1167
1171
|
const f = this.syncIndex, m = this.tmpPoints.slice(this.consumeIndex);
|
|
1168
1172
|
this.consumeIndex = this.tmpPoints.length - 1, this.syncTimestamp === 0 && (this.syncTimestamp = Date.now());
|
|
1169
1173
|
const g = {
|
|
@@ -1180,30 +1184,30 @@ class xe extends b {
|
|
|
1180
1184
|
lineCap: p,
|
|
1181
1185
|
lineWidth: c,
|
|
1182
1186
|
anchor: [0.5, 0.5]
|
|
1183
|
-
},
|
|
1184
|
-
if (
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
+
}, v = this.getTaskPoints(m);
|
|
1188
|
+
if (v.length) {
|
|
1189
|
+
const I = Date.now();
|
|
1190
|
+
I - this.syncTimestamp > this.syncUnitTime && (d = !0, this.syncTimestamp = I, this.syncIndex = this.tmpPoints.length), s && this.draw({
|
|
1187
1191
|
attrs: g,
|
|
1188
|
-
tasks:
|
|
1192
|
+
tasks: v,
|
|
1189
1193
|
isDot: !1,
|
|
1190
1194
|
layer: this.drawLayer || this.fullLayer
|
|
1191
1195
|
});
|
|
1192
1196
|
}
|
|
1193
|
-
const
|
|
1194
|
-
return this.tmpPoints.slice(f).forEach((
|
|
1195
|
-
|
|
1197
|
+
const k = [];
|
|
1198
|
+
return this.tmpPoints.slice(f).forEach((I) => {
|
|
1199
|
+
k.push(I.x, I.y);
|
|
1196
1200
|
}), {
|
|
1197
1201
|
rect: {
|
|
1198
|
-
x:
|
|
1199
|
-
y:
|
|
1200
|
-
w:
|
|
1201
|
-
h:
|
|
1202
|
+
x: u.x * this.fullLayer.worldScaling[0] + this.fullLayer.worldPosition[0],
|
|
1203
|
+
y: u.y * this.fullLayer.worldScaling[1] + this.fullLayer.worldPosition[1],
|
|
1204
|
+
w: u.w * this.fullLayer.worldScaling[0],
|
|
1205
|
+
h: u.h * this.fullLayer.worldScaling[1]
|
|
1202
1206
|
},
|
|
1203
1207
|
type: w.DrawWork,
|
|
1204
1208
|
dataType: x.Local,
|
|
1205
|
-
op:
|
|
1206
|
-
index:
|
|
1209
|
+
op: d ? k : void 0,
|
|
1210
|
+
index: d ? f * 2 : void 0,
|
|
1207
1211
|
...this.baseConsumeResult
|
|
1208
1212
|
};
|
|
1209
1213
|
}
|
|
@@ -1215,11 +1219,11 @@ class xe extends b {
|
|
|
1215
1219
|
let n = this.tmpPoints.slice(this.consumeIndex);
|
|
1216
1220
|
const a = n.length === 1, { strokeColor: c, thickness: l, strokeType: h } = this.workOptions;
|
|
1217
1221
|
if (a) {
|
|
1218
|
-
const
|
|
1222
|
+
const d = this.computDotStroke({
|
|
1219
1223
|
point: n[0],
|
|
1220
1224
|
radius: l / 2
|
|
1221
1225
|
});
|
|
1222
|
-
n =
|
|
1226
|
+
n = d.ps, e = d.rect;
|
|
1223
1227
|
} else
|
|
1224
1228
|
e = $(this.tmpPoints, l);
|
|
1225
1229
|
const p = {
|
|
@@ -1231,10 +1235,10 @@ class xe extends b {
|
|
|
1231
1235
|
lineCap: a ? void 0 : "round",
|
|
1232
1236
|
lineWidth: a ? 0 : l,
|
|
1233
1237
|
anchor: [0.5, 0.5]
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1238
|
+
}, u = this.getTaskPoints(n);
|
|
1239
|
+
u.length && this.draw({
|
|
1236
1240
|
attrs: p,
|
|
1237
|
-
tasks:
|
|
1241
|
+
tasks: u,
|
|
1238
1242
|
isDot: a,
|
|
1239
1243
|
layer: this.drawLayer || this.fullLayer
|
|
1240
1244
|
});
|
|
@@ -1285,7 +1289,7 @@ class xe extends b {
|
|
|
1285
1289
|
h = m.ps, l = m.rect;
|
|
1286
1290
|
} else
|
|
1287
1291
|
l = $(this.tmpPoints, n);
|
|
1288
|
-
const
|
|
1292
|
+
const u = {
|
|
1289
1293
|
name: (f = this.workId) == null ? void 0 : f.toString(),
|
|
1290
1294
|
fillColor: p ? r : void 0,
|
|
1291
1295
|
opacity: 1,
|
|
@@ -1294,10 +1298,10 @@ class xe extends b {
|
|
|
1294
1298
|
lineCap: p ? void 0 : "round",
|
|
1295
1299
|
lineWidth: p ? 0 : n,
|
|
1296
1300
|
anchor: [0.5, 0.5]
|
|
1297
|
-
},
|
|
1298
|
-
if (
|
|
1301
|
+
}, d = this.getTaskPoints(h);
|
|
1302
|
+
if (d.length) {
|
|
1299
1303
|
const m = o ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
1300
|
-
this.draw({ attrs:
|
|
1304
|
+
this.draw({ attrs: u, tasks: d, isDot: p, replaceId: s, layer: m });
|
|
1301
1305
|
}
|
|
1302
1306
|
return {
|
|
1303
1307
|
x: l.x * this.fullLayer.worldScaling[0] + this.fullLayer.worldPosition[0],
|
|
@@ -1353,15 +1357,15 @@ class xe extends b {
|
|
|
1353
1357
|
for (; s < t.length; ) {
|
|
1354
1358
|
const l = t[s], h = l.x - o, p = l.y - r;
|
|
1355
1359
|
if (a.push(new O(h, p)), s > 0 && s < t.length - 1) {
|
|
1356
|
-
const
|
|
1360
|
+
const u = t[s].getAngleByPoints(
|
|
1357
1361
|
t[s - 1],
|
|
1358
1362
|
t[s + 1]
|
|
1359
1363
|
);
|
|
1360
|
-
if (
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1364
|
+
if (u < 60 || u > 300) {
|
|
1365
|
+
const d = (c = a.pop()) == null ? void 0 : c.clone();
|
|
1366
|
+
d && e.push({
|
|
1363
1367
|
pos: n,
|
|
1364
|
-
points: [...a,
|
|
1368
|
+
points: [...a, d]
|
|
1365
1369
|
}), o = t[s].x, r = t[s].y, n = [o, r];
|
|
1366
1370
|
const f = l.x - o, m = l.y - r;
|
|
1367
1371
|
a = [new O(f, m)];
|
|
@@ -1397,7 +1401,7 @@ const vt = class vt extends b {
|
|
|
1397
1401
|
super(t);
|
|
1398
1402
|
y(this, "canRotate", !1);
|
|
1399
1403
|
y(this, "scaleType", z.none);
|
|
1400
|
-
y(this, "toolsType",
|
|
1404
|
+
y(this, "toolsType", S.Eraser);
|
|
1401
1405
|
y(this, "serviceWork");
|
|
1402
1406
|
y(this, "tmpPoints", []);
|
|
1403
1407
|
y(this, "workOptions");
|
|
@@ -1435,8 +1439,8 @@ const vt = class vt extends b {
|
|
|
1435
1439
|
if (l > 1) {
|
|
1436
1440
|
const h = [];
|
|
1437
1441
|
for (let p = 0; p < l; p++) {
|
|
1438
|
-
const
|
|
1439
|
-
h.push(this.tmpPoints[0] +
|
|
1442
|
+
const u = W.Mul(o, p * c);
|
|
1443
|
+
h.push(this.tmpPoints[0] + u.x, this.tmpPoints[1] + u.y);
|
|
1440
1444
|
}
|
|
1441
1445
|
return h.concat(t);
|
|
1442
1446
|
}
|
|
@@ -1470,7 +1474,7 @@ const vt = class vt extends b {
|
|
|
1470
1474
|
return s.forEach((r) => {
|
|
1471
1475
|
var a;
|
|
1472
1476
|
const n = this.fullLayer.getElementsByName(r);
|
|
1473
|
-
n[0] && (n[0].remove(),
|
|
1477
|
+
n[0] && (n[0].remove(), V(n[0], this.fullLayer.parent), (a = this.vNodes) == null || a.delete(r));
|
|
1474
1478
|
}), o && (o.x -= b.SafeBorderPadding, o.y -= b.SafeBorderPadding, o.w += b.SafeBorderPadding * 2, o.h += b.SafeBorderPadding * 2), o;
|
|
1475
1479
|
}
|
|
1476
1480
|
consume(t) {
|
|
@@ -1554,25 +1558,25 @@ function xs(T, i, t, e, s, o) {
|
|
|
1554
1558
|
if (!(r ? p in i : Ns.call(i, p)))
|
|
1555
1559
|
return !1;
|
|
1556
1560
|
}
|
|
1557
|
-
var
|
|
1558
|
-
if (
|
|
1559
|
-
return
|
|
1561
|
+
var u = o.get(T), d = o.get(i);
|
|
1562
|
+
if (u && d)
|
|
1563
|
+
return u == i && d == T;
|
|
1560
1564
|
var f = !0;
|
|
1561
1565
|
o.set(T, i), o.set(i, T);
|
|
1562
1566
|
for (var m = r; ++h < a; ) {
|
|
1563
1567
|
p = n[h];
|
|
1564
|
-
var g = T[p],
|
|
1568
|
+
var g = T[p], v = i[p];
|
|
1565
1569
|
if (e)
|
|
1566
|
-
var
|
|
1567
|
-
if (!(
|
|
1570
|
+
var k = r ? e(v, g, p, i, T, o) : e(g, v, p, T, i, o);
|
|
1571
|
+
if (!(k === void 0 ? g === v || s(g, v, t, e, o) : k)) {
|
|
1568
1572
|
f = !1;
|
|
1569
1573
|
break;
|
|
1570
1574
|
}
|
|
1571
1575
|
m || (m = p == "constructor");
|
|
1572
1576
|
}
|
|
1573
1577
|
if (f && !m) {
|
|
1574
|
-
var
|
|
1575
|
-
|
|
1578
|
+
var I = T.constructor, L = i.constructor;
|
|
1579
|
+
I != L && "constructor" in T && "constructor" in i && !(typeof I == "function" && I instanceof I && typeof L == "function" && L instanceof L) && (f = !1);
|
|
1576
1580
|
}
|
|
1577
1581
|
return o.delete(T), o.delete(i), f;
|
|
1578
1582
|
}
|
|
@@ -1589,9 +1593,9 @@ function zs(T, i, t, e, s, o) {
|
|
|
1589
1593
|
if (p && !l)
|
|
1590
1594
|
return o || (o = new jt()), r || Es(T) ? Ms(T, i, t, e, s, o) : Os(T, i, a, t, e, s, o);
|
|
1591
1595
|
if (!(t & Bs)) {
|
|
1592
|
-
var
|
|
1593
|
-
if (
|
|
1594
|
-
var f =
|
|
1596
|
+
var u = l && ve.call(T, "__wrapped__"), d = h && ve.call(i, "__wrapped__");
|
|
1597
|
+
if (u || d) {
|
|
1598
|
+
var f = u ? T.value() : T, m = d ? i.value() : i;
|
|
1595
1599
|
return o || (o = new jt()), s(f, m, t, e, o);
|
|
1596
1600
|
}
|
|
1597
1601
|
}
|
|
@@ -1609,7 +1613,7 @@ var _s = $s;
|
|
|
1609
1613
|
const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
1610
1614
|
constructor(t) {
|
|
1611
1615
|
super(t);
|
|
1612
|
-
y(this, "toolsType",
|
|
1616
|
+
y(this, "toolsType", S.Selector);
|
|
1613
1617
|
y(this, "tmpPoints", []);
|
|
1614
1618
|
y(this, "subTmpPoints", []);
|
|
1615
1619
|
y(this, "workOptions");
|
|
@@ -1686,7 +1690,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1686
1690
|
const p = [
|
|
1687
1691
|
l.rect.x + l.rect.w / 2 - e.x,
|
|
1688
1692
|
l.rect.y + l.rect.h / 2 - e.y
|
|
1689
|
-
],
|
|
1693
|
+
], u = new Kt({
|
|
1690
1694
|
normalize: !0,
|
|
1691
1695
|
pos: p,
|
|
1692
1696
|
lineWidth: 1,
|
|
@@ -1696,7 +1700,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1696
1700
|
id: `selector-${h}`,
|
|
1697
1701
|
name: `selector-${h}`
|
|
1698
1702
|
});
|
|
1699
|
-
c.push(
|
|
1703
|
+
c.push(u);
|
|
1700
1704
|
}), c && a.append(...c), (r == null ? void 0 : r.parent).appendChild(a);
|
|
1701
1705
|
}
|
|
1702
1706
|
draw(t, e, s, o = !1) {
|
|
@@ -1716,7 +1720,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1716
1720
|
let s, o = !0;
|
|
1717
1721
|
for (const r of t.values()) {
|
|
1718
1722
|
const { opt: n, canRotate: a, scaleType: c, toolsType: l } = r;
|
|
1719
|
-
this.selectorColor = this.workOptions.strokeColor, n.strokeColor && (this.strokeColor = n.strokeColor), n.fillColor && (this.fillColor = n.fillColor), n.textOpt && (this.textOpt = n.textOpt), n.thickness && (this.thickness = n.thickness), l !==
|
|
1723
|
+
this.selectorColor = this.workOptions.strokeColor, n.strokeColor && (this.strokeColor = n.strokeColor), n.fillColor && (this.fillColor = n.fillColor), n.textOpt && (this.textOpt = n.textOpt), n.thickness && (this.thickness = n.thickness), l !== S.Pencil && (o = !1), n.strokeType && (this.strokeType = n.strokeType), l === S.SpeechBalloon && (e.add(l), this.shapeOpt || (this.shapeOpt = {}), this.shapeOpt.placement = n.placement), l === S.Polygon && (e.add(l), this.shapeOpt || (this.shapeOpt = {}), this.shapeOpt.vertices = n.vertices), l === S.Star && (e.add(l), this.shapeOpt || (this.shapeOpt = {}), this.shapeOpt.vertices = n.vertices, this.shapeOpt.innerRatio = n.innerRatio, this.shapeOpt.innerVerticeStep = n.innerVerticeStep), l === S.Text && (this.textOpt = n), t.size === 1 && (this.textOpt && (this.canTextEdit = !0), this.canRotate = a, this.scaleType = c), (l === S.Image || l === S.BackgroundSVG) && (s = r), (c === z.proportional && this.scaleType !== z.none || c === z.none) && (this.scaleType = c);
|
|
1720
1724
|
}
|
|
1721
1725
|
o && (this.useStroke = !0), e.size && (this.toolsTypes = [...e]), s && (t.size === 1 ? (this.canLock = !0, s.opt.locked && (this.isLocked = !0, this.scaleType = z.none, this.canRotate = !1, this.textOpt = void 0, this.fillColor = void 0, this.selectorColor = "rgb(177,177,177)", this.strokeColor = void 0, this.canTextEdit = !1, this.thickness = void 0, this.strokeType = void 0, this.useStroke = void 0)) : t.size > 1 && !s.opt.locked && (this.canLock = !1, this.canRotate = !1));
|
|
1722
1726
|
}
|
|
@@ -1840,7 +1844,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1840
1844
|
};
|
|
1841
1845
|
}
|
|
1842
1846
|
drawForSubWorker(t) {
|
|
1843
|
-
const { workId: e, layer: s, ps: o } = t, { strokeColor: r, scale: n, rotate: a, translate: c } = this.workOptions, l = s.worldPosition, h = s.worldScaling, { points: p, rect:
|
|
1847
|
+
const { workId: e, layer: s, ps: o } = t, { strokeColor: r, scale: n, rotate: a, translate: c } = this.workOptions, l = s.worldPosition, h = s.worldScaling, { points: p, rect: u, pos: d } = this.computDrawPoints(o), f = 1 / s.worldScaling[0], m = r && os(r) || [0, 0, 0, 0], g = {
|
|
1844
1848
|
close: !0,
|
|
1845
1849
|
normalize: !0,
|
|
1846
1850
|
points: p,
|
|
@@ -1850,43 +1854,43 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1850
1854
|
lineJoin: "round",
|
|
1851
1855
|
lineCap: "round"
|
|
1852
1856
|
};
|
|
1853
|
-
let
|
|
1857
|
+
let v = {
|
|
1854
1858
|
x: Math.floor(
|
|
1855
|
-
|
|
1859
|
+
u.x * h[0] + l[0] - b.SafeBorderPadding
|
|
1856
1860
|
),
|
|
1857
1861
|
y: Math.floor(
|
|
1858
|
-
|
|
1862
|
+
u.y * h[1] + l[1] - b.SafeBorderPadding
|
|
1859
1863
|
),
|
|
1860
1864
|
w: Math.floor(
|
|
1861
|
-
|
|
1865
|
+
u.w * h[0] + 2 * b.SafeBorderPadding
|
|
1862
1866
|
),
|
|
1863
1867
|
h: Math.floor(
|
|
1864
|
-
|
|
1868
|
+
u.h * h[0] + 2 * b.SafeBorderPadding
|
|
1865
1869
|
)
|
|
1866
1870
|
};
|
|
1867
|
-
const
|
|
1871
|
+
const k = new j({
|
|
1868
1872
|
name: e,
|
|
1869
1873
|
id: e,
|
|
1870
|
-
pos:
|
|
1874
|
+
pos: d,
|
|
1871
1875
|
anchor: [0.5, 0.5],
|
|
1872
|
-
size: [
|
|
1876
|
+
size: [u.w, u.h],
|
|
1873
1877
|
scale: n,
|
|
1874
1878
|
rotate: a,
|
|
1875
1879
|
translate: c
|
|
1876
|
-
}),
|
|
1880
|
+
}), I = new ht({
|
|
1877
1881
|
...g,
|
|
1878
1882
|
pos: [0, 0]
|
|
1879
1883
|
});
|
|
1880
|
-
if (
|
|
1881
|
-
const L =
|
|
1882
|
-
|
|
1884
|
+
if (k.appendChild(I), this.replace(s, e, k), n || a || c) {
|
|
1885
|
+
const L = k.getBoundingClientRect();
|
|
1886
|
+
v = {
|
|
1883
1887
|
x: Math.floor(L.x - b.SafeBorderPadding),
|
|
1884
1888
|
y: Math.floor(L.y - b.SafeBorderPadding),
|
|
1885
1889
|
w: Math.floor(L.width + 2 * b.SafeBorderPadding),
|
|
1886
1890
|
h: Math.floor(L.height + 2 * b.SafeBorderPadding)
|
|
1887
1891
|
};
|
|
1888
1892
|
}
|
|
1889
|
-
return
|
|
1893
|
+
return v;
|
|
1890
1894
|
}
|
|
1891
1895
|
transformData(t) {
|
|
1892
1896
|
const e = $(t);
|
|
@@ -1953,7 +1957,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
1953
1957
|
const h = this.fullLayer.getElementsByName(
|
|
1954
1958
|
l.name
|
|
1955
1959
|
);
|
|
1956
|
-
if (Ge(h).find((
|
|
1960
|
+
if (Ge(h).find((u) => u.isPointCollision(o, r))) {
|
|
1957
1961
|
n = l;
|
|
1958
1962
|
break;
|
|
1959
1963
|
}
|
|
@@ -2013,7 +2017,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
2013
2017
|
})), s;
|
|
2014
2018
|
}
|
|
2015
2019
|
isCanFillColor(t) {
|
|
2016
|
-
return t ===
|
|
2020
|
+
return t === S.Ellipse || t === S.Triangle || t === S.Rectangle || t === S.Polygon || t === S.Star || t === S.SpeechBalloon;
|
|
2017
2021
|
}
|
|
2018
2022
|
async updateSelector(t) {
|
|
2019
2023
|
const {
|
|
@@ -2027,21 +2031,21 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
2027
2031
|
if (!c)
|
|
2028
2032
|
return;
|
|
2029
2033
|
let l;
|
|
2030
|
-
const h = /* @__PURE__ */ new Map(), { originPoint: p, workState:
|
|
2034
|
+
const h = /* @__PURE__ */ new Map(), { originPoint: p, workState: u, angle: d, translate: f, dir: m, scale: g } = e;
|
|
2031
2035
|
a && (f ? e.translate = [
|
|
2032
2036
|
f[0] + a[0],
|
|
2033
2037
|
f[1] + a[1]
|
|
2034
2038
|
] : e.translate = a);
|
|
2035
|
-
let
|
|
2036
|
-
if (p || f ||
|
|
2037
|
-
if (
|
|
2039
|
+
let v;
|
|
2040
|
+
if (p || f || q(d)) {
|
|
2041
|
+
if (u === A.Start && s)
|
|
2038
2042
|
return o.setTargetAssignKeys(s), {
|
|
2039
2043
|
type: w.Select,
|
|
2040
2044
|
dataType: x.Local,
|
|
2041
2045
|
selectRect: this.oldSelectRect,
|
|
2042
2046
|
rect: this.oldSelectRect
|
|
2043
2047
|
};
|
|
2044
|
-
if (
|
|
2048
|
+
if (v = o.getLastTarget(), !v)
|
|
2045
2049
|
return;
|
|
2046
2050
|
}
|
|
2047
2051
|
if (s)
|
|
@@ -2061,7 +2065,7 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
2061
2065
|
willSerializeData: r
|
|
2062
2066
|
});
|
|
2063
2067
|
if (N) {
|
|
2064
|
-
D =
|
|
2068
|
+
D = v == null ? void 0 : v.get(L);
|
|
2065
2069
|
const F = Ue(N);
|
|
2066
2070
|
if (F == null || F.updateNodeOpt({
|
|
2067
2071
|
node: P,
|
|
@@ -2076,51 +2080,51 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
2076
2080
|
toolsOpt: C.opt
|
|
2077
2081
|
});
|
|
2078
2082
|
U == null || U.setWorkId(L);
|
|
2079
|
-
let
|
|
2080
|
-
if (N ===
|
|
2081
|
-
|
|
2083
|
+
let H;
|
|
2084
|
+
if (N === S.BackgroundSVG)
|
|
2085
|
+
H = U.consumeService({
|
|
2082
2086
|
isFullWork: !0,
|
|
2083
2087
|
replaceId: L
|
|
2084
2088
|
});
|
|
2085
|
-
else if (N ===
|
|
2086
|
-
|
|
2089
|
+
else if (N === S.Image)
|
|
2090
|
+
H = await U.consumeServiceAsync({
|
|
2087
2091
|
isFullWork: !0,
|
|
2088
2092
|
replaceId: L,
|
|
2089
2093
|
worker: n
|
|
2090
2094
|
});
|
|
2091
|
-
else if (N ===
|
|
2092
|
-
|
|
2095
|
+
else if (N === S.Text)
|
|
2096
|
+
H = await U.consumeServiceAsync({
|
|
2093
2097
|
isFullWork: !0,
|
|
2094
2098
|
replaceId: L,
|
|
2095
2099
|
isDrawLabel: !0
|
|
2096
2100
|
});
|
|
2097
2101
|
else
|
|
2098
2102
|
try {
|
|
2099
|
-
|
|
2103
|
+
H = U == null ? void 0 : U.consumeService({
|
|
2100
2104
|
op: C.op,
|
|
2101
2105
|
isFullWork: !0,
|
|
2102
2106
|
replaceId: L,
|
|
2103
|
-
workState:
|
|
2107
|
+
workState: u
|
|
2104
2108
|
});
|
|
2105
2109
|
} catch (Z) {
|
|
2106
2110
|
console.error("consumeService error", Z);
|
|
2107
2111
|
continue;
|
|
2108
2112
|
}
|
|
2109
|
-
|
|
2113
|
+
H && (C.rect = H);
|
|
2110
2114
|
}
|
|
2111
2115
|
C && (h.set(L, C), l = E(l, C.rect));
|
|
2112
2116
|
}
|
|
2113
2117
|
}
|
|
2114
2118
|
}
|
|
2115
2119
|
}
|
|
2116
|
-
|
|
2117
|
-
const
|
|
2118
|
-
if (p && f && g && m &&
|
|
2120
|
+
v && u === A.Done && (o.deleteLastTarget(), v = void 0);
|
|
2121
|
+
const k = l;
|
|
2122
|
+
if (p && f && g && m && k && !a) {
|
|
2119
2123
|
const L = [
|
|
2120
|
-
[
|
|
2121
|
-
[
|
|
2122
|
-
[
|
|
2123
|
-
[
|
|
2124
|
+
[k.x, k.y],
|
|
2125
|
+
[k.x + k.w, k.y],
|
|
2126
|
+
[k.x + k.w, k.y + k.h],
|
|
2127
|
+
[k.x, k.y + k.h]
|
|
2124
2128
|
];
|
|
2125
2129
|
let C;
|
|
2126
2130
|
switch (m) {
|
|
@@ -2148,22 +2152,22 @@ const lt = /* @__PURE__ */ Jt(_s), _t = class _t extends b {
|
|
|
2148
2152
|
if (!lt(N, [0, 0]))
|
|
2149
2153
|
return await this.updateSelector({
|
|
2150
2154
|
...t,
|
|
2151
|
-
updateSelectorOpt: { workState:
|
|
2155
|
+
updateSelectorOpt: { workState: u },
|
|
2152
2156
|
offset: N
|
|
2153
2157
|
});
|
|
2154
2158
|
}
|
|
2155
2159
|
this.getSelecteorInfo(h), this.draw(X, c, {
|
|
2156
2160
|
selectIds: s || [],
|
|
2157
2161
|
subNodeMap: h,
|
|
2158
|
-
intersectRect:
|
|
2162
|
+
intersectRect: k
|
|
2159
2163
|
});
|
|
2160
|
-
const
|
|
2161
|
-
return this.oldSelectRect =
|
|
2164
|
+
const I = E(this.oldSelectRect, k);
|
|
2165
|
+
return this.oldSelectRect = k, {
|
|
2162
2166
|
type: w.Select,
|
|
2163
2167
|
dataType: x.Local,
|
|
2164
|
-
selectRect:
|
|
2168
|
+
selectRect: k,
|
|
2165
2169
|
renderRect: l,
|
|
2166
|
-
rect: E(
|
|
2170
|
+
rect: E(I, k),
|
|
2167
2171
|
selectIds: s
|
|
2168
2172
|
};
|
|
2169
2173
|
}
|
|
@@ -2272,7 +2276,7 @@ class Me extends b {
|
|
|
2272
2276
|
super(t);
|
|
2273
2277
|
y(this, "canRotate", !1);
|
|
2274
2278
|
y(this, "scaleType", z.both);
|
|
2275
|
-
y(this, "toolsType",
|
|
2279
|
+
y(this, "toolsType", S.Arrow);
|
|
2276
2280
|
y(this, "tmpPoints", []);
|
|
2277
2281
|
y(this, "workOptions");
|
|
2278
2282
|
y(this, "oldRect");
|
|
@@ -2293,17 +2297,17 @@ class Me extends b {
|
|
|
2293
2297
|
const p = l == null ? void 0 : l.length;
|
|
2294
2298
|
if (!p || p < 2)
|
|
2295
2299
|
return { type: w.None };
|
|
2296
|
-
let d;
|
|
2297
|
-
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], d = !1) : d = this.updateTempPoints(l), !d)
|
|
2298
|
-
return { type: w.None };
|
|
2299
2300
|
let u;
|
|
2301
|
+
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], u = !1) : u = this.updateTempPoints(l), !u)
|
|
2302
|
+
return { type: w.None };
|
|
2303
|
+
let d;
|
|
2300
2304
|
if (o || r || a) {
|
|
2301
2305
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
2302
|
-
|
|
2306
|
+
d = this.draw({ workId: c, layer: m });
|
|
2303
2307
|
}
|
|
2304
2308
|
if (a) {
|
|
2305
|
-
const m = E(
|
|
2306
|
-
this.oldRect =
|
|
2309
|
+
const m = E(d, this.oldRect);
|
|
2310
|
+
this.oldRect = d;
|
|
2307
2311
|
const g = {
|
|
2308
2312
|
rect: m,
|
|
2309
2313
|
type: w.DrawWork,
|
|
@@ -2311,8 +2315,8 @@ class Me extends b {
|
|
|
2311
2315
|
...this.baseConsumeResult
|
|
2312
2316
|
};
|
|
2313
2317
|
if (n) {
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2318
|
+
const v = Date.now();
|
|
2319
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = this.tmpPoints.map((k) => [...k.XY, 0]).flat(1), g.index = 0, g.isSync = !0);
|
|
2316
2320
|
}
|
|
2317
2321
|
return g;
|
|
2318
2322
|
}
|
|
@@ -2327,8 +2331,8 @@ class Me extends b {
|
|
|
2327
2331
|
index: 0
|
|
2328
2332
|
}) : { type: w.None };
|
|
2329
2333
|
}
|
|
2330
|
-
const f = E(
|
|
2331
|
-
return this.oldRect =
|
|
2334
|
+
const f = E(d, this.oldRect);
|
|
2335
|
+
return this.oldRect = d, {
|
|
2332
2336
|
rect: f,
|
|
2333
2337
|
...this.baseConsumeResult,
|
|
2334
2338
|
type: w.DrawWork,
|
|
@@ -2375,19 +2379,19 @@ class Me extends b {
|
|
|
2375
2379
|
rotate: l,
|
|
2376
2380
|
translate: h,
|
|
2377
2381
|
strokeType: p,
|
|
2378
|
-
eraserlines:
|
|
2379
|
-
lineDash:
|
|
2382
|
+
eraserlines: u,
|
|
2383
|
+
lineDash: d,
|
|
2380
2384
|
lineCap: f
|
|
2381
|
-
} = this.workOptions, m = s.worldPosition, g = s.worldScaling, { points:
|
|
2382
|
-
|
|
2383
|
-
|
|
2385
|
+
} = this.workOptions, m = s.worldPosition, g = s.worldScaling, { points: v, pos: k, rect: I, isTriangle: L, trianglePoints: C, trianglePos: N } = this.computDrawPoints(n), R = [
|
|
2386
|
+
I.x + I.w / 2,
|
|
2387
|
+
I.y + I.h / 2
|
|
2384
2388
|
], P = {
|
|
2385
2389
|
pos: R,
|
|
2386
2390
|
name: e,
|
|
2387
2391
|
id: e,
|
|
2388
2392
|
zIndex: a,
|
|
2389
2393
|
anchor: [0.5, 0.5],
|
|
2390
|
-
size: [
|
|
2394
|
+
size: [I.w, I.h]
|
|
2391
2395
|
};
|
|
2392
2396
|
c && (P.scale = c), l && (P.rotate = l), h && (P.translate = h);
|
|
2393
2397
|
const M = new j(P), D = {
|
|
@@ -2398,29 +2402,29 @@ class Me extends b {
|
|
|
2398
2402
|
lineWidth: 0,
|
|
2399
2403
|
normalize: !1
|
|
2400
2404
|
}, B = new ht(D);
|
|
2401
|
-
if (M.append(B), !L &&
|
|
2405
|
+
if (M.append(B), !L && v && k) {
|
|
2402
2406
|
const U = {
|
|
2403
|
-
points:
|
|
2404
|
-
pos: [
|
|
2407
|
+
points: v,
|
|
2408
|
+
pos: [k[0] - R[0], k[1] - R[1]],
|
|
2405
2409
|
fillColor: r,
|
|
2406
2410
|
strokeColor: r,
|
|
2407
2411
|
lineDash: p === G.Dotted ? [
|
|
2408
|
-
|
|
2409
|
-
(
|
|
2412
|
+
d && d[0] || 1,
|
|
2413
|
+
(d && d[1] || 2) * n
|
|
2410
2414
|
] : p === G.LongDotted ? [
|
|
2411
|
-
(
|
|
2412
|
-
(
|
|
2415
|
+
(d && d[0] || 1) * n,
|
|
2416
|
+
(d && d[1] || 2) * n
|
|
2413
2417
|
] : void 0,
|
|
2414
2418
|
lineCap: p === G.Normal ? void 0 : f,
|
|
2415
2419
|
lineWidth: n,
|
|
2416
2420
|
normalize: !1
|
|
2417
|
-
},
|
|
2418
|
-
M.append(
|
|
2421
|
+
}, H = new ht(U);
|
|
2422
|
+
M.append(H);
|
|
2419
2423
|
}
|
|
2420
|
-
|
|
2424
|
+
u && (this.scaleType = z.proportional, this.drawEraserlines(
|
|
2421
2425
|
{
|
|
2422
2426
|
group: M,
|
|
2423
|
-
eraserlines:
|
|
2427
|
+
eraserlines: u,
|
|
2424
2428
|
pos: R,
|
|
2425
2429
|
layer: s
|
|
2426
2430
|
},
|
|
@@ -2428,16 +2432,16 @@ class Me extends b {
|
|
|
2428
2432
|
)), this.replace(s, e, M);
|
|
2429
2433
|
let F = {
|
|
2430
2434
|
x: Math.floor(
|
|
2431
|
-
|
|
2435
|
+
I.x * g[0] + m[0] - b.SafeBorderPadding
|
|
2432
2436
|
),
|
|
2433
2437
|
y: Math.floor(
|
|
2434
|
-
|
|
2438
|
+
I.y * g[1] + m[1] - b.SafeBorderPadding
|
|
2435
2439
|
),
|
|
2436
2440
|
w: Math.floor(
|
|
2437
|
-
|
|
2441
|
+
I.w * g[0] + 2 * b.SafeBorderPadding
|
|
2438
2442
|
),
|
|
2439
2443
|
h: Math.floor(
|
|
2440
|
-
|
|
2444
|
+
I.h * g[1] + 2 * b.SafeBorderPadding
|
|
2441
2445
|
)
|
|
2442
2446
|
};
|
|
2443
2447
|
if (c || l || h) {
|
|
@@ -2461,7 +2465,7 @@ class Me extends b {
|
|
|
2461
2465
|
), r = O.Add(
|
|
2462
2466
|
this.tmpPoints[0],
|
|
2463
2467
|
s
|
|
2464
|
-
), n = W.Mul(e, this.arrowTipWidth), a = W.Sub(this.tmpPoints[1], n), c = O.Sub(a, s), l = O.Add(a, s), h = W.Per(e).mul(t * 1.5), p = O.Sub(a, h),
|
|
2468
|
+
), n = W.Mul(e, this.arrowTipWidth), a = W.Sub(this.tmpPoints[1], n), c = O.Sub(a, s), l = O.Add(a, s), h = W.Per(e).mul(t * 1.5), p = O.Sub(a, h), u = O.Add(a, h), d = [this.tmpPoints[0], a], f = [p, this.tmpPoints[1], u], m = [
|
|
2465
2469
|
o,
|
|
2466
2470
|
r,
|
|
2467
2471
|
...f,
|
|
@@ -2471,7 +2475,7 @@ class Me extends b {
|
|
|
2471
2475
|
return {
|
|
2472
2476
|
trianglePoints: f.map((g) => O.Sub(g, this.tmpPoints[1]).XY).flat(1),
|
|
2473
2477
|
trianglePos: this.tmpPoints[1].XY,
|
|
2474
|
-
points:
|
|
2478
|
+
points: d.map((g) => O.Sub(g, this.tmpPoints[0]).XY).flat(1),
|
|
2475
2479
|
rect: $(m),
|
|
2476
2480
|
isTriangle: !1,
|
|
2477
2481
|
pos: this.tmpPoints[0].XY
|
|
@@ -2542,7 +2546,7 @@ class Oe extends b {
|
|
|
2542
2546
|
super(t);
|
|
2543
2547
|
y(this, "canRotate", !1);
|
|
2544
2548
|
y(this, "scaleType", z.all);
|
|
2545
|
-
y(this, "toolsType",
|
|
2549
|
+
y(this, "toolsType", S.Ellipse);
|
|
2546
2550
|
y(this, "tmpPoints", []);
|
|
2547
2551
|
y(this, "workOptions");
|
|
2548
2552
|
y(this, "oldRect");
|
|
@@ -2562,31 +2566,31 @@ class Oe extends b {
|
|
|
2562
2566
|
const p = l == null ? void 0 : l.length;
|
|
2563
2567
|
if (!p || p < 2)
|
|
2564
2568
|
return { type: w.None };
|
|
2565
|
-
let d;
|
|
2566
|
-
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], d = !1) : d = this.updateTempPoints(l), !d)
|
|
2567
|
-
return { type: w.None };
|
|
2568
2569
|
let u;
|
|
2570
|
+
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], u = !1) : u = this.updateTempPoints(l), !u)
|
|
2571
|
+
return { type: w.None };
|
|
2572
|
+
let d;
|
|
2569
2573
|
if (o || r || a) {
|
|
2570
2574
|
const f = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
2571
|
-
|
|
2575
|
+
d = this.draw({ workId: c, layer: f, isDrawing: !0 });
|
|
2572
2576
|
const m = f.parent.parent, g = {
|
|
2573
2577
|
x: 0,
|
|
2574
2578
|
y: 0,
|
|
2575
2579
|
w: Math.floor(m.width),
|
|
2576
2580
|
h: Math.floor(m.height)
|
|
2577
|
-
},
|
|
2581
|
+
}, v = {
|
|
2578
2582
|
type: w.DrawWork,
|
|
2579
2583
|
dataType: x.Local,
|
|
2580
2584
|
...this.baseConsumeResult
|
|
2581
2585
|
};
|
|
2582
|
-
if (Rt(
|
|
2583
|
-
const
|
|
2584
|
-
if (this.oldRect =
|
|
2585
|
-
return
|
|
2586
|
+
if (Rt(d, g) !== Vt.outside) {
|
|
2587
|
+
const I = E(d, this.oldRect);
|
|
2588
|
+
if (this.oldRect = d, v.rect = I, !a)
|
|
2589
|
+
return v;
|
|
2586
2590
|
}
|
|
2587
2591
|
if (a) {
|
|
2588
|
-
const
|
|
2589
|
-
return
|
|
2592
|
+
const I = Date.now();
|
|
2593
|
+
return I - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = I, v.op = this.tmpPoints.map((L) => [...L.XY, 0]).flat(1), v.index = 0, v.isSync = !0), v;
|
|
2590
2594
|
}
|
|
2591
2595
|
return { type: w.None };
|
|
2592
2596
|
}
|
|
@@ -2646,23 +2650,23 @@ class Oe extends b {
|
|
|
2646
2650
|
zIndex: l,
|
|
2647
2651
|
scale: h,
|
|
2648
2652
|
rotate: p,
|
|
2649
|
-
translate:
|
|
2650
|
-
strokeType:
|
|
2653
|
+
translate: u,
|
|
2654
|
+
strokeType: d,
|
|
2651
2655
|
eraserlines: f,
|
|
2652
2656
|
lineDash: m,
|
|
2653
2657
|
lineCap: g
|
|
2654
|
-
} = this.workOptions,
|
|
2658
|
+
} = this.workOptions, v = s.worldScaling, { radius: k, rect: I, pos: L } = this.computDrawPoints(c), C = {
|
|
2655
2659
|
closeType: "normal",
|
|
2656
|
-
radius:
|
|
2660
|
+
radius: k,
|
|
2657
2661
|
lineWidth: c,
|
|
2658
2662
|
fillColor: a !== "transparent" && a || void 0,
|
|
2659
2663
|
strokeColor: n,
|
|
2660
2664
|
normalize: !0,
|
|
2661
2665
|
lineCap: g,
|
|
2662
|
-
lineDash:
|
|
2666
|
+
lineDash: d === G.Dotted ? [
|
|
2663
2667
|
m && m[0] || 1,
|
|
2664
2668
|
(m && m[1] || 2) * c
|
|
2665
|
-
] :
|
|
2669
|
+
] : d === G.LongDotted ? [
|
|
2666
2670
|
(m && m[0] || 1) * c,
|
|
2667
2671
|
(m && m[1] || 2) * c
|
|
2668
2672
|
] : void 0
|
|
@@ -2672,9 +2676,9 @@ class Oe extends b {
|
|
|
2672
2676
|
zIndex: l,
|
|
2673
2677
|
pos: L,
|
|
2674
2678
|
anchor: [0.5, 0.5],
|
|
2675
|
-
size: [
|
|
2679
|
+
size: [I.w, I.h]
|
|
2676
2680
|
};
|
|
2677
|
-
h && (N.scale = h), p && (N.rotate = p),
|
|
2681
|
+
h && (N.scale = h), p && (N.rotate = p), u && (N.translate = u);
|
|
2678
2682
|
const R = new j(N);
|
|
2679
2683
|
if (o) {
|
|
2680
2684
|
const D = new wt({
|
|
@@ -2683,7 +2687,7 @@ class Oe extends b {
|
|
|
2683
2687
|
pos: [0, 0],
|
|
2684
2688
|
strokeColor: n,
|
|
2685
2689
|
lineWidth: 1,
|
|
2686
|
-
scale: [1 /
|
|
2690
|
+
scale: [1 / v[0], 1 / v[1]]
|
|
2687
2691
|
});
|
|
2688
2692
|
R.append(D);
|
|
2689
2693
|
}
|
|
@@ -2759,10 +2763,10 @@ class Oe extends b {
|
|
|
2759
2763
|
this.tmpPoints.length = 0;
|
|
2760
2764
|
}
|
|
2761
2765
|
static updateNodeOpt(t) {
|
|
2762
|
-
var h, p,
|
|
2766
|
+
var h, p, u;
|
|
2763
2767
|
const { node: e, opt: s, vNodes: o } = t, { strokeColor: r, fillColor: n, strokeType: a } = s, c = o.get(e.name);
|
|
2764
2768
|
let l = e;
|
|
2765
|
-
return e.tagName === "GROUP" && (l = e.children[0]), r && (l.setAttribute("strokeColor", r), (h = c == null ? void 0 : c.opt) != null && h.strokeColor && (c.opt.strokeColor = r)), n && (n === "transparent" ? l.setAttribute("fillColor", "rgba(0,0,0,0)") : l.setAttribute("fillColor", n), (p = c == null ? void 0 : c.opt) != null && p.fillColor && (c.opt.fillColor = n)), a && (c != null && c.opt) && ((
|
|
2769
|
+
return e.tagName === "GROUP" && (l = e.children[0]), r && (l.setAttribute("strokeColor", r), (h = c == null ? void 0 : c.opt) != null && h.strokeColor && (c.opt.strokeColor = r)), n && (n === "transparent" ? l.setAttribute("fillColor", "rgba(0,0,0,0)") : l.setAttribute("fillColor", n), (p = c == null ? void 0 : c.opt) != null && p.fillColor && (c.opt.fillColor = n)), a && (c != null && c.opt) && ((u = c.opt) != null && u.strokeType) && (c.opt.strokeType = a), c && o.setInfo(e.name, c), b.updateNodeOpt(t);
|
|
2766
2770
|
}
|
|
2767
2771
|
}
|
|
2768
2772
|
class Ae extends b {
|
|
@@ -2770,7 +2774,7 @@ class Ae extends b {
|
|
|
2770
2774
|
super(t);
|
|
2771
2775
|
y(this, "canRotate", !0);
|
|
2772
2776
|
y(this, "scaleType", z.all);
|
|
2773
|
-
y(this, "toolsType",
|
|
2777
|
+
y(this, "toolsType", S.Rectangle);
|
|
2774
2778
|
y(this, "tmpPoints", []);
|
|
2775
2779
|
y(this, "workOptions");
|
|
2776
2780
|
y(this, "oldRect");
|
|
@@ -2814,15 +2818,15 @@ class Ae extends b {
|
|
|
2814
2818
|
let p;
|
|
2815
2819
|
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], p = !1) : p = this.updateTempPoints(l), !p)
|
|
2816
2820
|
return { type: w.None };
|
|
2817
|
-
const
|
|
2818
|
-
let
|
|
2821
|
+
const u = this.transformData();
|
|
2822
|
+
let d;
|
|
2819
2823
|
if (o || r || a) {
|
|
2820
2824
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
2821
|
-
|
|
2825
|
+
d = this.draw({ ps: u, workId: c, layer: m, isDrawing: !0 });
|
|
2822
2826
|
}
|
|
2823
2827
|
if (a) {
|
|
2824
|
-
const m = E(
|
|
2825
|
-
this.oldRect =
|
|
2828
|
+
const m = E(d, this.oldRect);
|
|
2829
|
+
this.oldRect = d;
|
|
2826
2830
|
const g = {
|
|
2827
2831
|
rect: m,
|
|
2828
2832
|
type: w.DrawWork,
|
|
@@ -2830,8 +2834,8 @@ class Ae extends b {
|
|
|
2830
2834
|
...this.baseConsumeResult
|
|
2831
2835
|
};
|
|
2832
2836
|
if (n) {
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2837
|
+
const v = Date.now();
|
|
2838
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = u.flat(1), g.index = 0, g.isSync = !0);
|
|
2835
2839
|
}
|
|
2836
2840
|
return g;
|
|
2837
2841
|
}
|
|
@@ -2840,14 +2844,14 @@ class Ae extends b {
|
|
|
2840
2844
|
return m - this.syncTimestamp > this.syncUnitTime ? (this.syncTimestamp = m, {
|
|
2841
2845
|
type: w.DrawWork,
|
|
2842
2846
|
dataType: x.Local,
|
|
2843
|
-
op:
|
|
2847
|
+
op: u.flat(1),
|
|
2844
2848
|
isSync: !0,
|
|
2845
2849
|
index: 0,
|
|
2846
2850
|
...this.baseConsumeResult
|
|
2847
2851
|
}) : { type: w.None };
|
|
2848
2852
|
}
|
|
2849
|
-
const f = E(
|
|
2850
|
-
return this.oldRect =
|
|
2853
|
+
const f = E(d, this.oldRect);
|
|
2854
|
+
return this.oldRect = d, {
|
|
2851
2855
|
rect: f,
|
|
2852
2856
|
type: w.DrawWork,
|
|
2853
2857
|
dataType: x.Local,
|
|
@@ -2903,35 +2907,35 @@ class Ae extends b {
|
|
|
2903
2907
|
fillColor: l,
|
|
2904
2908
|
thickness: h,
|
|
2905
2909
|
zIndex: p,
|
|
2906
|
-
scale:
|
|
2907
|
-
rotate:
|
|
2910
|
+
scale: u,
|
|
2911
|
+
rotate: d,
|
|
2908
2912
|
translate: f,
|
|
2909
2913
|
strokeType: m,
|
|
2910
2914
|
eraserlines: g,
|
|
2911
|
-
lineCap:
|
|
2912
|
-
lineDash:
|
|
2913
|
-
} = this.workOptions,
|
|
2915
|
+
lineCap: v,
|
|
2916
|
+
lineDash: k
|
|
2917
|
+
} = this.workOptions, I = s.worldPosition, L = s.worldScaling, { points: C, rect: N, pos: R } = this.computDrawPoints(r), P = {
|
|
2914
2918
|
close: !0,
|
|
2915
2919
|
normalize: !0,
|
|
2916
2920
|
points: C,
|
|
2917
2921
|
lineWidth: h,
|
|
2918
2922
|
fillColor: l !== "transparent" && l || void 0,
|
|
2919
2923
|
strokeColor: c,
|
|
2920
|
-
lineCap:
|
|
2924
|
+
lineCap: v,
|
|
2921
2925
|
lineDash: m === G.Dotted ? [
|
|
2922
|
-
|
|
2923
|
-
(
|
|
2926
|
+
k && k[0] || 1,
|
|
2927
|
+
(k && k[1] || 2) * h
|
|
2924
2928
|
] : m === G.LongDotted ? [
|
|
2925
|
-
(
|
|
2926
|
-
(
|
|
2929
|
+
(k && k[0] || 1) * h,
|
|
2930
|
+
(k && k[1] || 2) * h
|
|
2927
2931
|
] : void 0
|
|
2928
2932
|
};
|
|
2929
2933
|
let M = {
|
|
2930
2934
|
x: Math.floor(
|
|
2931
|
-
N.x * L[0] +
|
|
2935
|
+
N.x * L[0] + I[0] - b.SafeBorderPadding
|
|
2932
2936
|
),
|
|
2933
2937
|
y: Math.floor(
|
|
2934
|
-
N.y * L[1] +
|
|
2938
|
+
N.y * L[1] + I[1] - b.SafeBorderPadding
|
|
2935
2939
|
),
|
|
2936
2940
|
w: Math.floor(
|
|
2937
2941
|
N.w * L[0] + 2 * b.SafeBorderPadding
|
|
@@ -2947,8 +2951,8 @@ class Ae extends b {
|
|
|
2947
2951
|
pos: R,
|
|
2948
2952
|
anchor: [0.5, 0.5],
|
|
2949
2953
|
size: [N.w, N.h],
|
|
2950
|
-
scale:
|
|
2951
|
-
rotate:
|
|
2954
|
+
scale: u,
|
|
2955
|
+
rotate: d,
|
|
2952
2956
|
translate: f
|
|
2953
2957
|
}), B = new ht({
|
|
2954
2958
|
...P,
|
|
@@ -2973,7 +2977,7 @@ class Ae extends b {
|
|
|
2973
2977
|
layer: s
|
|
2974
2978
|
},
|
|
2975
2979
|
a
|
|
2976
|
-
)), this.replace(s, n || e, D),
|
|
2980
|
+
)), this.replace(s, n || e, D), u || d || f) {
|
|
2977
2981
|
const F = D.getBoundingClientRect();
|
|
2978
2982
|
M = {
|
|
2979
2983
|
x: Math.floor(F.x - b.SafeBorderPadding),
|
|
@@ -3007,8 +3011,8 @@ class Ae extends b {
|
|
|
3007
3011
|
if (!n)
|
|
3008
3012
|
return;
|
|
3009
3013
|
const a = [];
|
|
3010
|
-
for (let
|
|
3011
|
-
a.push([e[
|
|
3014
|
+
for (let u = 0; u < e.length; u += 3)
|
|
3015
|
+
a.push([e[u], e[u + 1], e[u + 2]]);
|
|
3012
3016
|
const c = s ? this.fullLayer : this.drawLayer || this.fullLayer, l = this.draw({
|
|
3013
3017
|
ps: a,
|
|
3014
3018
|
workId: n,
|
|
@@ -3031,10 +3035,10 @@ class Ae extends b {
|
|
|
3031
3035
|
this.tmpPoints.length = 0;
|
|
3032
3036
|
}
|
|
3033
3037
|
static updateNodeOpt(t) {
|
|
3034
|
-
var h, p,
|
|
3038
|
+
var h, p, u;
|
|
3035
3039
|
const { node: e, opt: s, vNodes: o } = t, { strokeColor: r, fillColor: n, strokeType: a } = s, c = o.get(e.name);
|
|
3036
3040
|
let l = e;
|
|
3037
|
-
return e.tagName === "GROUP" && (l = e.children[0]), r && (l.setAttribute("strokeColor", r), (h = c == null ? void 0 : c.opt) != null && h.strokeColor && (c.opt.strokeColor = r)), n && (n === "transparent" ? l.setAttribute("fillColor", "rgba(0,0,0,0)") : l.setAttribute("fillColor", n), (p = c == null ? void 0 : c.opt) != null && p.fillColor && (c.opt.fillColor = n)), a && (c != null && c.opt) && ((
|
|
3041
|
+
return e.tagName === "GROUP" && (l = e.children[0]), r && (l.setAttribute("strokeColor", r), (h = c == null ? void 0 : c.opt) != null && h.strokeColor && (c.opt.strokeColor = r)), n && (n === "transparent" ? l.setAttribute("fillColor", "rgba(0,0,0,0)") : l.setAttribute("fillColor", n), (p = c == null ? void 0 : c.opt) != null && p.fillColor && (c.opt.fillColor = n)), a && (c != null && c.opt) && ((u = c.opt) != null && u.strokeType) && (c.opt.strokeType = a), c && o.setInfo(e.name, c), b.updateNodeOpt(t);
|
|
3038
3042
|
}
|
|
3039
3043
|
}
|
|
3040
3044
|
class Ee extends b {
|
|
@@ -3042,7 +3046,7 @@ class Ee extends b {
|
|
|
3042
3046
|
super(t);
|
|
3043
3047
|
y(this, "canRotate", !1);
|
|
3044
3048
|
y(this, "scaleType", z.all);
|
|
3045
|
-
y(this, "toolsType",
|
|
3049
|
+
y(this, "toolsType", S.Star);
|
|
3046
3050
|
y(this, "tmpPoints", []);
|
|
3047
3051
|
y(this, "workOptions");
|
|
3048
3052
|
y(this, "oldRect");
|
|
@@ -3061,17 +3065,17 @@ class Ee extends b {
|
|
|
3061
3065
|
if (!p || p < 2)
|
|
3062
3066
|
return { type: w.None };
|
|
3063
3067
|
h && (this.syncUnitTime = h);
|
|
3064
|
-
let d;
|
|
3065
|
-
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], d = !1) : d = this.updateTempPoints(l), !d)
|
|
3066
|
-
return { type: w.None };
|
|
3067
3068
|
let u;
|
|
3069
|
+
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], u = !1) : u = this.updateTempPoints(l), !u)
|
|
3070
|
+
return { type: w.None };
|
|
3071
|
+
let d;
|
|
3068
3072
|
if (o || r || a) {
|
|
3069
3073
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
3070
|
-
|
|
3074
|
+
d = this.draw({ workId: c, layer: m, isDrawing: !0 });
|
|
3071
3075
|
}
|
|
3072
3076
|
if (a) {
|
|
3073
|
-
const m = E(
|
|
3074
|
-
this.oldRect =
|
|
3077
|
+
const m = E(d, this.oldRect);
|
|
3078
|
+
this.oldRect = d;
|
|
3075
3079
|
const g = {
|
|
3076
3080
|
rect: m,
|
|
3077
3081
|
type: w.DrawWork,
|
|
@@ -3079,8 +3083,8 @@ class Ee extends b {
|
|
|
3079
3083
|
...this.baseConsumeResult
|
|
3080
3084
|
};
|
|
3081
3085
|
if (n) {
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3086
|
+
const v = Date.now();
|
|
3087
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = this.tmpPoints.map((k) => [...k.XY, 0]).flat(1), g.index = 0, g.isSync = !0);
|
|
3084
3088
|
}
|
|
3085
3089
|
return g;
|
|
3086
3090
|
}
|
|
@@ -3095,8 +3099,8 @@ class Ee extends b {
|
|
|
3095
3099
|
...this.baseConsumeResult
|
|
3096
3100
|
}) : { type: w.None };
|
|
3097
3101
|
}
|
|
3098
|
-
const f = E(
|
|
3099
|
-
return this.oldRect =
|
|
3102
|
+
const f = E(d, this.oldRect);
|
|
3103
|
+
return this.oldRect = d, {
|
|
3100
3104
|
rect: f,
|
|
3101
3105
|
type: w.DrawWork,
|
|
3102
3106
|
dataType: x.Local,
|
|
@@ -3146,19 +3150,19 @@ class Ee extends b {
|
|
|
3146
3150
|
zIndex: l,
|
|
3147
3151
|
vertices: h,
|
|
3148
3152
|
innerVerticeStep: p,
|
|
3149
|
-
innerRatio:
|
|
3150
|
-
scale:
|
|
3153
|
+
innerRatio: u,
|
|
3154
|
+
scale: d,
|
|
3151
3155
|
rotate: f,
|
|
3152
3156
|
translate: m,
|
|
3153
3157
|
strokeType: g,
|
|
3154
|
-
eraserlines:
|
|
3155
|
-
lineDash:
|
|
3156
|
-
lineCap:
|
|
3158
|
+
eraserlines: v,
|
|
3159
|
+
lineDash: k,
|
|
3160
|
+
lineCap: I
|
|
3157
3161
|
} = this.workOptions, L = s.worldScaling, { rect: C, pos: N, points: R } = this.computDrawPoints(
|
|
3158
3162
|
c,
|
|
3159
3163
|
h,
|
|
3160
3164
|
p,
|
|
3161
|
-
|
|
3165
|
+
u
|
|
3162
3166
|
), P = {
|
|
3163
3167
|
close: !0,
|
|
3164
3168
|
points: R,
|
|
@@ -3166,13 +3170,13 @@ class Ee extends b {
|
|
|
3166
3170
|
fillColor: a !== "transparent" && a || void 0,
|
|
3167
3171
|
strokeColor: n,
|
|
3168
3172
|
normalize: !0,
|
|
3169
|
-
lineCap:
|
|
3173
|
+
lineCap: I,
|
|
3170
3174
|
lineDash: g === G.Dotted ? [
|
|
3171
|
-
|
|
3172
|
-
(
|
|
3175
|
+
k && k[0] || 1,
|
|
3176
|
+
(k && k[1] || 2) * c
|
|
3173
3177
|
] : g === G.LongDotted ? [
|
|
3174
|
-
(
|
|
3175
|
-
(
|
|
3178
|
+
(k && k[0] || 1) * c,
|
|
3179
|
+
(k && k[1] || 2) * c
|
|
3176
3180
|
] : void 0
|
|
3177
3181
|
}, M = {
|
|
3178
3182
|
name: e,
|
|
@@ -3182,7 +3186,7 @@ class Ee extends b {
|
|
|
3182
3186
|
anchor: [0.5, 0.5],
|
|
3183
3187
|
size: [C.w, C.h]
|
|
3184
3188
|
};
|
|
3185
|
-
|
|
3189
|
+
d && (M.scale = d), f && (M.rotate = f), m && (M.translate = m);
|
|
3186
3190
|
const D = new j(M);
|
|
3187
3191
|
if (o) {
|
|
3188
3192
|
const U = new wt({
|
|
@@ -3199,10 +3203,10 @@ class Ee extends b {
|
|
|
3199
3203
|
...P,
|
|
3200
3204
|
pos: [0, 0]
|
|
3201
3205
|
});
|
|
3202
|
-
D.append(B),
|
|
3206
|
+
D.append(B), v && (this.scaleType = z.proportional, this.drawEraserlines(
|
|
3203
3207
|
{
|
|
3204
3208
|
group: D,
|
|
3205
|
-
eraserlines:
|
|
3209
|
+
eraserlines: v,
|
|
3206
3210
|
pos: N,
|
|
3207
3211
|
layer: s
|
|
3208
3212
|
},
|
|
@@ -3221,10 +3225,10 @@ class Ee extends b {
|
|
|
3221
3225
|
Math.floor(r.x + r.w / 2),
|
|
3222
3226
|
Math.floor(r.y + r.h / 2)
|
|
3223
3227
|
], a = We(r.w, r.h), c = Math.floor(Math.min(r.w, r.h) / 2), l = o * c, h = [], p = 2 * Math.PI / e;
|
|
3224
|
-
for (let
|
|
3225
|
-
const f =
|
|
3228
|
+
for (let d = 0; d < e; d++) {
|
|
3229
|
+
const f = d * p - 0.5 * Math.PI;
|
|
3226
3230
|
let m, g;
|
|
3227
|
-
|
|
3231
|
+
d % s === 1 ? (m = l * a[0] * Math.cos(f), g = l * a[1] * Math.sin(f)) : (m = c * a[0] * Math.cos(f), g = c * a[1] * Math.sin(f), h.push(m, g)), h.push(m, g);
|
|
3228
3232
|
}
|
|
3229
3233
|
return {
|
|
3230
3234
|
rect: $(this.tmpPoints, t),
|
|
@@ -3281,9 +3285,9 @@ class Ee extends b {
|
|
|
3281
3285
|
innerVerticeStep: l,
|
|
3282
3286
|
innerRatio: h,
|
|
3283
3287
|
strokeType: p
|
|
3284
|
-
} = s,
|
|
3288
|
+
} = s, u = o.get(e.name), d = u == null ? void 0 : u.opt;
|
|
3285
3289
|
let f = e;
|
|
3286
|
-
return e.tagName === "GROUP" && (f = e.children[0]), r && (f.setAttribute("strokeColor", r),
|
|
3290
|
+
return e.tagName === "GROUP" && (f = e.children[0]), r && (f.setAttribute("strokeColor", r), d != null && d.strokeColor && (d.strokeColor = r)), n && (n === "transparent" ? f.setAttribute("fillColor", "rgba(0,0,0,0)") : f.setAttribute("fillColor", n), d != null && d.fillColor && (d.fillColor = n)), a === S.Star && (c && (d.vertices = c), l && (d.innerVerticeStep = l), h && (d.innerRatio = h)), p && (u != null && u.opt) && ((m = u.opt) != null && m.strokeType) && (u.opt.strokeType = p), u && o.setInfo(e.name, { ...u, opt: d }), b.updateNodeOpt(t);
|
|
3287
3291
|
}
|
|
3288
3292
|
}
|
|
3289
3293
|
class Be extends b {
|
|
@@ -3291,7 +3295,7 @@ class Be extends b {
|
|
|
3291
3295
|
super(t);
|
|
3292
3296
|
y(this, "canRotate", !1);
|
|
3293
3297
|
y(this, "scaleType", z.all);
|
|
3294
|
-
y(this, "toolsType",
|
|
3298
|
+
y(this, "toolsType", S.Polygon);
|
|
3295
3299
|
y(this, "tmpPoints", []);
|
|
3296
3300
|
y(this, "workOptions");
|
|
3297
3301
|
y(this, "oldRect");
|
|
@@ -3311,17 +3315,17 @@ class Be extends b {
|
|
|
3311
3315
|
const h = this.workId, p = c == null ? void 0 : c.length;
|
|
3312
3316
|
if (!p || p < 2)
|
|
3313
3317
|
return { type: w.None };
|
|
3314
|
-
let d;
|
|
3315
|
-
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(c[0], c[1])], d = !1) : d = this.updateTempPoints(c), !d)
|
|
3316
|
-
return { type: w.None };
|
|
3317
3318
|
let u;
|
|
3319
|
+
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(c[0], c[1])], u = !1) : u = this.updateTempPoints(c), !u)
|
|
3320
|
+
return { type: w.None };
|
|
3321
|
+
let d;
|
|
3318
3322
|
if (o || r || a) {
|
|
3319
3323
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
3320
|
-
|
|
3324
|
+
d = this.draw({ workId: h, layer: m, isDrawing: !0 });
|
|
3321
3325
|
}
|
|
3322
3326
|
if (a) {
|
|
3323
|
-
const m = E(
|
|
3324
|
-
this.oldRect =
|
|
3327
|
+
const m = E(d, this.oldRect);
|
|
3328
|
+
this.oldRect = d;
|
|
3325
3329
|
const g = {
|
|
3326
3330
|
type: w.DrawWork,
|
|
3327
3331
|
rect: m,
|
|
@@ -3329,8 +3333,8 @@ class Be extends b {
|
|
|
3329
3333
|
...this.baseConsumeResult
|
|
3330
3334
|
};
|
|
3331
3335
|
if (n) {
|
|
3332
|
-
const
|
|
3333
|
-
|
|
3336
|
+
const v = Date.now();
|
|
3337
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = this.tmpPoints.map((k) => [...k.XY, 0]).flat(1), g.index = 0, g.isSync = !0);
|
|
3334
3338
|
}
|
|
3335
3339
|
return g;
|
|
3336
3340
|
}
|
|
@@ -3345,8 +3349,8 @@ class Be extends b {
|
|
|
3345
3349
|
...this.baseConsumeResult
|
|
3346
3350
|
}) : { type: w.None };
|
|
3347
3351
|
}
|
|
3348
|
-
const f = E(
|
|
3349
|
-
return this.oldRect =
|
|
3352
|
+
const f = E(d, this.oldRect);
|
|
3353
|
+
return this.oldRect = d, {
|
|
3350
3354
|
rect: f,
|
|
3351
3355
|
type: w.DrawWork,
|
|
3352
3356
|
dataType: x.Local,
|
|
@@ -3396,13 +3400,13 @@ class Be extends b {
|
|
|
3396
3400
|
zIndex: l,
|
|
3397
3401
|
vertices: h,
|
|
3398
3402
|
scale: p,
|
|
3399
|
-
rotate:
|
|
3400
|
-
translate:
|
|
3403
|
+
rotate: u,
|
|
3404
|
+
translate: d,
|
|
3401
3405
|
strokeType: f,
|
|
3402
3406
|
eraserlines: m,
|
|
3403
3407
|
lineCap: g,
|
|
3404
|
-
lineDash:
|
|
3405
|
-
} = this.workOptions,
|
|
3408
|
+
lineDash: v
|
|
3409
|
+
} = this.workOptions, k = s.worldScaling, { rect: I, pos: L, points: C } = this.computDrawPoints(c, h), N = {
|
|
3406
3410
|
close: !0,
|
|
3407
3411
|
points: C,
|
|
3408
3412
|
lineWidth: c,
|
|
@@ -3411,11 +3415,11 @@ class Be extends b {
|
|
|
3411
3415
|
normalize: !0,
|
|
3412
3416
|
lineCap: g,
|
|
3413
3417
|
lineDash: f === G.Dotted ? [
|
|
3414
|
-
|
|
3415
|
-
(
|
|
3418
|
+
v && v[0] || 1,
|
|
3419
|
+
(v && v[1] || 2) * c
|
|
3416
3420
|
] : f === G.LongDotted ? [
|
|
3417
|
-
(
|
|
3418
|
-
(
|
|
3421
|
+
(v && v[0] || 1) * c,
|
|
3422
|
+
(v && v[1] || 2) * c
|
|
3419
3423
|
] : void 0
|
|
3420
3424
|
}, R = {
|
|
3421
3425
|
name: e,
|
|
@@ -3423,9 +3427,9 @@ class Be extends b {
|
|
|
3423
3427
|
zIndex: l,
|
|
3424
3428
|
pos: L,
|
|
3425
3429
|
anchor: [0.5, 0.5],
|
|
3426
|
-
size: [
|
|
3430
|
+
size: [I.w, I.h]
|
|
3427
3431
|
};
|
|
3428
|
-
p && (R.scale = p),
|
|
3432
|
+
p && (R.scale = p), u && (R.rotate = u), d && (R.translate = d);
|
|
3429
3433
|
const P = new j(R);
|
|
3430
3434
|
if (o) {
|
|
3431
3435
|
const B = new wt({
|
|
@@ -3434,7 +3438,7 @@ class Be extends b {
|
|
|
3434
3438
|
pos: [0, 0],
|
|
3435
3439
|
strokeColor: n,
|
|
3436
3440
|
lineWidth: 1,
|
|
3437
|
-
scale: [1 /
|
|
3441
|
+
scale: [1 / k[0], 1 / k[1]]
|
|
3438
3442
|
});
|
|
3439
3443
|
P.append(B);
|
|
3440
3444
|
}
|
|
@@ -3465,8 +3469,8 @@ class Be extends b {
|
|
|
3465
3469
|
Math.floor(s.y + s.h / 2)
|
|
3466
3470
|
], r = We(s.w, s.h), n = Math.floor(Math.min(s.w, s.h) / 2), a = [], c = 2 * Math.PI / e;
|
|
3467
3471
|
for (let h = 0; h < e; h++) {
|
|
3468
|
-
const p = h * c - 0.5 * Math.PI,
|
|
3469
|
-
a.push(
|
|
3472
|
+
const p = h * c - 0.5 * Math.PI, u = n * r[0] * Math.cos(p), d = n * r[1] * Math.sin(p);
|
|
3473
|
+
a.push(u, d);
|
|
3470
3474
|
}
|
|
3471
3475
|
return {
|
|
3472
3476
|
rect: $(this.tmpPoints, t),
|
|
@@ -3514,10 +3518,10 @@ class Be extends b {
|
|
|
3514
3518
|
this.tmpPoints.length = 0;
|
|
3515
3519
|
}
|
|
3516
3520
|
static updateNodeOpt(t) {
|
|
3517
|
-
var
|
|
3521
|
+
var d;
|
|
3518
3522
|
const { node: e, opt: s, vNodes: o } = t, { strokeColor: r, fillColor: n, toolsType: a, vertices: c, strokeType: l } = s, h = o.get(e.name), p = h == null ? void 0 : h.opt;
|
|
3519
|
-
let
|
|
3520
|
-
return e.tagName === "GROUP" && (
|
|
3523
|
+
let u = e;
|
|
3524
|
+
return e.tagName === "GROUP" && (u = e.children[0]), r && (u.setAttribute("strokeColor", r), p != null && p.strokeColor && (p.strokeColor = r)), n && (n === "transparent" ? u.setAttribute("fillColor", "rgba(0,0,0,0)") : u.setAttribute("fillColor", n), p != null && p.fillColor && (p.fillColor = n)), a === S.Polygon && c && (p.vertices = c), l && (h != null && h.opt) && ((d = h.opt) != null && d.strokeType) && (h.opt.strokeType = l), h && o.setInfo(e.name, { ...h, opt: p }), b.updateNodeOpt(t);
|
|
3521
3525
|
}
|
|
3522
3526
|
}
|
|
3523
3527
|
class ot {
|
|
@@ -3587,7 +3591,7 @@ class Fe extends b {
|
|
|
3587
3591
|
super(t);
|
|
3588
3592
|
y(this, "canRotate", !1);
|
|
3589
3593
|
y(this, "scaleType", z.all);
|
|
3590
|
-
y(this, "toolsType",
|
|
3594
|
+
y(this, "toolsType", S.SpeechBalloon);
|
|
3591
3595
|
y(this, "ratio", 0.8);
|
|
3592
3596
|
y(this, "tmpPoints", []);
|
|
3593
3597
|
y(this, "workOptions");
|
|
@@ -3613,14 +3617,14 @@ class Fe extends b {
|
|
|
3613
3617
|
let p;
|
|
3614
3618
|
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], p = !1) : p = this.updateTempPoints(l), !p)
|
|
3615
3619
|
return { type: w.None };
|
|
3616
|
-
let
|
|
3620
|
+
let u;
|
|
3617
3621
|
if (o || r || a) {
|
|
3618
3622
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
3619
|
-
|
|
3623
|
+
u = this.draw({ workId: c, layer: m, isDrawing: !0 });
|
|
3620
3624
|
}
|
|
3621
3625
|
if (a) {
|
|
3622
|
-
const m = E(
|
|
3623
|
-
this.oldRect =
|
|
3626
|
+
const m = E(u, this.oldRect);
|
|
3627
|
+
this.oldRect = u;
|
|
3624
3628
|
const g = {
|
|
3625
3629
|
rect: m,
|
|
3626
3630
|
type: w.DrawWork,
|
|
@@ -3628,8 +3632,8 @@ class Fe extends b {
|
|
|
3628
3632
|
...this.baseConsumeResult
|
|
3629
3633
|
};
|
|
3630
3634
|
if (n) {
|
|
3631
|
-
const
|
|
3632
|
-
|
|
3635
|
+
const v = Date.now();
|
|
3636
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = this.tmpPoints.map((k) => [...k.XY, 0]).flat(1), g.index = 0, g.isSync = !0);
|
|
3633
3637
|
}
|
|
3634
3638
|
return g;
|
|
3635
3639
|
}
|
|
@@ -3644,9 +3648,9 @@ class Fe extends b {
|
|
|
3644
3648
|
...this.baseConsumeResult
|
|
3645
3649
|
}) : { type: w.None };
|
|
3646
3650
|
}
|
|
3647
|
-
const
|
|
3648
|
-
return this.oldRect =
|
|
3649
|
-
rect:
|
|
3651
|
+
const d = E(u, this.oldRect);
|
|
3652
|
+
return this.oldRect = u, {
|
|
3653
|
+
rect: d,
|
|
3650
3654
|
type: w.DrawWork,
|
|
3651
3655
|
dataType: x.Local,
|
|
3652
3656
|
...this.baseConsumeResult
|
|
@@ -3696,24 +3700,24 @@ class Fe extends b {
|
|
|
3696
3700
|
placement: l,
|
|
3697
3701
|
scale: h,
|
|
3698
3702
|
rotate: p,
|
|
3699
|
-
translate:
|
|
3700
|
-
strokeType:
|
|
3703
|
+
translate: u,
|
|
3704
|
+
strokeType: d,
|
|
3701
3705
|
eraserlines: f,
|
|
3702
3706
|
lineDash: m,
|
|
3703
3707
|
lineCap: g
|
|
3704
|
-
} = this.workOptions, { rect:
|
|
3705
|
-
points:
|
|
3708
|
+
} = this.workOptions, { rect: v, pos: k, points: I } = this.computDrawPoints(a, l), L = {
|
|
3709
|
+
points: I.map((M) => M.XY),
|
|
3706
3710
|
lineWidth: a,
|
|
3707
3711
|
fillColor: n !== "transparent" && n || void 0,
|
|
3708
3712
|
strokeColor: r,
|
|
3709
3713
|
normalize: !0,
|
|
3710
|
-
className: `${
|
|
3714
|
+
className: `${k[0]},${k[1]}`,
|
|
3711
3715
|
close: !0,
|
|
3712
3716
|
lineCap: g,
|
|
3713
|
-
lineDash:
|
|
3717
|
+
lineDash: d === G.Dotted ? [
|
|
3714
3718
|
m && m[0] || 1,
|
|
3715
3719
|
(m && m[1] || 2) * a
|
|
3716
|
-
] :
|
|
3720
|
+
] : d === G.LongDotted ? [
|
|
3717
3721
|
(m && m[0] || 1) * a,
|
|
3718
3722
|
(m && m[1] || 2) * a
|
|
3719
3723
|
] : void 0
|
|
@@ -3721,11 +3725,11 @@ class Fe extends b {
|
|
|
3721
3725
|
name: e,
|
|
3722
3726
|
id: e,
|
|
3723
3727
|
zIndex: c,
|
|
3724
|
-
pos:
|
|
3728
|
+
pos: k,
|
|
3725
3729
|
anchor: [0.5, 0.5],
|
|
3726
|
-
size: [
|
|
3730
|
+
size: [v.w, v.h]
|
|
3727
3731
|
};
|
|
3728
|
-
h && (C.scale = h), p && (C.rotate = p),
|
|
3732
|
+
h && (C.scale = h), p && (C.rotate = p), u && (C.translate = u);
|
|
3729
3733
|
const N = new j(C), R = new ht({
|
|
3730
3734
|
...L,
|
|
3731
3735
|
pos: [0, 0]
|
|
@@ -3734,7 +3738,7 @@ class Fe extends b {
|
|
|
3734
3738
|
{
|
|
3735
3739
|
group: N,
|
|
3736
3740
|
eraserlines: f,
|
|
3737
|
-
pos:
|
|
3741
|
+
pos: k,
|
|
3738
3742
|
layer: s
|
|
3739
3743
|
},
|
|
3740
3744
|
o
|
|
@@ -3802,14 +3806,14 @@ class Fe extends b {
|
|
|
3802
3806
|
c,
|
|
3803
3807
|
o[0],
|
|
3804
3808
|
l
|
|
3805
|
-
), p = W.Sub(o[1], new W(r, 0, 0)),
|
|
3809
|
+
), p = W.Sub(o[1], new W(r, 0, 0)), u = W.Add(
|
|
3806
3810
|
o[1],
|
|
3807
3811
|
new W(0, n, 0)
|
|
3808
|
-
),
|
|
3812
|
+
), d = ot.getBezierPoints(
|
|
3809
3813
|
10,
|
|
3810
3814
|
p,
|
|
3811
3815
|
o[1],
|
|
3812
|
-
|
|
3816
|
+
u
|
|
3813
3817
|
), f = W.Sub(o[2], new W(0, n, 0)), m = W.Sub(
|
|
3814
3818
|
o[2],
|
|
3815
3819
|
new W(r, 0, 0)
|
|
@@ -3818,17 +3822,17 @@ class Fe extends b {
|
|
|
3818
3822
|
f,
|
|
3819
3823
|
o[2],
|
|
3820
3824
|
m
|
|
3821
|
-
),
|
|
3825
|
+
), v = W.Add(
|
|
3822
3826
|
o[3],
|
|
3823
3827
|
new W(r, 0, 0)
|
|
3824
|
-
),
|
|
3828
|
+
), k = W.Sub(
|
|
3825
3829
|
o[3],
|
|
3826
3830
|
new W(0, n, 0)
|
|
3827
|
-
),
|
|
3831
|
+
), I = ot.getBezierPoints(
|
|
3828
3832
|
10,
|
|
3829
|
-
|
|
3833
|
+
v,
|
|
3830
3834
|
o[3],
|
|
3831
|
-
|
|
3835
|
+
k
|
|
3832
3836
|
), L = r * (1 - this.ratio) * 10, C = n * (1 - this.ratio) * 10;
|
|
3833
3837
|
switch (e) {
|
|
3834
3838
|
case "bottom": {
|
|
@@ -3845,9 +3849,9 @@ class Fe extends b {
|
|
|
3845
3849
|
a.push(
|
|
3846
3850
|
M,
|
|
3847
3851
|
D,
|
|
3848
|
-
...
|
|
3852
|
+
...I,
|
|
3849
3853
|
...h,
|
|
3850
|
-
...
|
|
3854
|
+
...d,
|
|
3851
3855
|
...g,
|
|
3852
3856
|
P
|
|
3853
3857
|
);
|
|
@@ -3867,9 +3871,9 @@ class Fe extends b {
|
|
|
3867
3871
|
a.push(
|
|
3868
3872
|
M,
|
|
3869
3873
|
D,
|
|
3870
|
-
...
|
|
3874
|
+
...I,
|
|
3871
3875
|
...h,
|
|
3872
|
-
...
|
|
3876
|
+
...d,
|
|
3873
3877
|
...g,
|
|
3874
3878
|
P
|
|
3875
3879
|
);
|
|
@@ -3889,9 +3893,9 @@ class Fe extends b {
|
|
|
3889
3893
|
a.push(
|
|
3890
3894
|
M,
|
|
3891
3895
|
D,
|
|
3892
|
-
...
|
|
3896
|
+
...I,
|
|
3893
3897
|
...h,
|
|
3894
|
-
...
|
|
3898
|
+
...d,
|
|
3895
3899
|
...g,
|
|
3896
3900
|
P
|
|
3897
3901
|
);
|
|
@@ -3911,9 +3915,9 @@ class Fe extends b {
|
|
|
3911
3915
|
a.push(
|
|
3912
3916
|
M,
|
|
3913
3917
|
P,
|
|
3914
|
-
...
|
|
3918
|
+
...d,
|
|
3915
3919
|
...g,
|
|
3916
|
-
...
|
|
3920
|
+
...I,
|
|
3917
3921
|
...h,
|
|
3918
3922
|
D
|
|
3919
3923
|
);
|
|
@@ -3933,9 +3937,9 @@ class Fe extends b {
|
|
|
3933
3937
|
a.push(
|
|
3934
3938
|
M,
|
|
3935
3939
|
P,
|
|
3936
|
-
...
|
|
3940
|
+
...d,
|
|
3937
3941
|
...g,
|
|
3938
|
-
...
|
|
3942
|
+
...I,
|
|
3939
3943
|
...h,
|
|
3940
3944
|
D
|
|
3941
3945
|
);
|
|
@@ -3955,9 +3959,9 @@ class Fe extends b {
|
|
|
3955
3959
|
a.push(
|
|
3956
3960
|
M,
|
|
3957
3961
|
P,
|
|
3958
|
-
...
|
|
3962
|
+
...d,
|
|
3959
3963
|
...g,
|
|
3960
|
-
...
|
|
3964
|
+
...I,
|
|
3961
3965
|
...h,
|
|
3962
3966
|
D
|
|
3963
3967
|
);
|
|
@@ -3978,9 +3982,9 @@ class Fe extends b {
|
|
|
3978
3982
|
M,
|
|
3979
3983
|
P,
|
|
3980
3984
|
...h,
|
|
3981
|
-
...
|
|
3985
|
+
...d,
|
|
3982
3986
|
...g,
|
|
3983
|
-
...
|
|
3987
|
+
...I,
|
|
3984
3988
|
D
|
|
3985
3989
|
);
|
|
3986
3990
|
break;
|
|
@@ -4000,9 +4004,9 @@ class Fe extends b {
|
|
|
4000
4004
|
M,
|
|
4001
4005
|
P,
|
|
4002
4006
|
...h,
|
|
4003
|
-
...
|
|
4007
|
+
...d,
|
|
4004
4008
|
...g,
|
|
4005
|
-
...
|
|
4009
|
+
...I,
|
|
4006
4010
|
D
|
|
4007
4011
|
);
|
|
4008
4012
|
break;
|
|
@@ -4022,9 +4026,9 @@ class Fe extends b {
|
|
|
4022
4026
|
M,
|
|
4023
4027
|
P,
|
|
4024
4028
|
...h,
|
|
4025
|
-
...
|
|
4029
|
+
...d,
|
|
4026
4030
|
...g,
|
|
4027
|
-
...
|
|
4031
|
+
...I,
|
|
4028
4032
|
D
|
|
4029
4033
|
);
|
|
4030
4034
|
break;
|
|
@@ -4044,9 +4048,9 @@ class Fe extends b {
|
|
|
4044
4048
|
M,
|
|
4045
4049
|
D,
|
|
4046
4050
|
...g,
|
|
4047
|
-
...
|
|
4051
|
+
...I,
|
|
4048
4052
|
...h,
|
|
4049
|
-
...
|
|
4053
|
+
...d,
|
|
4050
4054
|
P
|
|
4051
4055
|
);
|
|
4052
4056
|
break;
|
|
@@ -4066,9 +4070,9 @@ class Fe extends b {
|
|
|
4066
4070
|
M,
|
|
4067
4071
|
D,
|
|
4068
4072
|
...g,
|
|
4069
|
-
...
|
|
4073
|
+
...I,
|
|
4070
4074
|
...h,
|
|
4071
|
-
...
|
|
4075
|
+
...d,
|
|
4072
4076
|
P
|
|
4073
4077
|
);
|
|
4074
4078
|
break;
|
|
@@ -4088,9 +4092,9 @@ class Fe extends b {
|
|
|
4088
4092
|
M,
|
|
4089
4093
|
D,
|
|
4090
4094
|
...g,
|
|
4091
|
-
...
|
|
4095
|
+
...I,
|
|
4092
4096
|
...h,
|
|
4093
|
-
...
|
|
4097
|
+
...d,
|
|
4094
4098
|
P
|
|
4095
4099
|
);
|
|
4096
4100
|
break;
|
|
@@ -4146,10 +4150,10 @@ class Fe extends b {
|
|
|
4146
4150
|
this.tmpPoints.length = 0;
|
|
4147
4151
|
}
|
|
4148
4152
|
static updateNodeOpt(t) {
|
|
4149
|
-
var
|
|
4153
|
+
var d;
|
|
4150
4154
|
const { node: e, opt: s, vNodes: o } = t, { strokeColor: r, fillColor: n, toolsType: a, placement: c, strokeType: l } = s, h = o.get(e.name), p = h == null ? void 0 : h.opt;
|
|
4151
|
-
let
|
|
4152
|
-
return e.tagName === "GROUP" && (
|
|
4155
|
+
let u = e;
|
|
4156
|
+
return e.tagName === "GROUP" && (u = e.children[0]), r && (u.setAttribute("strokeColor", r), p != null && p.strokeColor && (p.strokeColor = r)), n && (n === "transparent" ? u.setAttribute("fillColor", "rgba(0,0,0,0)") : u.setAttribute("fillColor", n), p != null && p.fillColor && (p.fillColor = n)), a === S.SpeechBalloon && c && (p.placement = c), l && (h != null && h.opt) && ((d = h.opt) != null && d.strokeType) && (h.opt.strokeType = l), h && o.setInfo(e.name, { ...h, opt: p }), b.updateNodeOpt(t);
|
|
4153
4157
|
}
|
|
4154
4158
|
}
|
|
4155
4159
|
var Vs = Pe, Hs = te, qs = "[object Boolean]";
|
|
@@ -4163,7 +4167,7 @@ class ze extends b {
|
|
|
4163
4167
|
super(t);
|
|
4164
4168
|
y(this, "canRotate", !1);
|
|
4165
4169
|
y(this, "scaleType", z.both);
|
|
4166
|
-
y(this, "toolsType",
|
|
4170
|
+
y(this, "toolsType", S.Straight);
|
|
4167
4171
|
y(this, "tmpPoints", []);
|
|
4168
4172
|
y(this, "workOptions");
|
|
4169
4173
|
y(this, "oldRect");
|
|
@@ -4183,17 +4187,17 @@ class ze extends b {
|
|
|
4183
4187
|
if (!p || p < 2)
|
|
4184
4188
|
return { type: w.None };
|
|
4185
4189
|
h && (this.syncUnitTime = h);
|
|
4186
|
-
let d;
|
|
4187
|
-
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], d = !1) : d = this.updateTempPoints(l), !d)
|
|
4188
|
-
return { type: w.None };
|
|
4189
4190
|
let u;
|
|
4191
|
+
if (this.tmpPoints.length === 0 ? (this.tmpPoints = [new O(l[0], l[1])], u = !1) : u = this.updateTempPoints(l), !u)
|
|
4192
|
+
return { type: w.None };
|
|
4193
|
+
let d;
|
|
4190
4194
|
if (o || r || a) {
|
|
4191
4195
|
const m = s ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
4192
|
-
|
|
4196
|
+
d = this.draw({ workId: c, layer: m });
|
|
4193
4197
|
}
|
|
4194
4198
|
if (a) {
|
|
4195
|
-
const m = E(
|
|
4196
|
-
this.oldRect =
|
|
4199
|
+
const m = E(d, this.oldRect);
|
|
4200
|
+
this.oldRect = d;
|
|
4197
4201
|
const g = {
|
|
4198
4202
|
rect: m,
|
|
4199
4203
|
type: w.DrawWork,
|
|
@@ -4201,8 +4205,8 @@ class ze extends b {
|
|
|
4201
4205
|
...this.baseConsumeResult
|
|
4202
4206
|
};
|
|
4203
4207
|
if (n) {
|
|
4204
|
-
const
|
|
4205
|
-
|
|
4208
|
+
const v = Date.now();
|
|
4209
|
+
v - this.syncTimestamp > this.syncUnitTime && (this.syncTimestamp = v, g.op = this.tmpPoints.map((k) => [...k.XY, 0]).flat(1), g.index = 0, g.isSync = !0);
|
|
4206
4210
|
}
|
|
4207
4211
|
return g;
|
|
4208
4212
|
}
|
|
@@ -4217,8 +4221,8 @@ class ze extends b {
|
|
|
4217
4221
|
...this.baseConsumeResult
|
|
4218
4222
|
}) : { type: w.None };
|
|
4219
4223
|
}
|
|
4220
|
-
const f = E(
|
|
4221
|
-
return this.oldRect =
|
|
4224
|
+
const f = E(d, this.oldRect);
|
|
4225
|
+
return this.oldRect = d, {
|
|
4222
4226
|
rect: f,
|
|
4223
4227
|
type: w.DrawWork,
|
|
4224
4228
|
dataType: x.Local,
|
|
@@ -4265,16 +4269,16 @@ class ze extends b {
|
|
|
4265
4269
|
rotate: l,
|
|
4266
4270
|
translate: h,
|
|
4267
4271
|
strokeType: p,
|
|
4268
|
-
eraserlines:
|
|
4269
|
-
lineCap:
|
|
4272
|
+
eraserlines: u,
|
|
4273
|
+
lineCap: d,
|
|
4270
4274
|
lineDash: f
|
|
4271
|
-
} = this.workOptions, m = s.worldPosition, g = s.worldScaling, { d:
|
|
4272
|
-
|
|
4273
|
-
|
|
4275
|
+
} = this.workOptions, m = s.worldPosition, g = s.worldScaling, { d: v, rect: k, isDot: I } = this.computDrawPoints(n, p), L = [
|
|
4276
|
+
k.x + k.w / 2,
|
|
4277
|
+
k.y + k.h / 2
|
|
4274
4278
|
], C = new j({
|
|
4275
4279
|
pos: L,
|
|
4276
4280
|
anchor: [0.5, 0.5],
|
|
4277
|
-
size: [
|
|
4281
|
+
size: [k.w, k.h],
|
|
4278
4282
|
name: e,
|
|
4279
4283
|
id: e,
|
|
4280
4284
|
normalize: !0,
|
|
@@ -4282,25 +4286,25 @@ class ze extends b {
|
|
|
4282
4286
|
}), N = {
|
|
4283
4287
|
pos: [0, 0],
|
|
4284
4288
|
normalize: !0,
|
|
4285
|
-
d:
|
|
4289
|
+
d: v,
|
|
4286
4290
|
fillColor: r,
|
|
4287
4291
|
strokeColor: r,
|
|
4288
|
-
lineDash:
|
|
4292
|
+
lineDash: I ? void 0 : p === G.Dotted ? [
|
|
4289
4293
|
f && f[0] || 1,
|
|
4290
4294
|
(f && f[1] || 2) * n
|
|
4291
4295
|
] : p === G.LongDotted ? [
|
|
4292
4296
|
(f && f[0] || 1) * n,
|
|
4293
4297
|
(f && f[1] || 2) * n
|
|
4294
4298
|
] : void 0,
|
|
4295
|
-
lineCap:
|
|
4296
|
-
lineWidth: p === G.Normal ||
|
|
4299
|
+
lineCap: I ? void 0 : d,
|
|
4300
|
+
lineWidth: p === G.Normal || I ? 0 : n
|
|
4297
4301
|
};
|
|
4298
4302
|
c && (N.scale = c), l && (N.rotate = l), h && (N.translate = h);
|
|
4299
4303
|
const R = new wt(N);
|
|
4300
|
-
C.append(R),
|
|
4304
|
+
C.append(R), u && (this.scaleType = z.proportional, this.drawEraserlines(
|
|
4301
4305
|
{
|
|
4302
4306
|
group: C,
|
|
4303
|
-
eraserlines:
|
|
4307
|
+
eraserlines: u,
|
|
4304
4308
|
pos: L,
|
|
4305
4309
|
layer: s
|
|
4306
4310
|
},
|
|
@@ -4308,16 +4312,16 @@ class ze extends b {
|
|
|
4308
4312
|
)), this.replace(s, e, C);
|
|
4309
4313
|
let P = {
|
|
4310
4314
|
x: Math.floor(
|
|
4311
|
-
|
|
4315
|
+
k.x * g[0] + m[0] - b.SafeBorderPadding
|
|
4312
4316
|
),
|
|
4313
4317
|
y: Math.floor(
|
|
4314
|
-
|
|
4318
|
+
k.y * g[1] + m[1] - b.SafeBorderPadding
|
|
4315
4319
|
),
|
|
4316
4320
|
w: Math.floor(
|
|
4317
|
-
|
|
4321
|
+
k.w * g[0] + 2 * b.SafeBorderPadding
|
|
4318
4322
|
),
|
|
4319
4323
|
h: Math.floor(
|
|
4320
|
-
|
|
4324
|
+
k.h * g[1] + 2 * b.SafeBorderPadding
|
|
4321
4325
|
)
|
|
4322
4326
|
};
|
|
4323
4327
|
if (l || c || h) {
|
|
@@ -4365,9 +4369,9 @@ class ze extends b {
|
|
|
4365
4369
|
n,
|
|
4366
4370
|
...h
|
|
4367
4371
|
];
|
|
4368
|
-
let
|
|
4369
|
-
return e !== G.Normal ?
|
|
4370
|
-
d,
|
|
4372
|
+
let u;
|
|
4373
|
+
return e !== G.Normal ? u = mt(this.tmpPoints, !1) : u = mt(p, !0), {
|
|
4374
|
+
d: u,
|
|
4371
4375
|
rect: $(p),
|
|
4372
4376
|
isDot: !1,
|
|
4373
4377
|
pos: this.tmpPoints[0].XY
|
|
@@ -4437,7 +4441,7 @@ const ft = class ft extends b {
|
|
|
4437
4441
|
super(t);
|
|
4438
4442
|
y(this, "canRotate", !1);
|
|
4439
4443
|
y(this, "scaleType", z.proportional);
|
|
4440
|
-
y(this, "toolsType",
|
|
4444
|
+
y(this, "toolsType", S.Text);
|
|
4441
4445
|
y(this, "tmpPoints", []);
|
|
4442
4446
|
y(this, "workOptions");
|
|
4443
4447
|
y(this, "oldRect");
|
|
@@ -4466,27 +4470,27 @@ const ft = class ft extends b {
|
|
|
4466
4470
|
anchor: [0, 0],
|
|
4467
4471
|
size: n,
|
|
4468
4472
|
zIndex: c
|
|
4469
|
-
},
|
|
4473
|
+
}, u = new j(p), d = {
|
|
4470
4474
|
x: a[0] - Bt,
|
|
4471
4475
|
y: a[1] - Bt,
|
|
4472
4476
|
w: n[0],
|
|
4473
4477
|
h: n[1]
|
|
4474
4478
|
}, f = {
|
|
4475
|
-
x: Math.floor(
|
|
4476
|
-
y: Math.floor(
|
|
4477
|
-
w: Math.floor(
|
|
4478
|
-
h: Math.floor(
|
|
4479
|
+
x: Math.floor(d.x * h[0] + l[0]),
|
|
4480
|
+
y: Math.floor(d.y * h[1] + l[1]),
|
|
4481
|
+
w: Math.floor(d.w * h[0]) + 2,
|
|
4482
|
+
h: Math.floor(d.h * h[1]) + 2
|
|
4479
4483
|
};
|
|
4480
|
-
this.replace(s, e,
|
|
4484
|
+
this.replace(s, e, u);
|
|
4481
4485
|
let m;
|
|
4482
4486
|
if (r && (m = Rt(f, r)), (o || r && m !== Vt.outside) && s && this.workOptions.text) {
|
|
4483
|
-
const g = await ft.createLabels(this.workOptions, s, f), { labels:
|
|
4484
|
-
|
|
4487
|
+
const g = await ft.createLabels(this.workOptions, s, f), { labels: v, maxWidth: k } = g;
|
|
4488
|
+
u.append(...v), f.w = Math.ceil(Math.max(k * s.worldScaling[0], f.w));
|
|
4485
4489
|
}
|
|
4486
4490
|
return f;
|
|
4487
4491
|
}
|
|
4488
4492
|
async consumeServiceAsync(t) {
|
|
4489
|
-
var l, h, p,
|
|
4493
|
+
var l, h, p, u;
|
|
4490
4494
|
const e = (l = this.workId) == null ? void 0 : l.toString();
|
|
4491
4495
|
if (!e)
|
|
4492
4496
|
return;
|
|
@@ -4498,7 +4502,7 @@ const ft = class ft extends b {
|
|
|
4498
4502
|
isDrawLabel: typeof r > "u" && this.workOptions.workState === A.Done || r,
|
|
4499
4503
|
boxRect: n
|
|
4500
4504
|
});
|
|
4501
|
-
return (
|
|
4505
|
+
return (u = this.vNodes) == null || u.setInfo(e, {
|
|
4502
4506
|
rect: c,
|
|
4503
4507
|
op: [],
|
|
4504
4508
|
opt: this.workOptions,
|
|
@@ -4522,25 +4526,25 @@ const ft = class ft extends b {
|
|
|
4522
4526
|
lineThrough: l,
|
|
4523
4527
|
underline: h,
|
|
4524
4528
|
zIndex: p
|
|
4525
|
-
} = t,
|
|
4526
|
-
if (!
|
|
4529
|
+
} = t, u = (f = this.vNodes) == null ? void 0 : f.get(o);
|
|
4530
|
+
if (!u)
|
|
4527
4531
|
return;
|
|
4528
|
-
r && (
|
|
4529
|
-
const
|
|
4532
|
+
r && (u.opt.fontColor = r), n && (u.opt.fontBgColor = n), a && (u.opt.bold = a), c && (u.opt.italic = c), kt(l) && (u.opt.lineThrough = l), kt(h) && (u.opt.underline = h), q(p) && (u.opt.zIndex = p), this.oldRect = u.rect;
|
|
4533
|
+
const d = await this.draw({
|
|
4530
4534
|
workId: o,
|
|
4531
4535
|
layer: this.fullLayer,
|
|
4532
4536
|
isDrawLabel: typeof e > "u" && this.workOptions.workState === A.Done || e,
|
|
4533
4537
|
boxRect: s
|
|
4534
4538
|
});
|
|
4535
4539
|
return (m = this.vNodes) == null || m.setInfo(o, {
|
|
4536
|
-
rect:
|
|
4540
|
+
rect: d,
|
|
4537
4541
|
op: [],
|
|
4538
4542
|
opt: this.workOptions,
|
|
4539
4543
|
toolsType: this.toolsType,
|
|
4540
4544
|
scaleType: this.scaleType,
|
|
4541
4545
|
canRotate: this.canRotate,
|
|
4542
|
-
centerPos:
|
|
4543
|
-
}),
|
|
4546
|
+
centerPos: d && b.getCenterPos(d, this.fullLayer)
|
|
4547
|
+
}), d;
|
|
4544
4548
|
}
|
|
4545
4549
|
clearTmpPoints() {
|
|
4546
4550
|
this.tmpPoints.length = 0;
|
|
@@ -4557,23 +4561,23 @@ const ft = class ft extends b {
|
|
|
4557
4561
|
var D;
|
|
4558
4562
|
const o = [], { x: r, y: n } = s, { width: a, height: c } = (D = e.parent) == null ? void 0 : D.parent, l = yt(t.text), h = l.length, {
|
|
4559
4563
|
fontSize: p,
|
|
4560
|
-
lineHeight:
|
|
4561
|
-
bold:
|
|
4564
|
+
lineHeight: u,
|
|
4565
|
+
bold: d,
|
|
4562
4566
|
textAlign: f,
|
|
4563
4567
|
italic: m,
|
|
4564
4568
|
fontFamily: g,
|
|
4565
|
-
verticalAlign:
|
|
4566
|
-
fontColor:
|
|
4567
|
-
fontBgColor:
|
|
4569
|
+
verticalAlign: v,
|
|
4570
|
+
fontColor: k,
|
|
4571
|
+
fontBgColor: I,
|
|
4568
4572
|
underline: L,
|
|
4569
4573
|
lineThrough: C
|
|
4570
4574
|
} = t, N = ft.getSafetySnippetRatio(e) || 1, R = Math.floor(p * N), P = ft.getSafetySnippetFontLength(R);
|
|
4571
4575
|
let M = 0;
|
|
4572
4576
|
for (let B = 0; B < h; B++) {
|
|
4573
|
-
const F = l[B], U =
|
|
4577
|
+
const F = l[B], U = u || R * 1.5;
|
|
4574
4578
|
if (F) {
|
|
4575
|
-
const
|
|
4576
|
-
|
|
4579
|
+
const H = is(F), Z = [0, 0], K = [0, p * 1.2];
|
|
4580
|
+
v === "middle" && (Z[1] = Math.floor(
|
|
4577
4581
|
B * p * 1.2 + 6 + p * (1.1 - 1)
|
|
4578
4582
|
));
|
|
4579
4583
|
const nt = [0, Math.floor(-p * 0.15)];
|
|
@@ -4582,7 +4586,7 @@ const ft = class ft extends b {
|
|
|
4582
4586
|
let pt = 0;
|
|
4583
4587
|
const Ot = [];
|
|
4584
4588
|
let Ct = 0;
|
|
4585
|
-
for (; Ct <
|
|
4589
|
+
for (; Ct < H; ) {
|
|
4586
4590
|
f === "left" && (nt[0] = pt), Ct === 0 && m === "italic" && (nt[0] = nt[0] - gt / 2 * p);
|
|
4587
4591
|
const qt = F.slice(Ct, Ct + P), At = {
|
|
4588
4592
|
anchor: [0, 0],
|
|
@@ -4591,9 +4595,9 @@ const ft = class ft extends b {
|
|
|
4591
4595
|
fontFamily: g,
|
|
4592
4596
|
fontSize: R,
|
|
4593
4597
|
lineHeight: U,
|
|
4594
|
-
strokeColor:
|
|
4595
|
-
fontWeight:
|
|
4596
|
-
fillColor:
|
|
4598
|
+
strokeColor: k,
|
|
4599
|
+
fontWeight: d,
|
|
4600
|
+
fillColor: k,
|
|
4597
4601
|
textAlign: f,
|
|
4598
4602
|
fontStyle: m,
|
|
4599
4603
|
scale: [1 / N, 1 / N]
|
|
@@ -4603,7 +4607,7 @@ const ft = class ft extends b {
|
|
|
4603
4607
|
const ae = at.rect && at.rect[2], ce = at.rect && at.rect[3];
|
|
4604
4608
|
if (ae && ce) {
|
|
4605
4609
|
const le = ae / N, $e = ce / N;
|
|
4606
|
-
pt = le + pt, m === "italic" && (
|
|
4610
|
+
pt = le + pt, m === "italic" && (d === "bold" ? pt = pt - gt * p * 1.2 : pt = pt - gt * p), ((nt[0] + Z[0] + le) * e.worldScaling[0] + r <= 0 || (nt[0] + Z[0]) * e.worldScaling[0] + r >= a || (nt[1] + Z[1] + $e) * e.worldScaling[1] + n <= 0 || (nt[1] + Z[1]) * e.worldScaling[1] + n >= c) && (dt.disconnect(), Et = !1), Et && Ot.push(dt);
|
|
4607
4611
|
}
|
|
4608
4612
|
}
|
|
4609
4613
|
Ct += P;
|
|
@@ -4617,7 +4621,7 @@ const ft = class ft extends b {
|
|
|
4617
4621
|
pos: [0, p * 1.1 + dt / 2],
|
|
4618
4622
|
lineWidth: dt,
|
|
4619
4623
|
points: [0, 0, Math.ceil(K[0]), 0],
|
|
4620
|
-
strokeColor:
|
|
4624
|
+
strokeColor: k,
|
|
4621
4625
|
className: "underline"
|
|
4622
4626
|
}, Et = new ht(at);
|
|
4623
4627
|
Ot.push(Et);
|
|
@@ -4628,7 +4632,7 @@ const ft = class ft extends b {
|
|
|
4628
4632
|
pos: [0, p * 1.2 / 2],
|
|
4629
4633
|
lineWidth: Math.floor(p / 10),
|
|
4630
4634
|
points: [0, 0, Math.ceil(K[0]), 0],
|
|
4631
|
-
strokeColor:
|
|
4635
|
+
strokeColor: k,
|
|
4632
4636
|
className: "lineThrough"
|
|
4633
4637
|
}, at = new ht(dt);
|
|
4634
4638
|
Ot.push(at);
|
|
@@ -4637,7 +4641,7 @@ const ft = class ft extends b {
|
|
|
4637
4641
|
pos: Z,
|
|
4638
4642
|
anchor: [0, 0],
|
|
4639
4643
|
size: K,
|
|
4640
|
-
bgcolor:
|
|
4644
|
+
bgcolor: I
|
|
4641
4645
|
}, At = new j(qt);
|
|
4642
4646
|
At.append(...Ot), o.push(At);
|
|
4643
4647
|
}
|
|
@@ -4653,36 +4657,36 @@ const ft = class ft extends b {
|
|
|
4653
4657
|
originPoint: l,
|
|
4654
4658
|
scenePoint: h,
|
|
4655
4659
|
scale: p,
|
|
4656
|
-
bold:
|
|
4657
|
-
italic:
|
|
4660
|
+
bold: u,
|
|
4661
|
+
italic: d,
|
|
4658
4662
|
lineThrough: f,
|
|
4659
4663
|
underline: m,
|
|
4660
4664
|
fontSize: g,
|
|
4661
|
-
textInfos:
|
|
4662
|
-
zIndex:
|
|
4663
|
-
} = s,
|
|
4664
|
-
if (!
|
|
4665
|
-
const C =
|
|
4666
|
-
if (
|
|
4665
|
+
textInfos: v,
|
|
4666
|
+
zIndex: k
|
|
4667
|
+
} = s, I = r && st(r) || o.get(e.name);
|
|
4668
|
+
if (!I || !e.parent) return;
|
|
4669
|
+
const C = I.opt;
|
|
4670
|
+
if (q(k) && (e.setAttribute("zIndex", k), I.opt.zIndex = k), a && C.fontColor && (C.fontColor = a, e.children.forEach((N) => {
|
|
4667
4671
|
N.tagName === "GROUP" && N.children.forEach((R) => {
|
|
4668
4672
|
R.tagName === "LABEL" ? (R.setAttribute("fillColor", a), R.setAttribute("strokeColor", a)) : R.tagName === "POLYLINE" && R.setAttribute("strokeColor", a);
|
|
4669
4673
|
});
|
|
4670
4674
|
})), n && C.fontBgColor && (C.fontBgColor = n, e.children.forEach((N) => {
|
|
4671
4675
|
N.tagName === "GROUP" && N.setAttribute("bgcolor", n);
|
|
4672
|
-
})),
|
|
4673
|
-
const N =
|
|
4676
|
+
})), u && (C.bold = u), d && (C.italic = d), kt(f) && (C.lineThrough = f), kt(m) && (C.underline = m), g && (C.fontSize = g), l && h && p && r && C.boxPoint) {
|
|
4677
|
+
const N = v == null ? void 0 : v.get(e.name);
|
|
4674
4678
|
if (N) {
|
|
4675
4679
|
const { fontSize: D, boxSize: B } = N;
|
|
4676
4680
|
C.boxSize = B || C.boxSize, C.fontSize = D || C.fontSize;
|
|
4677
4681
|
}
|
|
4678
4682
|
const R = [C.boxPoint[0], C.boxPoint[1]];
|
|
4679
4683
|
Ht(C.boxPoint, h, p, c);
|
|
4680
|
-
const P = [
|
|
4681
|
-
if (
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
],
|
|
4685
|
-
for (const D of
|
|
4684
|
+
const P = [I.op[0], I.op[1]], M = [P[0] - R[0], P[1] - R[1]];
|
|
4685
|
+
if (I.centerPos = [
|
|
4686
|
+
I.centerPos[0] + M[0],
|
|
4687
|
+
I.centerPos[1] + M[1]
|
|
4688
|
+
], I.opt.eraserlines)
|
|
4689
|
+
for (const D of I.opt.eraserlines) {
|
|
4686
4690
|
const { op: B, thickness: F } = D;
|
|
4687
4691
|
D.thickness = Math.round(F * Math.max(p[0], p[1]));
|
|
4688
4692
|
for (let U = 0; U < B.length; U++)
|
|
@@ -4691,18 +4695,18 @@ const ft = class ft extends b {
|
|
|
4691
4695
|
} else if (c && C.boxPoint && (C.boxPoint = [
|
|
4692
4696
|
Math.round(C.boxPoint[0] + c[0]),
|
|
4693
4697
|
Math.round(C.boxPoint[1] + c[1])
|
|
4694
|
-
],
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
],
|
|
4698
|
-
for (const N of
|
|
4698
|
+
], I.centerPos = [
|
|
4699
|
+
I.centerPos[0] + c[0],
|
|
4700
|
+
I.centerPos[1] + c[1]
|
|
4701
|
+
], I.opt.eraserlines))
|
|
4702
|
+
for (const N of I.opt.eraserlines) {
|
|
4699
4703
|
const { op: R } = N;
|
|
4700
4704
|
for (let P = 0; P < R.length; P++) {
|
|
4701
4705
|
const M = R[P].map((D, B) => B % 2 ? D + c[1] : D + c[0]);
|
|
4702
4706
|
N.op[P] = M;
|
|
4703
4707
|
}
|
|
4704
4708
|
}
|
|
4705
|
-
return
|
|
4709
|
+
return I && o.setInfo(e.name, I), I == null ? void 0 : I.rect;
|
|
4706
4710
|
}
|
|
4707
4711
|
static getRectFromLayer(t, e) {
|
|
4708
4712
|
const s = t.getElementsByName(e)[0];
|
|
@@ -4736,7 +4740,7 @@ const It = class It extends b {
|
|
|
4736
4740
|
super(t);
|
|
4737
4741
|
y(this, "canRotate", !1);
|
|
4738
4742
|
y(this, "scaleType", z.none);
|
|
4739
|
-
y(this, "toolsType",
|
|
4743
|
+
y(this, "toolsType", S.PencilEraser);
|
|
4740
4744
|
y(this, "tmpPoints", []);
|
|
4741
4745
|
y(this, "workOptions");
|
|
4742
4746
|
y(this, "worldPosition");
|
|
@@ -4796,59 +4800,59 @@ const It = class It extends b {
|
|
|
4796
4800
|
return { willDeleteNodes: o, willNewNodes: s, rect: r };
|
|
4797
4801
|
const l = this.computEraserPointLines(this.tmpPoints, 90);
|
|
4798
4802
|
for (const [h, p] of c.entries()) {
|
|
4799
|
-
if (p.toolsType !==
|
|
4803
|
+
if (p.toolsType !== S.Pencil)
|
|
4800
4804
|
continue;
|
|
4801
|
-
let
|
|
4802
|
-
|
|
4803
|
-
x:
|
|
4804
|
-
y:
|
|
4805
|
-
w:
|
|
4806
|
-
h:
|
|
4805
|
+
let u = Nt(p.rect, [-n[0], -n[1]]);
|
|
4806
|
+
u = {
|
|
4807
|
+
x: u.x / this.worldScaling[0],
|
|
4808
|
+
y: u.y / this.worldScaling[1],
|
|
4809
|
+
w: u.w / this.worldScaling[0],
|
|
4810
|
+
h: u.h / this.worldScaling[1]
|
|
4807
4811
|
};
|
|
4808
|
-
const
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4812
|
+
const d = [
|
|
4813
|
+
u.x,
|
|
4814
|
+
u.y,
|
|
4815
|
+
u.x + u.w,
|
|
4816
|
+
u.y + u.h
|
|
4813
4817
|
], f = [], m = [];
|
|
4814
4818
|
for (const g of l)
|
|
4815
|
-
ie.polyline(g,
|
|
4819
|
+
ie.polyline(g, d, f);
|
|
4816
4820
|
if (f.length && p.opt)
|
|
4817
4821
|
for (const g of f) {
|
|
4818
|
-
const
|
|
4819
|
-
for (let
|
|
4820
|
-
|
|
4821
|
-
m.push(
|
|
4822
|
+
const v = [];
|
|
4823
|
+
for (let k = 0; k < g.length; k++)
|
|
4824
|
+
k !== 0 && lt(g[k], g[k - 1]) || v.push(...g[k]);
|
|
4825
|
+
m.push(v);
|
|
4822
4826
|
}
|
|
4823
4827
|
if (m.length && e) {
|
|
4824
4828
|
const g = e.createWorkShapeNode({
|
|
4825
4829
|
workId: h,
|
|
4826
|
-
toolsType:
|
|
4830
|
+
toolsType: S.Pencil,
|
|
4827
4831
|
toolsOpt: p.opt
|
|
4828
4832
|
});
|
|
4829
4833
|
g.setWorkId(h);
|
|
4830
|
-
const
|
|
4834
|
+
const v = g == null ? void 0 : g.computPencilPoints({
|
|
4831
4835
|
op: p.op,
|
|
4832
4836
|
eraserPolylines: m,
|
|
4833
4837
|
eraserThickness: t
|
|
4834
4838
|
});
|
|
4835
|
-
if (r = E(r, p.rect), o.add(h), e.removeNode(h),
|
|
4836
|
-
for (let
|
|
4837
|
-
const
|
|
4839
|
+
if (r = E(r, p.rect), o.add(h), e.removeNode(h), v.length)
|
|
4840
|
+
for (let k = 0; k < v.length; k++) {
|
|
4841
|
+
const I = `${h}_${Date.now()}_${k}`, L = I, N = e.setFullWork({
|
|
4838
4842
|
workId: L,
|
|
4839
4843
|
opt: p.opt,
|
|
4840
|
-
toolsType:
|
|
4844
|
+
toolsType: S.Pencil
|
|
4841
4845
|
}).consumeService({
|
|
4842
|
-
op:
|
|
4846
|
+
op: v[k],
|
|
4843
4847
|
isFullWork: !0,
|
|
4844
4848
|
replaceId: L
|
|
4845
4849
|
});
|
|
4846
|
-
e.clearWorkShapeNodeCache(L), r = E(r, N), s.set(
|
|
4850
|
+
e.clearWorkShapeNodeCache(L), r = E(r, N), s.set(I, {
|
|
4847
4851
|
...p,
|
|
4848
|
-
toolsType:
|
|
4852
|
+
toolsType: S.Pencil,
|
|
4849
4853
|
rect: N ?? p.rect,
|
|
4850
|
-
name:
|
|
4851
|
-
op:
|
|
4854
|
+
name: I,
|
|
4855
|
+
op: v[k]
|
|
4852
4856
|
});
|
|
4853
4857
|
}
|
|
4854
4858
|
}
|
|
@@ -4899,8 +4903,8 @@ const It = class It extends b {
|
|
|
4899
4903
|
rect: l
|
|
4900
4904
|
};
|
|
4901
4905
|
const h = [];
|
|
4902
|
-
this.tmpPoints.map((
|
|
4903
|
-
h.push(
|
|
4906
|
+
this.tmpPoints.map((u) => {
|
|
4907
|
+
h.push(u.x, u.y, n / 2);
|
|
4904
4908
|
});
|
|
4905
4909
|
const p = tt(h);
|
|
4906
4910
|
return {
|
|
@@ -4925,7 +4929,7 @@ const Pt = class Pt extends b {
|
|
|
4925
4929
|
super(t);
|
|
4926
4930
|
y(this, "canRotate", !1);
|
|
4927
4931
|
y(this, "scaleType", z.none);
|
|
4928
|
-
y(this, "toolsType",
|
|
4932
|
+
y(this, "toolsType", S.BitMapEraser);
|
|
4929
4933
|
y(this, "tmpPoints", []);
|
|
4930
4934
|
y(this, "workOptions");
|
|
4931
4935
|
y(this, "worldPosition");
|
|
@@ -4982,53 +4986,53 @@ const Pt = class Pt extends b {
|
|
|
4982
4986
|
return { willDeleteNodes: o, willUpdateNodes: s, rect: r };
|
|
4983
4987
|
const l = this.computEraserPointLines(this.tmpPoints, 120);
|
|
4984
4988
|
for (const [h, p] of c.entries()) {
|
|
4985
|
-
if (p.toolsType ===
|
|
4989
|
+
if (p.toolsType === S.Text || p.toolsType === S.Image)
|
|
4986
4990
|
continue;
|
|
4987
|
-
let
|
|
4988
|
-
|
|
4989
|
-
x:
|
|
4990
|
-
y:
|
|
4991
|
-
w:
|
|
4992
|
-
h:
|
|
4991
|
+
let u = Nt(p.rect, [-n[0], -n[1]]);
|
|
4992
|
+
u = {
|
|
4993
|
+
x: u.x / this.worldScaling[0],
|
|
4994
|
+
y: u.y / this.worldScaling[1],
|
|
4995
|
+
w: u.w / this.worldScaling[0],
|
|
4996
|
+
h: u.h / this.worldScaling[1]
|
|
4993
4997
|
};
|
|
4994
|
-
const
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4998
|
+
const d = [
|
|
4999
|
+
u.x,
|
|
5000
|
+
u.y,
|
|
5001
|
+
u.x + u.w,
|
|
5002
|
+
u.y + u.h
|
|
4999
5003
|
], f = [], m = [];
|
|
5000
|
-
for (const
|
|
5001
|
-
ie.polyline(
|
|
5004
|
+
for (const k of l)
|
|
5005
|
+
ie.polyline(k, d, f);
|
|
5002
5006
|
if (f.length && p.opt)
|
|
5003
|
-
for (const
|
|
5004
|
-
const
|
|
5005
|
-
for (let L = 0; L <
|
|
5006
|
-
const C =
|
|
5007
|
+
for (const k of f) {
|
|
5008
|
+
const I = [];
|
|
5009
|
+
for (let L = 0; L < k.length && !(isNaN(k[L][0]) || isNaN(k[L][1])); L++) {
|
|
5010
|
+
const C = k[L].map((N) => Math.round(N * 100) / 100);
|
|
5007
5011
|
if (L !== 0) {
|
|
5008
|
-
const N =
|
|
5012
|
+
const N = k[L - 1].map((R) => Math.round(R * 100) / 100);
|
|
5009
5013
|
if (lt(C, N))
|
|
5010
5014
|
continue;
|
|
5011
5015
|
}
|
|
5012
|
-
|
|
5016
|
+
I.push(...C);
|
|
5013
5017
|
}
|
|
5014
|
-
|
|
5018
|
+
I.length !== 0 && m.push(I);
|
|
5015
5019
|
}
|
|
5016
5020
|
if (!m.length)
|
|
5017
5021
|
continue;
|
|
5018
|
-
const g = p.opt.eraserlines ? p.opt.eraserlines : [],
|
|
5019
|
-
if (
|
|
5020
|
-
const { toolsType:
|
|
5022
|
+
const g = p.opt.eraserlines ? p.opt.eraserlines : [], v = g.find((k) => k.workId === this.workId);
|
|
5023
|
+
if (v ? v.op = m : g.push({ workId: this.workId, op: m, thickness: t }), p.opt.eraserlines = g, e) {
|
|
5024
|
+
const { toolsType: k } = p, I = e.createWorkShapeNode({
|
|
5021
5025
|
workId: h,
|
|
5022
|
-
toolsType:
|
|
5026
|
+
toolsType: k,
|
|
5023
5027
|
toolsOpt: p.opt
|
|
5024
5028
|
});
|
|
5025
|
-
|
|
5026
|
-
const L =
|
|
5029
|
+
I == null || I.setWorkId(h);
|
|
5030
|
+
const L = I == null ? void 0 : I.consumeService({
|
|
5027
5031
|
op: p.op,
|
|
5028
5032
|
isFullWork: !0,
|
|
5029
5033
|
replaceId: h
|
|
5030
5034
|
});
|
|
5031
|
-
if (r = E(r, L),
|
|
5035
|
+
if (r = E(r, L), I != null && I.isDelete) {
|
|
5032
5036
|
e.removeNode(h), o.add(h);
|
|
5033
5037
|
continue;
|
|
5034
5038
|
}
|
|
@@ -5081,8 +5085,8 @@ const Pt = class Pt extends b {
|
|
|
5081
5085
|
rect: l
|
|
5082
5086
|
};
|
|
5083
5087
|
const h = [];
|
|
5084
|
-
this.tmpPoints.map((
|
|
5085
|
-
h.push(
|
|
5088
|
+
this.tmpPoints.map((u) => {
|
|
5089
|
+
h.push(u.x, u.y, n / 2);
|
|
5086
5090
|
});
|
|
5087
5091
|
const p = tt(h);
|
|
5088
5092
|
return {
|
|
@@ -5107,7 +5111,7 @@ class xt extends b {
|
|
|
5107
5111
|
super(t);
|
|
5108
5112
|
y(this, "canRotate", !1);
|
|
5109
5113
|
y(this, "scaleType", z.all);
|
|
5110
|
-
y(this, "toolsType",
|
|
5114
|
+
y(this, "toolsType", S.BackgroundSVG);
|
|
5111
5115
|
y(this, "tmpPoints", []);
|
|
5112
5116
|
y(this, "workOptions");
|
|
5113
5117
|
y(this, "oldRect");
|
|
@@ -5120,21 +5124,21 @@ class xt extends b {
|
|
|
5120
5124
|
return { type: w.None };
|
|
5121
5125
|
}
|
|
5122
5126
|
draw(t) {
|
|
5123
|
-
const { layer: e, workId: s, replaceId: o } = t, { centerX: r, centerY: n, width: a, height: c, rotate: l, zIndex: h } = this.workOptions, p = (h || 0) - 100,
|
|
5127
|
+
const { layer: e, workId: s, replaceId: o } = t, { centerX: r, centerY: n, width: a, height: c, rotate: l, zIndex: h } = this.workOptions, p = (h || 0) - 100, u = new j({
|
|
5124
5128
|
anchor: [0.5, 0.5],
|
|
5125
5129
|
pos: [r, n],
|
|
5126
5130
|
name: s,
|
|
5127
5131
|
size: [a, c],
|
|
5128
5132
|
zIndex: p,
|
|
5129
5133
|
rotate: l
|
|
5130
|
-
}),
|
|
5134
|
+
}), d = new Kt({
|
|
5131
5135
|
normalize: !0,
|
|
5132
5136
|
pos: [0, 0],
|
|
5133
5137
|
width: a,
|
|
5134
5138
|
height: c
|
|
5135
5139
|
});
|
|
5136
|
-
|
|
5137
|
-
const f =
|
|
5140
|
+
u.appendChild(d), this.replace(e, o || s, u);
|
|
5141
|
+
const f = u.getBoundingClientRect();
|
|
5138
5142
|
if (f)
|
|
5139
5143
|
return {
|
|
5140
5144
|
x: Math.floor(f.x - b.SafeBorderPadding),
|
|
@@ -5171,123 +5175,123 @@ class xt extends b {
|
|
|
5171
5175
|
scale: l,
|
|
5172
5176
|
angle: h,
|
|
5173
5177
|
isLocked: p,
|
|
5174
|
-
zIndexForBackgroundSVG:
|
|
5175
|
-
} = s,
|
|
5176
|
-
if (!
|
|
5178
|
+
zIndexForBackgroundSVG: u
|
|
5179
|
+
} = s, d = r && st(r) || o.get(e.name);
|
|
5180
|
+
if (!d) return;
|
|
5177
5181
|
const f = e.parent;
|
|
5178
5182
|
if (f) {
|
|
5179
|
-
if (
|
|
5180
|
-
const m = (
|
|
5181
|
-
e.setAttribute("zIndex", m),
|
|
5183
|
+
if (q(u)) {
|
|
5184
|
+
const m = (u || 0) - 100;
|
|
5185
|
+
e.setAttribute("zIndex", m), d.opt.zIndex = u;
|
|
5182
5186
|
}
|
|
5183
|
-
if (kt(p) && (
|
|
5184
|
-
const { centerX: m, centerY: g, width:
|
|
5187
|
+
if (kt(p) && (d.opt.locked = p), a && c && l && n) {
|
|
5188
|
+
const { centerX: m, centerY: g, width: v, height: k, uniformScale: I } = d.opt, L = I !== !1 ? [l[0], l[0]] : l, C = [m, g], N = [m, g];
|
|
5185
5189
|
Ht(N, c, L, n);
|
|
5186
5190
|
const R = [
|
|
5187
5191
|
N[0] - C[0],
|
|
5188
5192
|
N[1] - C[1]
|
|
5189
5193
|
];
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
],
|
|
5194
|
+
d.centerPos = [
|
|
5195
|
+
d.centerPos[0] + R[0],
|
|
5196
|
+
d.centerPos[1] + R[1]
|
|
5197
|
+
], d.opt.width = Math.round(v * L[0]), d.opt.height = Math.round(k * L[1]), d.opt.centerX = N[0], d.opt.centerY = N[1];
|
|
5194
5198
|
} else if (n)
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5199
|
+
d.opt.centerX = d.opt.centerX + n[0], d.opt.centerY = d.opt.centerY + n[1], d.centerPos = [
|
|
5200
|
+
d.centerPos[0] + n[0],
|
|
5201
|
+
d.centerPos[1] + n[1]
|
|
5198
5202
|
];
|
|
5199
|
-
else if (
|
|
5200
|
-
if (
|
|
5201
|
-
|
|
5203
|
+
else if (q(h))
|
|
5204
|
+
if (d.opt.rotate = h, d.scaleType = xt.getScaleType(
|
|
5205
|
+
d.opt
|
|
5202
5206
|
), r) {
|
|
5203
|
-
const m = se(
|
|
5204
|
-
|
|
5207
|
+
const m = se(d.rect, h);
|
|
5208
|
+
d.rect = m;
|
|
5205
5209
|
} else {
|
|
5206
5210
|
const m = b.getRectFromLayer(f, e.name);
|
|
5207
|
-
|
|
5211
|
+
d.rect = m || d.rect;
|
|
5208
5212
|
}
|
|
5209
|
-
return
|
|
5213
|
+
return d && o.setInfo(e.name, d), d == null ? void 0 : d.rect;
|
|
5210
5214
|
}
|
|
5211
5215
|
}
|
|
5212
5216
|
}
|
|
5213
5217
|
function Ue(T) {
|
|
5214
5218
|
switch (T) {
|
|
5215
|
-
case
|
|
5219
|
+
case S.Arrow:
|
|
5216
5220
|
return Me;
|
|
5217
|
-
case
|
|
5221
|
+
case S.Pencil:
|
|
5218
5222
|
return Ne;
|
|
5219
|
-
case
|
|
5223
|
+
case S.Straight:
|
|
5220
5224
|
return ze;
|
|
5221
|
-
case
|
|
5225
|
+
case S.Ellipse:
|
|
5222
5226
|
return Oe;
|
|
5223
|
-
case
|
|
5224
|
-
case
|
|
5227
|
+
case S.Polygon:
|
|
5228
|
+
case S.Triangle:
|
|
5225
5229
|
return Be;
|
|
5226
|
-
case
|
|
5227
|
-
case
|
|
5230
|
+
case S.Star:
|
|
5231
|
+
case S.Rhombus:
|
|
5228
5232
|
return Ee;
|
|
5229
|
-
case
|
|
5233
|
+
case S.Rectangle:
|
|
5230
5234
|
return Ae;
|
|
5231
|
-
case
|
|
5235
|
+
case S.SpeechBalloon:
|
|
5232
5236
|
return Fe;
|
|
5233
|
-
case
|
|
5237
|
+
case S.Text:
|
|
5234
5238
|
return Xt;
|
|
5235
|
-
case
|
|
5239
|
+
case S.LaserPen:
|
|
5236
5240
|
return xe;
|
|
5237
|
-
case
|
|
5241
|
+
case S.Eraser:
|
|
5238
5242
|
return Ut;
|
|
5239
|
-
case
|
|
5243
|
+
case S.PencilEraser:
|
|
5240
5244
|
return Yt;
|
|
5241
|
-
case
|
|
5245
|
+
case S.BitMapEraser:
|
|
5242
5246
|
return $t;
|
|
5243
|
-
case
|
|
5247
|
+
case S.Selector:
|
|
5244
5248
|
return Gt;
|
|
5245
|
-
case
|
|
5249
|
+
case S.Image:
|
|
5246
5250
|
return Dt;
|
|
5247
|
-
case
|
|
5251
|
+
case S.BackgroundSVG:
|
|
5248
5252
|
return xt;
|
|
5249
5253
|
}
|
|
5250
5254
|
}
|
|
5251
5255
|
function Lt(T, i) {
|
|
5252
5256
|
const { toolsType: t, ...e } = T;
|
|
5253
5257
|
switch (t) {
|
|
5254
|
-
case
|
|
5258
|
+
case S.Arrow:
|
|
5255
5259
|
return new Me(e);
|
|
5256
|
-
case
|
|
5260
|
+
case S.Pencil:
|
|
5257
5261
|
return new Ne(e);
|
|
5258
|
-
case
|
|
5262
|
+
case S.Straight:
|
|
5259
5263
|
return new ze(e);
|
|
5260
|
-
case
|
|
5264
|
+
case S.Ellipse:
|
|
5261
5265
|
return new Oe(e);
|
|
5262
|
-
case
|
|
5263
|
-
case
|
|
5266
|
+
case S.Polygon:
|
|
5267
|
+
case S.Triangle:
|
|
5264
5268
|
return new Be(e);
|
|
5265
|
-
case
|
|
5266
|
-
case
|
|
5269
|
+
case S.Star:
|
|
5270
|
+
case S.Rhombus:
|
|
5267
5271
|
return new Ee(e);
|
|
5268
|
-
case
|
|
5272
|
+
case S.Rectangle:
|
|
5269
5273
|
return new Ae(e);
|
|
5270
|
-
case
|
|
5274
|
+
case S.SpeechBalloon:
|
|
5271
5275
|
return new Fe(e);
|
|
5272
|
-
case
|
|
5276
|
+
case S.Text:
|
|
5273
5277
|
return new Xt(e);
|
|
5274
|
-
case
|
|
5278
|
+
case S.LaserPen:
|
|
5275
5279
|
return new xe(e);
|
|
5276
|
-
case
|
|
5280
|
+
case S.Eraser:
|
|
5277
5281
|
return new Ut(e, i);
|
|
5278
|
-
case
|
|
5282
|
+
case S.BitMapEraser:
|
|
5279
5283
|
return new $t(e);
|
|
5280
|
-
case
|
|
5284
|
+
case S.PencilEraser:
|
|
5281
5285
|
return new Yt(e);
|
|
5282
|
-
case
|
|
5286
|
+
case S.Selector:
|
|
5283
5287
|
return e.vNodes ? new Gt({
|
|
5284
5288
|
...e,
|
|
5285
5289
|
vNodes: e.vNodes,
|
|
5286
5290
|
drawLayer: e.fullLayer
|
|
5287
5291
|
}) : void 0;
|
|
5288
|
-
case
|
|
5292
|
+
case S.Image:
|
|
5289
5293
|
return new Dt(e);
|
|
5290
|
-
case
|
|
5294
|
+
case S.BackgroundSVG:
|
|
5291
5295
|
return new xt({
|
|
5292
5296
|
...e,
|
|
5293
5297
|
toolsOpt: e.toolsOpt
|
|
@@ -5348,7 +5352,7 @@ class Xe {
|
|
|
5348
5352
|
getCanEraserNodes(i, t) {
|
|
5349
5353
|
const e = /* @__PURE__ */ new Map();
|
|
5350
5354
|
for (const [s, o] of i.entries())
|
|
5351
|
-
o.toolsType !==
|
|
5355
|
+
o.toolsType !== S.BackgroundSVG && (o.toolsType === S.Image && o.opt.type === Mt.Image && (o.opt.locked || t && t.disableEraseImage) || o.toolsType === S.Text && (o.opt.workState === A.Doing || o.opt.workState === A.Start || t && t.disableEraseText) || this.isCanClearWorkId(s) && e.set(s, o));
|
|
5352
5356
|
return e;
|
|
5353
5357
|
}
|
|
5354
5358
|
getNodesByType(i) {
|
|
@@ -5394,7 +5398,7 @@ class Xe {
|
|
|
5394
5398
|
const o = /* @__PURE__ */ new Map();
|
|
5395
5399
|
for (const [r, n] of this.curNodeMap.entries())
|
|
5396
5400
|
if (Zt(i, n.rect)) {
|
|
5397
|
-
if (t && n.toolsType ===
|
|
5401
|
+
if (t && n.toolsType === S.Image && n.opt.locked || e && n.toolsType === S.Text && (n.opt.workState === A.Doing || n.opt.workState === A.Start))
|
|
5398
5402
|
continue;
|
|
5399
5403
|
s = E(s, n.rect), o.set(r, n);
|
|
5400
5404
|
}
|
|
@@ -5551,7 +5555,7 @@ class Ks {
|
|
|
5551
5555
|
const { msgType: t, toolsType: e, opt: s, imageSrc: o, imageBitmap: r, workId: n, dpr: a } = i;
|
|
5552
5556
|
switch (t) {
|
|
5553
5557
|
case w.UpdateDpr: {
|
|
5554
|
-
|
|
5558
|
+
q(a) && await this.updateDpr(a);
|
|
5555
5559
|
break;
|
|
5556
5560
|
}
|
|
5557
5561
|
case w.UpdateCamera: {
|
|
@@ -5602,7 +5606,7 @@ class Ks {
|
|
|
5602
5606
|
}
|
|
5603
5607
|
async loadImageBitMap(i) {
|
|
5604
5608
|
const { toolsType: t, opt: e, workId: s, isSubWorker: o } = i;
|
|
5605
|
-
if (t ===
|
|
5609
|
+
if (t === S.Image && e && s) {
|
|
5606
5610
|
const r = s.toString(), { src: n, type: a, width: c, height: l, strokeColor: h } = e;
|
|
5607
5611
|
if (!n || !a || !c || !l)
|
|
5608
5612
|
return;
|
|
@@ -5627,8 +5631,8 @@ class Ks {
|
|
|
5627
5631
|
timer: void 0
|
|
5628
5632
|
};
|
|
5629
5633
|
g.timer && clearTimeout(g.timer), g.resolve = m, g.timer = setTimeout(() => {
|
|
5630
|
-
const
|
|
5631
|
-
|
|
5634
|
+
const v = this.imageResolveMap.get(p);
|
|
5635
|
+
v != null && v.resolve && v.resolve(p);
|
|
5632
5636
|
}, 5e3), this.imageResolveMap.set(p, g), this._post({
|
|
5633
5637
|
sp: [
|
|
5634
5638
|
{
|
|
@@ -5718,7 +5722,7 @@ class Ks {
|
|
|
5718
5722
|
}
|
|
5719
5723
|
destroy() {
|
|
5720
5724
|
var i;
|
|
5721
|
-
this.vNodes.clear(), this.fullLayer.remove(),
|
|
5725
|
+
this.vNodes.clear(), this.fullLayer.remove(), V(this.fullLayer, this.fullLayer.parent), this.clearCacheImages(), this.clearImageResolveMap(), this.scene.remove(), this.localWork.destroy(), (i = this.serviceWork) == null || i.destroy();
|
|
5722
5726
|
}
|
|
5723
5727
|
async post(i) {
|
|
5724
5728
|
this.combinePostMsg.add(i), await this.runBatchPostData();
|
|
@@ -5745,8 +5749,8 @@ class Ks {
|
|
|
5745
5749
|
if (!p || !(p.parent instanceof ms))
|
|
5746
5750
|
continue;
|
|
5747
5751
|
if (p.parent.render(), l.isDrawAll) {
|
|
5748
|
-
const
|
|
5749
|
-
l.rect =
|
|
5752
|
+
const u = this.getSceneRect();
|
|
5753
|
+
l.rect = u, delete l.isDrawAll;
|
|
5750
5754
|
}
|
|
5751
5755
|
}
|
|
5752
5756
|
for (const p of i)
|
|
@@ -5772,7 +5776,7 @@ class Ks {
|
|
|
5772
5776
|
}
|
|
5773
5777
|
h || t.push(l);
|
|
5774
5778
|
}
|
|
5775
|
-
|
|
5779
|
+
q(c.fullWorkerDrawCount) && (e = c.fullWorkerDrawCount), q(c.subWorkerDrawCount) && (s = c.subWorkerDrawCount), q(c.consumeCount) && (o = c.consumeCount);
|
|
5776
5780
|
}
|
|
5777
5781
|
return this.combinePostMsg.clear(), {
|
|
5778
5782
|
render: i,
|
|
@@ -5873,11 +5877,15 @@ class Ye {
|
|
|
5873
5877
|
if (t && e && s) {
|
|
5874
5878
|
const o = t.toString();
|
|
5875
5879
|
let r;
|
|
5876
|
-
return t && this.workShapes.has(o) ? (r = this.workShapes.get(o), r == null || r.setWorkOptions(e)) : r = this.createWorkShapeNode({
|
|
5880
|
+
return t && this.workShapes.has(o) ? (r = this.workShapes.get(o), (r == null ? void 0 : r.toolsType) !== s ? (r == null || r.clearTmpPoints(), this.workShapes.delete(o), r = void 0) : r == null || r.setWorkOptions(e)) : r = this.createWorkShapeNode({
|
|
5877
5881
|
toolsOpt: e,
|
|
5878
5882
|
toolsType: s,
|
|
5879
5883
|
workId: o
|
|
5880
|
-
}), r
|
|
5884
|
+
}), r || (r = this.createWorkShapeNode({
|
|
5885
|
+
toolsOpt: e,
|
|
5886
|
+
toolsType: s,
|
|
5887
|
+
workId: o
|
|
5888
|
+
})), r ? (this.workShapes.set(o, r), r) : void 0;
|
|
5881
5889
|
}
|
|
5882
5890
|
}
|
|
5883
5891
|
}
|
|
@@ -5911,7 +5919,7 @@ class Qs extends Ye {
|
|
|
5911
5919
|
dataType: x.Local
|
|
5912
5920
|
}), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && r !== X && (this.drawWorkActiveId = r);
|
|
5913
5921
|
const a = n.toolsType;
|
|
5914
|
-
|
|
5922
|
+
q(o) && (this.consumeCount = o);
|
|
5915
5923
|
const c = n.consume({
|
|
5916
5924
|
data: t,
|
|
5917
5925
|
drawCount: this.drawCount,
|
|
@@ -5920,25 +5928,25 @@ class Qs extends Ye {
|
|
|
5920
5928
|
removeDrawCount: s
|
|
5921
5929
|
});
|
|
5922
5930
|
switch (a) {
|
|
5923
|
-
case
|
|
5931
|
+
case S.Selector:
|
|
5924
5932
|
c && (this.drawCount++, await this.drawSelector(c));
|
|
5925
5933
|
break;
|
|
5926
|
-
case
|
|
5927
|
-
case
|
|
5928
|
-
case
|
|
5929
|
-
case
|
|
5930
|
-
case
|
|
5931
|
-
case
|
|
5932
|
-
case
|
|
5934
|
+
case S.Ellipse:
|
|
5935
|
+
case S.Arrow:
|
|
5936
|
+
case S.Straight:
|
|
5937
|
+
case S.Rectangle:
|
|
5938
|
+
case S.Star:
|
|
5939
|
+
case S.Polygon:
|
|
5940
|
+
case S.SpeechBalloon: {
|
|
5933
5941
|
c && (this.drawCount++, await this.drawShape(c));
|
|
5934
5942
|
break;
|
|
5935
5943
|
}
|
|
5936
|
-
case
|
|
5944
|
+
case S.Pencil: {
|
|
5937
5945
|
c && (this.drawCount++, await this.drawPencil(c, e == null ? void 0 : e.toString()));
|
|
5938
5946
|
break;
|
|
5939
5947
|
}
|
|
5940
|
-
case
|
|
5941
|
-
case
|
|
5948
|
+
case S.BitMapEraser:
|
|
5949
|
+
case S.PencilEraser: {
|
|
5942
5950
|
c && (this.drawCount++, await this._post({
|
|
5943
5951
|
subWorkerDrawCount: this.drawCount,
|
|
5944
5952
|
consumeCount: this.consumeCount
|
|
@@ -5956,7 +5964,7 @@ class Qs extends Ye {
|
|
|
5956
5964
|
if (!o)
|
|
5957
5965
|
return;
|
|
5958
5966
|
switch (o.toolsType) {
|
|
5959
|
-
case
|
|
5967
|
+
case S.Selector:
|
|
5960
5968
|
this.drawCount = 0, Q(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s), this._post({
|
|
5961
5969
|
render: [
|
|
5962
5970
|
{
|
|
@@ -5967,16 +5975,16 @@ class Qs extends Ye {
|
|
|
5967
5975
|
]
|
|
5968
5976
|
});
|
|
5969
5977
|
break;
|
|
5970
|
-
case
|
|
5971
|
-
case
|
|
5972
|
-
case
|
|
5973
|
-
case
|
|
5974
|
-
case
|
|
5975
|
-
case
|
|
5976
|
-
case
|
|
5977
|
-
case
|
|
5978
|
-
case
|
|
5979
|
-
case
|
|
5978
|
+
case S.Arrow:
|
|
5979
|
+
case S.Straight:
|
|
5980
|
+
case S.Ellipse:
|
|
5981
|
+
case S.Pencil:
|
|
5982
|
+
case S.Rectangle:
|
|
5983
|
+
case S.Star:
|
|
5984
|
+
case S.Polygon:
|
|
5985
|
+
case S.SpeechBalloon:
|
|
5986
|
+
case S.BitMapEraser:
|
|
5987
|
+
case S.PencilEraser:
|
|
5980
5988
|
this.drawCount = 0, Q(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s);
|
|
5981
5989
|
break;
|
|
5982
5990
|
}
|
|
@@ -6016,7 +6024,7 @@ class Qs extends Ye {
|
|
|
6016
6024
|
y: r.y - b.SafeBorderPadding,
|
|
6017
6025
|
w: r.width + b.SafeBorderPadding * 2,
|
|
6018
6026
|
h: r.height + b.SafeBorderPadding * 2
|
|
6019
|
-
}), o.remove(),
|
|
6027
|
+
}), o.remove(), V(o, this.fullLayer.parent);
|
|
6020
6028
|
}), s && this.clearWorkShapeNodeCache(t)), s;
|
|
6021
6029
|
}
|
|
6022
6030
|
async drawPencil(t, e) {
|
|
@@ -6088,7 +6096,7 @@ class Js {
|
|
|
6088
6096
|
this.viewId = i.viewId, this.vNodes = i.vNodes, this.topLayer = i.topLayer, this.thread = i.thread, this.post = i.thread.post.bind(i.thread);
|
|
6089
6097
|
}
|
|
6090
6098
|
canUseTopLayer(i) {
|
|
6091
|
-
return i ===
|
|
6099
|
+
return i === S.LaserPen;
|
|
6092
6100
|
}
|
|
6093
6101
|
getWorkShape(i) {
|
|
6094
6102
|
return this.localWorkShapes.get(i);
|
|
@@ -6113,7 +6121,7 @@ class Js {
|
|
|
6113
6121
|
}
|
|
6114
6122
|
createWorkShapeNode(i) {
|
|
6115
6123
|
const { toolsType: t } = i;
|
|
6116
|
-
if (t ===
|
|
6124
|
+
if (t === S.LaserPen)
|
|
6117
6125
|
return Lt({
|
|
6118
6126
|
...i,
|
|
6119
6127
|
vNodes: this.vNodes,
|
|
@@ -6181,13 +6189,13 @@ class Js {
|
|
|
6181
6189
|
}), t;
|
|
6182
6190
|
}
|
|
6183
6191
|
activeServiceWorkShape(i) {
|
|
6184
|
-
var p,
|
|
6192
|
+
var p, u;
|
|
6185
6193
|
const { workId: t, opt: e, toolsType: s, type: o, updateNodeOpt: r, ops: n, op: a } = i;
|
|
6186
6194
|
if (!t)
|
|
6187
6195
|
return;
|
|
6188
6196
|
const c = t.toString(), l = (p = this.vNodes.get(c)) == null ? void 0 : p.rect;
|
|
6189
|
-
if (!((
|
|
6190
|
-
let
|
|
6197
|
+
if (!((u = this.serviceWorkShapes) != null && u.has(c))) {
|
|
6198
|
+
let d = {
|
|
6191
6199
|
toolsType: s,
|
|
6192
6200
|
animationWorkData: a || [],
|
|
6193
6201
|
animationIndex: 0,
|
|
@@ -6196,7 +6204,7 @@ class Js {
|
|
|
6196
6204
|
ops: n,
|
|
6197
6205
|
oldRect: l
|
|
6198
6206
|
};
|
|
6199
|
-
s && e && (
|
|
6207
|
+
s && e && (d = this.setNodeKey(c, d, s, e)), this.serviceWorkShapes.set(c, d);
|
|
6200
6208
|
}
|
|
6201
6209
|
const h = this.serviceWorkShapes.get(c);
|
|
6202
6210
|
o && (h.type = o), n && (h.animationWorkData = yt(n), h.ops = n), r && (h.updateNodeOpt = r), a && (h.animationWorkData = a), h.node && h.node.getWorkId() !== c && h.node.setWorkId(c), l && (h.oldRect = l), s && e && (h.toolsType !== s && s && e && this.setNodeKey(c, h, s, e), h.node && h.node.setWorkOptions(e));
|
|
@@ -6217,21 +6225,21 @@ class Js {
|
|
|
6217
6225
|
const t = /* @__PURE__ */ new Map(), e = [], s = [], o = [];
|
|
6218
6226
|
for (const [l, h] of this.serviceWorkShapes.entries())
|
|
6219
6227
|
switch (h.toolsType) {
|
|
6220
|
-
case
|
|
6221
|
-
const
|
|
6228
|
+
case S.LaserPen: {
|
|
6229
|
+
const u = this.computNextAnimationIndex(
|
|
6222
6230
|
h,
|
|
6223
6231
|
8
|
|
6224
|
-
),
|
|
6225
|
-
|
|
6226
|
-
|
|
6232
|
+
), d = Math.max(0, h.animationIndex || 0), f = (h.animationWorkData || []).slice(
|
|
6233
|
+
d,
|
|
6234
|
+
u
|
|
6227
6235
|
);
|
|
6228
|
-
if ((h.animationIndex || 0) <
|
|
6236
|
+
if ((h.animationIndex || 0) < u) {
|
|
6229
6237
|
const m = (r = h.node) == null ? void 0 : r.consumeService({
|
|
6230
6238
|
op: f,
|
|
6231
6239
|
isFullWork: !1
|
|
6232
6240
|
});
|
|
6233
|
-
h.totalRect = E(h.totalRect, m), h.animationIndex =
|
|
6234
|
-
workState:
|
|
6241
|
+
h.totalRect = E(h.totalRect, m), h.animationIndex = u, f.length && t.set(l, {
|
|
6242
|
+
workState: d === 0 ? A.Start : u === ((n = h.animationWorkData) == null ? void 0 : n.length) ? A.Done : A.Doing,
|
|
6235
6243
|
op: f.slice(-2)
|
|
6236
6244
|
});
|
|
6237
6245
|
}
|
|
@@ -6253,16 +6261,16 @@ class Js {
|
|
|
6253
6261
|
}
|
|
6254
6262
|
}
|
|
6255
6263
|
for (const [l, h] of this.localWorkShapes.entries()) {
|
|
6256
|
-
const { result: p, toolsType:
|
|
6257
|
-
switch (
|
|
6258
|
-
case
|
|
6259
|
-
if (
|
|
6264
|
+
const { result: p, toolsType: u, totalRect: d, isDel: f, workState: m } = h;
|
|
6265
|
+
switch (u) {
|
|
6266
|
+
case S.LaserPen: {
|
|
6267
|
+
if (d && (s.push({
|
|
6260
6268
|
isClear: !0,
|
|
6261
|
-
rect:
|
|
6269
|
+
rect: d,
|
|
6262
6270
|
clearCanvas: _.TopFloat,
|
|
6263
6271
|
viewId: this.viewId
|
|
6264
6272
|
}), e.push({
|
|
6265
|
-
rect:
|
|
6273
|
+
rect: d,
|
|
6266
6274
|
drawCanvas: _.TopFloat,
|
|
6267
6275
|
viewId: this.viewId
|
|
6268
6276
|
})), f) {
|
|
@@ -6390,13 +6398,13 @@ class to extends Ye {
|
|
|
6390
6398
|
if (e) {
|
|
6391
6399
|
let r, n;
|
|
6392
6400
|
const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
|
|
6393
|
-
return e.toolsType ===
|
|
6401
|
+
return e.toolsType === S.BackgroundSVG ? r = e.consumeService({
|
|
6394
6402
|
isFullWork: !0,
|
|
6395
6403
|
replaceId: a
|
|
6396
|
-
}) : e.toolsType ===
|
|
6404
|
+
}) : e.toolsType === S.Image ? r = await e.consumeServiceAsync({
|
|
6397
6405
|
isFullWork: !0,
|
|
6398
6406
|
worker: this.thread
|
|
6399
|
-
}) : e.toolsType ===
|
|
6407
|
+
}) : e.toolsType === S.Text ? r = await e.consumeServiceAsync({
|
|
6400
6408
|
isFullWork: !0,
|
|
6401
6409
|
replaceId: a,
|
|
6402
6410
|
isDrawLabel: !0
|
|
@@ -6568,7 +6576,7 @@ class eo extends Ks {
|
|
|
6568
6576
|
return;
|
|
6569
6577
|
}
|
|
6570
6578
|
case w.DrawWork: {
|
|
6571
|
-
n === A.Done && r === x.Local ? (await this.consumeDrawAll(r, t), s ===
|
|
6579
|
+
n === A.Done && r === x.Local ? (await this.consumeDrawAll(r, t), s === S.LaserPen && a && this.post({
|
|
6572
6580
|
sp: [
|
|
6573
6581
|
{
|
|
6574
6582
|
type: w.None,
|
|
@@ -6583,7 +6591,11 @@ class eo extends Ks {
|
|
|
6583
6591
|
return;
|
|
6584
6592
|
}
|
|
6585
6593
|
case w.FullWork: {
|
|
6586
|
-
s && ((l = this.topLayerWork) != null && l.canUseTopLayer(s))
|
|
6594
|
+
s && ((l = this.topLayerWork) != null && l.canUseTopLayer(s)) ? await this.consumeDrawAll(r, t) : r === x.Local && t.clearPreviewLocalWork && t.workId && await this.localWork.consumeDrawAll({
|
|
6595
|
+
...t,
|
|
6596
|
+
msgType: w.DrawWork,
|
|
6597
|
+
workState: A.Done
|
|
6598
|
+
});
|
|
6587
6599
|
return;
|
|
6588
6600
|
}
|
|
6589
6601
|
case w.Snapshot: {
|
|
@@ -6728,13 +6740,13 @@ class eo extends Ks {
|
|
|
6728
6740
|
if (c.totalRect) {
|
|
6729
6741
|
let l;
|
|
6730
6742
|
(o = this.topLayer) == null || o.getElementsByName(a.toString()).forEach((h) => {
|
|
6731
|
-
const p = h.getBoundingClientRect(),
|
|
6743
|
+
const p = h.getBoundingClientRect(), u = ut({
|
|
6732
6744
|
x: p.x,
|
|
6733
6745
|
y: p.y,
|
|
6734
6746
|
w: p.width,
|
|
6735
6747
|
h: p.height
|
|
6736
6748
|
});
|
|
6737
|
-
l = E(l,
|
|
6749
|
+
l = E(l, u);
|
|
6738
6750
|
}), c.totalRect = l, this.topLayerWork.localWorkShapes.set(a, c);
|
|
6739
6751
|
}
|
|
6740
6752
|
}
|
|
@@ -6753,7 +6765,7 @@ class Dt extends b {
|
|
|
6753
6765
|
super(t);
|
|
6754
6766
|
y(this, "canRotate", !0);
|
|
6755
6767
|
y(this, "scaleType", z.all);
|
|
6756
|
-
y(this, "toolsType",
|
|
6768
|
+
y(this, "toolsType", S.Image);
|
|
6757
6769
|
y(this, "tmpPoints", []);
|
|
6758
6770
|
y(this, "workOptions");
|
|
6759
6771
|
y(this, "oldRect");
|
|
@@ -6766,7 +6778,7 @@ class Dt extends b {
|
|
|
6766
6778
|
return { type: w.None };
|
|
6767
6779
|
}
|
|
6768
6780
|
draw(t) {
|
|
6769
|
-
const { layer: e, workId: s, replaceId: o, imageBitmap: r } = t, { centerX: n, centerY: a, width: c, height: l, rotate: h, zIndex: p, eraserlines:
|
|
6781
|
+
const { layer: e, workId: s, replaceId: o, imageBitmap: r } = t, { centerX: n, centerY: a, width: c, height: l, rotate: h, zIndex: p, eraserlines: u } = this.workOptions, d = new j({
|
|
6770
6782
|
anchor: [0.5, 0.5],
|
|
6771
6783
|
pos: [n, a],
|
|
6772
6784
|
name: s,
|
|
@@ -6781,13 +6793,13 @@ class Dt extends b {
|
|
|
6781
6793
|
};
|
|
6782
6794
|
r || (f.bgcolor = "rgba(0,0,0,0.3)");
|
|
6783
6795
|
const m = new Ce(f);
|
|
6784
|
-
|
|
6785
|
-
group:
|
|
6786
|
-
eraserlines:
|
|
6796
|
+
d.append(m), u && this.drawEraserlines({
|
|
6797
|
+
group: d,
|
|
6798
|
+
eraserlines: u,
|
|
6787
6799
|
pos: [n, a],
|
|
6788
6800
|
layer: e
|
|
6789
|
-
}), this.replace(e, o || s,
|
|
6790
|
-
const g =
|
|
6801
|
+
}), this.replace(e, o || s, d);
|
|
6802
|
+
const g = d.getBoundingClientRect();
|
|
6791
6803
|
if (g)
|
|
6792
6804
|
return {
|
|
6793
6805
|
x: Math.floor(g.x - b.SafeBorderPadding),
|
|
@@ -6799,18 +6811,18 @@ class Dt extends b {
|
|
|
6799
6811
|
consumeService() {
|
|
6800
6812
|
}
|
|
6801
6813
|
async consumeServiceAsync(t) {
|
|
6802
|
-
var l, h, p,
|
|
6814
|
+
var l, h, p, u;
|
|
6803
6815
|
const { isFullWork: e, replaceId: s, worker: o } = t, { src: r, uuid: n } = this.workOptions, a = ((l = this.workId) == null ? void 0 : l.toString()) || n, c = e ? this.fullLayer : this.drawLayer || this.fullLayer;
|
|
6804
6816
|
if (r) {
|
|
6805
|
-
const
|
|
6817
|
+
const d = await o.loadImageBitMap({
|
|
6806
6818
|
toolsType: this.toolsType,
|
|
6807
6819
|
opt: this.workOptions,
|
|
6808
6820
|
workId: a,
|
|
6809
6821
|
isSubWorker: o instanceof eo
|
|
6810
6822
|
});
|
|
6811
|
-
if (
|
|
6812
|
-
const f = this.draw({ workId: a, layer: c, replaceId: s, imageBitmap:
|
|
6813
|
-
return this.oldRect = a && ((p = (h = this.vNodes) == null ? void 0 : h.get(a)) == null ? void 0 : p.rect) || void 0, (
|
|
6823
|
+
if (d) {
|
|
6824
|
+
const f = this.draw({ workId: a, layer: c, replaceId: s, imageBitmap: d });
|
|
6825
|
+
return this.oldRect = a && ((p = (h = this.vNodes) == null ? void 0 : h.get(a)) == null ? void 0 : p.rect) || void 0, (u = this.vNodes) == null || u.setInfo(a, {
|
|
6814
6826
|
rect: f,
|
|
6815
6827
|
op: [],
|
|
6816
6828
|
opt: this.workOptions,
|
|
@@ -6837,14 +6849,14 @@ class Dt extends b {
|
|
|
6837
6849
|
scale: l,
|
|
6838
6850
|
angle: h,
|
|
6839
6851
|
isLocked: p,
|
|
6840
|
-
zIndex:
|
|
6841
|
-
strokeColor:
|
|
6852
|
+
zIndex: u,
|
|
6853
|
+
strokeColor: d
|
|
6842
6854
|
} = s, f = r && st(r) || o.get(e.name);
|
|
6843
6855
|
if (!f) return;
|
|
6844
6856
|
const m = e.parent;
|
|
6845
6857
|
if (m) {
|
|
6846
|
-
if (
|
|
6847
|
-
const { centerX: g, centerY:
|
|
6858
|
+
if (d && (f.opt.strokeColor = d), q(u) && (e.setAttribute("zIndex", u), f.opt.zIndex = u), kt(p) && (f.opt.locked = p), a && c && l && n) {
|
|
6859
|
+
const { centerX: g, centerY: v, width: k, height: I, uniformScale: L } = f.opt, C = L !== !1 ? [l[0], l[0]] : l, N = [g, v], R = [g, v];
|
|
6848
6860
|
Ht(R, c, C, n);
|
|
6849
6861
|
const P = [
|
|
6850
6862
|
R[0] - N[0],
|
|
@@ -6853,7 +6865,7 @@ class Dt extends b {
|
|
|
6853
6865
|
if (f.centerPos = [
|
|
6854
6866
|
f.centerPos[0] + P[0],
|
|
6855
6867
|
f.centerPos[1] + P[1]
|
|
6856
|
-
], f.opt.width = Math.round(
|
|
6868
|
+
], f.opt.width = Math.round(k * C[0]), f.opt.height = Math.round(I * C[1]), f.opt.centerX = R[0], f.opt.centerY = R[1], f.opt.eraserlines)
|
|
6857
6869
|
for (const M of f.opt.eraserlines) {
|
|
6858
6870
|
const { op: D, thickness: B } = M;
|
|
6859
6871
|
M.thickness = Math.round(B * Math.max(l[0], l[1]));
|
|
@@ -6866,13 +6878,13 @@ class Dt extends b {
|
|
|
6866
6878
|
f.centerPos[1] + n[1]
|
|
6867
6879
|
], f.opt.eraserlines)
|
|
6868
6880
|
for (const g of f.opt.eraserlines) {
|
|
6869
|
-
const { op:
|
|
6870
|
-
for (let
|
|
6871
|
-
const
|
|
6872
|
-
g.op[
|
|
6881
|
+
const { op: v } = g;
|
|
6882
|
+
for (let k = 0; k < v.length; k++) {
|
|
6883
|
+
const I = v[k].map((L, C) => C % 2 ? L + n[1] : L + n[0]);
|
|
6884
|
+
g.op[k] = I;
|
|
6873
6885
|
}
|
|
6874
6886
|
}
|
|
6875
|
-
} else if (
|
|
6887
|
+
} else if (q(h))
|
|
6876
6888
|
if (f.opt.rotate = h, f.scaleType = Dt.getScaleType(f.opt), r) {
|
|
6877
6889
|
const g = se(f.rect, h);
|
|
6878
6890
|
f.rect = g;
|
|
@@ -6893,24 +6905,24 @@ const so = (T) => {
|
|
|
6893
6905
|
return !0;
|
|
6894
6906
|
}
|
|
6895
6907
|
return !1;
|
|
6896
|
-
},
|
|
6908
|
+
}, V = (T, i) => {
|
|
6897
6909
|
if (T.mesh && T.mesh.texture && T.name === "eraserTexture") {
|
|
6898
6910
|
const t = T.mesh.texture.image;
|
|
6899
6911
|
i.deleteTexture(t);
|
|
6900
6912
|
} else if (T.tagName === "GROUP" && T && T.children)
|
|
6901
6913
|
for (const t of T.children)
|
|
6902
|
-
|
|
6914
|
+
V(t, i);
|
|
6903
6915
|
}, Q = (T, i) => {
|
|
6904
|
-
|
|
6916
|
+
V(T, i), T.removeAllChildren();
|
|
6905
6917
|
}, oo = (T, i, t) => {
|
|
6906
6918
|
const e = t.parent;
|
|
6907
6919
|
if (i) {
|
|
6908
6920
|
const s = i.children;
|
|
6909
6921
|
if (s) {
|
|
6910
6922
|
for (const o of s)
|
|
6911
|
-
if (
|
|
6923
|
+
if (V(o, e), o.tagName === "GROUP")
|
|
6912
6924
|
for (const r of o.children)
|
|
6913
|
-
|
|
6925
|
+
V(r, e);
|
|
6914
6926
|
}
|
|
6915
6927
|
}
|
|
6916
6928
|
i.parent.replaceChild(T, i);
|
|
@@ -6969,7 +6981,7 @@ class ro {
|
|
|
6969
6981
|
}
|
|
6970
6982
|
}
|
|
6971
6983
|
canUseTopLayer(i) {
|
|
6972
|
-
return i ===
|
|
6984
|
+
return i === S.LaserPen;
|
|
6973
6985
|
}
|
|
6974
6986
|
destroy() {
|
|
6975
6987
|
this.clearAll();
|
|
@@ -7008,7 +7020,7 @@ class ro {
|
|
|
7008
7020
|
}
|
|
7009
7021
|
createWorkShapeNode(i) {
|
|
7010
7022
|
const { toolsType: t } = i;
|
|
7011
|
-
if (t ===
|
|
7023
|
+
if (t === S.LaserPen)
|
|
7012
7024
|
return Lt({
|
|
7013
7025
|
...i,
|
|
7014
7026
|
vNodes: this.vNodes,
|
|
@@ -7024,13 +7036,13 @@ class ro {
|
|
|
7024
7036
|
}), t;
|
|
7025
7037
|
}
|
|
7026
7038
|
activeServiceWorkShape(i) {
|
|
7027
|
-
var p,
|
|
7039
|
+
var p, u;
|
|
7028
7040
|
const { workId: t, opt: e, toolsType: s, type: o, updateNodeOpt: r, ops: n, op: a } = i;
|
|
7029
7041
|
if (!t)
|
|
7030
7042
|
return;
|
|
7031
7043
|
const c = t.toString(), l = (p = this.vNodes.get(c)) == null ? void 0 : p.rect;
|
|
7032
|
-
if (!((
|
|
7033
|
-
let
|
|
7044
|
+
if (!((u = this.serviceWorkShapes) != null && u.has(c))) {
|
|
7045
|
+
let d = {
|
|
7034
7046
|
toolsType: s,
|
|
7035
7047
|
animationWorkData: a || [],
|
|
7036
7048
|
animationIndex: 0,
|
|
@@ -7039,7 +7051,7 @@ class ro {
|
|
|
7039
7051
|
ops: n,
|
|
7040
7052
|
oldRect: l
|
|
7041
7053
|
};
|
|
7042
|
-
s && e && (
|
|
7054
|
+
s && e && (d = this.setNodeKey(c, d, s, e)), this.serviceWorkShapes.set(c, d);
|
|
7043
7055
|
}
|
|
7044
7056
|
const h = this.serviceWorkShapes.get(c);
|
|
7045
7057
|
o && (h.type = o), n && (h.animationWorkData = yt(n), h.ops = n), r && (h.updateNodeOpt = r), a && (h.animationWorkData = a), h.node && h.node.getWorkId() !== c && h.node.setWorkId(c), l && (h.oldRect = l), s && e && (h.toolsType !== s && s && e && this.setNodeKey(c, h, s, e), h.node && h.node.setWorkOptions(e));
|
|
@@ -7061,20 +7073,20 @@ class ro {
|
|
|
7061
7073
|
const t = /* @__PURE__ */ new Map(), e = [];
|
|
7062
7074
|
for (const [a, c] of this.serviceWorkShapes.entries())
|
|
7063
7075
|
switch (c.toolsType) {
|
|
7064
|
-
case
|
|
7076
|
+
case S.LaserPen: {
|
|
7065
7077
|
const h = this.computNextAnimationIndex(
|
|
7066
7078
|
c,
|
|
7067
7079
|
8
|
|
7068
|
-
), p = Math.max(0, c.animationIndex || 0),
|
|
7080
|
+
), p = Math.max(0, c.animationIndex || 0), u = (c.animationWorkData || []).slice(
|
|
7069
7081
|
p,
|
|
7070
7082
|
h
|
|
7071
7083
|
);
|
|
7072
7084
|
if ((c.animationIndex || 0) < h && ((s = c.node) == null || s.consumeService({
|
|
7073
|
-
op:
|
|
7085
|
+
op: u,
|
|
7074
7086
|
isFullWork: !1
|
|
7075
|
-
}), c.animationIndex = h,
|
|
7087
|
+
}), c.animationIndex = h, u.length && t.set(a, {
|
|
7076
7088
|
workState: p === 0 ? A.Start : h === ((o = c.animationWorkData) == null ? void 0 : o.length) ? A.Done : A.Doing,
|
|
7077
|
-
op:
|
|
7089
|
+
op: u.slice(-2)
|
|
7078
7090
|
})), c.isDel) {
|
|
7079
7091
|
(r = c.node) == null || r.clearTmpPoints(), this.serviceWorkShapes.delete(a);
|
|
7080
7092
|
break;
|
|
@@ -7086,9 +7098,9 @@ class ro {
|
|
|
7086
7098
|
}
|
|
7087
7099
|
}
|
|
7088
7100
|
for (const [a, c] of this.localWorkShapes.entries()) {
|
|
7089
|
-
const { result: l, toolsType: h, isDel: p, workState:
|
|
7101
|
+
const { result: l, toolsType: h, isDel: p, workState: u } = c;
|
|
7090
7102
|
switch (h) {
|
|
7091
|
-
case
|
|
7103
|
+
case S.LaserPen: {
|
|
7092
7104
|
if (p) {
|
|
7093
7105
|
c.node.clearTmpPoints(), this.localWorkShapes.delete(a), e.push({
|
|
7094
7106
|
removeIds: [a.toString()],
|
|
@@ -7098,7 +7110,7 @@ class ro {
|
|
|
7098
7110
|
}
|
|
7099
7111
|
l && ((l.op || l.ops) && e.push(l), c.result = void 0), !this.thread.topLayer.getElementsByName(
|
|
7100
7112
|
a.toString()
|
|
7101
|
-
)[0] &&
|
|
7113
|
+
)[0] && u === A.Done && (c.isDel = !0, this.localWorkShapes.set(a, c)), i = !0;
|
|
7102
7114
|
break;
|
|
7103
7115
|
}
|
|
7104
7116
|
}
|
|
@@ -7186,11 +7198,11 @@ class no {
|
|
|
7186
7198
|
// }
|
|
7187
7199
|
// }
|
|
7188
7200
|
async updateSelector(i) {
|
|
7189
|
-
var
|
|
7201
|
+
var u;
|
|
7190
7202
|
const t = this.workShapes.get(
|
|
7191
7203
|
X
|
|
7192
7204
|
);
|
|
7193
|
-
if (!((
|
|
7205
|
+
if (!((u = t == null ? void 0 : t.selectIds) != null && u.length)) return;
|
|
7194
7206
|
const { callback: e, ...s } = i, { updateSelectorOpt: o, willSerializeData: r, smoothSync: n } = s, a = await (t == null ? void 0 : t.updateSelector({
|
|
7195
7207
|
updateSelectorOpt: o,
|
|
7196
7208
|
selectIds: be(t.selectIds),
|
|
@@ -7199,12 +7211,12 @@ class no {
|
|
|
7199
7211
|
worker: this
|
|
7200
7212
|
})), c = /* @__PURE__ */ new Map();
|
|
7201
7213
|
let l;
|
|
7202
|
-
a != null && a.selectIds && (l = ys(t.selectIds, a.selectIds), a.selectIds.forEach((
|
|
7203
|
-
const f = this.vNodes.get(
|
|
7214
|
+
a != null && a.selectIds && (l = ys(t.selectIds, a.selectIds), a.selectIds.forEach((d) => {
|
|
7215
|
+
const f = this.vNodes.get(d);
|
|
7204
7216
|
if (f) {
|
|
7205
|
-
const { toolsType: m, op: g, opt:
|
|
7206
|
-
c.set(
|
|
7207
|
-
opt:
|
|
7217
|
+
const { toolsType: m, op: g, opt: v } = f;
|
|
7218
|
+
c.set(d, {
|
|
7219
|
+
opt: v,
|
|
7208
7220
|
toolsType: m,
|
|
7209
7221
|
ops: (g == null ? void 0 : g.length) && tt(g) || void 0
|
|
7210
7222
|
});
|
|
@@ -7252,7 +7264,7 @@ class no {
|
|
|
7252
7264
|
let o;
|
|
7253
7265
|
for (const r of this.vNodes.curNodeMap.values()) {
|
|
7254
7266
|
const { rect: n, name: a, toolsType: c, opt: l } = r, h = t[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], p = t[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
|
|
7255
|
-
if (c ===
|
|
7267
|
+
if (c === S.Text && hs([h, p], n) && l.workState === A.Done) {
|
|
7256
7268
|
o = a;
|
|
7257
7269
|
break;
|
|
7258
7270
|
}
|
|
@@ -7266,7 +7278,7 @@ class no {
|
|
|
7266
7278
|
sp: [
|
|
7267
7279
|
{
|
|
7268
7280
|
type: w.GetTextActive,
|
|
7269
|
-
toolsType:
|
|
7281
|
+
toolsType: S.Text,
|
|
7270
7282
|
workId: o
|
|
7271
7283
|
}
|
|
7272
7284
|
]
|
|
@@ -7299,7 +7311,7 @@ class no {
|
|
|
7299
7311
|
}
|
|
7300
7312
|
if (!t) {
|
|
7301
7313
|
const c = this.setFullWork(i);
|
|
7302
|
-
!c && i.workId && this.tmpOpt && ((s = this.tmpOpt) == null ? void 0 : s.toolsType) ===
|
|
7314
|
+
!c && i.workId && this.tmpOpt && ((s = this.tmpOpt) == null ? void 0 : s.toolsType) === S.Selector && this.setWorkOptions(
|
|
7303
7315
|
i.workId.toString(),
|
|
7304
7316
|
i.opt || this.tmpOpt.toolsOpt
|
|
7305
7317
|
), c && this.updateFullSelectWork(i);
|
|
@@ -7344,19 +7356,19 @@ class no {
|
|
|
7344
7356
|
const c = this.vNodes.get(a);
|
|
7345
7357
|
if (c)
|
|
7346
7358
|
switch (c.toolsType) {
|
|
7347
|
-
case
|
|
7359
|
+
case S.Text: {
|
|
7348
7360
|
s.push({
|
|
7349
7361
|
type: w.TextUpdate,
|
|
7350
|
-
toolsType:
|
|
7362
|
+
toolsType: S.Text,
|
|
7351
7363
|
workId: a,
|
|
7352
7364
|
dataType: x.Local
|
|
7353
7365
|
});
|
|
7354
7366
|
break;
|
|
7355
7367
|
}
|
|
7356
|
-
case
|
|
7368
|
+
case S.BackgroundSVG:
|
|
7357
7369
|
s.push({
|
|
7358
7370
|
type: w.BackgroundSVGDelete,
|
|
7359
|
-
toolsType:
|
|
7371
|
+
toolsType: S.BackgroundSVG,
|
|
7360
7372
|
workId: a,
|
|
7361
7373
|
dataType: x.Local,
|
|
7362
7374
|
viewId: this.thread.viewId
|
|
@@ -7384,20 +7396,20 @@ class no {
|
|
|
7384
7396
|
removeNode(i) {
|
|
7385
7397
|
var s;
|
|
7386
7398
|
const t = this.vNodes.get(i);
|
|
7387
|
-
t && (t.toolsType ===
|
|
7399
|
+
t && (t.toolsType === S.BackgroundSVG && this.thread.post({
|
|
7388
7400
|
sp: [
|
|
7389
7401
|
{
|
|
7390
7402
|
type: w.BackgroundSVGDelete,
|
|
7391
|
-
toolsType:
|
|
7403
|
+
toolsType: S.BackgroundSVG,
|
|
7392
7404
|
workId: i,
|
|
7393
7405
|
dataType: x.Local,
|
|
7394
7406
|
viewId: this.thread.viewId
|
|
7395
7407
|
}
|
|
7396
7408
|
]
|
|
7397
7409
|
}), (s = this.thread.fullLayer) == null || s.getElementsByName(i).forEach((o) => {
|
|
7398
|
-
o.remove(),
|
|
7410
|
+
o.remove(), V(o, this.thread.fullLayer.parent);
|
|
7399
7411
|
}), this.vNodes.delete(i)), this.workShapes.has(i) && (this.thread.localLayer.getElementsByName(i).forEach((o) => {
|
|
7400
|
-
o.remove(),
|
|
7412
|
+
o.remove(), V(o, this.thread.localLayer.parent);
|
|
7401
7413
|
}), this.clearWorkShapeNodeCache(i));
|
|
7402
7414
|
}
|
|
7403
7415
|
setFullWork(i) {
|
|
@@ -7405,11 +7417,15 @@ class no {
|
|
|
7405
7417
|
if (t && e && s) {
|
|
7406
7418
|
const o = t.toString();
|
|
7407
7419
|
let r;
|
|
7408
|
-
return t && this.workShapes.has(o) ? (r = this.workShapes.get(o), r == null || r.setWorkOptions(e)) : r = this.createWorkShapeNode({
|
|
7420
|
+
return t && this.workShapes.has(o) ? (r = this.workShapes.get(o), (r == null ? void 0 : r.toolsType) !== s ? (r == null || r.clearTmpPoints(), this.workShapes.delete(o), r = void 0) : r == null || r.setWorkOptions(e)) : r = this.createWorkShapeNode({
|
|
7409
7421
|
toolsOpt: e,
|
|
7410
7422
|
toolsType: s,
|
|
7411
7423
|
workId: o
|
|
7412
|
-
}), r
|
|
7424
|
+
}), r || (r = this.createWorkShapeNode({
|
|
7425
|
+
toolsOpt: e,
|
|
7426
|
+
toolsType: s,
|
|
7427
|
+
workId: o
|
|
7428
|
+
})), r ? (this.workShapes.set(o, r), r) : void 0;
|
|
7413
7429
|
}
|
|
7414
7430
|
}
|
|
7415
7431
|
async consumeFull(i) {
|
|
@@ -7417,14 +7433,16 @@ class no {
|
|
|
7417
7433
|
const t = this.setFullWork(i), e = i.ops && yt(i.ops);
|
|
7418
7434
|
if (t) {
|
|
7419
7435
|
const o = (s = i.workId) == null ? void 0 : s.toString();
|
|
7420
|
-
|
|
7436
|
+
o && i.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(o).forEach((n) => {
|
|
7437
|
+
n.remove(), V(n, this.thread.localLayer.parent);
|
|
7438
|
+
}), t.toolsType === S.BackgroundSVG ? t.consumeService({
|
|
7421
7439
|
isFullWork: !0,
|
|
7422
7440
|
replaceId: o
|
|
7423
|
-
}) : t.toolsType ===
|
|
7441
|
+
}) : t.toolsType === S.Image ? await t.consumeServiceAsync({
|
|
7424
7442
|
isFullWork: !0,
|
|
7425
7443
|
replaceId: o,
|
|
7426
7444
|
worker: this
|
|
7427
|
-
}) : t.toolsType ===
|
|
7445
|
+
}) : t.toolsType === S.Text ? await t.consumeServiceAsync({
|
|
7428
7446
|
isFullWork: !0,
|
|
7429
7447
|
replaceId: o,
|
|
7430
7448
|
boxRect: this.thread.getSceneRect()
|
|
@@ -7442,6 +7460,9 @@ class no {
|
|
|
7442
7460
|
ops: i.ops,
|
|
7443
7461
|
updateNodeOpt: i.updateNodeOpt,
|
|
7444
7462
|
viewId: this.thread.viewId
|
|
7463
|
+
}), i.isLockSentEventCursor && r.push({
|
|
7464
|
+
type: w.None,
|
|
7465
|
+
isLockSentEventCursor: !0
|
|
7445
7466
|
}), i.needUndoTicker && r.push({
|
|
7446
7467
|
type: w.None,
|
|
7447
7468
|
needUndoTicker: i.needUndoTicker
|
|
@@ -7473,18 +7494,18 @@ class no {
|
|
|
7473
7494
|
const s = this.setFullWork(e);
|
|
7474
7495
|
if (s) {
|
|
7475
7496
|
const o = (t = e.workId) == null ? void 0 : t.toString();
|
|
7476
|
-
if (s.toolsType ===
|
|
7497
|
+
if (s.toolsType === S.BackgroundSVG)
|
|
7477
7498
|
s.consumeService({
|
|
7478
7499
|
isFullWork: !0,
|
|
7479
7500
|
replaceId: o
|
|
7480
7501
|
});
|
|
7481
|
-
else if (s.toolsType ===
|
|
7502
|
+
else if (s.toolsType === S.Image)
|
|
7482
7503
|
await s.consumeServiceAsync({
|
|
7483
7504
|
isFullWork: !0,
|
|
7484
7505
|
replaceId: o,
|
|
7485
7506
|
worker: this
|
|
7486
7507
|
});
|
|
7487
|
-
else if (s.toolsType ===
|
|
7508
|
+
else if (s.toolsType === S.Text)
|
|
7488
7509
|
await s.consumeServiceAsync({
|
|
7489
7510
|
isFullWork: !0,
|
|
7490
7511
|
replaceId: o,
|
|
@@ -7658,7 +7679,7 @@ class no {
|
|
|
7658
7679
|
if (!c)
|
|
7659
7680
|
return;
|
|
7660
7681
|
const l = c.toolsType;
|
|
7661
|
-
if (l ===
|
|
7682
|
+
if (l === S.LaserPen)
|
|
7662
7683
|
return;
|
|
7663
7684
|
switch (this.combineDrawActiveId && this.combineDrawActiveId !== a && (this.combineTimerId && (clearTimeout(this.combineTimerId), this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!1), this.combineDrawActiveId = void 0), this.consumeDrawAll(
|
|
7664
7685
|
{
|
|
@@ -7679,7 +7700,7 @@ class no {
|
|
|
7679
7700
|
},
|
|
7680
7701
|
t
|
|
7681
7702
|
), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== X && (this.drawWorkActiveId = a), zt(r) && (this.consumeCount = r), l) {
|
|
7682
|
-
case
|
|
7703
|
+
case S.Selector: {
|
|
7683
7704
|
const h = c.consume({
|
|
7684
7705
|
data: i,
|
|
7685
7706
|
isFullWork: !0,
|
|
@@ -7694,8 +7715,8 @@ class no {
|
|
|
7694
7715
|
});
|
|
7695
7716
|
break;
|
|
7696
7717
|
}
|
|
7697
|
-
case
|
|
7698
|
-
case
|
|
7718
|
+
case S.PencilEraser:
|
|
7719
|
+
case S.BitMapEraser: {
|
|
7699
7720
|
c.consume({
|
|
7700
7721
|
data: i,
|
|
7701
7722
|
isFullWork: !1,
|
|
@@ -7719,7 +7740,7 @@ class no {
|
|
|
7719
7740
|
});
|
|
7720
7741
|
break;
|
|
7721
7742
|
}
|
|
7722
|
-
case
|
|
7743
|
+
case S.Eraser:
|
|
7723
7744
|
{
|
|
7724
7745
|
const h = c.consume({
|
|
7725
7746
|
data: i,
|
|
@@ -7728,14 +7749,14 @@ class no {
|
|
|
7728
7749
|
this.drawEraser(h);
|
|
7729
7750
|
}
|
|
7730
7751
|
break;
|
|
7731
|
-
case
|
|
7732
|
-
case
|
|
7733
|
-
case
|
|
7734
|
-
case
|
|
7735
|
-
case
|
|
7736
|
-
case
|
|
7737
|
-
case
|
|
7738
|
-
case
|
|
7752
|
+
case S.Arrow:
|
|
7753
|
+
case S.Straight:
|
|
7754
|
+
case S.Ellipse:
|
|
7755
|
+
case S.Rectangle:
|
|
7756
|
+
case S.Star:
|
|
7757
|
+
case S.Polygon:
|
|
7758
|
+
case S.SpeechBalloon:
|
|
7759
|
+
case S.Pencil:
|
|
7739
7760
|
{
|
|
7740
7761
|
const h = c.consume({
|
|
7741
7762
|
data: i,
|
|
@@ -7808,56 +7829,56 @@ class no {
|
|
|
7808
7829
|
if (!l)
|
|
7809
7830
|
return;
|
|
7810
7831
|
const h = l.toolsType;
|
|
7811
|
-
if (h ===
|
|
7832
|
+
if (h === S.LaserPen)
|
|
7812
7833
|
return;
|
|
7813
|
-
const p = this.workShapes.get(bt),
|
|
7834
|
+
const p = this.workShapes.get(bt), u = (r = p == null ? void 0 : p.selectIds) == null ? void 0 : r[0], d = l.consumeAll({ data: i, workerEngine: this });
|
|
7814
7835
|
switch (h) {
|
|
7815
|
-
case
|
|
7836
|
+
case S.Selector:
|
|
7816
7837
|
{
|
|
7817
|
-
|
|
7838
|
+
d.selectIds && u && ((n = d.selectIds) != null && n.includes(u)) && p.cursorBlur();
|
|
7818
7839
|
const f = [];
|
|
7819
7840
|
o && f.push({
|
|
7820
7841
|
type: w.None,
|
|
7821
7842
|
isLockSentEventCursor: o
|
|
7822
|
-
}),
|
|
7843
|
+
}), d.type === w.Select && (d.selectIds && t.runReverseSelectWork(d.selectIds), f.push({ ...d, scenePath: s })), f.length && this.thread.post({ sp: f }), (a = l.selectIds) != null && a.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(c);
|
|
7823
7844
|
}
|
|
7824
7845
|
break;
|
|
7825
|
-
case
|
|
7846
|
+
case S.PencilEraser:
|
|
7826
7847
|
this.drawPencilEraserFull(
|
|
7827
7848
|
l,
|
|
7828
|
-
|
|
7849
|
+
d,
|
|
7829
7850
|
o,
|
|
7830
7851
|
i.needUndoTicker
|
|
7831
7852
|
), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(c);
|
|
7832
7853
|
break;
|
|
7833
|
-
case
|
|
7854
|
+
case S.BitMapEraser:
|
|
7834
7855
|
this.drawBitMapEraserFull(
|
|
7835
7856
|
l,
|
|
7836
|
-
|
|
7857
|
+
d,
|
|
7837
7858
|
o,
|
|
7838
7859
|
i.needUndoTicker
|
|
7839
7860
|
), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(c);
|
|
7840
7861
|
break;
|
|
7841
|
-
case
|
|
7862
|
+
case S.Eraser:
|
|
7842
7863
|
this.drawEraser(
|
|
7843
|
-
{ ...
|
|
7864
|
+
{ ...d, scenePath: s },
|
|
7844
7865
|
o,
|
|
7845
7866
|
i.needUndoTicker
|
|
7846
7867
|
), l.clearTmpPoints();
|
|
7847
7868
|
break;
|
|
7848
|
-
case
|
|
7849
|
-
case
|
|
7850
|
-
case
|
|
7851
|
-
case
|
|
7852
|
-
case
|
|
7853
|
-
case
|
|
7854
|
-
case
|
|
7855
|
-
case
|
|
7869
|
+
case S.Arrow:
|
|
7870
|
+
case S.Straight:
|
|
7871
|
+
case S.Ellipse:
|
|
7872
|
+
case S.Rectangle:
|
|
7873
|
+
case S.Star:
|
|
7874
|
+
case S.Polygon:
|
|
7875
|
+
case S.SpeechBalloon:
|
|
7876
|
+
case S.Pencil: {
|
|
7856
7877
|
const f = [];
|
|
7857
7878
|
o && f.push({
|
|
7858
7879
|
type: w.None,
|
|
7859
7880
|
isLockSentEventCursor: o
|
|
7860
|
-
}),
|
|
7881
|
+
}), d && (f.push(d), this.fullWorkerDrawCount = 0, i.needUndoTicker && f.push({
|
|
7861
7882
|
type: w.None,
|
|
7862
7883
|
needUndoTicker: i.needUndoTicker
|
|
7863
7884
|
}), this.thread.post({
|
|
@@ -7981,13 +8002,13 @@ class ao {
|
|
|
7981
8002
|
);
|
|
7982
8003
|
}
|
|
7983
8004
|
async animationDraw() {
|
|
7984
|
-
var e, s, o, r, n, a, c, l, h, p,
|
|
8005
|
+
var e, s, o, r, n, a, c, l, h, p, u, d, f, m, g, v, k, I, L, C, N;
|
|
7985
8006
|
this.animationId = void 0;
|
|
7986
8007
|
let i = !1;
|
|
7987
8008
|
const t = /* @__PURE__ */ new Map();
|
|
7988
8009
|
for (const [R, P] of this.workShapes.entries())
|
|
7989
8010
|
switch (P.toolsType) {
|
|
7990
|
-
case
|
|
8011
|
+
case S.BackgroundSVG: {
|
|
7991
8012
|
(e = P.node) == null || e.consumeService({
|
|
7992
8013
|
isFullWork: !0,
|
|
7993
8014
|
replaceId: R
|
|
@@ -7997,7 +8018,7 @@ class ao {
|
|
|
7997
8018
|
}), this.workShapes.delete(R);
|
|
7998
8019
|
break;
|
|
7999
8020
|
}
|
|
8000
|
-
case
|
|
8021
|
+
case S.Image: {
|
|
8001
8022
|
await ((s = P.node) == null ? void 0 : s.consumeServiceAsync({
|
|
8002
8023
|
isFullWork: !0,
|
|
8003
8024
|
worker: this
|
|
@@ -8007,7 +8028,7 @@ class ao {
|
|
|
8007
8028
|
}), this.workShapes.delete(R);
|
|
8008
8029
|
break;
|
|
8009
8030
|
}
|
|
8010
|
-
case
|
|
8031
|
+
case S.Text: {
|
|
8011
8032
|
P.node && (await ((o = P.node) == null ? void 0 : o.consumeServiceAsync({
|
|
8012
8033
|
isFullWork: !0,
|
|
8013
8034
|
replaceId: R,
|
|
@@ -8018,13 +8039,13 @@ class ao {
|
|
|
8018
8039
|
}), (r = P.node) == null || r.clearTmpPoints(), this.workShapes.delete(R));
|
|
8019
8040
|
break;
|
|
8020
8041
|
}
|
|
8021
|
-
case
|
|
8022
|
-
case
|
|
8023
|
-
case
|
|
8024
|
-
case
|
|
8025
|
-
case
|
|
8026
|
-
case
|
|
8027
|
-
case
|
|
8042
|
+
case S.Arrow:
|
|
8043
|
+
case S.Straight:
|
|
8044
|
+
case S.Rectangle:
|
|
8045
|
+
case S.Ellipse:
|
|
8046
|
+
case S.Star:
|
|
8047
|
+
case S.Polygon:
|
|
8048
|
+
case S.SpeechBalloon: {
|
|
8028
8049
|
const M = !!P.ops;
|
|
8029
8050
|
if ((n = P.animationWorkData) != null && n.length) {
|
|
8030
8051
|
const D = P.oldRect;
|
|
@@ -8045,11 +8066,11 @@ class ao {
|
|
|
8045
8066
|
}
|
|
8046
8067
|
break;
|
|
8047
8068
|
}
|
|
8048
|
-
case
|
|
8069
|
+
case S.Pencil: {
|
|
8049
8070
|
if (P.useAnimation) {
|
|
8050
8071
|
if (P.useAnimation) {
|
|
8051
8072
|
if (P.isDel) {
|
|
8052
|
-
(
|
|
8073
|
+
(v = P.node) == null || v.clearTmpPoints(), this.workShapes.delete(R);
|
|
8053
8074
|
break;
|
|
8054
8075
|
}
|
|
8055
8076
|
const M = 3, D = this.computNextAnimationIndex(
|
|
@@ -8058,16 +8079,16 @@ class ao {
|
|
|
8058
8079
|
), B = P.isDiff ? 0 : Math.max(0, (P.animationIndex || 0) - M), F = (P.animationWorkData || []).slice(
|
|
8059
8080
|
B,
|
|
8060
8081
|
D
|
|
8061
|
-
), U = (
|
|
8082
|
+
), U = (I = (k = P.node) == null ? void 0 : k.getWorkId()) == null ? void 0 : I.toString();
|
|
8062
8083
|
if ((P.animationIndex || 0) < D || P.isDiff) {
|
|
8063
8084
|
if ((L = P.node) == null || L.consumeService({
|
|
8064
8085
|
op: F,
|
|
8065
8086
|
isFullWork: !1
|
|
8066
8087
|
}), P.animationIndex = D, P.isDiff && (P.isDiff = !1), F.length && P.isEnableCursor) {
|
|
8067
|
-
const
|
|
8088
|
+
const H = F.slice(-3, -1);
|
|
8068
8089
|
t.set(R, {
|
|
8069
8090
|
workState: B === 0 ? A.Start : D === ((C = P.animationWorkData) == null ? void 0 : C.length) ? A.Done : A.Doing,
|
|
8070
|
-
op:
|
|
8091
|
+
op: H
|
|
8071
8092
|
});
|
|
8072
8093
|
}
|
|
8073
8094
|
} else P.ops && ((N = P.node) == null || N.consumeService({
|
|
@@ -8087,8 +8108,8 @@ class ao {
|
|
|
8087
8108
|
op: P.animationWorkData || [],
|
|
8088
8109
|
isFullWork: M,
|
|
8089
8110
|
replaceId: R
|
|
8090
|
-
}), (
|
|
8091
|
-
if (!P.isEnableCursor && ((
|
|
8111
|
+
}), (u = P.node) == null || u.updataOptService(P.updateNodeOpt), M) {
|
|
8112
|
+
if (!P.isEnableCursor && ((d = P.updateNodeOpt) != null && d.useAnimation) && ((f = P.animationWorkData) != null && f.length)) {
|
|
8092
8113
|
const D = P.animationWorkData.slice(-3, -1);
|
|
8093
8114
|
t.set(R, {
|
|
8094
8115
|
workState: A.Done,
|
|
@@ -8126,13 +8147,13 @@ class ao {
|
|
|
8126
8147
|
if (t.length < s)
|
|
8127
8148
|
return !0;
|
|
8128
8149
|
switch (e) {
|
|
8129
|
-
case
|
|
8150
|
+
case S.Pencil: {
|
|
8130
8151
|
for (let o = 0; o < s; o += 3)
|
|
8131
8152
|
if (t[o] !== i[o] || t[o + 1] !== i[o + 1])
|
|
8132
8153
|
return !0;
|
|
8133
8154
|
break;
|
|
8134
8155
|
}
|
|
8135
|
-
case
|
|
8156
|
+
case S.LaserPen: {
|
|
8136
8157
|
for (let o = 0; o < s; o += 2)
|
|
8137
8158
|
if (t[o] !== i[o] || t[o + 1] !== i[o + 1])
|
|
8138
8159
|
return !0;
|
|
@@ -8142,7 +8163,7 @@ class ao {
|
|
|
8142
8163
|
return !1;
|
|
8143
8164
|
}
|
|
8144
8165
|
activeWorkShape(i) {
|
|
8145
|
-
var f, m, g,
|
|
8166
|
+
var f, m, g, v;
|
|
8146
8167
|
const {
|
|
8147
8168
|
workId: t,
|
|
8148
8169
|
opt: e,
|
|
@@ -8157,9 +8178,9 @@ class ao {
|
|
|
8157
8178
|
} = i;
|
|
8158
8179
|
if (!t)
|
|
8159
8180
|
return;
|
|
8160
|
-
const p = t.toString(),
|
|
8181
|
+
const p = t.toString(), u = (f = this.vNodes.get(p)) == null ? void 0 : f.rect;
|
|
8161
8182
|
if (!((m = this.workShapes) != null && m.has(p))) {
|
|
8162
|
-
let
|
|
8183
|
+
let k = {
|
|
8163
8184
|
toolsType: s,
|
|
8164
8185
|
animationWorkData: a || [],
|
|
8165
8186
|
animationIndex: 0,
|
|
@@ -8167,32 +8188,32 @@ class ao {
|
|
|
8167
8188
|
updateNodeOpt: r,
|
|
8168
8189
|
ops: n,
|
|
8169
8190
|
useAnimation: typeof c < "u" ? c : typeof (r == null ? void 0 : r.useAnimation) < "u" ? r == null ? void 0 : r.useAnimation : !0,
|
|
8170
|
-
oldRect:
|
|
8191
|
+
oldRect: u,
|
|
8171
8192
|
isDiff: !1,
|
|
8172
8193
|
imageBitmap: l,
|
|
8173
8194
|
isEnableCursor: h
|
|
8174
8195
|
};
|
|
8175
|
-
s && e && (
|
|
8196
|
+
s && e && (k = this.setNodeKey(p, k, s, e)), (g = this.workShapes) == null || g.set(p, k);
|
|
8176
8197
|
}
|
|
8177
|
-
const
|
|
8178
|
-
|
|
8179
|
-
|
|
8198
|
+
const d = (v = this.workShapes) == null ? void 0 : v.get(p);
|
|
8199
|
+
d.isEnableCursor = h, o && (d.type = o), n && (d.animationWorkData = yt(n), d.ops = n), r && (d.updateNodeOpt = r), a && (d.isDiff = this.hasDiffData(
|
|
8200
|
+
d.animationWorkData || [],
|
|
8180
8201
|
a,
|
|
8181
|
-
|
|
8182
|
-
),
|
|
8202
|
+
d.toolsType
|
|
8203
|
+
), d.animationWorkData = a), d.node && d.node.getWorkId() !== p && d.node.setWorkId(p), u && (d.oldRect = u), s && e && (e.syncUnitTime && (this.syncUnitTime = e.syncUnitTime), d.toolsType !== s && s && e && this.setNodeKey(p, d, s, e), d.node && d.node.setWorkOptions(e)), l && (d.imageBitmap = l);
|
|
8183
8204
|
}
|
|
8184
8205
|
removeNode(i, t) {
|
|
8185
8206
|
i.indexOf(X) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(i).forEach((s) => {
|
|
8186
|
-
s.remove(),
|
|
8207
|
+
s.remove(), V(s, this.thread.fullLayer.parent);
|
|
8187
8208
|
}), this.thread.serviceLayer.getElementsByName(i).forEach((s) => {
|
|
8188
|
-
s.remove(),
|
|
8209
|
+
s.remove(), V(s, this.thread.serviceLayer.parent);
|
|
8189
8210
|
});
|
|
8190
8211
|
const e = this.vNodes.get(i);
|
|
8191
|
-
e && e.toolsType ===
|
|
8212
|
+
e && e.toolsType === S.BackgroundSVG && this.thread.post({
|
|
8192
8213
|
sp: [
|
|
8193
8214
|
{
|
|
8194
8215
|
type: w.BackgroundSVGDelete,
|
|
8195
|
-
toolsType:
|
|
8216
|
+
toolsType: S.BackgroundSVG,
|
|
8196
8217
|
workId: i,
|
|
8197
8218
|
dataType: x.Service,
|
|
8198
8219
|
viewId: this.thread.viewId
|
|
@@ -8297,7 +8318,7 @@ class lo extends rt {
|
|
|
8297
8318
|
const { param: e, postData: s, newServiceStore: o } = t, { willSyncService: r, isSync: n, textUpdateForWoker: a, needUndoTicker: c } = e, l = s.sp || [];
|
|
8298
8319
|
if (r)
|
|
8299
8320
|
for (const [h, p] of o.entries())
|
|
8300
|
-
a && p.toolsType ===
|
|
8321
|
+
a && p.toolsType === S.Text ? l.push({
|
|
8301
8322
|
...p,
|
|
8302
8323
|
workId: h,
|
|
8303
8324
|
type: w.TextUpdate,
|
|
@@ -8351,7 +8372,7 @@ class ho extends rt {
|
|
|
8351
8372
|
const { param: e, postData: s, newServiceStore: o } = t, { willSyncService: r, isSync: n } = e, a = s.sp || [];
|
|
8352
8373
|
if (r && a)
|
|
8353
8374
|
for (const [c, l] of o.entries())
|
|
8354
|
-
l.toolsType ===
|
|
8375
|
+
l.toolsType === S.BackgroundSVG && a.push({
|
|
8355
8376
|
...l,
|
|
8356
8377
|
workId: c,
|
|
8357
8378
|
type: w.BackgroundSVGUpdate,
|
|
@@ -8384,7 +8405,7 @@ class po extends rt {
|
|
|
8384
8405
|
return await this.consumeForLocalWorker(t), !0;
|
|
8385
8406
|
}
|
|
8386
8407
|
async consumeForLocalWorker(t) {
|
|
8387
|
-
var p,
|
|
8408
|
+
var p, u;
|
|
8388
8409
|
const {
|
|
8389
8410
|
workId: e,
|
|
8390
8411
|
updateNodeOpt: s,
|
|
@@ -8407,7 +8428,7 @@ class po extends rt {
|
|
|
8407
8428
|
callback: this.updateSelectorCallback,
|
|
8408
8429
|
smoothSync: l,
|
|
8409
8430
|
needUndoTicker: h
|
|
8410
|
-
})) : s.workState === A.Done && ((
|
|
8431
|
+
})) : s.workState === A.Done && ((u = this.localWork) == null || u.vNodes.deleteLastTarget()));
|
|
8411
8432
|
}
|
|
8412
8433
|
updateSelectorCallback(t) {
|
|
8413
8434
|
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n, smoothSync: a } = t, {
|
|
@@ -8415,9 +8436,9 @@ class po extends rt {
|
|
|
8415
8436
|
isSync: l,
|
|
8416
8437
|
updateSelectorOpt: h,
|
|
8417
8438
|
textUpdateForWoker: p,
|
|
8418
|
-
needUndoTicker:
|
|
8419
|
-
} = e,
|
|
8420
|
-
if (
|
|
8439
|
+
needUndoTicker: u
|
|
8440
|
+
} = e, d = h.workState, f = s.sp || [];
|
|
8441
|
+
if (d === A.Start)
|
|
8421
8442
|
return {
|
|
8422
8443
|
sp: [],
|
|
8423
8444
|
render: []
|
|
@@ -8428,41 +8449,41 @@ class po extends rt {
|
|
|
8428
8449
|
type: w.Select,
|
|
8429
8450
|
selectIds: r.selectIds,
|
|
8430
8451
|
selectRect: m,
|
|
8431
|
-
willSyncService:
|
|
8452
|
+
willSyncService: d === A.Done ? !0 : a,
|
|
8432
8453
|
isSync: !0,
|
|
8433
|
-
points:
|
|
8454
|
+
points: d === A.Done && r.getChildrenPoints() || void 0,
|
|
8434
8455
|
textOpt: r.textOpt
|
|
8435
8456
|
});
|
|
8436
8457
|
const g = {
|
|
8437
8458
|
useAnimation: h.useAnimation || !1
|
|
8438
8459
|
};
|
|
8439
8460
|
h.uid && (g.uid = h.uid);
|
|
8440
|
-
for (const [
|
|
8441
|
-
|
|
8442
|
-
...
|
|
8443
|
-
workId:
|
|
8461
|
+
for (const [v, k] of o.entries())
|
|
8462
|
+
k.toolsType === S.BackgroundSVG && f.push({
|
|
8463
|
+
...k,
|
|
8464
|
+
workId: v,
|
|
8444
8465
|
type: w.BackgroundSVGUpdate,
|
|
8445
8466
|
dataType: x.Local,
|
|
8446
|
-
willSyncService:
|
|
8467
|
+
willSyncService: d === A.Done ? !0 : a,
|
|
8447
8468
|
updateNodeOpt: g
|
|
8448
|
-
}), p &&
|
|
8449
|
-
...
|
|
8450
|
-
workId:
|
|
8469
|
+
}), p && k.toolsType === S.Text ? f.push({
|
|
8470
|
+
...k,
|
|
8471
|
+
workId: v,
|
|
8451
8472
|
type: w.TextUpdate,
|
|
8452
8473
|
dataType: x.Local,
|
|
8453
|
-
willSyncService:
|
|
8474
|
+
willSyncService: d === A.Done ? !0 : a,
|
|
8454
8475
|
updateNodeOpt: g
|
|
8455
|
-
}) : (a ||
|
|
8456
|
-
...
|
|
8457
|
-
workId:
|
|
8476
|
+
}) : (a || d === A.Done) && f.push({
|
|
8477
|
+
...k,
|
|
8478
|
+
workId: v,
|
|
8458
8479
|
type: w.UpdateNode,
|
|
8459
8480
|
updateNodeOpt: g,
|
|
8460
8481
|
isSync: l
|
|
8461
8482
|
});
|
|
8462
8483
|
}
|
|
8463
|
-
return
|
|
8484
|
+
return u && f.push({
|
|
8464
8485
|
type: w.None,
|
|
8465
|
-
needUndoTicker:
|
|
8486
|
+
needUndoTicker: u
|
|
8466
8487
|
}), {
|
|
8467
8488
|
sp: f
|
|
8468
8489
|
};
|
|
@@ -8499,17 +8520,17 @@ class uo extends rt {
|
|
|
8499
8520
|
}));
|
|
8500
8521
|
}
|
|
8501
8522
|
updateSelectorCallback(t) {
|
|
8502
|
-
const { param: e, postData: s, workShapeNode: o, res: r, newServiceStore: n, smoothSync: a } = t, { updateSelectorOpt: c, willSyncService: l, needUndoTicker: h } = e, p = c.workState,
|
|
8523
|
+
const { param: e, postData: s, workShapeNode: o, res: r, newServiceStore: n, smoothSync: a } = t, { updateSelectorOpt: c, willSyncService: l, needUndoTicker: h } = e, p = c.workState, u = s.sp || [], d = r == null ? void 0 : r.selectRect;
|
|
8503
8524
|
if (p === A.Start)
|
|
8504
8525
|
return {
|
|
8505
8526
|
sp: [],
|
|
8506
8527
|
render: []
|
|
8507
8528
|
};
|
|
8508
8529
|
if (l) {
|
|
8509
|
-
|
|
8530
|
+
u.push({
|
|
8510
8531
|
type: w.Select,
|
|
8511
8532
|
selectIds: o.selectIds,
|
|
8512
|
-
selectRect:
|
|
8533
|
+
selectRect: d,
|
|
8513
8534
|
willSyncService: p === A.Done ? !0 : a,
|
|
8514
8535
|
isSync: !0,
|
|
8515
8536
|
points: p === A.Done && o.getChildrenPoints() || void 0,
|
|
@@ -8520,21 +8541,21 @@ class uo extends rt {
|
|
|
8520
8541
|
};
|
|
8521
8542
|
c.uid && (f.uid = c.uid);
|
|
8522
8543
|
for (const [m, g] of n.entries())
|
|
8523
|
-
g.toolsType ===
|
|
8544
|
+
g.toolsType === S.BackgroundSVG && u.push({
|
|
8524
8545
|
...g,
|
|
8525
8546
|
workId: m,
|
|
8526
8547
|
type: w.BackgroundSVGUpdate,
|
|
8527
8548
|
dataType: x.Local,
|
|
8528
8549
|
willSyncService: p === A.Done ? !0 : a,
|
|
8529
8550
|
updateNodeOpt: f
|
|
8530
|
-
}), g.toolsType ===
|
|
8551
|
+
}), g.toolsType === S.Text ? u.push({
|
|
8531
8552
|
...g,
|
|
8532
8553
|
workId: m,
|
|
8533
8554
|
type: w.TextUpdate,
|
|
8534
8555
|
dataType: x.Local,
|
|
8535
8556
|
willSyncService: p === A.Done ? !0 : a,
|
|
8536
8557
|
updateNodeOpt: f
|
|
8537
|
-
}) : (a || p === A.Done) &&
|
|
8558
|
+
}) : (a || p === A.Done) && u.push({
|
|
8538
8559
|
...g,
|
|
8539
8560
|
workId: m,
|
|
8540
8561
|
type: w.UpdateNode,
|
|
@@ -8542,11 +8563,11 @@ class uo extends rt {
|
|
|
8542
8563
|
isSync: !0
|
|
8543
8564
|
});
|
|
8544
8565
|
}
|
|
8545
|
-
return h &&
|
|
8566
|
+
return h && u.push({
|
|
8546
8567
|
type: w.None,
|
|
8547
8568
|
needUndoTicker: h
|
|
8548
8569
|
}), {
|
|
8549
|
-
sp:
|
|
8570
|
+
sp: u
|
|
8550
8571
|
};
|
|
8551
8572
|
}
|
|
8552
8573
|
}
|
|
@@ -8590,33 +8611,33 @@ class fo extends rt {
|
|
|
8590
8611
|
willSyncService: l,
|
|
8591
8612
|
willSerializeData: h,
|
|
8592
8613
|
isSync: p,
|
|
8593
|
-
needUndoTicker:
|
|
8594
|
-
} = e,
|
|
8614
|
+
needUndoTicker: u
|
|
8615
|
+
} = e, d = c.workState, f = s.sp || [], m = r == null ? void 0 : r.selectRect;
|
|
8595
8616
|
if (l) {
|
|
8596
|
-
h &&
|
|
8617
|
+
h && d === A.Done && f.push({
|
|
8597
8618
|
type: w.Select,
|
|
8598
8619
|
selectIds: o.selectIds,
|
|
8599
8620
|
selectRect: m,
|
|
8600
|
-
willSyncService:
|
|
8621
|
+
willSyncService: d === A.Done ? !0 : a,
|
|
8601
8622
|
isSync: p,
|
|
8602
8623
|
points: o.getChildrenPoints()
|
|
8603
8624
|
});
|
|
8604
8625
|
const g = {
|
|
8605
8626
|
useAnimation: c.useAnimation || !1
|
|
8606
8627
|
};
|
|
8607
|
-
if (c.uid && (g.uid = c.uid), a ||
|
|
8608
|
-
for (const [
|
|
8628
|
+
if (c.uid && (g.uid = c.uid), a || d === A.Done)
|
|
8629
|
+
for (const [v, k] of n.entries())
|
|
8609
8630
|
f.push({
|
|
8610
|
-
...
|
|
8611
|
-
workId:
|
|
8631
|
+
...k,
|
|
8632
|
+
workId: v,
|
|
8612
8633
|
type: w.UpdateNode,
|
|
8613
8634
|
updateNodeOpt: g,
|
|
8614
8635
|
isSync: p
|
|
8615
8636
|
});
|
|
8616
8637
|
}
|
|
8617
|
-
return
|
|
8638
|
+
return u && f.push({
|
|
8618
8639
|
type: w.None,
|
|
8619
|
-
needUndoTicker:
|
|
8640
|
+
needUndoTicker: u
|
|
8620
8641
|
}), {
|
|
8621
8642
|
sp: f
|
|
8622
8643
|
};
|
|
@@ -8652,26 +8673,26 @@ class mo extends rt {
|
|
|
8652
8673
|
}));
|
|
8653
8674
|
}
|
|
8654
8675
|
updateSelectorCallback(t) {
|
|
8655
|
-
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n } = t, { willSyncService: a, isSync: c, updateSelectorOpt: l, textUpdateForWoker: h } = e, p = s.sp || [],
|
|
8676
|
+
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n } = t, { willSyncService: a, isSync: c, updateSelectorOpt: l, textUpdateForWoker: h } = e, p = s.sp || [], u = n == null ? void 0 : n.selectRect;
|
|
8656
8677
|
if (a && p) {
|
|
8657
8678
|
l.fontSize && p.push({
|
|
8658
8679
|
type: w.Select,
|
|
8659
8680
|
selectIds: r.selectIds,
|
|
8660
|
-
selectRect:
|
|
8681
|
+
selectRect: u,
|
|
8661
8682
|
willSyncService: a,
|
|
8662
8683
|
isSync: c,
|
|
8663
8684
|
points: r.getChildrenPoints()
|
|
8664
8685
|
});
|
|
8665
|
-
for (const [
|
|
8666
|
-
h && f.toolsType ===
|
|
8686
|
+
for (const [d, f] of o.entries())
|
|
8687
|
+
h && f.toolsType === S.Text ? p.push({
|
|
8667
8688
|
...f,
|
|
8668
|
-
workId:
|
|
8689
|
+
workId: d,
|
|
8669
8690
|
type: w.TextUpdate,
|
|
8670
8691
|
dataType: x.Local,
|
|
8671
8692
|
willSyncService: !0
|
|
8672
8693
|
}) : p.push({
|
|
8673
8694
|
...f,
|
|
8674
|
-
workId:
|
|
8695
|
+
workId: d,
|
|
8675
8696
|
type: w.UpdateNode,
|
|
8676
8697
|
updateNodeOpt: {
|
|
8677
8698
|
useAnimation: !1
|
|
@@ -8720,10 +8741,10 @@ class yo extends rt {
|
|
|
8720
8741
|
updateSelectorCallback(t) {
|
|
8721
8742
|
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n } = t, { willSyncService: a, isSync: c, needUndoTicker: l } = e, h = s.sp || [], p = n == null ? void 0 : n.selectRect;
|
|
8722
8743
|
if (a && h) {
|
|
8723
|
-
for (const [
|
|
8744
|
+
for (const [u, d] of o.entries())
|
|
8724
8745
|
h.push({
|
|
8725
|
-
...
|
|
8726
|
-
workId:
|
|
8746
|
+
...d,
|
|
8747
|
+
workId: u,
|
|
8727
8748
|
type: w.UpdateNode,
|
|
8728
8749
|
updateNodeOpt: {
|
|
8729
8750
|
useAnimation: !1
|
|
@@ -8777,12 +8798,12 @@ class wo extends rt {
|
|
|
8777
8798
|
}));
|
|
8778
8799
|
}
|
|
8779
8800
|
updateSelectorCallback(t) {
|
|
8780
|
-
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n } = t, { willSyncService: a, isSync: c, updateSelectorOpt: l, needUndoTicker: h } = e, p = s.sp || [],
|
|
8801
|
+
const { param: e, postData: s, newServiceStore: o, workShapeNode: r, res: n } = t, { willSyncService: a, isSync: c, updateSelectorOpt: l, needUndoTicker: h } = e, p = s.sp || [], u = n == null ? void 0 : n.selectRect;
|
|
8781
8802
|
if (a && p) {
|
|
8782
|
-
for (const [
|
|
8803
|
+
for (const [d, f] of o.entries())
|
|
8783
8804
|
p.push({
|
|
8784
8805
|
...f,
|
|
8785
|
-
workId:
|
|
8806
|
+
workId: d,
|
|
8786
8807
|
type: w.UpdateNode,
|
|
8787
8808
|
updateNodeOpt: {
|
|
8788
8809
|
useAnimation: !1
|
|
@@ -8796,7 +8817,7 @@ class wo extends rt {
|
|
|
8796
8817
|
canRotate: r.canRotate,
|
|
8797
8818
|
type: w.Select,
|
|
8798
8819
|
selectIds: r.selectIds,
|
|
8799
|
-
selectRect:
|
|
8820
|
+
selectRect: u,
|
|
8800
8821
|
willSyncService: a,
|
|
8801
8822
|
isSync: c
|
|
8802
8823
|
});
|
|
@@ -9009,8 +9030,8 @@ class So {
|
|
|
9009
9030
|
zt(i.dpr) && this.updateDpr(i.dpr);
|
|
9010
9031
|
break;
|
|
9011
9032
|
case w.AuthClear: {
|
|
9012
|
-
const { clearUids:
|
|
9013
|
-
this.vNodes.setCanClearUids(
|
|
9033
|
+
const { clearUids: u, localUid: d } = i;
|
|
9034
|
+
this.vNodes.setCanClearUids(u), this.vNodes.setLocalUid(d);
|
|
9014
9035
|
break;
|
|
9015
9036
|
}
|
|
9016
9037
|
case w.Destroy:
|
|
@@ -9024,11 +9045,11 @@ class So {
|
|
|
9024
9045
|
break;
|
|
9025
9046
|
case w.UpdateTools:
|
|
9026
9047
|
if (e && s) {
|
|
9027
|
-
const
|
|
9048
|
+
const u = {
|
|
9028
9049
|
toolsType: e,
|
|
9029
9050
|
toolsOpt: s
|
|
9030
9051
|
};
|
|
9031
|
-
this.topWork.canUseTopLayer(e) ? this.topWork.setToolsOpt(
|
|
9052
|
+
this.topWork.canUseTopLayer(e) ? this.topWork.setToolsOpt(u) : this.localWork.setToolsOpt(u);
|
|
9032
9053
|
}
|
|
9033
9054
|
break;
|
|
9034
9055
|
case w.CreateWork:
|
|
@@ -9047,7 +9068,7 @@ class So {
|
|
|
9047
9068
|
}
|
|
9048
9069
|
break;
|
|
9049
9070
|
case w.DrawWork:
|
|
9050
|
-
n === A.Done && o === x.Local ? (this.consumeDrawAll(o, i), e ===
|
|
9071
|
+
n === A.Done && o === x.Local ? (this.consumeDrawAll(o, i), e === S.LaserPen && h && this.post({
|
|
9051
9072
|
sp: [
|
|
9052
9073
|
{
|
|
9053
9074
|
type: w.None,
|
|
@@ -9081,28 +9102,28 @@ class So {
|
|
|
9081
9102
|
break;
|
|
9082
9103
|
case w.GetImageBitMap:
|
|
9083
9104
|
if (a && c && r) {
|
|
9084
|
-
const
|
|
9085
|
-
this.deleteCachedImagesByWorkId(
|
|
9105
|
+
const u = r.toString();
|
|
9106
|
+
this.deleteCachedImagesByWorkId(u), this.cacheImages.set(a, {
|
|
9086
9107
|
imageBitmap: c,
|
|
9087
|
-
workId:
|
|
9108
|
+
workId: u
|
|
9088
9109
|
});
|
|
9089
|
-
const
|
|
9090
|
-
if (
|
|
9091
|
-
const { resolve: f, timer: m } =
|
|
9110
|
+
const d = this.imageResolveMap.get(a);
|
|
9111
|
+
if (d) {
|
|
9112
|
+
const { resolve: f, timer: m } = d;
|
|
9092
9113
|
m && clearTimeout(m), f && f(a);
|
|
9093
9114
|
}
|
|
9094
9115
|
}
|
|
9095
9116
|
break;
|
|
9096
9117
|
case w.GetVNodeInfo:
|
|
9097
9118
|
if (r && l) {
|
|
9098
|
-
const
|
|
9119
|
+
const u = l.map((d) => this.vNodes.get(d));
|
|
9099
9120
|
this.post({
|
|
9100
9121
|
sp: [
|
|
9101
9122
|
{
|
|
9102
9123
|
type: w.GetVNodeInfo,
|
|
9103
9124
|
dataType: x.Local,
|
|
9104
9125
|
workId: r,
|
|
9105
|
-
vInfo:
|
|
9126
|
+
vInfo: u
|
|
9106
9127
|
}
|
|
9107
9128
|
]
|
|
9108
9129
|
});
|
|
@@ -9117,7 +9138,7 @@ class So {
|
|
|
9117
9138
|
}
|
|
9118
9139
|
async loadImageBitMap(i) {
|
|
9119
9140
|
const { toolsType: t, opt: e, workId: s } = i;
|
|
9120
|
-
if (t ===
|
|
9141
|
+
if (t === S.Image && e && s) {
|
|
9121
9142
|
const o = s.toString(), { src: r, type: n, width: a, height: c, strokeColor: l } = e;
|
|
9122
9143
|
if (!r || !n || !a || !c)
|
|
9123
9144
|
return;
|
|
@@ -9136,7 +9157,7 @@ class So {
|
|
|
9136
9157
|
if (f)
|
|
9137
9158
|
return f;
|
|
9138
9159
|
}
|
|
9139
|
-
const
|
|
9160
|
+
const d = await new Promise((f) => {
|
|
9140
9161
|
const m = this.imageResolveMap.get(h) || {
|
|
9141
9162
|
resolve: void 0,
|
|
9142
9163
|
timer: void 0
|
|
@@ -9157,7 +9178,7 @@ class So {
|
|
|
9157
9178
|
]
|
|
9158
9179
|
});
|
|
9159
9180
|
});
|
|
9160
|
-
return this.imageResolveMap.delete(
|
|
9181
|
+
return this.imageResolveMap.delete(d), this.getCachedImages(h);
|
|
9161
9182
|
}
|
|
9162
9183
|
}
|
|
9163
9184
|
async removeNode(i) {
|
|
@@ -9260,12 +9281,12 @@ class So {
|
|
|
9260
9281
|
let c = !1;
|
|
9261
9282
|
for (const [l, h] of this.localWork.getWorkShapes().entries())
|
|
9262
9283
|
switch (h.toolsType) {
|
|
9263
|
-
case
|
|
9264
|
-
case
|
|
9265
|
-
case
|
|
9266
|
-
case
|
|
9267
|
-
case
|
|
9268
|
-
case
|
|
9284
|
+
case S.Text:
|
|
9285
|
+
case S.BitMapEraser:
|
|
9286
|
+
case S.PencilEraser:
|
|
9287
|
+
case S.Eraser:
|
|
9288
|
+
case S.Selector:
|
|
9289
|
+
case S.LaserPen:
|
|
9269
9290
|
break;
|
|
9270
9291
|
default:
|
|
9271
9292
|
l !== bt && l !== X && (c = !0);
|
|
@@ -9279,7 +9300,7 @@ class So {
|
|
|
9279
9300
|
}
|
|
9280
9301
|
}
|
|
9281
9302
|
const o = /* @__PURE__ */ new Map();
|
|
9282
|
-
for (const [c, l] of this.vNodes.getNodesByType(
|
|
9303
|
+
for (const [c, l] of this.vNodes.getNodesByType(S.Text).entries()) {
|
|
9283
9304
|
const h = l.rect;
|
|
9284
9305
|
o.set(c, be(h));
|
|
9285
9306
|
}
|
|
@@ -9308,11 +9329,11 @@ class So {
|
|
|
9308
9329
|
for (const [c, l] of o.entries()) {
|
|
9309
9330
|
const h = this.vNodes.get(c);
|
|
9310
9331
|
if (h) {
|
|
9311
|
-
const p = l,
|
|
9332
|
+
const p = l, u = h.rect, d = this.getSceneRect(), f = Rt(p, d), m = Rt(u, d);
|
|
9312
9333
|
let g = !1;
|
|
9313
|
-
if ((f !== m || p.w !==
|
|
9314
|
-
const { toolsType:
|
|
9315
|
-
|
|
9334
|
+
if ((f !== m || p.w !== u.w || p.h !== u.h || m === Vt.intersect) && (g = !0), g) {
|
|
9335
|
+
const { toolsType: v } = h;
|
|
9336
|
+
v === S.Text && this.debounceUpdateCache.add(c);
|
|
9316
9337
|
}
|
|
9317
9338
|
}
|
|
9318
9339
|
}
|
|
@@ -9334,10 +9355,10 @@ class So {
|
|
|
9334
9355
|
const c = [];
|
|
9335
9356
|
for (const h of this.debounceUpdateCache.values()) {
|
|
9336
9357
|
if ((l = this.fullLayer) == null ? void 0 : l.getElementsByName(h)[0]) {
|
|
9337
|
-
const
|
|
9338
|
-
if (
|
|
9339
|
-
const { toolsType:
|
|
9340
|
-
toolsType:
|
|
9358
|
+
const u = this.vNodes.get(h);
|
|
9359
|
+
if (u) {
|
|
9360
|
+
const { toolsType: d, opt: f } = u, m = this.localWork.setFullWork({
|
|
9361
|
+
toolsType: d,
|
|
9341
9362
|
opt: f,
|
|
9342
9363
|
workId: h
|
|
9343
9364
|
});
|
|
@@ -9400,7 +9421,7 @@ class So {
|
|
|
9400
9421
|
this.fullLayer.parent.setAttribute("width", t), this.fullLayer.parent.setAttribute("height", e), this.fullLayer.setAttribute("size", [t, e]), this.fullLayer.setAttribute("pos", [t * 0.5, e * 0.5]), this.topLayer.parent.setAttribute("width", t), this.topLayer.parent.setAttribute("height", e), this.topLayer.setAttribute("size", [t, e]), this.topLayer.setAttribute("pos", [t * 0.5, e * 0.5]), this.localLayer.parent.setAttribute("width", t), this.localLayer.parent.setAttribute("height", e), this.localLayer.setAttribute("size", [t, e]), this.localLayer.setAttribute("pos", [t * 0.5, e * 0.5]), this.serviceLayer.parent.setAttribute("width", t), this.serviceLayer.parent.setAttribute("height", e), this.serviceLayer.setAttribute("size", [t, e]), this.serviceLayer.setAttribute("pos", [t * 0.5, e * 0.5]);
|
|
9401
9422
|
}
|
|
9402
9423
|
destroy() {
|
|
9403
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(),
|
|
9424
|
+
this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), V(this.fullLayer, this.fullLayer.parent), this.topLayer.remove(), V(this.topLayer, this.topLayer.parent), this.localLayer.remove(), V(this.localLayer, this.localLayer.parent), this.serviceLayer.remove(), V(this.serviceLayer, this.serviceLayer.parent), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
|
|
9404
9425
|
}
|
|
9405
9426
|
}
|
|
9406
9427
|
class To {
|
|
@@ -9482,7 +9503,7 @@ class To {
|
|
|
9482
9503
|
}
|
|
9483
9504
|
async loadImageBitMap(i) {
|
|
9484
9505
|
const { toolsType: t, opt: e, workId: s } = i;
|
|
9485
|
-
if (t ===
|
|
9506
|
+
if (t === S.Image && e && s) {
|
|
9486
9507
|
const o = s.toString(), { src: r, type: n, width: a, height: c, strokeColor: l } = e;
|
|
9487
9508
|
if (!r || !n || !a || !c)
|
|
9488
9509
|
return;
|
|
@@ -9501,7 +9522,7 @@ class To {
|
|
|
9501
9522
|
if (f)
|
|
9502
9523
|
return f;
|
|
9503
9524
|
}
|
|
9504
|
-
const
|
|
9525
|
+
const d = await new Promise((f) => {
|
|
9505
9526
|
const m = this.imageResolveMap.get(h) || {
|
|
9506
9527
|
resolve: void 0,
|
|
9507
9528
|
timer: void 0
|
|
@@ -9522,7 +9543,7 @@ class To {
|
|
|
9522
9543
|
]
|
|
9523
9544
|
});
|
|
9524
9545
|
});
|
|
9525
|
-
return this.imageResolveMap.delete(
|
|
9546
|
+
return this.imageResolveMap.delete(d), this.getCachedImages(h);
|
|
9526
9547
|
}
|
|
9527
9548
|
}
|
|
9528
9549
|
createWorkShapeNode(i) {
|
|
@@ -9550,13 +9571,13 @@ class To {
|
|
|
9550
9571
|
if (t) {
|
|
9551
9572
|
let o, r;
|
|
9552
9573
|
const n = (s = t.getWorkId()) == null ? void 0 : s.toString();
|
|
9553
|
-
return t.toolsType ===
|
|
9574
|
+
return t.toolsType === S.BackgroundSVG ? o = t.consumeService({
|
|
9554
9575
|
isFullWork: !0,
|
|
9555
9576
|
replaceId: n
|
|
9556
|
-
}) : t.toolsType ===
|
|
9577
|
+
}) : t.toolsType === S.Image ? o = await t.consumeServiceAsync({
|
|
9557
9578
|
isFullWork: !0,
|
|
9558
9579
|
worker: this
|
|
9559
|
-
}) : t.toolsType ===
|
|
9580
|
+
}) : t.toolsType === S.Text ? o = await t.consumeServiceAsync({
|
|
9560
9581
|
isFullWork: !0,
|
|
9561
9582
|
replaceId: n,
|
|
9562
9583
|
isDrawLabel: !0
|
|
@@ -9748,7 +9769,7 @@ class To {
|
|
|
9748
9769
|
this.fullLayer.parent.setAttribute("width", t), this.fullLayer.parent.setAttribute("height", e), this.fullLayer.setAttribute("size", [t, e]), this.fullLayer.setAttribute("pos", [t * 0.5, e * 0.5]);
|
|
9749
9770
|
}
|
|
9750
9771
|
destroy() {
|
|
9751
|
-
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(),
|
|
9772
|
+
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), V(this.fullLayer, this.fullLayer.parent), this.scene.remove();
|
|
9752
9773
|
}
|
|
9753
9774
|
}
|
|
9754
9775
|
class Oo {
|
|
@@ -9758,11 +9779,15 @@ class Oo {
|
|
|
9758
9779
|
y(this, "master");
|
|
9759
9780
|
y(this, "post", (i) => {
|
|
9760
9781
|
const { fullWorkerDrawCount: t, sp: e, workerTasksqueueCount: s, consumeCount: o } = i;
|
|
9761
|
-
this.master.isBusy &&
|
|
9782
|
+
this.master.isBusy && q(s) && this.master.setWorkerTasksqueueCount(s), q(t) && this.master.setMaxDrawCount(t), q(o) && this.master.setConsumeCount(o), e && this.master.collectorSyncData(e);
|
|
9762
9783
|
});
|
|
9763
9784
|
this.master = i;
|
|
9764
9785
|
}
|
|
9765
9786
|
destroy() {
|
|
9787
|
+
var i;
|
|
9788
|
+
(i = this.snapshotThread) == null || i.destroy(), this.snapshotThread = void 0;
|
|
9789
|
+
for (const t of this.mainThreadMap.values())
|
|
9790
|
+
t.destroy();
|
|
9766
9791
|
this.mainThreadMap.clear();
|
|
9767
9792
|
}
|
|
9768
9793
|
createMainThread(i, t) {
|
|
@@ -9772,82 +9797,85 @@ class Oo {
|
|
|
9772
9797
|
return new To(i, t);
|
|
9773
9798
|
}
|
|
9774
9799
|
async consume(i) {
|
|
9775
|
-
var t, e, s, o;
|
|
9776
|
-
for (const
|
|
9800
|
+
var t, e, s, o, r;
|
|
9801
|
+
for (const n of i.values()) {
|
|
9777
9802
|
const {
|
|
9778
|
-
msgType:
|
|
9779
|
-
viewId:
|
|
9780
|
-
tasksqueue:
|
|
9781
|
-
mainTasksqueueCount:
|
|
9782
|
-
layerOpt:
|
|
9783
|
-
offscreenCanvasOpt:
|
|
9803
|
+
msgType: a,
|
|
9804
|
+
viewId: c,
|
|
9805
|
+
tasksqueue: l,
|
|
9806
|
+
mainTasksqueueCount: h,
|
|
9807
|
+
layerOpt: p,
|
|
9808
|
+
offscreenCanvasOpt: u,
|
|
9784
9809
|
cameraOpt: d,
|
|
9785
|
-
isSubWorker:
|
|
9786
|
-
} =
|
|
9787
|
-
if (
|
|
9810
|
+
isSubWorker: f
|
|
9811
|
+
} = n;
|
|
9812
|
+
if (a === w.Console) {
|
|
9788
9813
|
console.log(this);
|
|
9789
9814
|
continue;
|
|
9790
9815
|
}
|
|
9791
|
-
if (
|
|
9792
|
-
const
|
|
9793
|
-
if (
|
|
9794
|
-
const
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9816
|
+
if (a === w.Init) {
|
|
9817
|
+
const g = (t = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : t.displayer, v = g == null ? void 0 : g.canvasContainerRef.current;
|
|
9818
|
+
if (g && v && p && u) {
|
|
9819
|
+
const k = this.mainThreadMap.get(c);
|
|
9820
|
+
k == null || k.destroy();
|
|
9821
|
+
const I = this.createMainThread(c, {
|
|
9822
|
+
displayer: g,
|
|
9823
|
+
container: v,
|
|
9824
|
+
layerOpt: p,
|
|
9798
9825
|
master: this.master,
|
|
9799
|
-
canvasOpt:
|
|
9826
|
+
canvasOpt: u,
|
|
9800
9827
|
post: this.post
|
|
9801
9828
|
});
|
|
9802
|
-
this.mainThreadMap.set(
|
|
9829
|
+
this.mainThreadMap.set(c, I), I && d && I.setCameraOpt(d);
|
|
9803
9830
|
}
|
|
9804
9831
|
continue;
|
|
9805
9832
|
}
|
|
9806
|
-
if ((
|
|
9807
|
-
const
|
|
9808
|
-
if (
|
|
9809
|
-
|
|
9810
|
-
const
|
|
9833
|
+
if ((a === w.Snapshot || a === w.BoundingBox) && c === ((e = this.master.control.viewContainerManager.mainView) == null ? void 0 : e.id)) {
|
|
9834
|
+
const g = (s = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : s.displayer, v = (o = g.snapshotContainerRef) == null ? void 0 : o.current;
|
|
9835
|
+
if (g && v && d) {
|
|
9836
|
+
(r = this.snapshotThread) == null || r.destroy(), v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
|
|
9837
|
+
const k = {
|
|
9811
9838
|
...de.defaultLayerOpt,
|
|
9812
9839
|
offscreen: !1,
|
|
9813
9840
|
width: d.width,
|
|
9814
9841
|
height: d.height
|
|
9815
|
-
},
|
|
9842
|
+
}, I = {
|
|
9816
9843
|
...de.defaultScreenCanvasOpt,
|
|
9817
9844
|
width: d.width,
|
|
9818
9845
|
height: d.height
|
|
9819
9846
|
};
|
|
9820
|
-
this.snapshotThread = this.createSnapshotThread(
|
|
9821
|
-
displayer:
|
|
9822
|
-
container:
|
|
9823
|
-
layerOpt:
|
|
9847
|
+
this.snapshotThread = this.createSnapshotThread(c, {
|
|
9848
|
+
displayer: g,
|
|
9849
|
+
container: v,
|
|
9850
|
+
layerOpt: k,
|
|
9824
9851
|
master: this.master,
|
|
9825
|
-
canvasOpt:
|
|
9852
|
+
canvasOpt: I,
|
|
9826
9853
|
post: this.post
|
|
9827
|
-
}), this.snapshotThread.on(
|
|
9828
|
-
this.snapshotThread = void 0,
|
|
9854
|
+
}), this.snapshotThread.on(n).then(() => {
|
|
9855
|
+
this.snapshotThread = void 0, v.innerHTML = "", v.style.width = "", v.style.height = "";
|
|
9829
9856
|
});
|
|
9830
9857
|
continue;
|
|
9831
9858
|
}
|
|
9832
9859
|
}
|
|
9833
|
-
if (
|
|
9834
|
-
this.snapshotThread.on(
|
|
9860
|
+
if (a === w.GetImageBitMap && f && this.snapshotThread) {
|
|
9861
|
+
this.snapshotThread.on(n);
|
|
9835
9862
|
continue;
|
|
9836
9863
|
}
|
|
9837
|
-
if (
|
|
9838
|
-
for (const [
|
|
9839
|
-
const
|
|
9840
|
-
|
|
9864
|
+
if (a === w.TasksQueue && (l != null && l.size)) {
|
|
9865
|
+
for (const [g, v] of this.mainThreadMap.entries()) {
|
|
9866
|
+
const k = l.get(g);
|
|
9867
|
+
k && (await v.on(k), h && this.post({ workerTasksqueueCount: h }));
|
|
9841
9868
|
}
|
|
9842
9869
|
continue;
|
|
9843
9870
|
}
|
|
9844
|
-
if (
|
|
9845
|
-
for (const
|
|
9846
|
-
|
|
9871
|
+
if (c === ds) {
|
|
9872
|
+
for (const g of this.mainThreadMap.values())
|
|
9873
|
+
await g.on(n);
|
|
9874
|
+
a === w.Destroy && this.mainThreadMap.clear();
|
|
9847
9875
|
continue;
|
|
9848
9876
|
}
|
|
9849
|
-
const
|
|
9850
|
-
|
|
9877
|
+
const m = this.mainThreadMap.get(c);
|
|
9878
|
+
m && (await m.on(n), a === w.Destroy && this.mainThreadMap.delete(c));
|
|
9851
9879
|
}
|
|
9852
9880
|
}
|
|
9853
9881
|
}
|