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