jvs-draw 1.0.3 → 1.0.4
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/dist/config.d.ts +8 -0
- package/dist/index.d.ts +2 -1
- package/dist/jvs-draw.es.js +930 -919
- package/dist/jvs-draw.umd.js +5 -5
- package/dist/store/index.d.ts +18 -0
- package/package.json +1 -1
package/dist/jvs-draw.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { markRaw as On, defineComponent as Qe, computed as U, ref as J, watch as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import { ElMessageBox as
|
|
4
|
-
const
|
|
1
|
+
import { markRaw as On, defineComponent as Qe, computed as U, ref as J, watch as Mt, resolveComponent as it, createElementBlock as j, openBlock as X, normalizeStyle as Ke, createElementVNode as m, normalizeClass as Xe, Fragment as We, renderList as ut, createBlock as wt, withCtx as Ae, createCommentVNode as ye, toDisplayString as nt, unref as Se, createVNode as ae, nextTick as Rt, withModifiers as Et, onMounted as nn, onUnmounted as bs, withDirectives as Hs, vModelText as Ws, mergeModels as Us, useModel as qs, createStaticVNode as Gs } from "vue";
|
|
2
|
+
import { defineStore as Ns } from "pinia";
|
|
3
|
+
import { ElMessageBox as Ks } from "element-plus";
|
|
4
|
+
const Js = (i, t, e, n, s) => [
|
|
5
5
|
(i - e) * Math.cos(s) - (t - n) * Math.sin(s) + e,
|
|
6
6
|
(i - e) * Math.sin(s) + (t - n) * Math.cos(s) + n
|
|
7
|
-
], me = (i, t, e) =>
|
|
7
|
+
], me = (i, t, e) => Js(i[0], i[1], t[0], t[1], e), Zs = (i) => {
|
|
8
8
|
const t = i.x + i.width / 2, e = i.y + i.height / 2, s = [
|
|
9
9
|
[i.x, i.y],
|
|
10
10
|
[i.x + i.width, i.y],
|
|
@@ -20,7 +20,7 @@ const Ks = (i, t, e, n, s) => [
|
|
|
20
20
|
}, as = (i, t, e, n) => {
|
|
21
21
|
const s = e - i, a = n - t;
|
|
22
22
|
return Math.hypot(s, a);
|
|
23
|
-
},
|
|
23
|
+
}, Qs = (i, t) => {
|
|
24
24
|
if (i.length < 3)
|
|
25
25
|
return i.length === 2 ? `M ${i[0][0]} ${i[0][1]} L ${i[1][0]} ${i[1][1]}` : "";
|
|
26
26
|
let e = `M ${i[0][0]} ${i[0][1]}`;
|
|
@@ -31,7 +31,7 @@ const Ks = (i, t, e, n, s) => [
|
|
|
31
31
|
const n = i[i.length - 1];
|
|
32
32
|
return e += ` L ${n[0]} ${n[1]}`, e;
|
|
33
33
|
}, _t = (i, t) => {
|
|
34
|
-
if (i.length < 3) return
|
|
34
|
+
if (i.length < 3) return Qs(i, t);
|
|
35
35
|
let e = "";
|
|
36
36
|
const n = i.length;
|
|
37
37
|
for (let s = 0; s < n; s++) {
|
|
@@ -47,13 +47,13 @@ const Ks = (i, t, e, n, s) => [
|
|
|
47
47
|
}, ft = (i, t, e, n, s, a, o) => {
|
|
48
48
|
const [l, r] = me([i, t], [e + s / 2, n + a / 2], -o);
|
|
49
49
|
return l >= e && l <= e + s && r >= n && r <= n + a;
|
|
50
|
-
},
|
|
50
|
+
}, Tt = (i, t, e, n, s, a, o) => {
|
|
51
51
|
const [l, r] = me([i, t], [e + s / 2, n + a / 2], -o), c = e + s / 2, f = n + a / 2, k = s / 2, d = a / 2;
|
|
52
52
|
return (l - c) ** 2 / k ** 2 + (r - f) ** 2 / d ** 2 <= 1;
|
|
53
53
|
}, At = (i, t, e, n, s, a, o) => {
|
|
54
54
|
const [l, r] = me([i, t], [e + s / 2, n + a / 2], -o), c = e + s / 2, f = n + a / 2, k = Math.abs(l - c) / (s / 2), d = Math.abs(r - f) / (a / 2);
|
|
55
55
|
return k + d <= 1;
|
|
56
|
-
},
|
|
56
|
+
}, ei = (i, t, e, n, s, a, o, l = 5) => {
|
|
57
57
|
const [r, c] = me([i, t], [e + s / 2, n + a / 2], -o), f = e + s / 2, k = n + a / 2, d = s / 2, v = a / 2, h = Math.abs(r - f), M = Math.abs(c - k), I = h / d + M / v, T = l / Math.max(d, v);
|
|
58
58
|
return Math.abs(I - 1) <= T;
|
|
59
59
|
}, Dt = (i, t, e, n, s, a) => {
|
|
@@ -75,7 +75,7 @@ const Ks = (i, t, e, n, s) => [
|
|
|
75
75
|
if (qn([i, t], f, k) <= l) return !0;
|
|
76
76
|
}
|
|
77
77
|
return !1;
|
|
78
|
-
},
|
|
78
|
+
}, St = (i, t) => {
|
|
79
79
|
const s = [];
|
|
80
80
|
for (let k = 0; k < 10; k++) {
|
|
81
81
|
const d = k * Math.PI / 5 - Math.PI / 2, v = k % 2 === 0 ? 1 : 0.4;
|
|
@@ -96,7 +96,7 @@ const Ks = (i, t, e, n, s) => [
|
|
|
96
96
|
[i, 0],
|
|
97
97
|
[i * 0.75, t],
|
|
98
98
|
[0, t]
|
|
99
|
-
],
|
|
99
|
+
], ti = (i, t) => [
|
|
100
100
|
[i / 2, 0],
|
|
101
101
|
[i, t / 2],
|
|
102
102
|
[i / 2, t],
|
|
@@ -106,20 +106,20 @@ const Ks = (i, t, e, n, s) => [
|
|
|
106
106
|
if ((l - (e + s / 2)) ** 2 / (s / 2) ** 2 + (r - f) ** 2 / c ** 2 <= 1) return !0;
|
|
107
107
|
const d = n + a - c;
|
|
108
108
|
return (l - (e + s / 2)) ** 2 / (s / 2) ** 2 + (r - d) ** 2 / c ** 2 <= 1 ? !0 : l >= e && l <= e + s && r >= n + c && r <= n + a - c;
|
|
109
|
-
},
|
|
109
|
+
}, ni = (i, t, e, n, s, a, o, l = 5) => {
|
|
110
110
|
const [r, c] = me([i, t], [e + s / 2, n + a / 2], -o), f = Ss(a);
|
|
111
111
|
if (Gn(i, t, e, n, s, f * 2, o, l)) return !0;
|
|
112
112
|
const k = n + a - f;
|
|
113
113
|
if (c >= k && Gn(i, t, e, n + a - f * 2, s, f * 2, o, l)) return !0;
|
|
114
114
|
const d = [e, n + f], v = [e, n + a - f], h = [e + s, n + f], M = [e + s, n + a - f];
|
|
115
115
|
return qn([r, c], d, v) <= l * l || qn([r, c], h, M) <= l * l;
|
|
116
|
-
},
|
|
116
|
+
}, si = (i, t, e, n, s, a, o, l = 5) => {
|
|
117
117
|
const [r, c] = me([i, t], [e + s / 2, n + a / 2], -o), f = Math.abs(r - e) <= l, k = Math.abs(r - (e + s)) <= l, d = Math.abs(c - n) <= l, v = Math.abs(c - (n + a)) <= l, h = c >= n - l && c <= n + a + l, M = r >= e - l && r <= e + s + l;
|
|
118
118
|
return (f || k) && h || (d || v) && M;
|
|
119
119
|
}, Gn = (i, t, e, n, s, a, o, l = 5) => {
|
|
120
120
|
const [r, c] = me([i, t], [e + s / 2, n + a / 2], -o), f = e + s / 2, k = n + a / 2, d = s / 2, v = a / 2, h = r - f, M = c - k, I = h * h / (d + l) ** 2 + M * M / (v + l) ** 2, T = d - l > 0 && v - l > 0 ? h * h / (d - l) ** 2 + M * M / (v - l) ** 2 : 2;
|
|
121
121
|
return I <= 1 && T >= 1;
|
|
122
|
-
},
|
|
122
|
+
}, ii = (i) => {
|
|
123
123
|
if (i.type !== "arrow") return null;
|
|
124
124
|
const t = i.points;
|
|
125
125
|
if (t.length < 2) return null;
|
|
@@ -149,31 +149,31 @@ const Ks = (i, t, e, n, s) => [
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
} else if (["ellipse", "circle", "cylinder"].includes(i.type)) {
|
|
152
|
-
const h = o / 2 + n, M = l / 2 + n, I = d[0] - k[0], T = d[1] - k[1], b = k[0] - c, B = k[1] - f,
|
|
152
|
+
const h = o / 2 + n, M = l / 2 + n, I = d[0] - k[0], T = d[1] - k[1], b = k[0] - c, B = k[1] - f, Y = I * I / (h * h) + T * T / (M * M), q = 2 * b * I / (h * h) + 2 * B * T / (M * M), se = b * b / (h * h) + B * B / (M * M) - 1, le = q * q - 4 * Y * se;
|
|
153
153
|
if (le >= 0) {
|
|
154
|
-
const
|
|
154
|
+
const ie = (-q - Math.sqrt(le)) / (2 * Y), ee = (-q + Math.sqrt(le)) / (2 * Y);
|
|
155
155
|
let G = -1;
|
|
156
|
-
|
|
156
|
+
ie >= 0 && ie <= 1 ? G = ie : ee >= 0 && ee <= 1 ? G = ee : ie > 0 && ie < ee ? G = ie : ee > 0 && (G = ee), G >= 0 && G <= 1 && (v = [k[0] + G * I, k[1] + G * T]);
|
|
157
157
|
}
|
|
158
158
|
} else if (["diamond", "decision", "star", "trapezoid", "parallelogram"].includes(i.type)) {
|
|
159
159
|
const h = s + o / 2, M = a + l / 2;
|
|
160
160
|
let I = [];
|
|
161
161
|
if (["diamond", "decision"].includes(i.type)) {
|
|
162
|
-
const b = [h, a - n], B = [s + o + n, M],
|
|
162
|
+
const b = [h, a - n], B = [s + o + n, M], Y = [h, a + l + n], q = [s - n, M];
|
|
163
163
|
I = [
|
|
164
164
|
[b, B],
|
|
165
|
-
[B,
|
|
166
|
-
[
|
|
165
|
+
[B, Y],
|
|
166
|
+
[Y, q],
|
|
167
167
|
[q, b]
|
|
168
168
|
];
|
|
169
169
|
} else if (i.type === "trapezoid") {
|
|
170
|
-
const b = [s + o * 0.2 - n, a - n], B = [s + o * 0.8 + n, a - n],
|
|
171
|
-
I = [[b, B], [B,
|
|
170
|
+
const b = [s + o * 0.2 - n, a - n], B = [s + o * 0.8 + n, a - n], Y = [s + o + n, a + l + n], q = [s - n, a + l + n];
|
|
171
|
+
I = [[b, B], [B, Y], [Y, q], [q, b]];
|
|
172
172
|
} else if (i.type === "parallelogram") {
|
|
173
|
-
const b = [s + o * 0.25 - n, a - n], B = [s + o + n, a - n],
|
|
174
|
-
I = [[b, B], [B,
|
|
173
|
+
const b = [s + o * 0.25 - n, a - n], B = [s + o + n, a - n], Y = [s + o * 0.75 + n, a + l + n], q = [s - n, a + l + n];
|
|
174
|
+
I = [[b, B], [B, Y], [Y, q], [q, b]];
|
|
175
175
|
} else if (i.type === "star") {
|
|
176
|
-
const b =
|
|
176
|
+
const b = St(o, l).map((B) => [B[0] + s, B[1] + a]);
|
|
177
177
|
for (let B = 0; B < b.length; B++)
|
|
178
178
|
I.push([b[B], b[(B + 1) % b.length]]);
|
|
179
179
|
}
|
|
@@ -181,13 +181,13 @@ const Ks = (i, t, e, n, s) => [
|
|
|
181
181
|
for (const b of I) {
|
|
182
182
|
const B = cs(k, d, b[0], b[1]);
|
|
183
183
|
if (B) {
|
|
184
|
-
const
|
|
185
|
-
|
|
184
|
+
const Y = as(k[0], k[1], B[0], B[1]);
|
|
185
|
+
Y < T && (T = Y, v = B);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
return v ? me(v, [c, f], r) : null;
|
|
190
|
-
},
|
|
190
|
+
}, oi = (i, t, e) => {
|
|
191
191
|
const n = i[0], s = i[1], a = t[0], o = t[1], l = e[0], r = e[1], c = n - a, f = s - o, k = l - a, d = r - o, v = c * k + f * d, h = k * k + d * d;
|
|
192
192
|
let M = -1;
|
|
193
193
|
h !== 0 && (M = v / h);
|
|
@@ -232,7 +232,7 @@ const Ne = (i, t, e, n, s) => {
|
|
|
232
232
|
k > c && (c = k);
|
|
233
233
|
}), { width: Math.max(c + 8, 10), height: r.length * (t * 1.25) + 10 };
|
|
234
234
|
}
|
|
235
|
-
},
|
|
235
|
+
}, ai = (i, t = 0.5, e = 10) => {
|
|
236
236
|
if (i.length < 2) return i;
|
|
237
237
|
const n = [], s = (a) => a < 0 ? i[0] : a >= i.length ? i[i.length - 1] : i[a];
|
|
238
238
|
for (let a = 0; a < i.length - 1; a++) {
|
|
@@ -248,7 +248,7 @@ const Ne = (i, t, e, n, s) => {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
return n;
|
|
251
|
-
},
|
|
251
|
+
}, li = (i) => {
|
|
252
252
|
const { x: t, y: e, width: n, height: s, angle: a } = i;
|
|
253
253
|
if (a === 0)
|
|
254
254
|
return {
|
|
@@ -271,7 +271,7 @@ const Ne = (i, t, e, n, s) => {
|
|
|
271
271
|
if (i.length === 0) return null;
|
|
272
272
|
let t = 1 / 0, e = 1 / 0, n = -1 / 0, s = -1 / 0;
|
|
273
273
|
return i.forEach((a) => {
|
|
274
|
-
const o =
|
|
274
|
+
const o = li(a);
|
|
275
275
|
t = Math.min(t, o.minX), e = Math.min(e, o.minY), n = Math.max(n, o.maxX), s = Math.max(s, o.maxY);
|
|
276
276
|
}), {
|
|
277
277
|
x: t,
|
|
@@ -289,17 +289,17 @@ const Ne = (i, t, e, n, s) => {
|
|
|
289
289
|
let h = r;
|
|
290
290
|
if (n.type === "arrow") {
|
|
291
291
|
if (n.arrowType === "round" && r.length > 2)
|
|
292
|
-
h =
|
|
292
|
+
h = ai(r);
|
|
293
293
|
else if (n.arrowType === "elbow") {
|
|
294
294
|
let M, I;
|
|
295
295
|
if (s && (n.startBinding || n.endBinding)) {
|
|
296
296
|
const T = (b) => {
|
|
297
297
|
if (!b) return;
|
|
298
|
-
const B = s.find((
|
|
298
|
+
const B = s.find((xe) => xe.id === b.elementId);
|
|
299
299
|
if (!B) return;
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
302
|
-
const q = n.x +
|
|
300
|
+
const Y = b.focus < 0 ? n.points[0] : n.points[n.points.length - 1];
|
|
301
|
+
if (!Y) return;
|
|
302
|
+
const q = n.x + Y[0], se = n.y + Y[1], le = B.x, ie = B.y, ee = B.width, G = B.height, he = Math.abs(q - le), H = Math.abs(q - (le + ee)), D = Math.abs(se - ie), N = Math.abs(se - (ie + G)), te = Math.min(he, H, D, N);
|
|
303
303
|
if (te === he) return [-1, 0];
|
|
304
304
|
if (te === H) return [1, 0];
|
|
305
305
|
if (te === D) return [0, -1];
|
|
@@ -312,7 +312,7 @@ const Ne = (i, t, e, n, s) => {
|
|
|
312
312
|
}
|
|
313
313
|
for (let M = 0; M < h.length - 1; M++) {
|
|
314
314
|
const I = h[M], T = h[M + 1];
|
|
315
|
-
if (
|
|
315
|
+
if (oi([d, v], I, T) <= i) return !0;
|
|
316
316
|
}
|
|
317
317
|
return !1;
|
|
318
318
|
}, Zn = (i, t, e) => {
|
|
@@ -323,7 +323,7 @@ const Ne = (i, t, e, n, s) => {
|
|
|
323
323
|
t && (o = [n[0] + t[0] * a, n[1] + t[1] * a], r.push(o)), e && (l = [s[0] + e[0] * a, s[1] + e[1] * a]);
|
|
324
324
|
const [c, f] = o, [k, d] = l, v = (c + k) / 2, h = (f + d) / 2, M = Math.abs(k - c), I = Math.abs(d - f);
|
|
325
325
|
return M > I ? (r.push([v, f]), r.push([v, d])) : (r.push([c, h]), r.push([k, h])), e && r.push(l), r.push(s), r;
|
|
326
|
-
},
|
|
326
|
+
}, ri = (i, t = 20, e, n) => {
|
|
327
327
|
const s = Zn(i, e, n), a = [];
|
|
328
328
|
s.length > 0 && a.push(s[0]);
|
|
329
329
|
for (let r = 1; r < s.length; r++) {
|
|
@@ -339,24 +339,34 @@ const Ne = (i, t, e, n, s) => {
|
|
|
339
339
|
o += ` L ${f[0]} ${f[1]}`;
|
|
340
340
|
continue;
|
|
341
341
|
}
|
|
342
|
-
const b = Math.min(t, h / 2, T / 2), B = f[0] - d / h * b,
|
|
343
|
-
o += ` L ${B} ${
|
|
342
|
+
const b = Math.min(t, h / 2, T / 2), B = f[0] - d / h * b, Y = f[1] - v / h * b, q = f[0] + M / T * b, se = f[1] + I / T * b;
|
|
343
|
+
o += ` L ${B} ${Y}`, o += ` Q ${f[0]} ${f[1]} ${q} ${se}`;
|
|
344
344
|
}
|
|
345
345
|
const l = a[a.length - 1];
|
|
346
346
|
return o += ` L ${l[0]} ${l[1]}`, o;
|
|
347
|
-
},
|
|
348
|
-
let
|
|
347
|
+
}, ci = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
348
|
+
let It = (i = 21) => {
|
|
349
349
|
let t = "", e = crypto.getRandomValues(new Uint8Array(i |= 0));
|
|
350
350
|
for (; i--; )
|
|
351
|
-
t +=
|
|
351
|
+
t += ci[e[i] & 63];
|
|
352
352
|
return t;
|
|
353
353
|
};
|
|
354
|
-
const
|
|
354
|
+
const Is = {
|
|
355
|
+
showToolbar: !0,
|
|
356
|
+
showBoardName: !0,
|
|
357
|
+
showFooter: !0,
|
|
358
|
+
showPropertiesPanel: !0
|
|
359
|
+
}, di = (i) => {
|
|
360
|
+
Object.assign(Is, i);
|
|
361
|
+
}, ot = Ns("excalidraw", {
|
|
355
362
|
state: () => ({
|
|
356
363
|
// State initialized correctly
|
|
357
364
|
elements: [],
|
|
358
365
|
history: On([[]]),
|
|
359
366
|
historyStep: 0,
|
|
367
|
+
appConfig: {
|
|
368
|
+
...Is
|
|
369
|
+
},
|
|
360
370
|
appState: {
|
|
361
371
|
lockedTool: !1,
|
|
362
372
|
viewBackgroundColor: "#FFFFFF",
|
|
@@ -440,7 +450,7 @@ const ot = Gs("excalidraw", {
|
|
|
440
450
|
},
|
|
441
451
|
insertImage(i, t, e, n, s) {
|
|
442
452
|
const a = {
|
|
443
|
-
id:
|
|
453
|
+
id: It(),
|
|
444
454
|
type: "image",
|
|
445
455
|
x: t,
|
|
446
456
|
y: e,
|
|
@@ -462,7 +472,7 @@ const ot = Gs("excalidraw", {
|
|
|
462
472
|
updated: Date.now(),
|
|
463
473
|
link: null,
|
|
464
474
|
locked: !1,
|
|
465
|
-
fileId:
|
|
475
|
+
fileId: It(),
|
|
466
476
|
status: "saved",
|
|
467
477
|
scale: [1, 1],
|
|
468
478
|
dataURL: i
|
|
@@ -592,8 +602,8 @@ const ot = Gs("excalidraw", {
|
|
|
592
602
|
let v = null;
|
|
593
603
|
const h = a.has(o.endBinding.elementId), M = o.startBinding && a.has(o.startBinding.elementId);
|
|
594
604
|
if (o.endBinding.fixedPoint && !o.endBinding.isBorder) {
|
|
595
|
-
const [I, T] = o.endBinding.fixedPoint, b = d.x + d.width / 2, B = d.y + d.height / 2,
|
|
596
|
-
v = me([
|
|
605
|
+
const [I, T] = o.endBinding.fixedPoint, b = d.x + d.width / 2, B = d.y + d.height / 2, Y = d.x + I * d.width, q = d.y + T * d.height;
|
|
606
|
+
v = me([Y, q], [b, B], d.angle);
|
|
597
607
|
} else {
|
|
598
608
|
let I = l.length > 1 ? l[l.length - 2] : l[l.length - 1];
|
|
599
609
|
M && l.length === 2 && (I = [I[0] + t, I[1] + e]);
|
|
@@ -602,10 +612,10 @@ const ot = Gs("excalidraw", {
|
|
|
602
612
|
}
|
|
603
613
|
if (v) {
|
|
604
614
|
l[l.length - 1] = [v[0], v[1]], r = !0;
|
|
605
|
-
const I = d.x + d.width / 2, T = d.y + d.height / 2, b = me(v, [I, T], -d.angle), B = (b[0] - d.x) / d.width,
|
|
615
|
+
const I = d.x + d.width / 2, T = d.y + d.height / 2, b = me(v, [I, T], -d.angle), B = (b[0] - d.x) / d.width, Y = (b[1] - d.y) / d.height;
|
|
606
616
|
o.endBinding && (o.endBinding = {
|
|
607
617
|
...o.endBinding,
|
|
608
|
-
fixedPoint: [B,
|
|
618
|
+
fixedPoint: [B, Y]
|
|
609
619
|
});
|
|
610
620
|
} else {
|
|
611
621
|
const I = l[l.length - 1];
|
|
@@ -772,20 +782,20 @@ const ot = Gs("excalidraw", {
|
|
|
772
782
|
} catch {
|
|
773
783
|
}
|
|
774
784
|
if (!s) {
|
|
775
|
-
const b = "sans-serif",
|
|
785
|
+
const b = "sans-serif", Y = n.split(`
|
|
776
786
|
`);
|
|
777
|
-
let q = 10, se =
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
|
|
787
|
+
let q = 10, se = Y.length * 25 + 10;
|
|
788
|
+
const ie = document.createElement("canvas").getContext("2d");
|
|
789
|
+
if (ie) {
|
|
790
|
+
ie.font = `20px ${b}`;
|
|
781
791
|
let G = 0;
|
|
782
|
-
|
|
783
|
-
const H =
|
|
792
|
+
Y.forEach((he) => {
|
|
793
|
+
const H = ie.measureText(he).width;
|
|
784
794
|
H > G && (G = H);
|
|
785
795
|
}), q = G + 10;
|
|
786
796
|
}
|
|
787
797
|
const ee = {
|
|
788
|
-
id:
|
|
798
|
+
id: It(),
|
|
789
799
|
type: "text",
|
|
790
800
|
x: t,
|
|
791
801
|
y: e,
|
|
@@ -828,7 +838,7 @@ const ot = Gs("excalidraw", {
|
|
|
828
838
|
});
|
|
829
839
|
const f = (o + r) / 2, k = (l + c) / 2, d = t - f, v = e - k, h = {}, M = [];
|
|
830
840
|
s.forEach((T) => {
|
|
831
|
-
const b =
|
|
841
|
+
const b = It();
|
|
832
842
|
h[T.id] = b;
|
|
833
843
|
}), s.forEach((T) => {
|
|
834
844
|
const b = {
|
|
@@ -873,7 +883,7 @@ const ot = Gs("excalidraw", {
|
|
|
873
883
|
});
|
|
874
884
|
});
|
|
875
885
|
const s = this.elements.filter((c) => e.has(c.id) || e.has(c.containerId)), a = /* @__PURE__ */ new Map(), o = s.map((c) => {
|
|
876
|
-
const f =
|
|
886
|
+
const f = It();
|
|
877
887
|
a.set(c.id, f);
|
|
878
888
|
const k = JSON.parse(JSON.stringify(c));
|
|
879
889
|
return delete k.roughElement, delete k.shape, {
|
|
@@ -889,7 +899,7 @@ const ot = Gs("excalidraw", {
|
|
|
889
899
|
}), l = /* @__PURE__ */ new Map();
|
|
890
900
|
o.forEach((c) => {
|
|
891
901
|
if (c.containerId && a.has(c.containerId) && (c.containerId = a.get(c.containerId)), (c.type === "arrow" || c.type === "line") && (c.startBinding && a.has(c.startBinding.elementId) && (c.startBinding = { ...c.startBinding, elementId: a.get(c.startBinding.elementId) }), c.endBinding && a.has(c.endBinding.elementId) && (c.endBinding = { ...c.endBinding, elementId: a.get(c.endBinding.elementId) })), c.groupIds && c.groupIds.length > 0) {
|
|
892
|
-
const f = c.groupIds.map((k) => (l.has(k) || l.set(k,
|
|
902
|
+
const f = c.groupIds.map((k) => (l.has(k) || l.set(k, It()), l.get(k)));
|
|
893
903
|
c.groupIds = f;
|
|
894
904
|
}
|
|
895
905
|
}), this.elements = [...this.elements, ...o];
|
|
@@ -939,7 +949,7 @@ const ot = Gs("excalidraw", {
|
|
|
939
949
|
});
|
|
940
950
|
if (console.log(`Group Elements: Input ${i.length}, Allowed ${t.length}`), t.length < 2) return;
|
|
941
951
|
this.recordHistory();
|
|
942
|
-
const e =
|
|
952
|
+
const e = It();
|
|
943
953
|
this.elements = this.elements.map((n) => t.includes(n.id) ? { ...n, groupIds: [...n.groupIds, e], updated: Date.now() } : n), this.setSelectedElementIds(i);
|
|
944
954
|
},
|
|
945
955
|
ungroupElements(i) {
|
|
@@ -995,7 +1005,7 @@ const ot = Gs("excalidraw", {
|
|
|
995
1005
|
}
|
|
996
1006
|
}
|
|
997
1007
|
}
|
|
998
|
-
}),
|
|
1008
|
+
}), Ms = () => new Promise((i) => {
|
|
999
1009
|
const t = document.createElement("input");
|
|
1000
1010
|
t.type = "file", t.accept = "image/*";
|
|
1001
1011
|
let e = !1;
|
|
@@ -1033,17 +1043,17 @@ const ot = Gs("excalidraw", {
|
|
|
1033
1043
|
}, 500);
|
|
1034
1044
|
};
|
|
1035
1045
|
window.addEventListener("focus", n), t.click();
|
|
1036
|
-
}),
|
|
1046
|
+
}), ui = { class: "tool-group" }, hi = { class: "svg-icon" }, pi = ["xlink:href"], fi = ["title"], gi = { class: "svg-icon" }, vi = ["xlink:href"], mi = {
|
|
1037
1047
|
key: 0,
|
|
1038
1048
|
class: "shortcut"
|
|
1039
|
-
},
|
|
1049
|
+
}, yi = { class: "sub-tools-container" }, xi = ["onClick"], ki = { class: "svg-icon" }, wi = ["xlink:href"], bi = ["onClick", "title"], Si = { class: "svg-icon" }, Ii = ["xlink:href"], Mi = {
|
|
1040
1050
|
key: 0,
|
|
1041
1051
|
class: "shortcut"
|
|
1042
|
-
},
|
|
1052
|
+
}, Ei = /* @__PURE__ */ Qe({
|
|
1043
1053
|
__name: "Toolbar",
|
|
1044
1054
|
setup(i) {
|
|
1045
1055
|
const t = ot(), e = U(() => t.appState.activeTool), n = U(() => t.appState.activeToolType), s = J(!1);
|
|
1046
|
-
|
|
1056
|
+
Mt(() => e.value, (d) => {
|
|
1047
1057
|
d === "shapes" ? s.value = !0 : s.value = !1;
|
|
1048
1058
|
});
|
|
1049
1059
|
const a = [
|
|
@@ -1082,7 +1092,7 @@ const ot = Gs("excalidraw", {
|
|
|
1082
1092
|
if (s.value = !1, d === "image") {
|
|
1083
1093
|
const v = t.appState.activeTool;
|
|
1084
1094
|
t.setTool("image");
|
|
1085
|
-
const h = await
|
|
1095
|
+
const h = await Ms();
|
|
1086
1096
|
if (h) {
|
|
1087
1097
|
const M = window.innerWidth / 2, I = window.innerHeight / 2;
|
|
1088
1098
|
t.insertImage ? t.insertImage(h.dataURL, M - h.width / 2, I - h.height / 2, h.width, h.height) : (console.error("Store action insertImage not found, reloading might fix this."), location.reload()), t.setTool(v);
|
|
@@ -1103,26 +1113,26 @@ const ot = Gs("excalidraw", {
|
|
|
1103
1113
|
}
|
|
1104
1114
|
return (d, v) => {
|
|
1105
1115
|
const h = it("el-popover");
|
|
1106
|
-
return
|
|
1116
|
+
return X(), j("div", {
|
|
1107
1117
|
class: "toolbar glass",
|
|
1108
1118
|
style: Ke({ pointerEvents: r.value ? "none" : "auto" })
|
|
1109
1119
|
}, [
|
|
1110
|
-
m("div",
|
|
1120
|
+
m("div", ui, [
|
|
1111
1121
|
m("div", {
|
|
1112
1122
|
class: Xe({ "tool-item": !0, active: o.value }),
|
|
1113
1123
|
onClick: k,
|
|
1114
1124
|
title: "绘制后保持所选工具状态"
|
|
1115
1125
|
}, [
|
|
1116
|
-
(
|
|
1126
|
+
(X(), j("svg", hi, [
|
|
1117
1127
|
m("use", {
|
|
1118
1128
|
"xlink:href": `${o.value ? "#icon-zujiansuoding" : "#icon-zujianjiesuo"}`
|
|
1119
|
-
}, null, 8,
|
|
1129
|
+
}, null, 8, pi)
|
|
1120
1130
|
]))
|
|
1121
1131
|
], 2),
|
|
1122
|
-
(
|
|
1132
|
+
(X(), j(We, null, ut(a, (M) => (X(), j(We, {
|
|
1123
1133
|
key: M.name
|
|
1124
1134
|
}, [
|
|
1125
|
-
M.subTools ? (
|
|
1135
|
+
M.subTools ? (X(), wt(h, {
|
|
1126
1136
|
key: 0,
|
|
1127
1137
|
placement: "right-start",
|
|
1128
1138
|
trigger: "click",
|
|
@@ -1139,45 +1149,45 @@ const ot = Gs("excalidraw", {
|
|
|
1139
1149
|
class: Xe({ "tool-item": !0, active: e.value === M.name }),
|
|
1140
1150
|
title: M.label
|
|
1141
1151
|
}, [
|
|
1142
|
-
(
|
|
1152
|
+
(X(), j("svg", gi, [
|
|
1143
1153
|
m("use", {
|
|
1144
1154
|
"xlink:href": `${e.value === M.name ? M.activeIcon : M.icon}`
|
|
1145
|
-
}, null, 8,
|
|
1155
|
+
}, null, 8, vi)
|
|
1146
1156
|
])),
|
|
1147
|
-
M.key ? (
|
|
1148
|
-
], 10,
|
|
1157
|
+
M.key ? (X(), j("span", mi, nt(M.key), 1)) : ye("", !0)
|
|
1158
|
+
], 10, fi)
|
|
1149
1159
|
]),
|
|
1150
1160
|
default: Ae(() => [
|
|
1151
|
-
m("div",
|
|
1152
|
-
(
|
|
1161
|
+
m("div", yi, [
|
|
1162
|
+
(X(!0), j(We, null, ut(M.subTools, (I) => (X(), j("div", {
|
|
1153
1163
|
key: I.name,
|
|
1154
1164
|
class: Xe(["sub-tool-item", { active: e.value === M.name && n.value === I.name }]),
|
|
1155
1165
|
onClick: (T) => c(I.name, M.name)
|
|
1156
1166
|
}, [
|
|
1157
|
-
(
|
|
1167
|
+
(X(), j("svg", ki, [
|
|
1158
1168
|
m("use", {
|
|
1159
1169
|
"xlink:href": `${I.icon}`
|
|
1160
|
-
}, null, 8,
|
|
1170
|
+
}, null, 8, wi)
|
|
1161
1171
|
]))
|
|
1162
|
-
], 10,
|
|
1172
|
+
], 10, xi))), 128))
|
|
1163
1173
|
])
|
|
1164
1174
|
]),
|
|
1165
1175
|
_: 2
|
|
1166
|
-
}, 1032, ["visible"])) : (
|
|
1176
|
+
}, 1032, ["visible"])) : (X(), j("div", {
|
|
1167
1177
|
key: 1,
|
|
1168
1178
|
class: Xe({ "tool-item": !0, active: e.value === M.name, "trand-line": M.name === "trand" }),
|
|
1169
1179
|
onClick: (I) => M.name !== "trand" ? l(M.name) : null,
|
|
1170
1180
|
title: M.label
|
|
1171
1181
|
}, [
|
|
1172
|
-
M.name !== "trand" ? (
|
|
1173
|
-
(
|
|
1182
|
+
M.name !== "trand" ? (X(), j(We, { key: 0 }, [
|
|
1183
|
+
(X(), j("svg", Si, [
|
|
1174
1184
|
m("use", {
|
|
1175
1185
|
"xlink:href": `${e.value === M.name ? M.activeIcon : M.icon}`
|
|
1176
|
-
}, null, 8,
|
|
1186
|
+
}, null, 8, Ii)
|
|
1177
1187
|
])),
|
|
1178
|
-
M.key ? (
|
|
1179
|
-
], 64)) :
|
|
1180
|
-
], 10,
|
|
1188
|
+
M.key ? (X(), j("span", Mi, nt(M.key), 1)) : ye("", !0)
|
|
1189
|
+
], 64)) : ye("", !0)
|
|
1190
|
+
], 10, bi))
|
|
1181
1191
|
], 64))), 64))
|
|
1182
1192
|
])
|
|
1183
1193
|
], 4);
|
|
@@ -1188,7 +1198,7 @@ const ot = Gs("excalidraw", {
|
|
|
1188
1198
|
for (const [n, s] of t)
|
|
1189
1199
|
e[n] = s;
|
|
1190
1200
|
return e;
|
|
1191
|
-
},
|
|
1201
|
+
}, Ci = /* @__PURE__ */ st(Ei, [["__scopeId", "data-v-b6ea5f5c"]]);
|
|
1192
1202
|
function ds(i) {
|
|
1193
1203
|
let t;
|
|
1194
1204
|
if (i > 100 && (i = 100), i < 0 || i > 100)
|
|
@@ -1201,7 +1211,7 @@ function pn(i) {
|
|
|
1201
1211
|
const t = parseInt(i, 16);
|
|
1202
1212
|
return isNaN(t) ? 100 : Math.round(t / 255 * 100);
|
|
1203
1213
|
}
|
|
1204
|
-
const
|
|
1214
|
+
const Ti = { class: "fill-style-box" }, Pi = ["onClick"], Bi = { class: "svg-icon" }, zi = ["xlink:href"], $i = /* @__PURE__ */ Qe({
|
|
1205
1215
|
__name: "fillStyle",
|
|
1206
1216
|
setup(i) {
|
|
1207
1217
|
const t = ot(), e = U(() => {
|
|
@@ -1234,21 +1244,21 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1234
1244
|
]), a = (o) => {
|
|
1235
1245
|
t.updateSelectedElements({ fillStyle: o });
|
|
1236
1246
|
};
|
|
1237
|
-
return (o, l) => (
|
|
1238
|
-
(
|
|
1247
|
+
return (o, l) => (X(), j("div", Ti, [
|
|
1248
|
+
(X(!0), j(We, null, ut(s.value, (r, c) => (X(), j("div", {
|
|
1239
1249
|
key: c,
|
|
1240
1250
|
class: Xe(["fill-style-item", { active: e.value === r.value }]),
|
|
1241
1251
|
onClick: (f) => a(r.value)
|
|
1242
1252
|
}, [
|
|
1243
|
-
(
|
|
1253
|
+
(X(), j("svg", Bi, [
|
|
1244
1254
|
m("use", {
|
|
1245
1255
|
"xlink:href": `#${e.value === r.value ? r.iconActive : r.icon}`
|
|
1246
|
-
}, null, 8,
|
|
1256
|
+
}, null, 8, zi)
|
|
1247
1257
|
]))
|
|
1248
|
-
], 10,
|
|
1258
|
+
], 10, Pi))), 128))
|
|
1249
1259
|
]));
|
|
1250
1260
|
}
|
|
1251
|
-
}),
|
|
1261
|
+
}), Es = /* @__PURE__ */ st($i, [["__scopeId", "data-v-9356d2e1"]]), _i = { class: "fill-style-box" }, Ai = ["onClick"], Di = { class: "svg-icon" }, Fi = ["xlink:href"], Oi = /* @__PURE__ */ Qe({
|
|
1252
1262
|
__name: "borderStyle",
|
|
1253
1263
|
setup(i) {
|
|
1254
1264
|
const t = ot(), e = U(() => {
|
|
@@ -1281,21 +1291,21 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1281
1291
|
]), a = (o) => {
|
|
1282
1292
|
t.updateSelectedElements({ strokeStyle: o });
|
|
1283
1293
|
};
|
|
1284
|
-
return (o, l) => (
|
|
1285
|
-
(
|
|
1294
|
+
return (o, l) => (X(), j("div", _i, [
|
|
1295
|
+
(X(!0), j(We, null, ut(s.value, (r, c) => (X(), j("div", {
|
|
1286
1296
|
key: c,
|
|
1287
1297
|
class: Xe(["fill-style-item", { active: e.value === r.value }]),
|
|
1288
1298
|
onClick: (f) => a(r.value)
|
|
1289
1299
|
}, [
|
|
1290
|
-
(
|
|
1300
|
+
(X(), j("svg", Di, [
|
|
1291
1301
|
m("use", {
|
|
1292
1302
|
"xlink:href": `#${e.value === r.value ? r.iconActive : r.icon}`
|
|
1293
|
-
}, null, 8,
|
|
1303
|
+
}, null, 8, Fi)
|
|
1294
1304
|
]))
|
|
1295
|
-
], 10,
|
|
1305
|
+
], 10, Ai))), 128))
|
|
1296
1306
|
]));
|
|
1297
1307
|
}
|
|
1298
|
-
}),
|
|
1308
|
+
}), Cs = /* @__PURE__ */ st(Oi, [["__scopeId", "data-v-dcf857c8"]]), Li = { class: "fill-style-box" }, Ri = ["onClick"], Xi = { class: "svg-icon" }, Yi = ["xlink:href"], Vi = /* @__PURE__ */ Qe({
|
|
1299
1309
|
__name: "lineStyle",
|
|
1300
1310
|
setup(i) {
|
|
1301
1311
|
const t = ot(), e = U(() => {
|
|
@@ -1328,21 +1338,21 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1328
1338
|
]), a = (o) => {
|
|
1329
1339
|
t.updateSelectedElements({ roughness: o });
|
|
1330
1340
|
};
|
|
1331
|
-
return (o, l) => (
|
|
1332
|
-
(
|
|
1341
|
+
return (o, l) => (X(), j("div", Li, [
|
|
1342
|
+
(X(!0), j(We, null, ut(s.value, (r, c) => (X(), j("div", {
|
|
1333
1343
|
key: c,
|
|
1334
1344
|
class: Xe(["fill-style-item", { active: e.value === r.value }]),
|
|
1335
1345
|
onClick: (f) => a(r.value)
|
|
1336
1346
|
}, [
|
|
1337
|
-
(
|
|
1347
|
+
(X(), j("svg", Xi, [
|
|
1338
1348
|
m("use", {
|
|
1339
1349
|
"xlink:href": `#${e.value === r.value ? r.iconActive : r.icon}`
|
|
1340
|
-
}, null, 8,
|
|
1350
|
+
}, null, 8, Yi)
|
|
1341
1351
|
]))
|
|
1342
|
-
], 10,
|
|
1352
|
+
], 10, Ri))), 128))
|
|
1343
1353
|
]));
|
|
1344
1354
|
}
|
|
1345
|
-
}),
|
|
1355
|
+
}), Ts = /* @__PURE__ */ st(Vi, [["__scopeId", "data-v-794ba895"]]), ji = { class: "fill-style-box" }, Hi = ["onClick"], Wi = { class: "svg-icon" }, Ui = ["xlink:href"], qi = /* @__PURE__ */ Qe({
|
|
1346
1356
|
__name: "textStyle",
|
|
1347
1357
|
setup(i) {
|
|
1348
1358
|
const t = ot(), e = () => {
|
|
@@ -1394,21 +1404,21 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1394
1404
|
value: "strikethrough"
|
|
1395
1405
|
}
|
|
1396
1406
|
]);
|
|
1397
|
-
return (o, l) => (
|
|
1398
|
-
(
|
|
1407
|
+
return (o, l) => (X(), j("div", ji, [
|
|
1408
|
+
(X(!0), j(We, null, ut(a.value, (r, c) => (X(), j("div", {
|
|
1399
1409
|
key: c,
|
|
1400
1410
|
class: Xe(["fill-style-item", { active: n(r.value) }]),
|
|
1401
1411
|
onClick: (f) => s(r.value)
|
|
1402
1412
|
}, [
|
|
1403
|
-
(
|
|
1413
|
+
(X(), j("svg", Wi, [
|
|
1404
1414
|
m("use", {
|
|
1405
1415
|
"xlink:href": `#${n(r.value) ? r.iconActive : r.icon}`
|
|
1406
|
-
}, null, 8,
|
|
1416
|
+
}, null, 8, Ui)
|
|
1407
1417
|
]))
|
|
1408
|
-
], 10,
|
|
1418
|
+
], 10, Hi))), 128))
|
|
1409
1419
|
]));
|
|
1410
1420
|
}
|
|
1411
|
-
}),
|
|
1421
|
+
}), Ps = /* @__PURE__ */ st(qi, [["__scopeId", "data-v-36600f47"]]), Gi = ["onClick"], Ni = { class: "svg-icon" }, Ki = ["xlink:href"], Ji = ["onClick"], Zi = { class: "svg-icon" }, Qi = ["xlink:href"], eo = /* @__PURE__ */ Qe({
|
|
1412
1422
|
__name: "alignStyle",
|
|
1413
1423
|
setup(i) {
|
|
1414
1424
|
const t = ot(), e = U(() => t.appState.activeTool), n = U(() => Object.keys(t.appState.selectedElementIds)), s = U(() => n.value.length > 0), a = () => {
|
|
@@ -1477,34 +1487,34 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1477
1487
|
function v(h) {
|
|
1478
1488
|
t.updateSelectedElements({ verticalAlign: h });
|
|
1479
1489
|
}
|
|
1480
|
-
return (h, M) => (
|
|
1490
|
+
return (h, M) => (X(), j("div", {
|
|
1481
1491
|
class: Xe(["fill-style-box", { "no-vertical-align": !o.value }])
|
|
1482
1492
|
}, [
|
|
1483
|
-
(
|
|
1493
|
+
(X(!0), j(We, null, ut(f.value, (I, T) => (X(), j("div", {
|
|
1484
1494
|
key: T,
|
|
1485
1495
|
class: Xe(["fill-style-item", { active: l.value === I.value }]),
|
|
1486
1496
|
onClick: (b) => d(I.value)
|
|
1487
1497
|
}, [
|
|
1488
|
-
(
|
|
1498
|
+
(X(), j("svg", Ni, [
|
|
1489
1499
|
m("use", {
|
|
1490
1500
|
"xlink:href": `#${l.value === I.value ? I.iconActive : I.icon}`
|
|
1491
|
-
}, null, 8,
|
|
1501
|
+
}, null, 8, Ki)
|
|
1492
1502
|
]))
|
|
1493
|
-
], 10,
|
|
1494
|
-
o.value ? (
|
|
1503
|
+
], 10, Gi))), 128)),
|
|
1504
|
+
o.value ? (X(!0), j(We, { key: 0 }, ut(k.value, (I, T) => (X(), j("div", {
|
|
1495
1505
|
key: T,
|
|
1496
1506
|
class: Xe(["fill-style-item", { active: r.value === I.value }]),
|
|
1497
1507
|
onClick: (b) => v(I.value)
|
|
1498
1508
|
}, [
|
|
1499
|
-
(
|
|
1509
|
+
(X(), j("svg", Zi, [
|
|
1500
1510
|
m("use", {
|
|
1501
1511
|
"xlink:href": `#${r.value === I.value ? I.iconActive : I.icon}`
|
|
1502
|
-
}, null, 8,
|
|
1512
|
+
}, null, 8, Qi)
|
|
1503
1513
|
]))
|
|
1504
|
-
], 10,
|
|
1514
|
+
], 10, Ji))), 128)) : ye("", !0)
|
|
1505
1515
|
], 2));
|
|
1506
1516
|
}
|
|
1507
|
-
}),
|
|
1517
|
+
}), Bs = /* @__PURE__ */ st(eo, [["__scopeId", "data-v-b408686c"]]), to = { class: "fill-style-box" }, no = ["onClick"], so = { class: "svg-icon" }, io = ["xlink:href"], oo = /* @__PURE__ */ Qe({
|
|
1508
1518
|
__name: "arrowStyle",
|
|
1509
1519
|
setup(i) {
|
|
1510
1520
|
const t = ot(), e = U(() => {
|
|
@@ -1537,51 +1547,51 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1537
1547
|
]), a = (o) => {
|
|
1538
1548
|
t.updateSelectedElements({ arrowType: o });
|
|
1539
1549
|
};
|
|
1540
|
-
return (o, l) => (
|
|
1541
|
-
(
|
|
1550
|
+
return (o, l) => (X(), j("div", to, [
|
|
1551
|
+
(X(!0), j(We, null, ut(s.value, (r, c) => (X(), j("div", {
|
|
1542
1552
|
key: c,
|
|
1543
1553
|
class: Xe(["fill-style-item", { active: e.value === r.value }]),
|
|
1544
1554
|
onClick: (f) => a(r.value)
|
|
1545
1555
|
}, [
|
|
1546
|
-
(
|
|
1556
|
+
(X(), j("svg", so, [
|
|
1547
1557
|
m("use", {
|
|
1548
1558
|
"xlink:href": `#${e.value === r.value ? r.iconActive : r.icon}`
|
|
1549
|
-
}, null, 8,
|
|
1559
|
+
}, null, 8, io)
|
|
1550
1560
|
]))
|
|
1551
|
-
], 10,
|
|
1561
|
+
], 10, no))), 128))
|
|
1552
1562
|
]));
|
|
1553
1563
|
}
|
|
1554
|
-
}),
|
|
1564
|
+
}), zs = /* @__PURE__ */ st(oo, [["__scopeId", "data-v-b56fafad"]]), ao = { class: "header" }, lo = { class: "content" }, ro = { class: "shape-panel-box" }, co = { class: "input-box" }, uo = { class: "input-box" }, ho = {
|
|
1555
1565
|
key: 0,
|
|
1556
1566
|
class: "input-box"
|
|
1557
|
-
},
|
|
1567
|
+
}, po = {
|
|
1558
1568
|
key: 1,
|
|
1559
1569
|
class: "input-box"
|
|
1560
|
-
},
|
|
1570
|
+
}, fo = {
|
|
1561
1571
|
key: 3,
|
|
1562
1572
|
class: "btn-box"
|
|
1563
|
-
},
|
|
1573
|
+
}, go = { class: "svg-icon" }, vo = ["xlink:href"], mo = {
|
|
1564
1574
|
key: 0,
|
|
1565
1575
|
class: "roundness-box"
|
|
1566
|
-
},
|
|
1576
|
+
}, yo = { class: "style-item" }, xo = {
|
|
1567
1577
|
key: 0,
|
|
1568
1578
|
class: "svg-icon"
|
|
1569
|
-
},
|
|
1579
|
+
}, ko = { class: "color-text" }, wo = { class: "style-item" }, bo = { class: "style-item" }, So = { class: "style-item" }, Io = {
|
|
1570
1580
|
key: 0,
|
|
1571
1581
|
class: "svg-icon"
|
|
1572
|
-
},
|
|
1582
|
+
}, Mo = { class: "color-text" }, Eo = { class: "style-item" }, Co = { class: "style-item" }, To = {
|
|
1573
1583
|
key: 0,
|
|
1574
1584
|
class: "style-item"
|
|
1575
|
-
},
|
|
1585
|
+
}, Po = { class: "style-item" }, Bo = {
|
|
1576
1586
|
key: 1,
|
|
1577
1587
|
class: "style-item"
|
|
1578
|
-
},
|
|
1588
|
+
}, zo = { class: "title" }, $o = { class: "style-item" }, _o = { class: "style-boxs" }, Ao = { class: "style-boxs-item" }, Do = { class: "style-boxs-item" }, Fo = { class: "style-item" }, Oo = {
|
|
1579
1589
|
key: 0,
|
|
1580
1590
|
class: "svg-icon"
|
|
1581
|
-
},
|
|
1591
|
+
}, Lo = { class: "color-text" }, Ro = { class: "style-item" }, Xo = {
|
|
1582
1592
|
key: 0,
|
|
1583
1593
|
class: "svg-icon"
|
|
1584
|
-
},
|
|
1594
|
+
}, Yo = { class: "color-text" }, Vo = /* @__PURE__ */ Qe({
|
|
1585
1595
|
__name: "PropertiesPanel",
|
|
1586
1596
|
setup(i) {
|
|
1587
1597
|
const t = ot(), e = J(), n = J(), s = J(), a = J(), o = J(), l = J(), r = J(), c = J(), f = () => {
|
|
@@ -1598,12 +1608,12 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1598
1608
|
return $ ? $.type : "none";
|
|
1599
1609
|
}
|
|
1600
1610
|
return v.value === "shapes" ? t.appState.activeToolType : v.value;
|
|
1601
|
-
}, T = U(() => H.value + ds(N.value)), b = U(() =>
|
|
1602
|
-
U(() => Fe.value), U(() =>
|
|
1611
|
+
}, T = U(() => H.value + ds(N.value)), b = U(() => Ce.value + ds(D.value));
|
|
1612
|
+
U(() => Fe.value), U(() => Be.value);
|
|
1603
1613
|
const B = U(() => {
|
|
1604
1614
|
const z = I();
|
|
1605
1615
|
return !["arrow", "line", "text", "freedraw", "image"].includes(z);
|
|
1606
|
-
}),
|
|
1616
|
+
}), Y = U(() => {
|
|
1607
1617
|
const z = I();
|
|
1608
1618
|
return !["arrow", "line", "freedraw", "frame", "image"].includes(z);
|
|
1609
1619
|
}), q = U(() => {
|
|
@@ -1615,7 +1625,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1615
1625
|
}), le = U(() => {
|
|
1616
1626
|
const z = I();
|
|
1617
1627
|
return !["arrow", "line"].includes(z);
|
|
1618
|
-
}),
|
|
1628
|
+
}), ie = U(() => {
|
|
1619
1629
|
const z = I();
|
|
1620
1630
|
return ["arrow", "line"].includes(z);
|
|
1621
1631
|
}), ee = U(() => {
|
|
@@ -1635,7 +1645,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1635
1645
|
return z ? z.backgroundColor : t.appState.currentItemBackgroundColor;
|
|
1636
1646
|
},
|
|
1637
1647
|
set(z) {
|
|
1638
|
-
|
|
1648
|
+
xe(z);
|
|
1639
1649
|
}
|
|
1640
1650
|
}), D = U({
|
|
1641
1651
|
get() {
|
|
@@ -1651,7 +1661,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1651
1661
|
return z ? z.backgroundOpacity ?? 100 : t.appState.currentItemBackgroundOpacity;
|
|
1652
1662
|
},
|
|
1653
1663
|
set(z) {
|
|
1654
|
-
|
|
1664
|
+
we(z);
|
|
1655
1665
|
}
|
|
1656
1666
|
}), te = U({
|
|
1657
1667
|
get() {
|
|
@@ -1661,13 +1671,13 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1661
1671
|
set(z) {
|
|
1662
1672
|
En(z);
|
|
1663
1673
|
}
|
|
1664
|
-
}),
|
|
1674
|
+
}), xe = (z) => {
|
|
1665
1675
|
const $ = z || "transparent";
|
|
1666
1676
|
t.updateSelectedElements({ backgroundColor: $ });
|
|
1667
|
-
},
|
|
1677
|
+
}, we = (z) => {
|
|
1668
1678
|
const $ = z;
|
|
1669
1679
|
t.updateSelectedElements({ backgroundOpacity: $ });
|
|
1670
|
-
},
|
|
1680
|
+
}, Ce = U(
|
|
1671
1681
|
{
|
|
1672
1682
|
get() {
|
|
1673
1683
|
const z = d();
|
|
@@ -1677,7 +1687,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1677
1687
|
cn(z);
|
|
1678
1688
|
}
|
|
1679
1689
|
}
|
|
1680
|
-
),
|
|
1690
|
+
), Be = U({
|
|
1681
1691
|
get() {
|
|
1682
1692
|
const z = d();
|
|
1683
1693
|
return z ? z?.fontColor : t.appState.currentItemFontColor;
|
|
@@ -1709,7 +1719,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1709
1719
|
set(z) {
|
|
1710
1720
|
ln(z);
|
|
1711
1721
|
}
|
|
1712
|
-
}),
|
|
1722
|
+
}), oe = U({
|
|
1713
1723
|
get() {
|
|
1714
1724
|
const z = d();
|
|
1715
1725
|
return z ? z.width : t.appState.currentItemWidth;
|
|
@@ -1742,7 +1752,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1742
1752
|
W(z * (Math.PI / 180) % 360);
|
|
1743
1753
|
}
|
|
1744
1754
|
}), Oe = J(1);
|
|
1745
|
-
|
|
1755
|
+
Mt(() => at.value, (z) => {
|
|
1746
1756
|
Oe.value = String(z || 0).length;
|
|
1747
1757
|
}, { immediate: !0 });
|
|
1748
1758
|
const tt = (z) => {
|
|
@@ -1754,7 +1764,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1754
1764
|
function W(z) {
|
|
1755
1765
|
const $ = d();
|
|
1756
1766
|
if ($) {
|
|
1757
|
-
const ge = t.elements.find((
|
|
1767
|
+
const ge = t.elements.find((Te) => Te.type === "text" && Te.containerId === $.id && !Te.isDeleted);
|
|
1758
1768
|
ge && t.updateElement(ge.id, { angle: z });
|
|
1759
1769
|
}
|
|
1760
1770
|
t.updateSelectedElements({ angle: z });
|
|
@@ -1763,17 +1773,17 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1763
1773
|
const $ = d();
|
|
1764
1774
|
if ($ && $.height > 0) {
|
|
1765
1775
|
const ge = { height: z };
|
|
1766
|
-
let
|
|
1776
|
+
let Te = $.width;
|
|
1767
1777
|
if ($.isAspectRatioLocked) {
|
|
1768
1778
|
const ve = $.width / $.height;
|
|
1769
|
-
|
|
1779
|
+
Te = z * ve, ge.width = Te;
|
|
1770
1780
|
}
|
|
1771
1781
|
const re = t.elements.find((ve) => ve.type === "text" && ve.containerId === $.id && !ve.isDeleted);
|
|
1772
1782
|
if (re) {
|
|
1773
|
-
const ve = Ne(re.text || "", re.fontSize || 20, re.fontFamily || "sans-serif",
|
|
1774
|
-
ge.height = Math.max(z, ve.height), t.updateElement(re.id, { width:
|
|
1783
|
+
const ve = Ne(re.text || "", re.fontSize || 20, re.fontFamily || "sans-serif", Te, { isBold: re.isBold, isItalic: re.isItalic });
|
|
1784
|
+
ge.height = Math.max(z, ve.height), t.updateElement(re.id, { width: Te, height: ge.height });
|
|
1775
1785
|
} else if ($.type === "text") {
|
|
1776
|
-
const ve = Ne($.text || "", $.fontSize || 20, $.fontFamily || "sans-serif",
|
|
1786
|
+
const ve = Ne($.text || "", $.fontSize || 20, $.fontFamily || "sans-serif", Te, { isBold: $.isBold, isItalic: $.isItalic });
|
|
1777
1787
|
ge.height = Math.max(z, ve.height);
|
|
1778
1788
|
}
|
|
1779
1789
|
t.updateSelectedElements(ge);
|
|
@@ -1783,7 +1793,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1783
1793
|
const $ = d();
|
|
1784
1794
|
if ($ && $.width > 0) {
|
|
1785
1795
|
const ge = { width: z };
|
|
1786
|
-
let
|
|
1796
|
+
let Te = $.height;
|
|
1787
1797
|
console.log($.height);
|
|
1788
1798
|
const re = t.elements.find((ve) => ve.type === "text" && ve.containerId === $.id && !ve.isDeleted);
|
|
1789
1799
|
if (re || $.type === "text") {
|
|
@@ -1792,19 +1802,19 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1792
1802
|
}
|
|
1793
1803
|
if ($.isAspectRatioLocked) {
|
|
1794
1804
|
const ve = $.height / $.width;
|
|
1795
|
-
|
|
1805
|
+
Te = ge.width * ve, ge.height = Te;
|
|
1796
1806
|
}
|
|
1797
1807
|
if (re) {
|
|
1798
1808
|
const ve = Ne(re.text || "", re.fontSize || 20, re.fontFamily || "sans-serif", ge.width, { isBold: re.isBold, isItalic: re.isItalic });
|
|
1799
|
-
ge.height = Math.max(
|
|
1809
|
+
ge.height = Math.max(Te, ve.height), t.updateElement(re.id, { width: ge.width, height: ge.height });
|
|
1800
1810
|
} else if ($.type === "text") {
|
|
1801
1811
|
const ve = Ne($.text || "", $.fontSize || 20, $.fontFamily || "sans-serif", ge.width, { isBold: $.isBold, isItalic: $.isItalic });
|
|
1802
|
-
ge.height = Math.max(
|
|
1812
|
+
ge.height = Math.max(Te, ve.height);
|
|
1803
1813
|
}
|
|
1804
1814
|
t.updateSelectedElements(ge);
|
|
1805
1815
|
}
|
|
1806
1816
|
}
|
|
1807
|
-
const
|
|
1817
|
+
const ke = U(() => {
|
|
1808
1818
|
const z = d();
|
|
1809
1819
|
return z ? !!z.isFlippedHorizontal : !1;
|
|
1810
1820
|
}), Ye = U(() => {
|
|
@@ -1840,7 +1850,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1840
1850
|
a.value.openColorPicker(), a.value.initPickerColor(b.value);
|
|
1841
1851
|
}
|
|
1842
1852
|
function Mn(z) {
|
|
1843
|
-
|
|
1853
|
+
xe(z.hex.substring(0, 7)), we(pn(z.hex.substring(7, 9)));
|
|
1844
1854
|
}
|
|
1845
1855
|
const En = (z) => {
|
|
1846
1856
|
t.updateSelectedElements({ strokeWidth: z });
|
|
@@ -1854,18 +1864,18 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1854
1864
|
t.updateSelectedElements({ strokeColor: z });
|
|
1855
1865
|
}, Vt = (z) => {
|
|
1856
1866
|
t.updateSelectedElements({ fontColor: z }), Object.keys(t.appState.selectedElementIds).forEach((ge) => {
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1867
|
+
const Te = t.elements.find((re) => re.type === "text" && re.containerId === ge && !re.isDeleted);
|
|
1868
|
+
Te && t.updateElement(Te.id, { fontColor: z });
|
|
1859
1869
|
});
|
|
1860
1870
|
}, Nt = (z) => {
|
|
1861
1871
|
t.updateSelectedElements({ fontBgColor: z }), Object.keys(t.appState.selectedElementIds).forEach((ge) => {
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1872
|
+
const Te = t.elements.find((re) => re.type === "text" && re.containerId === ge && !re.isDeleted);
|
|
1873
|
+
Te && t.updateElement(Te.id, { fontBgColor: z });
|
|
1864
1874
|
});
|
|
1865
1875
|
}, Tn = () => {
|
|
1866
1876
|
r.value.openColorPicker(), r.value.initPickerColor(Fe.value);
|
|
1867
1877
|
}, Pn = () => {
|
|
1868
|
-
c.value.openColorPicker(), c.value.initPickerColor(
|
|
1878
|
+
c.value.openColorPicker(), c.value.initPickerColor(Be.value);
|
|
1869
1879
|
}, Bn = (z) => {
|
|
1870
1880
|
pn(z.hex.substring(7, 9)) == 0 ? Vt("transparent") : Vt(z.hex.substring(0, 7));
|
|
1871
1881
|
}, zn = (z) => {
|
|
@@ -1874,14 +1884,14 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1874
1884
|
t.updateSelectedElements({ roundness: z });
|
|
1875
1885
|
}, Kt = (z) => {
|
|
1876
1886
|
Object.keys(t.appState.selectedElementIds).forEach((ge) => {
|
|
1877
|
-
const
|
|
1878
|
-
if (
|
|
1879
|
-
const re =
|
|
1887
|
+
const Te = t.elements.find((re) => re.id === ge);
|
|
1888
|
+
if (Te && Te.type === "text") {
|
|
1889
|
+
const re = Te;
|
|
1880
1890
|
if (re.autoResize) {
|
|
1881
1891
|
const ve = Ne(re.text || "", z, re.fontFamily || "sans-serif", void 0, { isBold: re.isBold, isItalic: re.isItalic });
|
|
1882
1892
|
t.updateElement(ge, { fontSize: z, width: ve.width, height: ve.height });
|
|
1883
1893
|
} else {
|
|
1884
|
-
const ve = Ne(re.text || "", z, re.fontFamily || "sans-serif",
|
|
1894
|
+
const ve = Ne(re.text || "", z, re.fontFamily || "sans-serif", Te.width, { isBold: re.isBold, isItalic: re.isItalic });
|
|
1885
1895
|
t.updateElement(ge, { fontSize: z, height: ve.height });
|
|
1886
1896
|
}
|
|
1887
1897
|
} else {
|
|
@@ -1889,68 +1899,68 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1889
1899
|
const re = t.elements.find((ve) => ve.type === "text" && ve.containerId === ge && !ve.isDeleted);
|
|
1890
1900
|
if (re) {
|
|
1891
1901
|
const ve = Ne(re.text || "", z, re.fontFamily || "sans-serif", re.width);
|
|
1892
|
-
t.updateElement(re.id, { fontSize: z, height: Math.max(ve.height,
|
|
1902
|
+
t.updateElement(re.id, { fontSize: z, height: Math.max(ve.height, Te?.height) });
|
|
1893
1903
|
}
|
|
1894
1904
|
}
|
|
1895
1905
|
});
|
|
1896
1906
|
};
|
|
1897
1907
|
return (z, $) => {
|
|
1898
|
-
const ge = it("el-input-number"),
|
|
1899
|
-
return
|
|
1908
|
+
const ge = it("el-input-number"), Te = it("el-slider"), re = it("jvs-picker-color-v3"), ve = it("el-select"), un = it("el-option"), hn = it("el-input"), $n = it("el-scrollbar");
|
|
1909
|
+
return Se(t).appState.isPropertiesPanelOpen ? (X(), j("div", {
|
|
1900
1910
|
key: 0,
|
|
1901
1911
|
class: "properties-panel",
|
|
1902
1912
|
style: Ke({ pointerEvents: he.value ? "none" : "auto" })
|
|
1903
1913
|
}, [
|
|
1904
|
-
m("div",
|
|
1914
|
+
m("div", ao, [
|
|
1905
1915
|
$[16] || ($[16] = m("div", null, "形状", -1)),
|
|
1906
|
-
(
|
|
1916
|
+
(X(), j("svg", { onClick: f }, [...$[15] || ($[15] = [
|
|
1907
1917
|
m("use", { "xlink:href": "#jvs-public-danchuangguanbi1" }, null, -1)
|
|
1908
1918
|
])]))
|
|
1909
1919
|
]),
|
|
1910
|
-
|
|
1920
|
+
ae($n, null, {
|
|
1911
1921
|
default: Ae(() => [
|
|
1912
|
-
m("div",
|
|
1913
|
-
m("div",
|
|
1922
|
+
m("div", lo, [
|
|
1923
|
+
m("div", ro, [
|
|
1914
1924
|
m("div", {
|
|
1915
1925
|
class: Xe(["shape-panel-row", { "not-bind-width-height": q.value || !se.value }])
|
|
1916
1926
|
}, [
|
|
1917
|
-
m("div",
|
|
1927
|
+
m("div", co, [
|
|
1918
1928
|
$[17] || ($[17] = m("div", { class: "icon" }, "X", -1)),
|
|
1919
|
-
|
|
1929
|
+
ae(ge, {
|
|
1920
1930
|
modelValue: ne.value,
|
|
1921
1931
|
"onUpdate:modelValue": $[0] || ($[0] = (_e) => ne.value = _e),
|
|
1922
1932
|
precision: 2,
|
|
1923
1933
|
"controls-position": "right"
|
|
1924
1934
|
}, null, 8, ["modelValue"])
|
|
1925
1935
|
]),
|
|
1926
|
-
m("div",
|
|
1936
|
+
m("div", uo, [
|
|
1927
1937
|
$[18] || ($[18] = m("div", { class: "icon" }, "Y", -1)),
|
|
1928
|
-
|
|
1938
|
+
ae(ge, {
|
|
1929
1939
|
modelValue: Ue.value,
|
|
1930
1940
|
"onUpdate:modelValue": $[1] || ($[1] = (_e) => Ue.value = _e),
|
|
1931
1941
|
precision: 2,
|
|
1932
1942
|
"controls-position": "right"
|
|
1933
1943
|
}, null, 8, ["modelValue"])
|
|
1934
1944
|
]),
|
|
1935
|
-
q.value ?
|
|
1945
|
+
q.value ? ye("", !0) : (X(), j("div", ho, [
|
|
1936
1946
|
$[19] || ($[19] = m("div", { class: "icon" }, "W", -1)),
|
|
1937
|
-
|
|
1938
|
-
modelValue:
|
|
1939
|
-
"onUpdate:modelValue": $[2] || ($[2] = (_e) =>
|
|
1947
|
+
ae(ge, {
|
|
1948
|
+
modelValue: oe.value,
|
|
1949
|
+
"onUpdate:modelValue": $[2] || ($[2] = (_e) => oe.value = _e),
|
|
1940
1950
|
precision: 2,
|
|
1941
1951
|
"controls-position": "right"
|
|
1942
1952
|
}, null, 8, ["modelValue"])
|
|
1943
1953
|
])),
|
|
1944
|
-
q.value ?
|
|
1954
|
+
q.value ? ye("", !0) : (X(), j("div", po, [
|
|
1945
1955
|
$[20] || ($[20] = m("div", { class: "icon" }, "H", -1)),
|
|
1946
|
-
|
|
1956
|
+
ae(ge, {
|
|
1947
1957
|
modelValue: et.value,
|
|
1948
1958
|
"onUpdate:modelValue": $[3] || ($[3] = (_e) => et.value = _e),
|
|
1949
1959
|
precision: 2,
|
|
1950
1960
|
"controls-position": "right"
|
|
1951
1961
|
}, null, 8, ["modelValue"])
|
|
1952
1962
|
])),
|
|
1953
|
-
le.value ? (
|
|
1963
|
+
le.value ? (X(), j("div", {
|
|
1954
1964
|
key: 2,
|
|
1955
1965
|
class: "input-box",
|
|
1956
1966
|
onInput: tt,
|
|
@@ -1961,7 +1971,7 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1961
1971
|
m("use", { "xlink:href": "#icon-jiaodu" })
|
|
1962
1972
|
])
|
|
1963
1973
|
], -1)),
|
|
1964
|
-
|
|
1974
|
+
ae(ge, {
|
|
1965
1975
|
modelValue: at.value,
|
|
1966
1976
|
"onUpdate:modelValue": $[4] || ($[4] = (_e) => at.value = _e),
|
|
1967
1977
|
"controls-position": "right"
|
|
@@ -1970,10 +1980,10 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1970
1980
|
class: "unit",
|
|
1971
1981
|
style: Ke({ left: 32 + Oe.value * 8 + "px" })
|
|
1972
1982
|
}, "°", 4)
|
|
1973
|
-
], 32)) :
|
|
1974
|
-
le.value ? (
|
|
1983
|
+
], 32)) : ye("", !0),
|
|
1984
|
+
le.value ? (X(), j("div", fo, [
|
|
1975
1985
|
m("div", {
|
|
1976
|
-
class: Xe(["btn-item", { active:
|
|
1986
|
+
class: Xe(["btn-item", { active: ke.value }]),
|
|
1977
1987
|
onClick: de
|
|
1978
1988
|
}, [...$[22] || ($[22] = [
|
|
1979
1989
|
m("svg", { class: "svg-icon" }, [
|
|
@@ -1988,26 +1998,26 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
1988
1998
|
m("use", { "xlink:href": "#icon-chuizhifanzhuan" })
|
|
1989
1999
|
], -1)
|
|
1990
2000
|
])], 2)
|
|
1991
|
-
])) :
|
|
2001
|
+
])) : ye("", !0)
|
|
1992
2002
|
], 2),
|
|
1993
|
-
q.value ?
|
|
2003
|
+
q.value ? ye("", !0) : (X(), j("div", {
|
|
1994
2004
|
key: 0,
|
|
1995
2005
|
class: Xe(["bind-box", { active: an.value }]),
|
|
1996
2006
|
onClick: vt
|
|
1997
2007
|
}, [
|
|
1998
|
-
(
|
|
2008
|
+
(X(), j("svg", go, [
|
|
1999
2009
|
m("use", {
|
|
2000
2010
|
"xlink:href": an.value ? "#icon-suoding1" : "#icon-quxiaosuoding"
|
|
2001
|
-
}, null, 8,
|
|
2011
|
+
}, null, 8, vo)
|
|
2002
2012
|
]))
|
|
2003
2013
|
], 2))
|
|
2004
2014
|
]),
|
|
2005
|
-
se.value ? (
|
|
2015
|
+
se.value ? (X(), j("div", mo, [
|
|
2006
2016
|
$[25] || ($[25] = m("div", {
|
|
2007
2017
|
class: "item-label",
|
|
2008
2018
|
style: { "padding-right": "8px" }
|
|
2009
2019
|
}, "圆角", -1)),
|
|
2010
|
-
|
|
2020
|
+
ae(Te, {
|
|
2011
2021
|
modelValue: G.value,
|
|
2012
2022
|
"onUpdate:modelValue": $[5] || ($[5] = (_e) => G.value = _e),
|
|
2013
2023
|
"show-input": "",
|
|
@@ -2023,15 +2033,15 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2023
2033
|
m("use", { "xlink:href": "#icon-biankuang-yincangzhuangtai" })
|
|
2024
2034
|
], -1)
|
|
2025
2035
|
])])
|
|
2026
|
-
])) :
|
|
2027
|
-
B.value ? (
|
|
2036
|
+
])) : ye("", !0),
|
|
2037
|
+
B.value ? (X(), j(We, { key: 1 }, [
|
|
2028
2038
|
$[30] || ($[30] = m("div", { class: "divider" }, null, -1)),
|
|
2029
2039
|
$[31] || ($[31] = m("div", { class: "type-item-title" }, [
|
|
2030
2040
|
m("div", { class: "title" }, "填充")
|
|
2031
2041
|
], -1)),
|
|
2032
|
-
m("div",
|
|
2042
|
+
m("div", yo, [
|
|
2033
2043
|
$[27] || ($[27] = m("div", { class: "title" }, "颜色", -1)),
|
|
2034
|
-
|
|
2044
|
+
ae(re, {
|
|
2035
2045
|
color: H.value,
|
|
2036
2046
|
ref_key: "bgColorPickerRef",
|
|
2037
2047
|
ref: n,
|
|
@@ -2048,14 +2058,14 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2048
2058
|
ref: e,
|
|
2049
2059
|
onClick: $[7] || ($[7] = (zt) => rn())
|
|
2050
2060
|
}, [
|
|
2051
|
-
H.value == "transparent" || !H.value || N.value == 0 ? (
|
|
2061
|
+
H.value == "transparent" || !H.value || N.value == 0 ? (X(), j("svg", xo, [...$[26] || ($[26] = [
|
|
2052
2062
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
2053
|
-
])])) : (
|
|
2063
|
+
])])) : (X(), j("div", {
|
|
2054
2064
|
key: 1,
|
|
2055
2065
|
class: "color-box",
|
|
2056
2066
|
style: Ke({ background: T.value })
|
|
2057
2067
|
}, null, 4)),
|
|
2058
|
-
m("div",
|
|
2068
|
+
m("div", ko, nt(H.value != "transparent" ? H.value.substring(
|
|
2059
2069
|
0,
|
|
2060
2070
|
7
|
|
2061
2071
|
).toUpperCase() : H.value), 1)
|
|
@@ -2064,9 +2074,9 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2064
2074
|
_: 1
|
|
2065
2075
|
}, 8, ["color", "options"])
|
|
2066
2076
|
]),
|
|
2067
|
-
m("div",
|
|
2077
|
+
m("div", wo, [
|
|
2068
2078
|
$[28] || ($[28] = m("div", { class: "title" }, "透明度", -1)),
|
|
2069
|
-
|
|
2079
|
+
ae(Te, {
|
|
2070
2080
|
modelValue: N.value,
|
|
2071
2081
|
"onUpdate:modelValue": $[8] || ($[8] = (_e) => N.value = _e),
|
|
2072
2082
|
"show-input": "",
|
|
@@ -2075,20 +2085,20 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2075
2085
|
max: 100
|
|
2076
2086
|
}, null, 8, ["modelValue"])
|
|
2077
2087
|
]),
|
|
2078
|
-
m("div",
|
|
2088
|
+
m("div", bo, [
|
|
2079
2089
|
$[29] || ($[29] = m("div", { class: "title" }, "填充样式", -1)),
|
|
2080
|
-
|
|
2090
|
+
ae(Es, { style: { width: "100%" } })
|
|
2081
2091
|
])
|
|
2082
|
-
], 64)) :
|
|
2083
|
-
ee.value ? (
|
|
2092
|
+
], 64)) : ye("", !0),
|
|
2093
|
+
ee.value ? (X(), j(We, { key: 2 }, [
|
|
2084
2094
|
$[38] || ($[38] = m("div", { class: "divider" }, null, -1)),
|
|
2085
2095
|
$[39] || ($[39] = m("div", { class: "type-item-title" }, [
|
|
2086
2096
|
m("div", { class: "title" }, "描边")
|
|
2087
2097
|
], -1)),
|
|
2088
|
-
m("div",
|
|
2098
|
+
m("div", So, [
|
|
2089
2099
|
$[33] || ($[33] = m("div", { class: "title" }, "颜色", -1)),
|
|
2090
|
-
|
|
2091
|
-
color:
|
|
2100
|
+
ae(re, {
|
|
2101
|
+
color: Ce.value,
|
|
2092
2102
|
ref_key: "strokeColorPickerRef",
|
|
2093
2103
|
ref: a,
|
|
2094
2104
|
options: {
|
|
@@ -2104,25 +2114,25 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2104
2114
|
ref: s,
|
|
2105
2115
|
onClick: $[9] || ($[9] = (zt) => Xt())
|
|
2106
2116
|
}, [
|
|
2107
|
-
|
|
2117
|
+
Ce.value == "transparent" || !Ce.value || D.value == 0 ? (X(), j("svg", Io, [...$[32] || ($[32] = [
|
|
2108
2118
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
2109
|
-
])])) : (
|
|
2119
|
+
])])) : (X(), j("div", {
|
|
2110
2120
|
key: 1,
|
|
2111
2121
|
class: "color-box",
|
|
2112
2122
|
style: Ke({ background: b.value })
|
|
2113
2123
|
}, null, 4)),
|
|
2114
|
-
m("div",
|
|
2124
|
+
m("div", Mo, nt(Ce.value != "transparent" ? Ce.value.substring(
|
|
2115
2125
|
0,
|
|
2116
2126
|
7
|
|
2117
|
-
).toUpperCase() :
|
|
2127
|
+
).toUpperCase() : Ce.value), 1)
|
|
2118
2128
|
], 512)
|
|
2119
2129
|
]),
|
|
2120
2130
|
_: 1
|
|
2121
2131
|
}, 8, ["color", "options"])
|
|
2122
2132
|
]),
|
|
2123
|
-
m("div",
|
|
2133
|
+
m("div", Eo, [
|
|
2124
2134
|
$[34] || ($[34] = m("div", { class: "title" }, "粗细", -1)),
|
|
2125
|
-
|
|
2135
|
+
ae(Te, {
|
|
2126
2136
|
modelValue: te.value,
|
|
2127
2137
|
"onUpdate:modelValue": $[10] || ($[10] = (_e) => te.value = _e),
|
|
2128
2138
|
"show-input": "",
|
|
@@ -2131,9 +2141,9 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2131
2141
|
max: 10
|
|
2132
2142
|
}, null, 8, ["modelValue"])
|
|
2133
2143
|
]),
|
|
2134
|
-
m("div",
|
|
2144
|
+
m("div", Co, [
|
|
2135
2145
|
$[35] || ($[35] = m("div", { class: "title" }, "透明度", -1)),
|
|
2136
|
-
|
|
2146
|
+
ae(Te, {
|
|
2137
2147
|
modelValue: D.value,
|
|
2138
2148
|
"onUpdate:modelValue": $[11] || ($[11] = (_e) => D.value = _e),
|
|
2139
2149
|
"show-input": "",
|
|
@@ -2142,37 +2152,37 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2142
2152
|
max: 100
|
|
2143
2153
|
}, null, 8, ["modelValue"])
|
|
2144
2154
|
]),
|
|
2145
|
-
I() != "freedraw" ? (
|
|
2155
|
+
I() != "freedraw" ? (X(), j("div", To, [
|
|
2146
2156
|
$[36] || ($[36] = m("div", { class: "title" }, "样式", -1)),
|
|
2147
|
-
|
|
2148
|
-
])) :
|
|
2149
|
-
m("div",
|
|
2157
|
+
ae(Cs, { style: { width: "100%" } })
|
|
2158
|
+
])) : ye("", !0),
|
|
2159
|
+
m("div", Po, [
|
|
2150
2160
|
$[37] || ($[37] = m("div", { class: "title" }, "风格", -1)),
|
|
2151
|
-
|
|
2161
|
+
ae(Ts, { style: { width: "100%" } })
|
|
2152
2162
|
]),
|
|
2153
|
-
|
|
2154
|
-
m("div",
|
|
2155
|
-
|
|
2156
|
-
])) :
|
|
2157
|
-
], 64)) :
|
|
2158
|
-
|
|
2163
|
+
ie.value ? (X(), j("div", Bo, [
|
|
2164
|
+
m("div", zo, nt(I() == "arrow" ? "箭头" : "线条") + "类型", 1),
|
|
2165
|
+
ae(zs, { style: { width: "100%" } })
|
|
2166
|
+
])) : ye("", !0)
|
|
2167
|
+
], 64)) : ye("", !0),
|
|
2168
|
+
Y.value ? (X(), j(We, { key: 3 }, [
|
|
2159
2169
|
$[45] || ($[45] = m("div", { class: "divider" }, null, -1)),
|
|
2160
2170
|
$[46] || ($[46] = m("div", { class: "type-item-title" }, [
|
|
2161
2171
|
m("div", { class: "title" }, "文本设置")
|
|
2162
2172
|
], -1)),
|
|
2163
|
-
m("div",
|
|
2173
|
+
m("div", $o, [
|
|
2164
2174
|
$[40] || ($[40] = m("div", { class: "title" }, "样式", -1)),
|
|
2165
|
-
m("div",
|
|
2166
|
-
m("div",
|
|
2167
|
-
|
|
2168
|
-
|
|
2175
|
+
m("div", _o, [
|
|
2176
|
+
m("div", Ao, [
|
|
2177
|
+
ae(ve, { style: { width: "100%" } }),
|
|
2178
|
+
ae(ve, {
|
|
2169
2179
|
style: { width: "100%" },
|
|
2170
2180
|
modelValue: ht.value,
|
|
2171
2181
|
"onUpdate:modelValue": $[12] || ($[12] = (_e) => ht.value = _e),
|
|
2172
2182
|
onChange: Kt
|
|
2173
2183
|
}, {
|
|
2174
2184
|
default: Ae(() => [
|
|
2175
|
-
(
|
|
2185
|
+
(X(), j(We, null, ut(k, (_e) => ae(un, {
|
|
2176
2186
|
key: _e,
|
|
2177
2187
|
label: _e,
|
|
2178
2188
|
value: _e
|
|
@@ -2181,18 +2191,18 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2181
2191
|
_: 1
|
|
2182
2192
|
}, 8, ["modelValue"])
|
|
2183
2193
|
]),
|
|
2184
|
-
m("div",
|
|
2185
|
-
|
|
2186
|
-
|
|
2194
|
+
m("div", Do, [
|
|
2195
|
+
ae(hn),
|
|
2196
|
+
ae(hn)
|
|
2187
2197
|
]),
|
|
2188
|
-
|
|
2189
|
-
|
|
2198
|
+
ae(Ps),
|
|
2199
|
+
ae(Bs)
|
|
2190
2200
|
])
|
|
2191
2201
|
]),
|
|
2192
|
-
m("div",
|
|
2202
|
+
m("div", Fo, [
|
|
2193
2203
|
$[42] || ($[42] = m("div", { class: "title" }, "文本颜色", -1)),
|
|
2194
|
-
|
|
2195
|
-
color:
|
|
2204
|
+
ae(re, {
|
|
2205
|
+
color: Be.value,
|
|
2196
2206
|
ref_key: "fontColorPickerRef",
|
|
2197
2207
|
ref: c,
|
|
2198
2208
|
options: {
|
|
@@ -2208,25 +2218,25 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2208
2218
|
ref: l,
|
|
2209
2219
|
onClick: $[13] || ($[13] = (zt) => Pn())
|
|
2210
2220
|
}, [
|
|
2211
|
-
|
|
2221
|
+
Be.value == "transparent" || !Be.value ? (X(), j("svg", Oo, [...$[41] || ($[41] = [
|
|
2212
2222
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
2213
|
-
])])) : (
|
|
2223
|
+
])])) : (X(), j("div", {
|
|
2214
2224
|
key: 1,
|
|
2215
2225
|
class: "color-box",
|
|
2216
|
-
style: Ke({ background:
|
|
2226
|
+
style: Ke({ background: Be.value })
|
|
2217
2227
|
}, null, 4)),
|
|
2218
|
-
m("div",
|
|
2228
|
+
m("div", Lo, nt(Be.value != "transparent" ? Be.value.substring(
|
|
2219
2229
|
0,
|
|
2220
2230
|
7
|
|
2221
|
-
).toUpperCase() :
|
|
2231
|
+
).toUpperCase() : Be.value), 1)
|
|
2222
2232
|
], 512)
|
|
2223
2233
|
]),
|
|
2224
2234
|
_: 1
|
|
2225
2235
|
}, 8, ["color", "options"])
|
|
2226
2236
|
]),
|
|
2227
|
-
m("div",
|
|
2237
|
+
m("div", Ro, [
|
|
2228
2238
|
$[44] || ($[44] = m("div", { class: "title" }, "文本背景色", -1)),
|
|
2229
|
-
|
|
2239
|
+
ae(re, {
|
|
2230
2240
|
color: Fe.value,
|
|
2231
2241
|
ref_key: "fontBgColorPickerRef",
|
|
2232
2242
|
ref: r,
|
|
@@ -2243,14 +2253,14 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2243
2253
|
ref: o,
|
|
2244
2254
|
onClick: $[14] || ($[14] = (zt) => Tn())
|
|
2245
2255
|
}, [
|
|
2246
|
-
Fe.value == "transparent" || !Fe.value ? (
|
|
2256
|
+
Fe.value == "transparent" || !Fe.value ? (X(), j("svg", Xo, [...$[43] || ($[43] = [
|
|
2247
2257
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
2248
|
-
])])) : (
|
|
2258
|
+
])])) : (X(), j("div", {
|
|
2249
2259
|
key: 1,
|
|
2250
2260
|
class: "color-box",
|
|
2251
2261
|
style: Ke({ background: Fe.value })
|
|
2252
2262
|
}, null, 4)),
|
|
2253
|
-
m("div",
|
|
2263
|
+
m("div", Yo, nt(Fe.value != "transparent" ? Fe.value.substring(
|
|
2254
2264
|
0,
|
|
2255
2265
|
7
|
|
2256
2266
|
).toUpperCase() : Fe.value), 1)
|
|
@@ -2259,15 +2269,15 @@ const Ei = { class: "fill-style-box" }, Ci = ["onClick"], Ti = { class: "svg-ico
|
|
|
2259
2269
|
_: 1
|
|
2260
2270
|
}, 8, ["color", "options"])
|
|
2261
2271
|
])
|
|
2262
|
-
], 64)) :
|
|
2272
|
+
], 64)) : ye("", !0)
|
|
2263
2273
|
])
|
|
2264
2274
|
]),
|
|
2265
2275
|
_: 1
|
|
2266
2276
|
})
|
|
2267
|
-
], 4)) :
|
|
2277
|
+
], 4)) : ye("", !0);
|
|
2268
2278
|
};
|
|
2269
2279
|
}
|
|
2270
|
-
}),
|
|
2280
|
+
}), jo = /* @__PURE__ */ st(Vo, [["__scopeId", "data-v-00889af3"]]);
|
|
2271
2281
|
function Xn(i, t, e) {
|
|
2272
2282
|
if (i && i.length) {
|
|
2273
2283
|
const [n, s] = t, a = Math.PI / 180 * e, o = Math.cos(a), l = Math.sin(a);
|
|
@@ -2277,26 +2287,26 @@ function Xn(i, t, e) {
|
|
|
2277
2287
|
}
|
|
2278
2288
|
}
|
|
2279
2289
|
}
|
|
2280
|
-
function
|
|
2290
|
+
function Ho(i, t) {
|
|
2281
2291
|
return i[0] === t[0] && i[1] === t[1];
|
|
2282
2292
|
}
|
|
2283
|
-
function
|
|
2293
|
+
function Wo(i, t, e, n = 1) {
|
|
2284
2294
|
const s = e, a = Math.max(t, 0.1), o = i[0] && i[0][0] && typeof i[0][0] == "number" ? [i] : i, l = [0, 0];
|
|
2285
2295
|
if (s) for (const c of o) Xn(c, l, s);
|
|
2286
2296
|
const r = (function(c, f, k) {
|
|
2287
2297
|
const d = [];
|
|
2288
2298
|
for (const b of c) {
|
|
2289
2299
|
const B = [...b];
|
|
2290
|
-
|
|
2300
|
+
Ho(B[0], B[B.length - 1]) || B.push([B[0][0], B[0][1]]), B.length > 2 && d.push(B);
|
|
2291
2301
|
}
|
|
2292
2302
|
const v = [];
|
|
2293
2303
|
f = Math.max(f, 0.1);
|
|
2294
2304
|
const h = [];
|
|
2295
2305
|
for (const b of d) for (let B = 0; B < b.length - 1; B++) {
|
|
2296
|
-
const
|
|
2297
|
-
if (
|
|
2298
|
-
const se = Math.min(
|
|
2299
|
-
h.push({ ymin: se, ymax: Math.max(
|
|
2306
|
+
const Y = b[B], q = b[B + 1];
|
|
2307
|
+
if (Y[1] !== q[1]) {
|
|
2308
|
+
const se = Math.min(Y[1], q[1]);
|
|
2309
|
+
h.push({ ymin: se, ymax: Math.max(Y[1], q[1]), x: se === Y[1] ? Y[0] : q[0], islope: (q[0] - Y[0]) / (q[1] - Y[1]) });
|
|
2300
2310
|
}
|
|
2301
2311
|
}
|
|
2302
2312
|
if (h.sort(((b, B) => b.ymin < B.ymin ? -1 : b.ymin > B.ymin ? 1 : b.x < B.x ? -1 : b.x > B.x ? 1 : b.ymax === B.ymax ? 0 : (b.ymax - B.ymax) / Math.abs(b.ymax - B.ymax))), !h.length) return v;
|
|
@@ -2312,8 +2322,8 @@ function jo(i, t, e, n = 1) {
|
|
|
2312
2322
|
if (M = M.filter(((b) => !(b.edge.ymax <= I))), M.sort(((b, B) => b.edge.x === B.edge.x ? 0 : (b.edge.x - B.edge.x) / Math.abs(b.edge.x - B.edge.x))), (k !== 1 || T % f == 0) && M.length > 1) for (let b = 0; b < M.length; b += 2) {
|
|
2313
2323
|
const B = b + 1;
|
|
2314
2324
|
if (B >= M.length) break;
|
|
2315
|
-
const
|
|
2316
|
-
v.push([[Math.round(
|
|
2325
|
+
const Y = M[b].edge, q = M[B].edge;
|
|
2326
|
+
v.push([[Math.round(Y.x), I], [Math.round(q.x), I]]);
|
|
2317
2327
|
}
|
|
2318
2328
|
I += k, M.forEach(((b) => {
|
|
2319
2329
|
b.edge.x = b.edge.x + k * b.edge.islope;
|
|
@@ -2336,7 +2346,7 @@ function sn(i, t) {
|
|
|
2336
2346
|
let s = t.hachureGap;
|
|
2337
2347
|
s < 0 && (s = 4 * t.strokeWidth), s = Math.round(Math.max(s, 0.1));
|
|
2338
2348
|
let a = 1;
|
|
2339
|
-
return t.roughness >= 1 && (((e = t.randomizer) === null || e === void 0 ? void 0 : e.next()) || Math.random()) > 0.7 && (a = s),
|
|
2349
|
+
return t.roughness >= 1 && (((e = t.randomizer) === null || e === void 0 ? void 0 : e.next()) || Math.random()) > 0.7 && (a = s), Wo(i, s, n, a || 1);
|
|
2340
2350
|
}
|
|
2341
2351
|
class Qn {
|
|
2342
2352
|
constructor(t) {
|
|
@@ -2359,7 +2369,7 @@ function Sn(i) {
|
|
|
2359
2369
|
const t = i[0], e = i[1];
|
|
2360
2370
|
return Math.sqrt(Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2));
|
|
2361
2371
|
}
|
|
2362
|
-
class
|
|
2372
|
+
class Uo extends Qn {
|
|
2363
2373
|
fillPolygons(t, e) {
|
|
2364
2374
|
let n = e.hachureGap;
|
|
2365
2375
|
n < 0 && (n = 4 * e.strokeWidth), n = Math.max(n, 0.1);
|
|
@@ -2368,13 +2378,13 @@ class Ho extends Qn {
|
|
|
2368
2378
|
return { type: "fillSketch", ops: this.renderLines(o, e) };
|
|
2369
2379
|
}
|
|
2370
2380
|
}
|
|
2371
|
-
class
|
|
2381
|
+
class qo extends Qn {
|
|
2372
2382
|
fillPolygons(t, e) {
|
|
2373
2383
|
const n = this._fillPolygons(t, e), s = Object.assign({}, e, { hachureAngle: e.hachureAngle + 90 }), a = this._fillPolygons(t, s);
|
|
2374
2384
|
return n.ops = n.ops.concat(a.ops), n;
|
|
2375
2385
|
}
|
|
2376
2386
|
}
|
|
2377
|
-
class
|
|
2387
|
+
class Go {
|
|
2378
2388
|
constructor(t) {
|
|
2379
2389
|
this.helper = t;
|
|
2380
2390
|
}
|
|
@@ -2399,7 +2409,7 @@ class Uo {
|
|
|
2399
2409
|
return { type: "fillSketch", ops: n };
|
|
2400
2410
|
}
|
|
2401
2411
|
}
|
|
2402
|
-
class
|
|
2412
|
+
class No {
|
|
2403
2413
|
constructor(t) {
|
|
2404
2414
|
this.helper = t;
|
|
2405
2415
|
}
|
|
@@ -2421,7 +2431,7 @@ class qo {
|
|
|
2421
2431
|
})), a;
|
|
2422
2432
|
}
|
|
2423
2433
|
}
|
|
2424
|
-
class
|
|
2434
|
+
class Ko {
|
|
2425
2435
|
constructor(t) {
|
|
2426
2436
|
this.helper = t;
|
|
2427
2437
|
}
|
|
@@ -2444,7 +2454,7 @@ class Go {
|
|
|
2444
2454
|
}
|
|
2445
2455
|
}
|
|
2446
2456
|
const dt = {};
|
|
2447
|
-
class
|
|
2457
|
+
class Jo {
|
|
2448
2458
|
constructor(t) {
|
|
2449
2459
|
this.seed = t;
|
|
2450
2460
|
}
|
|
@@ -2452,7 +2462,7 @@ class No {
|
|
|
2452
2462
|
return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
|
|
2453
2463
|
}
|
|
2454
2464
|
}
|
|
2455
|
-
const
|
|
2465
|
+
const Zo = 0, Yn = 1, us = 2, fn = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
|
|
2456
2466
|
function Vn(i, t) {
|
|
2457
2467
|
return i.type === t;
|
|
2458
2468
|
}
|
|
@@ -2460,7 +2470,7 @@ function es(i) {
|
|
|
2460
2470
|
const t = [], e = (function(o) {
|
|
2461
2471
|
const l = new Array();
|
|
2462
2472
|
for (; o !== ""; ) if (o.match(/^([ \t\r\n,]+)/)) o = o.substr(RegExp.$1.length);
|
|
2463
|
-
else if (o.match(/^([aAcChHlLmMqQsStTvVzZ])/)) l[l.length] = { type:
|
|
2473
|
+
else if (o.match(/^([aAcChHlLmMqQsStTvVzZ])/)) l[l.length] = { type: Zo, text: RegExp.$1 }, o = o.substr(RegExp.$1.length);
|
|
2464
2474
|
else {
|
|
2465
2475
|
if (!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
|
|
2466
2476
|
l[l.length] = { type: Yn, text: `${parseFloat(RegExp.$1)}` }, o = o.substr(RegExp.$1.length);
|
|
@@ -2489,7 +2499,7 @@ function es(i) {
|
|
|
2489
2499
|
}
|
|
2490
2500
|
return t;
|
|
2491
2501
|
}
|
|
2492
|
-
function
|
|
2502
|
+
function $s(i) {
|
|
2493
2503
|
let t = 0, e = 0, n = 0, s = 0;
|
|
2494
2504
|
const a = [];
|
|
2495
2505
|
for (const { key: o, data: l } of i) switch (o) {
|
|
@@ -2559,7 +2569,7 @@ function zs(i) {
|
|
|
2559
2569
|
}
|
|
2560
2570
|
return a;
|
|
2561
2571
|
}
|
|
2562
|
-
function
|
|
2572
|
+
function _s(i) {
|
|
2563
2573
|
const t = [];
|
|
2564
2574
|
let e = "", n = 0, s = 0, a = 0, o = 0, l = 0, r = 0;
|
|
2565
2575
|
for (const { key: c, data: f } of i) {
|
|
@@ -2599,7 +2609,7 @@ function $s(i) {
|
|
|
2599
2609
|
}
|
|
2600
2610
|
case "A": {
|
|
2601
2611
|
const k = Math.abs(f[0]), d = Math.abs(f[1]), v = f[2], h = f[3], M = f[4], I = f[5], T = f[6];
|
|
2602
|
-
k === 0 || d === 0 ? (t.push({ key: "C", data: [n, s, I, T, I, T] }), n = I, s = T) : (n !== I || s !== T) && (
|
|
2612
|
+
k === 0 || d === 0 ? (t.push({ key: "C", data: [n, s, I, T, I, T] }), n = I, s = T) : (n !== I || s !== T) && (As(n, s, I, T, k, d, v, h, M).forEach((function(b) {
|
|
2603
2613
|
t.push({ key: "C", data: b });
|
|
2604
2614
|
})), n = I, s = T);
|
|
2605
2615
|
break;
|
|
@@ -2614,7 +2624,7 @@ function $s(i) {
|
|
|
2614
2624
|
function Qt(i, t, e) {
|
|
2615
2625
|
return [i * Math.cos(e) - t * Math.sin(e), i * Math.sin(e) + t * Math.cos(e)];
|
|
2616
2626
|
}
|
|
2617
|
-
function
|
|
2627
|
+
function As(i, t, e, n, s, a, o, l, r, c) {
|
|
2618
2628
|
const f = (k = o, Math.PI * k / 180);
|
|
2619
2629
|
var k;
|
|
2620
2630
|
let d = [], v = 0, h = 0, M = 0, I = 0;
|
|
@@ -2624,38 +2634,38 @@ function _s(i, t, e, n, s, a, o, l, r, c) {
|
|
|
2624
2634
|
const D = (i - e) / 2, N = (t - n) / 2;
|
|
2625
2635
|
let te = D * D / (s * s) + N * N / (a * a);
|
|
2626
2636
|
te > 1 && (te = Math.sqrt(te), s *= te, a *= te);
|
|
2627
|
-
const
|
|
2637
|
+
const xe = s * s, we = a * a, Ce = xe * we - xe * N * N - we * D * D, Be = xe * N * N + we * D * D, Fe = (l === r ? -1 : 1) * Math.sqrt(Math.abs(Ce / Be));
|
|
2628
2638
|
M = Fe * s * N / a + (i + e) / 2, I = Fe * -a * D / s + (t + n) / 2, v = Math.asin(parseFloat(((t - I) / a).toFixed(9))), h = Math.asin(parseFloat(((n - I) / a).toFixed(9))), i < M && (v = Math.PI - v), e < M && (h = Math.PI - h), v < 0 && (v = 2 * Math.PI + v), h < 0 && (h = 2 * Math.PI + h), r && v > h && (v -= 2 * Math.PI), !r && h > v && (h -= 2 * Math.PI);
|
|
2629
2639
|
}
|
|
2630
2640
|
let T = h - v;
|
|
2631
2641
|
if (Math.abs(T) > 120 * Math.PI / 180) {
|
|
2632
2642
|
const D = h, N = e, te = n;
|
|
2633
|
-
h = r && h > v ? v + 120 * Math.PI / 180 * 1 : v + 120 * Math.PI / 180 * -1, d =
|
|
2643
|
+
h = r && h > v ? v + 120 * Math.PI / 180 * 1 : v + 120 * Math.PI / 180 * -1, d = As(e = M + s * Math.cos(h), n = I + a * Math.sin(h), N, te, s, a, o, 0, r, [h, D, M, I]);
|
|
2634
2644
|
}
|
|
2635
2645
|
T = h - v;
|
|
2636
|
-
const b = Math.cos(v), B = Math.sin(v),
|
|
2646
|
+
const b = Math.cos(v), B = Math.sin(v), Y = Math.cos(h), q = Math.sin(h), se = Math.tan(T / 4), le = 4 / 3 * s * se, ie = 4 / 3 * a * se, ee = [i, t], G = [i + le * B, t - ie * b], he = [e + le * q, n - ie * Y], H = [e, n];
|
|
2637
2647
|
if (G[0] = 2 * ee[0] - G[0], G[1] = 2 * ee[1] - G[1], c) return [G, he, H].concat(d);
|
|
2638
2648
|
{
|
|
2639
2649
|
d = [G, he, H].concat(d);
|
|
2640
2650
|
const D = [];
|
|
2641
2651
|
for (let N = 0; N < d.length; N += 3) {
|
|
2642
|
-
const te = Qt(d[N][0], d[N][1], f),
|
|
2643
|
-
D.push([te[0], te[1],
|
|
2652
|
+
const te = Qt(d[N][0], d[N][1], f), xe = Qt(d[N + 1][0], d[N + 1][1], f), we = Qt(d[N + 2][0], d[N + 2][1], f);
|
|
2653
|
+
D.push([te[0], te[1], xe[0], xe[1], we[0], we[1]]);
|
|
2644
2654
|
}
|
|
2645
2655
|
return D;
|
|
2646
2656
|
}
|
|
2647
2657
|
}
|
|
2648
|
-
const
|
|
2658
|
+
const Qo = { randOffset: function(i, t) {
|
|
2649
2659
|
return ce(i, t);
|
|
2650
2660
|
}, randOffsetWithRange: function(i, t, e) {
|
|
2651
2661
|
return xn(i, t, e);
|
|
2652
2662
|
}, ellipse: function(i, t, e, n, s) {
|
|
2653
|
-
const a =
|
|
2663
|
+
const a = Fs(e, n, s);
|
|
2654
2664
|
return Nn(i, t, s, a).opset;
|
|
2655
2665
|
}, doubleLineOps: function(i, t, e, n, s) {
|
|
2656
2666
|
return Bt(i, t, e, n, s, !0);
|
|
2657
2667
|
} };
|
|
2658
|
-
function
|
|
2668
|
+
function Ds(i, t, e, n, s) {
|
|
2659
2669
|
return { type: "path", ops: Bt(i, t, e, n, s) };
|
|
2660
2670
|
}
|
|
2661
2671
|
function mn(i, t, e) {
|
|
@@ -2665,9 +2675,9 @@ function mn(i, t, e) {
|
|
|
2665
2675
|
for (let a = 0; a < n - 1; a++) s.push(...Bt(i[a][0], i[a][1], i[a + 1][0], i[a + 1][1], e));
|
|
2666
2676
|
return t && s.push(...Bt(i[n - 1][0], i[n - 1][1], i[0][0], i[0][1], e)), { type: "path", ops: s };
|
|
2667
2677
|
}
|
|
2668
|
-
return n === 2 ?
|
|
2678
|
+
return n === 2 ? Ds(i[0][0], i[0][1], i[1][0], i[1][1], e) : { type: "path", ops: [] };
|
|
2669
2679
|
}
|
|
2670
|
-
function
|
|
2680
|
+
function ea(i, t, e, n, s) {
|
|
2671
2681
|
return (function(a, o) {
|
|
2672
2682
|
return mn(a, !0, o);
|
|
2673
2683
|
})([[i, t], [i + e, t], [i + e, t + n], [i, t + n]], s);
|
|
@@ -2687,7 +2697,7 @@ function hs(i, t) {
|
|
|
2687
2697
|
}
|
|
2688
2698
|
return { type: "path", ops: [] };
|
|
2689
2699
|
}
|
|
2690
|
-
function
|
|
2700
|
+
function Fs(i, t, e) {
|
|
2691
2701
|
const n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(i / 2, 2) + Math.pow(t / 2, 2)) / 2)), s = Math.ceil(Math.max(e.curveStepCount, e.curveStepCount / Math.sqrt(200) * n)), a = 2 * Math.PI / s;
|
|
2692
2702
|
let o = Math.abs(i / 2), l = Math.abs(t / 2);
|
|
2693
2703
|
const r = 1 - e.curveFitting;
|
|
@@ -2717,7 +2727,7 @@ function ps(i, t, e, n, s, a, o, l, r) {
|
|
|
2717
2727
|
return o && (l ? T.push(...Bt(c, f, c + k * Math.cos(v), f + d * Math.sin(v), r), ...Bt(c, f, c + k * Math.cos(h), f + d * Math.sin(h), r)) : T.push({ op: "lineTo", data: [c, f] }, { op: "lineTo", data: [c + k * Math.cos(v), f + d * Math.sin(v)] })), { type: "path", ops: T };
|
|
2718
2728
|
}
|
|
2719
2729
|
function fs(i, t) {
|
|
2720
|
-
const e = $s(
|
|
2730
|
+
const e = _s($s(es(i))), n = [];
|
|
2721
2731
|
let s = [0, 0], a = [0, 0];
|
|
2722
2732
|
for (const { key: o, data: l } of e) switch (o) {
|
|
2723
2733
|
case "M":
|
|
@@ -2728,7 +2738,7 @@ function fs(i, t) {
|
|
|
2728
2738
|
break;
|
|
2729
2739
|
case "C": {
|
|
2730
2740
|
const [r, c, f, k, d, v] = l;
|
|
2731
|
-
n.push(...
|
|
2741
|
+
n.push(...ta(r, c, f, k, d, v, a, t)), a = [d, v];
|
|
2732
2742
|
break;
|
|
2733
2743
|
}
|
|
2734
2744
|
case "Z":
|
|
@@ -2752,35 +2762,35 @@ function Ut(i, t) {
|
|
|
2752
2762
|
let s = e.fillStyle || "hachure";
|
|
2753
2763
|
if (!dt[s]) switch (s) {
|
|
2754
2764
|
case "zigzag":
|
|
2755
|
-
dt[s] || (dt[s] = new
|
|
2765
|
+
dt[s] || (dt[s] = new Uo(n));
|
|
2756
2766
|
break;
|
|
2757
2767
|
case "cross-hatch":
|
|
2758
|
-
dt[s] || (dt[s] = new
|
|
2768
|
+
dt[s] || (dt[s] = new qo(n));
|
|
2759
2769
|
break;
|
|
2760
2770
|
case "dots":
|
|
2761
|
-
dt[s] || (dt[s] = new
|
|
2771
|
+
dt[s] || (dt[s] = new Go(n));
|
|
2762
2772
|
break;
|
|
2763
2773
|
case "dashed":
|
|
2764
|
-
dt[s] || (dt[s] = new
|
|
2774
|
+
dt[s] || (dt[s] = new No(n));
|
|
2765
2775
|
break;
|
|
2766
2776
|
case "zigzag-line":
|
|
2767
|
-
dt[s] || (dt[s] = new
|
|
2777
|
+
dt[s] || (dt[s] = new Ko(n));
|
|
2768
2778
|
break;
|
|
2769
2779
|
default:
|
|
2770
2780
|
s = "hachure", dt[s] || (dt[s] = new Qn(n));
|
|
2771
2781
|
}
|
|
2772
2782
|
return dt[s];
|
|
2773
|
-
})(t,
|
|
2783
|
+
})(t, Qo).fillPolygons(i, t);
|
|
2774
2784
|
}
|
|
2775
2785
|
function gs(i) {
|
|
2776
2786
|
const t = Object.assign({}, i);
|
|
2777
2787
|
return t.randomizer = void 0, i.seed && (t.seed = i.seed + 1), t;
|
|
2778
2788
|
}
|
|
2779
|
-
function
|
|
2780
|
-
return i.randomizer || (i.randomizer = new
|
|
2789
|
+
function Os(i) {
|
|
2790
|
+
return i.randomizer || (i.randomizer = new Jo(i.seed || 0)), i.randomizer.next();
|
|
2781
2791
|
}
|
|
2782
2792
|
function xn(i, t, e, n = 1) {
|
|
2783
|
-
return e.roughness * n * (
|
|
2793
|
+
return e.roughness * n * (Os(e) * (t - i) + i);
|
|
2784
2794
|
}
|
|
2785
2795
|
function ce(i, t, e = 1) {
|
|
2786
2796
|
return xn(-i, i, t, e);
|
|
@@ -2797,7 +2807,7 @@ function Kn(i, t, e, n, s, a, o) {
|
|
|
2797
2807
|
c = r < 200 ? 1 : r > 500 ? 0.4 : -16668e-7 * r + 1.233334;
|
|
2798
2808
|
let f = s.maxRandomnessOffset || 0;
|
|
2799
2809
|
f * f * 100 > l && (f = r / 10);
|
|
2800
|
-
const k = f / 2, d = 0.2 + 0.2 *
|
|
2810
|
+
const k = f / 2, d = 0.2 + 0.2 * Os(s);
|
|
2801
2811
|
let v = s.bowing * s.maxRandomnessOffset * (n - t) / 200, h = s.bowing * s.maxRandomnessOffset * (i - e) / 200;
|
|
2802
2812
|
v = ce(v, s, c), h = ce(h, s, c);
|
|
2803
2813
|
const M = [], I = () => ce(k, s, c), T = () => ce(f, s, c), b = s.preserveVertices;
|
|
@@ -2849,7 +2859,7 @@ function ms(i, t, e, n, s, a, o, l, r) {
|
|
|
2849
2859
|
for (let k = c; k <= o; k += i) f.push([ce(l, r) + t + n * Math.cos(k), ce(l, r) + e + s * Math.sin(k)]);
|
|
2850
2860
|
return f.push([t + n * Math.cos(o), e + s * Math.sin(o)]), f.push([t + n * Math.cos(o), e + s * Math.sin(o)]), kn(f, null, r);
|
|
2851
2861
|
}
|
|
2852
|
-
function
|
|
2862
|
+
function ta(i, t, e, n, s, a, o, l) {
|
|
2853
2863
|
const r = [], c = [l.maxRandomnessOffset || 1, (l.maxRandomnessOffset || 1) + 0.3];
|
|
2854
2864
|
let f = [0, 0];
|
|
2855
2865
|
const k = l.disableMultiStroke ? 1 : 2, d = l.preserveVertices;
|
|
@@ -2880,7 +2890,7 @@ function ys(i, t = 0) {
|
|
|
2880
2890
|
function yn(i, t) {
|
|
2881
2891
|
return Math.pow(i[0] - t[0], 2) + Math.pow(i[1] - t[1], 2);
|
|
2882
2892
|
}
|
|
2883
|
-
function
|
|
2893
|
+
function na(i, t, e) {
|
|
2884
2894
|
const n = yn(t, e);
|
|
2885
2895
|
if (n === 0) return yn(i, t);
|
|
2886
2896
|
let s = ((i[0] - t[0]) * (e[0] - t[0]) + (i[1] - t[1]) * (e[1] - t[1])) / n;
|
|
@@ -2911,14 +2921,14 @@ function Jn(i, t, e, n) {
|
|
|
2911
2921
|
var a, o;
|
|
2912
2922
|
return s;
|
|
2913
2923
|
}
|
|
2914
|
-
function
|
|
2924
|
+
function sa(i, t) {
|
|
2915
2925
|
return wn(i, 0, i.length, t);
|
|
2916
2926
|
}
|
|
2917
2927
|
function wn(i, t, e, n, s) {
|
|
2918
2928
|
const a = s || [], o = i[t], l = i[e - 1];
|
|
2919
2929
|
let r = 0, c = 1;
|
|
2920
2930
|
for (let f = t + 1; f < e - 1; ++f) {
|
|
2921
|
-
const k =
|
|
2931
|
+
const k = na(i[f], o, l);
|
|
2922
2932
|
k > r && (r = k, c = f);
|
|
2923
2933
|
}
|
|
2924
2934
|
return Math.sqrt(r) > n ? (wn(i, t, c + 1, n, a), wn(i, c, e, n, a)) : (a.length || a.push(o), a.push(l)), a;
|
|
@@ -2945,10 +2955,10 @@ class bn {
|
|
|
2945
2955
|
}
|
|
2946
2956
|
line(t, e, n, s, a) {
|
|
2947
2957
|
const o = this._o(a);
|
|
2948
|
-
return this._d("line", [
|
|
2958
|
+
return this._d("line", [Ds(t, e, n, s, o)], o);
|
|
2949
2959
|
}
|
|
2950
2960
|
rectangle(t, e, n, s, a) {
|
|
2951
|
-
const o = this._o(a), l = [], r =
|
|
2961
|
+
const o = this._o(a), l = [], r = ea(t, e, n, s, o);
|
|
2952
2962
|
if (o.fill) {
|
|
2953
2963
|
const c = [[t, e], [t + n, e], [t + n, e + s], [t, e + s]];
|
|
2954
2964
|
o.fillStyle === "solid" ? l.push(jn([c], o)) : l.push(Ut([c], o));
|
|
@@ -2956,7 +2966,7 @@ class bn {
|
|
|
2956
2966
|
return o.stroke !== gt && l.push(r), this._d("rectangle", l, o);
|
|
2957
2967
|
}
|
|
2958
2968
|
ellipse(t, e, n, s, a) {
|
|
2959
|
-
const o = this._o(a), l = [], r =
|
|
2969
|
+
const o = this._o(a), l = [], r = Fs(n, s, o), c = Nn(t, e, o, r);
|
|
2960
2970
|
if (o.fill) if (o.fillStyle === "solid") {
|
|
2961
2971
|
const f = Nn(t, e, o, r).opset;
|
|
2962
2972
|
f.type = "fillPath", l.push(f);
|
|
@@ -2979,15 +2989,15 @@ class bn {
|
|
|
2979
2989
|
const v = ps(t, e, n, s, a, o, !0, !1, d);
|
|
2980
2990
|
v.type = "fillPath", f.push(v);
|
|
2981
2991
|
} else f.push((function(d, v, h, M, I, T, b) {
|
|
2982
|
-
const B = d,
|
|
2992
|
+
const B = d, Y = v;
|
|
2983
2993
|
let q = Math.abs(h / 2), se = Math.abs(M / 2);
|
|
2984
2994
|
q += ce(0.01 * q, b), se += ce(0.01 * se, b);
|
|
2985
|
-
let le = I,
|
|
2986
|
-
for (; le < 0; ) le += 2 * Math.PI,
|
|
2987
|
-
|
|
2988
|
-
const ee = (
|
|
2989
|
-
for (let he = le; he <=
|
|
2990
|
-
return G.push([B + q * Math.cos(
|
|
2995
|
+
let le = I, ie = T;
|
|
2996
|
+
for (; le < 0; ) le += 2 * Math.PI, ie += 2 * Math.PI;
|
|
2997
|
+
ie - le > 2 * Math.PI && (le = 0, ie = 2 * Math.PI);
|
|
2998
|
+
const ee = (ie - le) / b.curveStepCount, G = [];
|
|
2999
|
+
for (let he = le; he <= ie; he += ee) G.push([B + q * Math.cos(he), Y + se * Math.sin(he)]);
|
|
3000
|
+
return G.push([B + q * Math.cos(ie), Y + se * Math.sin(ie)]), G.push([B, Y]), Ut([G], b);
|
|
2991
3001
|
})(t, e, n, s, a, o, c));
|
|
2992
3002
|
return c.stroke !== gt && f.push(k), this._d("arc", f, c);
|
|
2993
3003
|
}
|
|
@@ -3015,7 +3025,7 @@ class bn {
|
|
|
3015
3025
|
if (!t) return this._d("path", s, n);
|
|
3016
3026
|
t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
|
|
3017
3027
|
const a = n.fill && n.fill !== "transparent" && n.fill !== gt, o = n.stroke !== gt, l = !!(n.simplification && n.simplification < 1), r = (function(f, k, d) {
|
|
3018
|
-
const v = $s(
|
|
3028
|
+
const v = _s($s(es(f))), h = [];
|
|
3019
3029
|
let M = [], I = [0, 0], T = [];
|
|
3020
3030
|
const b = () => {
|
|
3021
3031
|
T.length >= 4 && M.push(...Hn(T, k)), T = [];
|
|
@@ -3040,12 +3050,12 @@ class bn {
|
|
|
3040
3050
|
b(), M.push([I[0], I[1]]);
|
|
3041
3051
|
}
|
|
3042
3052
|
if (B(), !d) return h;
|
|
3043
|
-
const
|
|
3053
|
+
const Y = [];
|
|
3044
3054
|
for (const q of h) {
|
|
3045
|
-
const se =
|
|
3046
|
-
se.length &&
|
|
3055
|
+
const se = sa(q, d);
|
|
3056
|
+
se.length && Y.push(se);
|
|
3047
3057
|
}
|
|
3048
|
-
return
|
|
3058
|
+
return Y;
|
|
3049
3059
|
})(t, 1, l ? 4 - 4 * (n.simplification || 1) : (1 + n.roughness) / 2), c = fs(t, n);
|
|
3050
3060
|
if (a) if (n.fillStyle === "solid") if (r.length === 1) {
|
|
3051
3061
|
const f = fs(t, Object.assign(Object.assign({}, n), { disableMultiStroke: !0, roughness: n.roughness ? n.roughness + n.fillShapeRoughnessGain : 0 }));
|
|
@@ -3099,7 +3109,7 @@ class bn {
|
|
|
3099
3109
|
return t.filter(((e, n) => n === 0 || e.op !== "move"));
|
|
3100
3110
|
}
|
|
3101
3111
|
}
|
|
3102
|
-
class
|
|
3112
|
+
class ia {
|
|
3103
3113
|
constructor(t, e) {
|
|
3104
3114
|
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new bn(e);
|
|
3105
3115
|
}
|
|
@@ -3184,7 +3194,7 @@ class na {
|
|
|
3184
3194
|
}
|
|
3185
3195
|
}
|
|
3186
3196
|
const vn = "http://www.w3.org/2000/svg";
|
|
3187
|
-
class
|
|
3197
|
+
class oa {
|
|
3188
3198
|
constructor(t, e) {
|
|
3189
3199
|
this.svg = t, this.gen = new bn(e);
|
|
3190
3200
|
}
|
|
@@ -3258,8 +3268,8 @@ class sa {
|
|
|
3258
3268
|
return this.draw(n);
|
|
3259
3269
|
}
|
|
3260
3270
|
}
|
|
3261
|
-
var
|
|
3262
|
-
const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(),
|
|
3271
|
+
var aa = { canvas: (i, t) => new ia(i, t), svg: (i, t) => new oa(i, t), generator: (i) => new bn(i), newSeed: () => bn.newSeed() };
|
|
3272
|
+
const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), la = (i) => {
|
|
3263
3273
|
if (Wn.has(i)) return Wn.get(i);
|
|
3264
3274
|
const t = document.createElement("canvas");
|
|
3265
3275
|
t.width = 40, t.height = 40;
|
|
@@ -3271,7 +3281,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3271
3281
|
e.scale(o, o), e.translate(-512, -512);
|
|
3272
3282
|
const l = new Path2D("M771.09045312 471.64751562L252.89970312 471.64751562c-44.7575625 0-81.03670312 36.20432813-81.03670312 80.87625001l0 343.07339062c0 44.67290625 36.27914062 80.87625 81.03670312 80.87625l518.19173438 0c44.75854688 0 81.04753125-36.20334375 81.04753125-80.87625L852.13896875 552.52376563C852.13798437 507.85184375 815.849 471.64751562 771.09045312 471.64751562zM546.12434375 721.73979687l0 90.04964063c0 18.8409375-15.26864062 34.13123438-34.12926563 34.13123438-18.84979688 0-34.12926563-15.29029687-34.12926562-34.13123438l0-90.04964062c-20.37951562-11.804625-34.13025-33.80835938-34.13025-59.06348438 0-37.7015625 30.55795313-68.2605 68.25951562-68.2605s68.27034375 30.5589375 68.27034375 68.2605C580.26542188 687.9314375 566.52551562 709.93517188 546.12434375 721.73979687zM511.99507812 147.37175c-131.95251562 0-238.92946875 105.46889063-238.92946875 244.04034375l1e-8 105.98273437 477.87075 22.75284375L750.93635938 391.41209375C750.93635938 252.84064062 643.95940625 147.37175 511.99507812 147.37175zM341.36745312 491.406875L341.36745312 389.03876562c0-94.2204375 76.395375-170.627625 170.62664063-170.627625 94.24209375 0 170.627625 76.4071875 170.627625 170.627625l0 104.76309375L341.36745312 491.406875z");
|
|
3273
3283
|
return e.fillStyle = i, e.fill(l), e.restore(), Wn.set(i, t), t;
|
|
3274
|
-
},
|
|
3284
|
+
}, ra = (i, t, e, n, s, a, o) => {
|
|
3275
3285
|
if (o === "none") return;
|
|
3276
3286
|
const l = t.width / a, r = t.height / a, c = -e, f = -n, k = c + l / s, d = f + r / s, v = 20, h = Math.floor(c / v) * v, M = Math.floor(f / v) * v;
|
|
3277
3287
|
if (i.save(), o === "dot") {
|
|
@@ -3301,25 +3311,25 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3301
3311
|
i.stroke();
|
|
3302
3312
|
}
|
|
3303
3313
|
i.restore();
|
|
3304
|
-
},
|
|
3314
|
+
}, ca = (i, t, e, n, s, a = {}, o = null, l = {}, r = null, c = {}, f = "none", k = null, d = "#FFFFFF") => {
|
|
3305
3315
|
const v = i.getContext("2d");
|
|
3306
3316
|
if (!v) return;
|
|
3307
|
-
const h =
|
|
3317
|
+
const h = aa.canvas(i);
|
|
3308
3318
|
v.clearRect(0, 0, i.width, i.height), v.fillStyle = d, v.fillRect(0, 0, i.width, i.height);
|
|
3309
3319
|
const M = window.devicePixelRatio || 1;
|
|
3310
|
-
v.save(), v.scale(M, M), v.scale(s, s), v.translate(e, n),
|
|
3311
|
-
const I = [], T = [], b = [], B = [],
|
|
3320
|
+
v.save(), v.scale(M, M), v.scale(s, s), v.translate(e, n), ra(v, i, e, n, s, M, f);
|
|
3321
|
+
const I = [], T = [], b = [], B = [], Y = {};
|
|
3312
3322
|
t.forEach((D) => {
|
|
3313
3323
|
if (D.isDeleted) return;
|
|
3314
3324
|
const N = D.frameId;
|
|
3315
|
-
N && (
|
|
3325
|
+
N && (Y[N] || (Y[N] = []), Y[N].push(D));
|
|
3316
3326
|
});
|
|
3317
3327
|
const q = /* @__PURE__ */ new Set();
|
|
3318
3328
|
t.forEach((D) => {
|
|
3319
3329
|
if (!(D.isDeleted || q.has(D.id)))
|
|
3320
3330
|
if (D.type === "frame") {
|
|
3321
3331
|
B.push(D), q.add(D.id);
|
|
3322
|
-
const N =
|
|
3332
|
+
const N = Y[D.id];
|
|
3323
3333
|
N && N.forEach((te) => {
|
|
3324
3334
|
q.has(te.id) || (B.push(te), q.add(te.id));
|
|
3325
3335
|
});
|
|
@@ -3334,16 +3344,16 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3334
3344
|
const N = (r ? D.id === r : !1) || c[D.id], te = o === D.id;
|
|
3335
3345
|
Un(h, v, D, t, !1, l[D.id], "dashed", N, te, k === D.id);
|
|
3336
3346
|
});
|
|
3337
|
-
const se = b.filter((D) => a[D.id]), le = [...T, ...se],
|
|
3347
|
+
const se = b.filter((D) => a[D.id]), le = [...T, ...se], ie = le.length, ee = ie === 2 ? le.find((D) => D.type === "text" && D.containerId) : null, G = !!(ee && le.find((D) => D.id === ee.containerId)), he = ie > 1 && le[0] && !!le[0].groupIds.find((D) => le.every((N) => N.groupIds.includes(D))), H = ie > 1 && !G ? "solid" : "dashed";
|
|
3338
3348
|
if (T.forEach((D) => {
|
|
3339
|
-
const N = D.frameId, te = N && a[N],
|
|
3340
|
-
Un(h, v, D, t,
|
|
3349
|
+
const N = D.frameId, te = N && a[N], xe = a[D.id], we = ie === 1 || !he && (!!xe || !te), Ce = (r ? D.id === r : !1) || c[D.id], Be = o === D.id;
|
|
3350
|
+
Un(h, v, D, t, we, l[D.id], H, Ce, Be, k === D.id);
|
|
3341
3351
|
}), b.forEach((D) => {
|
|
3342
3352
|
let N = !!a[D.id];
|
|
3343
|
-
(
|
|
3344
|
-
const te = (r ? D.id === r : !1) || c[D.id],
|
|
3345
|
-
Un(h, v, D, t, N, l[D.id], H, te,
|
|
3346
|
-
}),
|
|
3353
|
+
(ie === 1 && N || ie > 1 && he) && (N = !1);
|
|
3354
|
+
const te = (r ? D.id === r : !1) || c[D.id], xe = o === D.id;
|
|
3355
|
+
Un(h, v, D, t, N, l[D.id], H, te, xe, k === D.id);
|
|
3356
|
+
}), ie > 1 && !G) {
|
|
3347
3357
|
const D = Gt(le);
|
|
3348
3358
|
D && (v.save(), v.translate(D.minX, D.minY), v.strokeStyle = "#6965db", v.lineWidth = 1, v.setLineDash([5, 5]), v.strokeRect(-4, -4, D.width + 8, D.height + 8), v.restore());
|
|
3349
3359
|
}
|
|
@@ -3410,12 +3420,12 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3410
3420
|
let D = e.name || "Frame";
|
|
3411
3421
|
const N = Math.max(0, e.width - 10);
|
|
3412
3422
|
if (t.measureText(D).width > N) {
|
|
3413
|
-
let te = 0,
|
|
3414
|
-
for (; te <=
|
|
3415
|
-
const
|
|
3416
|
-
t.measureText(
|
|
3423
|
+
let te = 0, xe = D.length, we = "";
|
|
3424
|
+
for (; te <= xe; ) {
|
|
3425
|
+
const Ce = Math.floor((te + xe) / 2), Be = D.slice(0, Ce) + "...";
|
|
3426
|
+
t.measureText(Be).width <= N ? (we = Be, te = Ce + 1) : xe = Ce - 1;
|
|
3417
3427
|
}
|
|
3418
|
-
D =
|
|
3428
|
+
D = we;
|
|
3419
3429
|
}
|
|
3420
3430
|
t.fillText(D, 4, -4), t.restore();
|
|
3421
3431
|
}
|
|
@@ -3441,7 +3451,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3441
3451
|
break;
|
|
3442
3452
|
}
|
|
3443
3453
|
case "star": {
|
|
3444
|
-
const H =
|
|
3454
|
+
const H = St(e.width, e.height);
|
|
3445
3455
|
e.roundness > 0 ? i.path(_t(H, T()), h) : i.polygon(H, h);
|
|
3446
3456
|
break;
|
|
3447
3457
|
}
|
|
@@ -3482,43 +3492,43 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3482
3492
|
if (e.arrowType === "round")
|
|
3483
3493
|
i.curve(D, H);
|
|
3484
3494
|
else if (e.arrowType === "elbow") {
|
|
3485
|
-
let
|
|
3486
|
-
const
|
|
3495
|
+
let we, Ce;
|
|
3496
|
+
const Be = (ne) => {
|
|
3487
3497
|
if (!ne) return;
|
|
3488
3498
|
const Ue = n.find((de) => de.id === ne.elementId);
|
|
3489
3499
|
if (!Ue) return;
|
|
3490
|
-
const
|
|
3491
|
-
if (!
|
|
3492
|
-
const et = e.x +
|
|
3500
|
+
const oe = ne.focus < 0 ? e.points[0] : e.points[e.points.length - 1];
|
|
3501
|
+
if (!oe) return;
|
|
3502
|
+
const et = e.x + oe[0], ht = e.y + oe[1], at = Ue.x, Oe = Ue.y, tt = Ue.width, O = Ue.height, W = Math.abs(et - at), $e = Math.abs(et - (at + tt)), De = Math.abs(ht - Oe), ke = Math.abs(ht - (Oe + O)), Ye = Math.min(W, $e, De, ke);
|
|
3493
3503
|
if (Ye === W) return [-1, 0];
|
|
3494
3504
|
if (Ye === $e) return [1, 0];
|
|
3495
3505
|
if (Ye === De) return [0, -1];
|
|
3496
|
-
if (Ye ===
|
|
3506
|
+
if (Ye === ke) return [0, 1];
|
|
3497
3507
|
};
|
|
3498
|
-
e.startBinding && (
|
|
3499
|
-
const Fe =
|
|
3508
|
+
e.startBinding && (we = Be(e.startBinding)), e.endBinding && (Ce = Be(e.endBinding));
|
|
3509
|
+
const Fe = ri(D, 20, we, Ce);
|
|
3500
3510
|
i.path(Fe, H);
|
|
3501
3511
|
} else
|
|
3502
3512
|
i.linearPath(D, H);
|
|
3503
3513
|
let N = e.points;
|
|
3504
3514
|
if (e.arrowType === "elbow") {
|
|
3505
|
-
let
|
|
3506
|
-
const
|
|
3515
|
+
let we, Ce;
|
|
3516
|
+
const Be = (Fe) => {
|
|
3507
3517
|
if (!Fe) return;
|
|
3508
3518
|
const ne = n.find((Ye) => Ye.id === Fe.elementId);
|
|
3509
3519
|
if (!ne) return;
|
|
3510
3520
|
const Ue = Fe.focus < 0 ? e.points[0] : e.points[e.points.length - 1];
|
|
3511
3521
|
if (!Ue) return;
|
|
3512
|
-
const
|
|
3513
|
-
if (
|
|
3514
|
-
if (
|
|
3515
|
-
if (
|
|
3516
|
-
if (
|
|
3522
|
+
const oe = e.x + Ue[0], et = e.y + Ue[1], ht = ne.x, at = ne.y, Oe = ne.width, tt = ne.height, O = Math.abs(oe - ht), W = Math.abs(oe - (ht + Oe)), $e = Math.abs(et - at), De = Math.abs(et - (at + tt)), ke = Math.min(O, W, $e, De);
|
|
3523
|
+
if (ke === O) return [-1, 0];
|
|
3524
|
+
if (ke === W) return [1, 0];
|
|
3525
|
+
if (ke === $e) return [0, -1];
|
|
3526
|
+
if (ke === De) return [0, 1];
|
|
3517
3527
|
};
|
|
3518
|
-
e.startBinding && (
|
|
3528
|
+
e.startBinding && (we = Be(e.startBinding)), e.endBinding && (Ce = Be(e.endBinding)), N = Zn(e.points, we, Ce);
|
|
3519
3529
|
}
|
|
3520
|
-
const te = { ...e, points: N },
|
|
3521
|
-
|
|
3530
|
+
const te = { ...e, points: N }, xe = ii(te);
|
|
3531
|
+
xe && i.linearPath(xe, h);
|
|
3522
3532
|
}
|
|
3523
3533
|
break;
|
|
3524
3534
|
case "line":
|
|
@@ -3531,48 +3541,48 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3531
3541
|
case "text":
|
|
3532
3542
|
let b = "";
|
|
3533
3543
|
e.isItalic && (b += "italic "), e.isBold && (b += "bold "), t.font = `${b}${e.fontSize}px ${e.fontFamily}`, t.fillStyle = e.fontColor || e.strokeColor, t.textAlign = e.textAlign || "left", t.textBaseline = "top";
|
|
3534
|
-
const B = Math.round(e.fontSize * 1.25),
|
|
3535
|
-
`),
|
|
3544
|
+
const B = Math.round(e.fontSize * 1.25), Y = 4, q = Math.max(0, e.width - Y * 2) + 2, se = Math.max(0, e.height - Y * 2) + 2, le = (e.text || "").split(`
|
|
3545
|
+
`), ie = [];
|
|
3536
3546
|
if (le.forEach((H) => {
|
|
3537
3547
|
if (!H) {
|
|
3538
|
-
|
|
3548
|
+
ie.push("");
|
|
3539
3549
|
return;
|
|
3540
3550
|
}
|
|
3541
3551
|
let D = "";
|
|
3542
3552
|
for (let N = 0; N < H.length; N++) {
|
|
3543
|
-
const te = H.charAt(N),
|
|
3544
|
-
t.measureText(
|
|
3553
|
+
const te = H.charAt(N), xe = D + te;
|
|
3554
|
+
t.measureText(xe).width > q && D !== "" ? (ie.push(D), D = te) : D = xe;
|
|
3545
3555
|
}
|
|
3546
|
-
D !== "" &&
|
|
3547
|
-
}),
|
|
3548
|
-
const ee =
|
|
3556
|
+
D !== "" && ie.push(D);
|
|
3557
|
+
}), ie.length === 0) break;
|
|
3558
|
+
const ee = ie.length * B;
|
|
3549
3559
|
let G;
|
|
3550
|
-
e.verticalAlign === "middle" ? (G = (e.height - ee) / 2, G <
|
|
3560
|
+
e.verticalAlign === "middle" ? (G = (e.height - ee) / 2, G < Y && (G = Y)) : e.verticalAlign === "bottom" ? (G = e.height - Y - ee, G < Y && (G = Y)) : G = Y, G += e.fontSize * 0.15;
|
|
3551
3561
|
let he;
|
|
3552
|
-
if (e.textAlign === "center" ? he = e.width / 2 : e.textAlign === "right" ? he = e.width -
|
|
3562
|
+
if (e.textAlign === "center" ? he = e.width / 2 : e.textAlign === "right" ? he = e.width - Y : he = Y, e.fontBgColor && e.fontBgColor !== "transparent") {
|
|
3553
3563
|
let H = 0;
|
|
3554
|
-
for (let te = 0; te <
|
|
3555
|
-
H = Math.max(H, t.measureText(
|
|
3564
|
+
for (let te = 0; te < ie.length; te++)
|
|
3565
|
+
H = Math.max(H, t.measureText(ie[te] || "").width);
|
|
3556
3566
|
const D = ee;
|
|
3557
3567
|
let N = he;
|
|
3558
3568
|
e.textAlign === "center" ? N = he - H / 2 : e.textAlign === "right" && (N = he - H), t.fillStyle = e.fontBgColor, t.fillRect(N, G - e.fontSize * 0.15, H, D), t.fillStyle = e.fontColor || e.strokeColor;
|
|
3559
3569
|
}
|
|
3560
3570
|
if (!r)
|
|
3561
|
-
for (let H = 0; H <
|
|
3571
|
+
for (let H = 0; H < ie.length; H++) {
|
|
3562
3572
|
const D = G + H * B;
|
|
3563
|
-
if (D + B <
|
|
3564
|
-
if (D >
|
|
3565
|
-
const N =
|
|
3573
|
+
if (D + B < Y) continue;
|
|
3574
|
+
if (D > Y + se) break;
|
|
3575
|
+
const N = ie[H] || "";
|
|
3566
3576
|
if (t.fillText(N, he, D), e.isUnderline || e.isStrikethrough) {
|
|
3567
3577
|
const te = t.measureText(N).width;
|
|
3568
|
-
let
|
|
3569
|
-
if (e.textAlign === "center" ?
|
|
3570
|
-
const
|
|
3571
|
-
t.moveTo(
|
|
3578
|
+
let xe = he;
|
|
3579
|
+
if (e.textAlign === "center" ? xe -= te / 2 : e.textAlign === "right" && (xe -= te), t.strokeStyle = t.fillStyle, t.lineWidth = Math.max(1, e.fontSize * 0.08), t.beginPath(), e.isUnderline) {
|
|
3580
|
+
const we = D + e.fontSize * 1.05;
|
|
3581
|
+
t.moveTo(xe, we), t.lineTo(xe + te, we);
|
|
3572
3582
|
}
|
|
3573
3583
|
if (e.isStrikethrough) {
|
|
3574
|
-
const
|
|
3575
|
-
t.moveTo(
|
|
3584
|
+
const we = D + e.fontSize * 0.55;
|
|
3585
|
+
t.moveTo(xe, we), t.lineTo(xe + te, we);
|
|
3576
3586
|
}
|
|
3577
3587
|
t.stroke();
|
|
3578
3588
|
}
|
|
@@ -3586,7 +3596,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3586
3596
|
break;
|
|
3587
3597
|
}
|
|
3588
3598
|
if (t.globalAlpha = 1, s && !e.containerId && (t.strokeStyle = e.locked ? "#d2e2ff" : "#1e6fff", t.lineWidth = 1, o === "dashed" && t.setLineDash([5, 5]), t.strokeRect(-4, -4, e.width + 8, e.height + 8), t.setLineDash([]), e.locked)) {
|
|
3589
|
-
const se =
|
|
3599
|
+
const se = la(c ? "#1e6fff" : "black");
|
|
3590
3600
|
se && t.drawImage(se, 0, -50, 40, 40);
|
|
3591
3601
|
}
|
|
3592
3602
|
if (l) {
|
|
@@ -3608,12 +3618,12 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3608
3618
|
t.moveTo(b * 0.25, 0), t.lineTo(b, 0), t.lineTo(b * 0.75, B), t.lineTo(0, B), t.closePath();
|
|
3609
3619
|
break;
|
|
3610
3620
|
case "star": {
|
|
3611
|
-
const
|
|
3612
|
-
if (
|
|
3613
|
-
const q =
|
|
3621
|
+
const Y = St(b, B);
|
|
3622
|
+
if (Y && Y.length > 0) {
|
|
3623
|
+
const q = Y[0];
|
|
3614
3624
|
t.moveTo(q[0], q[1]);
|
|
3615
|
-
for (let se = 1; se <
|
|
3616
|
-
const le =
|
|
3625
|
+
for (let se = 1; se < Y.length; se++) {
|
|
3626
|
+
const le = Y[se];
|
|
3617
3627
|
t.lineTo(le[0], le[1]);
|
|
3618
3628
|
}
|
|
3619
3629
|
t.closePath();
|
|
@@ -3621,8 +3631,8 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3621
3631
|
break;
|
|
3622
3632
|
}
|
|
3623
3633
|
case "cylinder": {
|
|
3624
|
-
const
|
|
3625
|
-
t.ellipse(b / 2,
|
|
3634
|
+
const Y = Math.min(B * 0.15, 20);
|
|
3635
|
+
t.ellipse(b / 2, Y, b / 2, Y, 0, 0, 2 * Math.PI), t.moveTo(b, Y), t.lineTo(b, B - Y), t.ellipse(b / 2, B - Y, b / 2, Y, 0, 0, Math.PI, !1), t.lineTo(0, Y);
|
|
3626
3636
|
break;
|
|
3627
3637
|
}
|
|
3628
3638
|
default:
|
|
@@ -3632,7 +3642,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3632
3642
|
t.stroke();
|
|
3633
3643
|
}
|
|
3634
3644
|
t.restore();
|
|
3635
|
-
},
|
|
3645
|
+
}, da = (i) => {
|
|
3636
3646
|
if (i.length < 3) return i;
|
|
3637
3647
|
let t = [...i];
|
|
3638
3648
|
for (let e = 0; e < 2; e++) {
|
|
@@ -3653,7 +3663,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3653
3663
|
n.push(t[t.length - 1]), t = n;
|
|
3654
3664
|
}
|
|
3655
3665
|
return t;
|
|
3656
|
-
},
|
|
3666
|
+
}, ua = (i, t, e, n, s) => {
|
|
3657
3667
|
const a = i.getContext("2d");
|
|
3658
3668
|
if (!a || t.length === 0) return;
|
|
3659
3669
|
a.save();
|
|
@@ -3662,7 +3672,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3662
3672
|
const l = Date.now(), r = 1600;
|
|
3663
3673
|
t.forEach((c) => {
|
|
3664
3674
|
if (c.length < 2) return;
|
|
3665
|
-
const f =
|
|
3675
|
+
const f = da(c);
|
|
3666
3676
|
for (let k = 0; k < f.length - 1; k++) {
|
|
3667
3677
|
const d = f[k], v = f[k + 1];
|
|
3668
3678
|
if (!d || !v) continue;
|
|
@@ -3676,7 +3686,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3676
3686
|
}), a.restore();
|
|
3677
3687
|
}, tn = (i, t, e, n = {}) => {
|
|
3678
3688
|
const s = {
|
|
3679
|
-
id:
|
|
3689
|
+
id: It(),
|
|
3680
3690
|
x: t,
|
|
3681
3691
|
y: e,
|
|
3682
3692
|
width: 0,
|
|
@@ -3795,7 +3805,7 @@ const xs = /* @__PURE__ */ new Map(), Wn = /* @__PURE__ */ new Map(), oa = (i) =
|
|
|
3795
3805
|
}
|
|
3796
3806
|
};
|
|
3797
3807
|
let Ze = null;
|
|
3798
|
-
const
|
|
3808
|
+
const ha = {
|
|
3799
3809
|
height: "0",
|
|
3800
3810
|
visibility: "hidden",
|
|
3801
3811
|
overflow: "hidden",
|
|
@@ -3805,14 +3815,14 @@ const da = {
|
|
|
3805
3815
|
right: "0",
|
|
3806
3816
|
whiteSpace: "pre-wrap"
|
|
3807
3817
|
};
|
|
3808
|
-
function
|
|
3818
|
+
function pa(i, t = 1, e = null) {
|
|
3809
3819
|
if (!i) return;
|
|
3810
3820
|
Ze || (Ze = document.createElement("textarea"), (i.parentNode ?? document.body).appendChild(Ze));
|
|
3811
|
-
const { paddingSize: n, borderSize: s, boxSizing: a, contextStyle: o, lineHeight: l } =
|
|
3821
|
+
const { paddingSize: n, borderSize: s, boxSizing: a, contextStyle: o, lineHeight: l } = ga(i);
|
|
3812
3822
|
o.forEach((I) => {
|
|
3813
3823
|
const T = I[0], b = I[1] ?? "";
|
|
3814
3824
|
Ze && Ze.style.setProperty(T, b);
|
|
3815
|
-
}), Object.entries(
|
|
3825
|
+
}), Object.entries(ha).forEach(([I, T]) => {
|
|
3816
3826
|
Ze && Ze.style.setProperty(I, T, "important");
|
|
3817
3827
|
}), Ze.style.width = window.getComputedStyle(i).getPropertyValue("width"), Ze.value = i.value || (i.placeholder ?? "");
|
|
3818
3828
|
const r = Ze.scrollHeight;
|
|
@@ -3831,7 +3841,7 @@ function ua(i, t = 1, e = null) {
|
|
|
3831
3841
|
};
|
|
3832
3842
|
return Ze && Ze.parentNode && Ze.parentNode.removeChild(Ze), Ze = null, M;
|
|
3833
3843
|
}
|
|
3834
|
-
const
|
|
3844
|
+
const fa = [
|
|
3835
3845
|
"letter-spacing",
|
|
3836
3846
|
"line-height",
|
|
3837
3847
|
"padding-top",
|
|
@@ -3849,14 +3859,14 @@ const ha = [
|
|
|
3849
3859
|
"box-sizing",
|
|
3850
3860
|
"word-break"
|
|
3851
3861
|
];
|
|
3852
|
-
function
|
|
3853
|
-
const t = window.getComputedStyle(i), e = t.getPropertyValue("box-sizing"), n = Number.parseFloat(t.getPropertyValue("padding-bottom")) + Number.parseFloat(t.getPropertyValue("padding-top")), s = Number.parseFloat(t.getPropertyValue("border-bottom-width")) + Number.parseFloat(t.getPropertyValue("border-top-width")), a =
|
|
3862
|
+
function ga(i) {
|
|
3863
|
+
const t = window.getComputedStyle(i), e = t.getPropertyValue("box-sizing"), n = Number.parseFloat(t.getPropertyValue("padding-bottom")) + Number.parseFloat(t.getPropertyValue("padding-top")), s = Number.parseFloat(t.getPropertyValue("border-bottom-width")) + Number.parseFloat(t.getPropertyValue("border-top-width")), a = fa.map((l) => [
|
|
3854
3864
|
l,
|
|
3855
3865
|
t.getPropertyValue(l)
|
|
3856
3866
|
]), o = parseFloat(t.getPropertyValue("line-height"));
|
|
3857
3867
|
return { contextStyle: a, paddingSize: n, borderSize: s, boxSizing: e, lineHeight: o };
|
|
3858
3868
|
}
|
|
3859
|
-
const
|
|
3869
|
+
const va = { key: 0 }, ma = { key: 1 }, ya = /* @__PURE__ */ Qe({
|
|
3860
3870
|
__name: "ContextMenu",
|
|
3861
3871
|
props: {
|
|
3862
3872
|
visible: { type: Boolean },
|
|
@@ -3869,7 +3879,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
3869
3879
|
emits: ["action", "close"],
|
|
3870
3880
|
setup(i, { emit: t }) {
|
|
3871
3881
|
const e = i, n = t, s = J(null), a = J(0), o = J(0);
|
|
3872
|
-
|
|
3882
|
+
Mt(
|
|
3873
3883
|
() => [e.visible, e.x, e.y],
|
|
3874
3884
|
async ([r]) => {
|
|
3875
3885
|
if (r && (a.value = e.x, o.value = e.y, await Rt(), s.value)) {
|
|
@@ -3882,20 +3892,20 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
3882
3892
|
const l = (r) => {
|
|
3883
3893
|
n("action", r), n("close");
|
|
3884
3894
|
};
|
|
3885
|
-
return (r, c) => i.visible ? (
|
|
3895
|
+
return (r, c) => i.visible ? (X(), j("div", {
|
|
3886
3896
|
key: 0,
|
|
3887
3897
|
ref_key: "menuRef",
|
|
3888
3898
|
ref: s,
|
|
3889
3899
|
class: "context-menu",
|
|
3890
3900
|
style: Ke({ top: o.value + "px", left: a.value + "px" }),
|
|
3891
|
-
onClick: c[12] || (c[12] =
|
|
3901
|
+
onClick: c[12] || (c[12] = Et(() => {
|
|
3892
3902
|
}, ["stop"])),
|
|
3893
|
-
onContextmenu: c[13] || (c[13] =
|
|
3903
|
+
onContextmenu: c[13] || (c[13] = Et(() => {
|
|
3894
3904
|
}, ["prevent"])),
|
|
3895
|
-
onMousedown: c[14] || (c[14] =
|
|
3905
|
+
onMousedown: c[14] || (c[14] = Et(() => {
|
|
3896
3906
|
}, ["stop"]))
|
|
3897
3907
|
}, [
|
|
3898
|
-
i.isElementSelected ? (
|
|
3908
|
+
i.isElementSelected ? (X(), j("ul", va, [
|
|
3899
3909
|
m("li", {
|
|
3900
3910
|
onClick: c[0] || (c[0] = (f) => l("cut"))
|
|
3901
3911
|
}, [...c[15] || (c[15] = [
|
|
@@ -3954,7 +3964,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
3954
3964
|
m("span", null, "删除", -1),
|
|
3955
3965
|
m("span", { class: "shortcut" }, "Del", -1)
|
|
3956
3966
|
])])
|
|
3957
|
-
])) : (
|
|
3967
|
+
])) : (X(), j("ul", ma, [
|
|
3958
3968
|
m("li", {
|
|
3959
3969
|
onClick: c[9] || (c[9] = (f) => l("paste"))
|
|
3960
3970
|
}, [...c[27] || (c[27] = [
|
|
@@ -3974,12 +3984,12 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
3974
3984
|
c[29] || (c[29] = m("span", { class: "shortcut" }, "Ctrl+'", -1))
|
|
3975
3985
|
])
|
|
3976
3986
|
]))
|
|
3977
|
-
], 36)) :
|
|
3987
|
+
], 36)) : ye("", !0);
|
|
3978
3988
|
}
|
|
3979
|
-
}),
|
|
3989
|
+
}), xa = /* @__PURE__ */ st(ya, [["__scopeId", "data-v-22c72497"]]), ka = {
|
|
3980
3990
|
class: "excalidraw-container",
|
|
3981
3991
|
ref: "container"
|
|
3982
|
-
},
|
|
3992
|
+
}, wa = ["width", "height"], ba = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M20 20H7L3 16C2 15 2 13 3 12L13 2L22 11L20 20Z" fill="white"/></svg>') 0 20, auto`, Sa = /* @__PURE__ */ Qe({
|
|
3983
3993
|
__name: "ExcalidrawCanvas",
|
|
3984
3994
|
props: {
|
|
3985
3995
|
elements: {},
|
|
@@ -3990,7 +4000,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
3990
4000
|
setup(i) {
|
|
3991
4001
|
const t = i, e = ot(), n = J(null), s = J(null), a = J(window.innerWidth), o = J(window.innerHeight), l = J(window.devicePixelRatio || 1), r = J(!1), c = () => {
|
|
3992
4002
|
a.value = window.innerWidth, o.value = window.innerHeight, l.value = window.devicePixelRatio || 1, Rt(() => {
|
|
3993
|
-
|
|
4003
|
+
ze();
|
|
3994
4004
|
});
|
|
3995
4005
|
}, f = (p) => {
|
|
3996
4006
|
p.preventDefault();
|
|
@@ -4006,8 +4016,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4006
4016
|
return;
|
|
4007
4017
|
let E = !!_;
|
|
4008
4018
|
_ && !_.locked && !e.appState.selectedElementIds[_.id] && e.setSelectedElementIds([_.id]);
|
|
4009
|
-
const
|
|
4010
|
-
let L = e.elements.filter((F) =>
|
|
4019
|
+
const V = Object.keys(e.appState.selectedElementIds);
|
|
4020
|
+
let L = e.elements.filter((F) => V.includes(F.id)), A = null;
|
|
4011
4021
|
_ && _.locked && (L = [_], A = _.id), E = L.length > 0;
|
|
4012
4022
|
const w = L.length > 0 && L.every((F) => F.locked);
|
|
4013
4023
|
Oe.value = {
|
|
@@ -4096,7 +4106,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4096
4106
|
}
|
|
4097
4107
|
}, d = J(!1), v = J(!1), h = J([]);
|
|
4098
4108
|
let M = 0;
|
|
4099
|
-
const I = J(!1), T = J(!1), b = J(null), B = J(null),
|
|
4109
|
+
const I = J(!1), T = J(!1), b = J(null), B = J(null), Y = J(null), q = J(0), se = J(0), le = J(0), ie = J(0), ee = J(null), G = J(null), he = J(null), H = J(null), D = J(null), N = J(null), te = J(""), xe = J(!1), we = J({}), Ce = J(null), Be = J(null), Fe = J({}), ne = J({ x: 0, y: 0 }), Ue = J({ x: 0, y: 0 }), oe = J({ x: 0, y: 0 }), et = J("26px"), ht = U(() => e.appState.showGrid), at = {
|
|
4100
4110
|
top: "flex-start",
|
|
4101
4111
|
middle: "center",
|
|
4102
4112
|
bottom: "flex-end"
|
|
@@ -4107,7 +4117,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4107
4117
|
isElementSelected: !1,
|
|
4108
4118
|
isElementLocked: !1
|
|
4109
4119
|
});
|
|
4110
|
-
|
|
4120
|
+
Mt(() => T.value, (p) => {
|
|
4111
4121
|
e.appState.isDraggingElement = p;
|
|
4112
4122
|
});
|
|
4113
4123
|
const tt = J([]);
|
|
@@ -4116,7 +4126,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4116
4126
|
if (r.value)
|
|
4117
4127
|
return "grabbing";
|
|
4118
4128
|
const p = e.appState.activeTool === "shapes" ? e.appState.activeToolType : e.appState.activeTool;
|
|
4119
|
-
return p === "hand" ? e.appState.viewLocked ? "not-allowed" : d.value ? "grabbing" : "grab" : p === "selection" ? T.value ? "move" : d.value ? rn(b.value) : "default" : p === "text" ? "text" : p === "eraser" ?
|
|
4129
|
+
return p === "hand" ? e.appState.viewLocked ? "not-allowed" : d.value ? "grabbing" : "grab" : p === "selection" ? T.value ? "move" : d.value ? rn(b.value) : "default" : p === "text" ? "text" : p === "eraser" ? ba : "crosshair";
|
|
4120
4130
|
}, De = U(() => {
|
|
4121
4131
|
if (!G.value) return {};
|
|
4122
4132
|
const p = e.elements.find((u) => u.id === G.value);
|
|
@@ -4197,7 +4207,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4197
4207
|
};
|
|
4198
4208
|
}
|
|
4199
4209
|
return {};
|
|
4200
|
-
}),
|
|
4210
|
+
}), ke = U(() => Object.keys(e.appState.selectedElementIds)), Ye = U(() => {
|
|
4201
4211
|
if (G.value) {
|
|
4202
4212
|
const p = e.elements.find((x) => x.id === G.value);
|
|
4203
4213
|
if (p)
|
|
@@ -4215,10 +4225,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4215
4225
|
let C = ((p.x - x.x) * (y.x - x.x) + (p.y - x.y) * (y.y - x.y)) / u;
|
|
4216
4226
|
return C = Math.max(0, Math.min(1, C)), Math.hypot(p.x - (x.x + C * (y.x - x.x)), p.y - (x.y + C * (y.y - x.y)));
|
|
4217
4227
|
}, an = (p, x, y) => {
|
|
4218
|
-
const u = y.x + y.width / 2, C = y.y + y.height / 2, [g, P] = me([p, x], [u, C], -y.angle), S = g - y.x, _ = P - y.y, E = 10 / t.zoom,
|
|
4219
|
-
if (!
|
|
4220
|
-
for (let L = 0; L <
|
|
4221
|
-
const A = { x:
|
|
4228
|
+
const u = y.x + y.width / 2, C = y.y + y.height / 2, [g, P] = me([p, x], [u, C], -y.angle), S = g - y.x, _ = P - y.y, E = 10 / t.zoom, V = y.points;
|
|
4229
|
+
if (!V) return !1;
|
|
4230
|
+
for (let L = 0; L < V.length - 1; L++) {
|
|
4231
|
+
const A = { x: V[L][0], y: V[L][1] }, w = { x: V[L + 1][0], y: V[L + 1][1] };
|
|
4222
4232
|
if (on({ x: S, y: _ }, A, w) <= E) return !0;
|
|
4223
4233
|
}
|
|
4224
4234
|
return !1;
|
|
@@ -4229,23 +4239,23 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4229
4239
|
const S = C[P];
|
|
4230
4240
|
if (!S || S.isDeleted || y && S.id === y) continue;
|
|
4231
4241
|
let _ = !1;
|
|
4232
|
-
const E = e.appState.selectedElementIds[S.id],
|
|
4242
|
+
const E = e.appState.selectedElementIds[S.id], V = S.backgroundColor && S.backgroundColor !== "transparent" && S.fillStyle !== "none" || u && E;
|
|
4233
4243
|
let L = p, A = x;
|
|
4234
4244
|
if (S.isFlippedHorizontal || S.isFlippedVertical) {
|
|
4235
|
-
const w = S.x + S.width / 2, F = S.y + S.height / 2, [Q, K] = me([p, x], [w, F], -(S.angle || 0)), Z = S.isFlippedHorizontal ? w - (Q - w) : Q, pe = S.isFlippedVertical ? F - (K - F) : K,
|
|
4236
|
-
L =
|
|
4245
|
+
const w = S.x + S.width / 2, F = S.y + S.height / 2, [Q, K] = me([p, x], [w, F], -(S.angle || 0)), Z = S.isFlippedHorizontal ? w - (Q - w) : Q, pe = S.isFlippedVertical ? F - (K - F) : K, Ie = me([Z, pe], [w, F], S.angle || 0);
|
|
4246
|
+
L = Ie[0], A = Ie[1];
|
|
4237
4247
|
}
|
|
4238
4248
|
if (["rectangle", "frame", "square", "process"].includes(S.type))
|
|
4239
|
-
|
|
4249
|
+
V ? _ = ft(L, A, S.x, S.y, S.width, S.height, S.angle) : _ = si(L, A, S.x, S.y, S.width, S.height, S.angle);
|
|
4240
4250
|
else if (["ellipse", "circle"].includes(S.type))
|
|
4241
|
-
|
|
4251
|
+
V ? _ = Tt(L, A, S.x, S.y, S.width, S.height, S.angle) : _ = Gn(L, A, S.x, S.y, S.width, S.height, S.angle);
|
|
4242
4252
|
else if (S.type === "cylinder")
|
|
4243
|
-
|
|
4253
|
+
V ? _ = rs(L, A, S.x, S.y, S.width, S.height, S.angle) : _ = ni(L, A, S.x, S.y, S.width, S.height, S.angle);
|
|
4244
4254
|
else if (["diamond", "decision"].includes(S.type))
|
|
4245
|
-
|
|
4255
|
+
V ? _ = At(L, A, S.x, S.y, S.width, S.height, S.angle) : _ = ei(L, A, S.x, S.y, S.width, S.height, S.angle);
|
|
4246
4256
|
else if (["star", "trapezoid", "parallelogram"].includes(S.type)) {
|
|
4247
4257
|
let w = [];
|
|
4248
|
-
S.type === "star" ? w =
|
|
4258
|
+
S.type === "star" ? w = St(S.width, S.height) : S.type === "trapezoid" ? w = Ft(S.width, S.height) : S.type === "parallelogram" && (w = Ot(S.width, S.height)), V ? _ = Dt(L, A, w, S.x, S.y, S.angle) : _ = ls(L, A, w, S.x, S.y, S.angle);
|
|
4249
4259
|
} else S.type === "freedraw" ? _ = an(L, A, S) : S.type === "text" || S.type === "image" ? _ = ft(L, A, S.x, S.y, S.width, S.height, S.angle) : (S.type === "line" || S.type === "arrow") && (_ = Rn(10, L, A, S, e.elements));
|
|
4250
4260
|
if (_)
|
|
4251
4261
|
if (u) {
|
|
@@ -4280,18 +4290,18 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4280
4290
|
end: "pointer"
|
|
4281
4291
|
}[p] || "default", Xt = (p, x, y, u) => {
|
|
4282
4292
|
if (p.locked) return null;
|
|
4283
|
-
const C = (p.x + y) * x, g = (p.y + u) * x, P = p.width * x, S = p.height * x, _ = p.angle || 0, E = C + P / 2,
|
|
4293
|
+
const C = (p.x + y) * x, g = (p.y + u) * x, P = p.width * x, S = p.height * x, _ = p.angle || 0, E = C + P / 2, V = g + S / 2, L = (Q, K) => me([Q, K], [E, V], _), A = 4, w = 8, F = {};
|
|
4284
4294
|
if (p.type === "line" || p.type === "arrow") {
|
|
4285
4295
|
if (p.points && p.points.length >= 2) {
|
|
4286
|
-
const Q = p.points, K = p.x + p.width / 2, Z = p.y + p.height / 2, pe = (
|
|
4287
|
-
const be = p.x +
|
|
4296
|
+
const Q = p.points, K = p.x + p.width / 2, Z = p.y + p.height / 2, pe = (Ie) => {
|
|
4297
|
+
const be = p.x + Ie[0], Ve = p.y + Ie[1], [je, He] = me([be, Ve], [K, Z], _);
|
|
4288
4298
|
return [
|
|
4289
4299
|
(je + y) * x,
|
|
4290
4300
|
(He + u) * x
|
|
4291
4301
|
];
|
|
4292
4302
|
};
|
|
4293
|
-
return Q.forEach((
|
|
4294
|
-
const Ve = pe(
|
|
4303
|
+
return Q.forEach((Ie, be) => {
|
|
4304
|
+
const Ve = pe(Ie);
|
|
4295
4305
|
F[`point-${be}`] = [Ve[0], Ve[1], w, w];
|
|
4296
4306
|
}), F;
|
|
4297
4307
|
}
|
|
@@ -4300,9 +4310,9 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4300
4310
|
return F.nw = [...L(C - A, g - A), w, w], F.ne = [...L(C + P + A, g - A), w, w], F.sw = [...L(C - A, g + S + A), w, w], F.se = [...L(C + P + A, g + S + A), w, w], F.n = [...L(C + P / 2, g - A), w, w], F.s = [...L(C + P / 2, g + S + A), w, w], F.w = [...L(C - A, g + S / 2), w, w], F.e = [...L(C + P + A, g + S / 2), w, w], F.rotation = [...L(C + P / 2, g - A * 4), w, w], F;
|
|
4301
4311
|
}, Mn = (p) => {
|
|
4302
4312
|
if (Oe.value.visible && (Oe.value.visible = !1), G.value) return;
|
|
4303
|
-
if (
|
|
4304
|
-
const g = e.elements.find((P) => P.id ===
|
|
4305
|
-
g && (e.updateElement(g.id, { locked: !1 }), g.containerId && e.updateElement(g.containerId, { locked: !1 })),
|
|
4313
|
+
if (Be.value) {
|
|
4314
|
+
const g = e.elements.find((P) => P.id === Be.value);
|
|
4315
|
+
g && (e.updateElement(g.id, { locked: !1 }), g.containerId && e.updateElement(g.containerId, { locked: !1 })), Be.value = null, ze();
|
|
4306
4316
|
return;
|
|
4307
4317
|
}
|
|
4308
4318
|
if (p.button === 2 && e.appState.rightClickPan) {
|
|
@@ -4313,7 +4323,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4313
4323
|
}
|
|
4314
4324
|
}
|
|
4315
4325
|
const x = e.appState.activeTool === "shapes" ? e.appState.activeToolType : e.appState.activeTool, { x: y, y: u } = de(p);
|
|
4316
|
-
if (ne.value = { x: y, y: u }, Ue.value = { x: y, y: u },
|
|
4326
|
+
if (ne.value = { x: y, y: u }, Ue.value = { x: y, y: u }, oe.value = { x: y, y: u }, x === "selection") {
|
|
4317
4327
|
const g = Object.keys(e.appState.selectedElementIds);
|
|
4318
4328
|
let P = null;
|
|
4319
4329
|
if (g.length === 1)
|
|
@@ -4332,21 +4342,21 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4332
4342
|
});
|
|
4333
4343
|
}
|
|
4334
4344
|
if (P) {
|
|
4335
|
-
const S = n.value.getBoundingClientRect(), _ = p.clientX - S.left, E = p.clientY - S.top,
|
|
4336
|
-
if (
|
|
4337
|
-
for (const [L, [A, w]] of Object.entries(
|
|
4345
|
+
const S = n.value.getBoundingClientRect(), _ = p.clientX - S.left, E = p.clientY - S.top, V = Xt(P, t.zoom, t.scrollX, t.scrollY);
|
|
4346
|
+
if (V) {
|
|
4347
|
+
for (const [L, [A, w]] of Object.entries(V))
|
|
4338
4348
|
if (Math.hypot(_ - A, E - w) < 10) {
|
|
4339
4349
|
if (b.value = L, d.value = !0, q.value = P.angle, B.value = JSON.parse(JSON.stringify(P)), L === "rotation") {
|
|
4340
4350
|
const Q = P.x + P.width / 2, K = P.y + P.height / 2;
|
|
4341
|
-
se.value = Math.atan2(u - K, y - Q), le.value = 0,
|
|
4351
|
+
se.value = Math.atan2(u - K, y - Q), le.value = 0, ie.value = 0;
|
|
4342
4352
|
}
|
|
4343
4353
|
if (g.length > 1) {
|
|
4344
4354
|
const Q = {};
|
|
4345
4355
|
e.elements.forEach((K) => {
|
|
4346
4356
|
e.appState.selectedElementIds[K.id] && (Q[K.id] = JSON.parse(JSON.stringify(K)));
|
|
4347
|
-
}),
|
|
4357
|
+
}), Y.value = Q;
|
|
4348
4358
|
} else
|
|
4349
|
-
|
|
4359
|
+
Y.value = null;
|
|
4350
4360
|
return;
|
|
4351
4361
|
}
|
|
4352
4362
|
}
|
|
@@ -4363,18 +4373,18 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4363
4373
|
for (let _ = e.elements.length - 1; _ >= 0; _--) {
|
|
4364
4374
|
const E = e.elements[_];
|
|
4365
4375
|
if (E && e.appState.selectedElementIds[E.id] && !E.isDeleted) {
|
|
4366
|
-
let
|
|
4376
|
+
let V = !1;
|
|
4367
4377
|
if (["rectangle", "frame", "image", "text", "square", "process"].includes(E.type))
|
|
4368
|
-
|
|
4378
|
+
V = ft(y, u, E.x, E.y, E.width, E.height, E.angle);
|
|
4369
4379
|
else if (["ellipse", "circle"].includes(E.type))
|
|
4370
|
-
|
|
4380
|
+
V = Tt(y, u, E.x, E.y, E.width, E.height, E.angle);
|
|
4371
4381
|
else if (E.type === "cylinder")
|
|
4372
|
-
|
|
4382
|
+
V = rs(y, u, E.x, E.y, E.width, E.height, E.angle);
|
|
4373
4383
|
else if (["star", "trapezoid", "parallelogram", "diamond", "decision"].includes(E.type)) {
|
|
4374
4384
|
let L = [];
|
|
4375
|
-
E.type === "star" ? L =
|
|
4376
|
-
} else E.type === "freedraw" ?
|
|
4377
|
-
if (
|
|
4385
|
+
E.type === "star" ? L = St(E.width, E.height) : E.type === "trapezoid" ? L = Ft(E.width, E.height) : E.type === "parallelogram" ? L = Ot(E.width, E.height) : (E.type === "diamond" || E.type === "decision") && (L = ti(E.width, E.height)), V = Dt(y, u, L, E.x, E.y, E.angle);
|
|
4386
|
+
} else E.type === "freedraw" ? V = ft(y, u, E.x, E.y, E.width, E.height, E.angle) : (E.type === "arrow" || E.type === "line") && (V = Rn(10, y, u, E, e.elements));
|
|
4387
|
+
if (V) {
|
|
4378
4388
|
g = E;
|
|
4379
4389
|
break;
|
|
4380
4390
|
}
|
|
@@ -4386,7 +4396,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4386
4396
|
}
|
|
4387
4397
|
let S = !1;
|
|
4388
4398
|
if (!g && P.length > 1 && !(p.ctrlKey || p.metaKey)) {
|
|
4389
|
-
const _ = e.elements.filter((
|
|
4399
|
+
const _ = e.elements.filter((V) => e.appState.selectedElementIds[V.id]), E = Gt(_);
|
|
4390
4400
|
E && ft(y, u, E.x, E.y, E.width, E.height, 0) && (S = !0);
|
|
4391
4401
|
}
|
|
4392
4402
|
if (g || S) {
|
|
@@ -4396,10 +4406,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4396
4406
|
const w = e.elements.find((F) => F.id === g.containerId);
|
|
4397
4407
|
w && !w.isDeleted && (E = w.id);
|
|
4398
4408
|
}
|
|
4399
|
-
const
|
|
4409
|
+
const V = e.elements.find((w) => w.id === E);
|
|
4400
4410
|
let L = [E];
|
|
4401
|
-
if (
|
|
4402
|
-
const w =
|
|
4411
|
+
if (V && V.groupIds.length > 0) {
|
|
4412
|
+
const w = V.groupIds[V.groupIds.length - 1];
|
|
4403
4413
|
L = e.elements.filter((F) => F.groupIds.includes(w)).map((F) => F.id);
|
|
4404
4414
|
}
|
|
4405
4415
|
if (p.ctrlKey || p.metaKey) {
|
|
@@ -4409,7 +4419,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4409
4419
|
e.appState.selectedElementIds[E] || e.setSelectedElementIds(L);
|
|
4410
4420
|
}
|
|
4411
4421
|
let _ = !0;
|
|
4412
|
-
g && g.locked && (_ = !1), S && e.elements.filter((
|
|
4422
|
+
g && g.locked && (_ = !1), S && e.elements.filter((V) => e.appState.selectedElementIds[V.id]).some((V) => V.locked) && (_ = !1), _ && p.button === 0 && (T.value = !0);
|
|
4413
4423
|
} else
|
|
4414
4424
|
p.button === 0 ? (I.value = !0, e.appState.isBoxSelecting = !0, p.ctrlKey || p.metaKey || e.setSelectedElementIds([])) : p.ctrlKey || p.metaKey || e.setSelectedElementIds([]);
|
|
4415
4425
|
return;
|
|
@@ -4443,12 +4453,12 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4443
4453
|
if (x === "arrow" && H.value) {
|
|
4444
4454
|
const g = e.elements.find((P) => P.id === H.value);
|
|
4445
4455
|
if (g && !g.isDeleted) {
|
|
4446
|
-
const P = g.x + g.width / 2, S = g.y + g.height / 2, [_, E] = me([y, u], [P, S], -g.angle),
|
|
4456
|
+
const P = g.x + g.width / 2, S = g.y + g.height / 2, [_, E] = me([y, u], [P, S], -g.angle), V = (_ - g.x) / g.width, L = (E - g.y) / g.height;
|
|
4447
4457
|
C.startBinding = {
|
|
4448
4458
|
elementId: g.id,
|
|
4449
4459
|
focus: 0,
|
|
4450
4460
|
gap: 5,
|
|
4451
|
-
fixedPoint: [
|
|
4461
|
+
fixedPoint: [V, L]
|
|
4452
4462
|
};
|
|
4453
4463
|
}
|
|
4454
4464
|
D.value = H.value;
|
|
@@ -4457,7 +4467,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4457
4467
|
}, En = (p) => {
|
|
4458
4468
|
if (G.value) return;
|
|
4459
4469
|
const x = e.appState.activeTool === "shapes" ? e.appState.activeToolType : e.appState.activeTool, { x: y, y: u } = de(p);
|
|
4460
|
-
if (
|
|
4470
|
+
if (oe.value = { x: y, y: u }, x === "laser" && d.value) {
|
|
4461
4471
|
const A = tt.value[tt.value.length - 1];
|
|
4462
4472
|
A && A.push({ x: y, y: u, time: Date.now() });
|
|
4463
4473
|
return;
|
|
@@ -4467,14 +4477,14 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4467
4477
|
for (const A of C) {
|
|
4468
4478
|
const w = e.elements.find((F) => F.id === A);
|
|
4469
4479
|
if (w && w.locked && !w.isDeleted) {
|
|
4470
|
-
const F = w.x + w.width / 2, Q = w.y + w.height / 2, [K, Z] = me([y, u], [F, Q], -w.angle), pe = w.x,
|
|
4471
|
-
if (K >= pe && K <= pe + be && Z >=
|
|
4480
|
+
const F = w.x + w.width / 2, Q = w.y + w.height / 2, [K, Z] = me([y, u], [F, Q], -w.angle), pe = w.x, Ie = w.y - 50, be = 40;
|
|
4481
|
+
if (K >= pe && K <= pe + be && Z >= Ie && Z <= Ie + be) {
|
|
4472
4482
|
g = !0, P = A;
|
|
4473
4483
|
break;
|
|
4474
4484
|
}
|
|
4475
4485
|
}
|
|
4476
4486
|
}
|
|
4477
|
-
if (
|
|
4487
|
+
if (Be.value !== P && (Be.value = P, ze()), g) {
|
|
4478
4488
|
n.value.style.cursor = "pointer";
|
|
4479
4489
|
return;
|
|
4480
4490
|
}
|
|
@@ -4489,9 +4499,9 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4489
4499
|
break;
|
|
4490
4500
|
}
|
|
4491
4501
|
}
|
|
4492
|
-
|
|
4493
|
-
} else
|
|
4494
|
-
} else
|
|
4502
|
+
Ce.value !== F && (Ce.value = F, ze());
|
|
4503
|
+
} else Ce.value && (Ce.value = null, ze());
|
|
4504
|
+
} else Ce.value && (Ce.value = null, ze());
|
|
4495
4505
|
if ((x === "line" || x === "arrow") && d.value && ee.value) {
|
|
4496
4506
|
const A = ln(y, u, ee.value);
|
|
4497
4507
|
A !== N.value && (N.value = A);
|
|
@@ -4517,13 +4527,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4517
4527
|
if (w) {
|
|
4518
4528
|
const Q = n.value.getBoundingClientRect(), K = p.clientX - Q.left, Z = p.clientY - Q.top, pe = Xt(w, t.zoom, t.scrollX, t.scrollY);
|
|
4519
4529
|
if (pe) {
|
|
4520
|
-
let
|
|
4530
|
+
let Ie = !1;
|
|
4521
4531
|
for (const [be, [Ve, je]] of Object.entries(pe))
|
|
4522
4532
|
if (Math.hypot(K - Ve, Z - je) < 10) {
|
|
4523
|
-
n.value.style.cursor = rn(be),
|
|
4533
|
+
n.value.style.cursor = rn(be), Ie = !0;
|
|
4524
4534
|
break;
|
|
4525
4535
|
}
|
|
4526
|
-
if (
|
|
4536
|
+
if (Ie) return;
|
|
4527
4537
|
}
|
|
4528
4538
|
w.id === "selection-group" && ft(y, u, w.x, w.y, w.width, w.height, 0) && (n.value.style.cursor = "move");
|
|
4529
4539
|
}
|
|
@@ -4533,13 +4543,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4533
4543
|
const Z = e.elements[K];
|
|
4534
4544
|
if (!(!Z || Z.isDeleted) && e.appState.selectedElementIds[Z.id]) {
|
|
4535
4545
|
let pe = !1;
|
|
4536
|
-
if (["rectangle", "image", "text", "frame", "freedraw", "square", "process"].includes(Z.type) ? pe = ft(y, u, Z.x, Z.y, Z.width, Z.height, Z.angle) : ["diamond", "decision", "star", "trapezoid", "parallelogram"].includes(Z.type) ? pe = At(y, u, Z.x, Z.y, Z.width, Z.height, Z.angle) : ["ellipse", "circle", "cylinder"].includes(Z.type) ? pe =
|
|
4546
|
+
if (["rectangle", "image", "text", "frame", "freedraw", "square", "process"].includes(Z.type) ? pe = ft(y, u, Z.x, Z.y, Z.width, Z.height, Z.angle) : ["diamond", "decision", "star", "trapezoid", "parallelogram"].includes(Z.type) ? pe = At(y, u, Z.x, Z.y, Z.width, Z.height, Z.angle) : ["ellipse", "circle", "cylinder"].includes(Z.type) ? pe = Tt(y, u, Z.x, Z.y, Z.width, Z.height, Z.angle) : ["arrow", "line"].includes(Z.type), pe) {
|
|
4537
4547
|
F = Z;
|
|
4538
4548
|
break;
|
|
4539
4549
|
}
|
|
4540
4550
|
}
|
|
4541
4551
|
}
|
|
4542
|
-
F && !d.value && !F.locked ? (he.value = F.id, n.value.style.cursor = "move") : he.value = null, he.value &&
|
|
4552
|
+
F && !d.value && !F.locked ? (he.value = F.id, n.value.style.cursor = "move") : he.value = null, he.value && ze();
|
|
4543
4553
|
}
|
|
4544
4554
|
if ((x === "arrow" || x === "line") && Yt(p, y, u), d.value && b.value === "rotation" && B.value) {
|
|
4545
4555
|
const A = B.value, w = A.id, F = A.x + A.width / 2, Q = A.y + A.height / 2, K = Math.atan2(u - Q, y - F);
|
|
@@ -4547,208 +4557,208 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4547
4557
|
Z > Math.PI && (Z -= 2 * Math.PI), Z < -Math.PI && (Z += 2 * Math.PI), le.value += Z, se.value = K;
|
|
4548
4558
|
let pe = le.value;
|
|
4549
4559
|
if (p.shiftKey) {
|
|
4550
|
-
const
|
|
4551
|
-
pe = Math.round(le.value /
|
|
4560
|
+
const Ie = Math.PI / 12;
|
|
4561
|
+
pe = Math.round(le.value / Ie) * Ie;
|
|
4552
4562
|
}
|
|
4553
|
-
if (
|
|
4554
|
-
const
|
|
4555
|
-
Object.values(
|
|
4563
|
+
if (ie.value = pe, Y.value && w === "selection-group") {
|
|
4564
|
+
const Ie = pe;
|
|
4565
|
+
Object.values(Y.value).forEach((be) => {
|
|
4556
4566
|
const [Ve, je] = me(
|
|
4557
4567
|
[be.x + be.width / 2, be.y + be.height / 2],
|
|
4558
4568
|
[F, Q],
|
|
4559
|
-
|
|
4569
|
+
Ie
|
|
4560
4570
|
);
|
|
4561
4571
|
e.updateElement(be.id, {
|
|
4562
4572
|
x: Ve - be.width / 2,
|
|
4563
4573
|
y: je - be.height / 2,
|
|
4564
|
-
angle: be.angle +
|
|
4574
|
+
angle: be.angle + Ie
|
|
4565
4575
|
});
|
|
4566
4576
|
});
|
|
4567
4577
|
} else {
|
|
4568
|
-
const
|
|
4569
|
-
be && e.updateElement(be.id, { angle:
|
|
4578
|
+
const Ie = q.value + pe, be = e.elements.find((Ve) => Ve.type === "text" && Ve.containerId === A.id && !Ve.isDeleted);
|
|
4579
|
+
be && e.updateElement(be.id, { angle: Ie }), e.updateElement(A.id, { angle: Ie });
|
|
4570
4580
|
}
|
|
4571
|
-
|
|
4581
|
+
ze();
|
|
4572
4582
|
return;
|
|
4573
4583
|
}
|
|
4574
4584
|
if (d.value && b.value && B.value) {
|
|
4575
4585
|
const A = b.value, w = B.value;
|
|
4576
|
-
if ((w.type === "line" || w.type === "arrow") && A.startsWith("point-") && !
|
|
4577
|
-
let fe = y,
|
|
4586
|
+
if ((w.type === "line" || w.type === "arrow") && A.startsWith("point-") && !Y.value) {
|
|
4587
|
+
let fe = y, Ee = u;
|
|
4578
4588
|
const rt = w.points, _n = w.x + w.width / 2, An = w.y + w.height / 2, qe = rt.map((ue) => {
|
|
4579
4589
|
const Re = w.x + ue[0], yt = w.y + ue[1];
|
|
4580
4590
|
return me([Re, yt], [_n, An], w.angle);
|
|
4581
4591
|
});
|
|
4582
4592
|
let mt = parseInt(A.split("-")[1] || "");
|
|
4583
4593
|
if (isNaN(mt) && (mt = A === "start" ? 0 : qe.length - 1), p.shiftKey && qe.length > 1) {
|
|
4584
|
-
const ue = A === "start" ? 1 : qe.length - 2, Re = qe[ue], yt = qe[mt],
|
|
4594
|
+
const ue = A === "start" ? 1 : qe.length - 2, Re = qe[ue], yt = qe[mt], Pe = Math.atan2(yt[1] - Re[1], yt[0] - Re[0]), Ge = Math.atan2(Ee - Re[1], fe - Re[0]), xt = Math.hypot(fe - Re[0], Ee - Re[1]);
|
|
4585
4595
|
let ct = Ge;
|
|
4586
4596
|
if (Re && yt) {
|
|
4587
|
-
let pt = Math.abs(Ge -
|
|
4597
|
+
let pt = Math.abs(Ge - Pe);
|
|
4588
4598
|
pt > Math.PI && (pt = 2 * Math.PI - pt);
|
|
4589
|
-
const kt =
|
|
4590
|
-
let
|
|
4591
|
-
if (
|
|
4592
|
-
ct = pt < 0.1 ?
|
|
4599
|
+
const kt = Pe + Math.PI > Math.PI ? Pe - Math.PI : Pe + Math.PI;
|
|
4600
|
+
let Ct = Math.abs(Ge - kt);
|
|
4601
|
+
if (Ct > Math.PI && (Ct = 2 * Math.PI - Ct), pt < 0.1 || Ct < 0.1)
|
|
4602
|
+
ct = pt < 0.1 ? Pe : kt;
|
|
4593
4603
|
else {
|
|
4594
4604
|
const Wt = 15 * Math.PI / 180;
|
|
4595
4605
|
ct = Math.round(Ge / Wt) * Wt;
|
|
4596
4606
|
}
|
|
4597
|
-
fe = Re[0] + xt * Math.cos(ct),
|
|
4607
|
+
fe = Re[0] + xt * Math.cos(ct), Ee = Re[1] + xt * Math.sin(ct);
|
|
4598
4608
|
}
|
|
4599
4609
|
}
|
|
4600
|
-
Yt(p, fe,
|
|
4601
|
-
let
|
|
4610
|
+
Yt(p, fe, Ee);
|
|
4611
|
+
let bt = null, R = vt(fe, Ee, w.id);
|
|
4602
4612
|
if (R && ["rectangle", "diamond", "ellipse", "image", "text", "frame", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram"].includes(R.type) && !R.locked) {
|
|
4603
4613
|
let ue = !0;
|
|
4604
|
-
R.type === "frame" && fe > R.x + 10 && fe < R.x + R.width - 10 &&
|
|
4614
|
+
R.type === "frame" && fe > R.x + 10 && fe < R.x + R.width - 10 && Ee > R.y + 10 && Ee < R.y + R.height - 10 && (ue = !1), ue ? (bt = R.id, he.value = R.id) : (R = null, bt = null, he.value = null);
|
|
4605
4615
|
} else if (H.value) {
|
|
4606
4616
|
const ue = e.elements.find((Re) => Re.id === H.value);
|
|
4607
4617
|
if (ue && !ue.isDeleted && ["rectangle", "diamond", "ellipse", "image", "text", "frame"].includes(ue.type) && !ue.locked) {
|
|
4608
4618
|
let Re = !0;
|
|
4609
|
-
ue.type === "frame" && fe > ue.x + 10 && fe < ue.x + ue.width - 10 &&
|
|
4619
|
+
ue.type === "frame" && fe > ue.x + 10 && fe < ue.x + ue.width - 10 && Ee > ue.y + 10 && Ee < ue.y + ue.height - 10 && (Re = !1), Re ? (bt = ue.id, R = ue, he.value = ue.id) : he.value = null;
|
|
4610
4620
|
} else
|
|
4611
4621
|
he.value = null;
|
|
4612
4622
|
} else
|
|
4613
4623
|
he.value = null;
|
|
4614
4624
|
let Ht = !1;
|
|
4615
4625
|
if (qe.length === 3 && (mt === 0 || mt === 2)) {
|
|
4616
|
-
const ue = qe[0], Re = qe[1], yt = qe[2],
|
|
4617
|
-
Math.abs(Re[0] -
|
|
4626
|
+
const ue = qe[0], Re = qe[1], yt = qe[2], Pe = (ue[0] + yt[0]) / 2, Ge = (ue[1] + yt[1]) / 2;
|
|
4627
|
+
Math.abs(Re[0] - Pe) < 1 && Math.abs(Re[1] - Ge) < 1 && (Ht = !0);
|
|
4618
4628
|
}
|
|
4619
|
-
if (qe[mt] = [fe,
|
|
4629
|
+
if (qe[mt] = [fe, Ee], Ht) {
|
|
4620
4630
|
const ue = qe[0], Re = qe[2];
|
|
4621
4631
|
qe[1] = [(ue[0] + Re[0]) / 2, (ue[1] + Re[1]) / 2];
|
|
4622
4632
|
}
|
|
4623
|
-
const Jt = qe.map((ue) => ue[0]), ts = qe.map((ue) => ue[1]), ns = Math.min(...Jt),
|
|
4633
|
+
const Jt = qe.map((ue) => ue[0]), ts = qe.map((ue) => ue[1]), ns = Math.min(...Jt), Rs = Math.max(...Jt), ss = Math.min(...ts), Xs = Math.max(...ts), is = ns, os = ss, Ys = Rs - ns, Vs = Xs - ss, js = qe.map((ue) => [ue[0] - is, ue[1] - os]), Zt = {
|
|
4624
4634
|
x: is,
|
|
4625
4635
|
y: os,
|
|
4626
|
-
width:
|
|
4627
|
-
height:
|
|
4628
|
-
points:
|
|
4636
|
+
width: Ys,
|
|
4637
|
+
height: Vs,
|
|
4638
|
+
points: js,
|
|
4629
4639
|
angle: 0
|
|
4630
4640
|
// Reset angle for simplicity
|
|
4631
4641
|
};
|
|
4632
4642
|
if (mt === 0) {
|
|
4633
|
-
let ue =
|
|
4634
|
-
if (
|
|
4643
|
+
let ue = bt ? { elementId: bt, focus: 0, gap: 5 } : null;
|
|
4644
|
+
if (bt && R)
|
|
4635
4645
|
if ((() => {
|
|
4636
4646
|
if (["rectangle", "image", "text", "frame", "square", "process"].includes(R.type))
|
|
4637
|
-
return ft(fe,
|
|
4647
|
+
return ft(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4638
4648
|
if (["ellipse", "circle", "cylinder"].includes(R.type))
|
|
4639
|
-
return
|
|
4649
|
+
return Tt(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4640
4650
|
if (["diamond", "decision"].includes(R.type))
|
|
4641
|
-
return At(fe,
|
|
4651
|
+
return At(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4642
4652
|
if (["star", "trapezoid", "parallelogram"].includes(R.type)) {
|
|
4643
|
-
let
|
|
4644
|
-
return R.type === "star" ?
|
|
4653
|
+
let Pe = [];
|
|
4654
|
+
return R.type === "star" ? Pe = St(R.width - 20, R.height - 20) : R.type === "trapezoid" ? Pe = Ft(R.width - 20, R.height - 20) : R.type === "parallelogram" && (Pe = Ot(R.width - 20, R.height - 20)), Dt(fe, Ee, Pe, R.x + 10, R.y + 10, R.angle);
|
|
4645
4655
|
}
|
|
4646
4656
|
return !1;
|
|
4647
4657
|
})()) {
|
|
4648
|
-
const
|
|
4658
|
+
const Pe = R.x + R.width / 2, Ge = R.y + R.height / 2, [xt, ct] = me([fe, Ee], [Pe, Ge], -R.angle), pt = (xt - R.x) / R.width, kt = (ct - R.y) / R.height;
|
|
4649
4659
|
ue.fixedPoint = [pt, kt], ue.isBorder = !1;
|
|
4650
4660
|
} else {
|
|
4651
|
-
const
|
|
4652
|
-
|
|
4661
|
+
const Pe = R.x + R.width / 2, Ge = R.y + R.height / 2, xt = Math.atan2(Ee - Ge, fe - Pe), ct = Math.max(R.width, R.height) * 2, pt = [
|
|
4662
|
+
Pe + Math.cos(xt) * ct,
|
|
4653
4663
|
Ge + Math.sin(xt) * ct
|
|
4654
|
-
], kt = Pt(R, pt, [
|
|
4664
|
+
], kt = Pt(R, pt, [Pe, Ge]);
|
|
4655
4665
|
if (kt) {
|
|
4656
|
-
const [
|
|
4666
|
+
const [Ct, Wt] = me(kt, [Pe, Ge], -R.angle), Dn = (Ct - R.x) / R.width, Fn = (Wt - R.y) / R.height;
|
|
4657
4667
|
ue.fixedPoint = [Dn, Fn], ue.isBorder = !0;
|
|
4658
4668
|
}
|
|
4659
4669
|
}
|
|
4660
4670
|
Zt.startBinding = ue;
|
|
4661
4671
|
} else w.startBinding && (Zt.startBinding = w.startBinding);
|
|
4662
4672
|
if (mt === qe.length - 1) {
|
|
4663
|
-
let ue =
|
|
4664
|
-
if (
|
|
4673
|
+
let ue = bt ? { elementId: bt, focus: 0, gap: 5 } : null;
|
|
4674
|
+
if (bt && R)
|
|
4665
4675
|
if ((() => {
|
|
4666
4676
|
if (["rectangle", "image", "text", "frame", "square", "process"].includes(R.type))
|
|
4667
|
-
return ft(fe,
|
|
4677
|
+
return ft(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4668
4678
|
if (["ellipse", "circle", "cylinder"].includes(R.type))
|
|
4669
|
-
return
|
|
4679
|
+
return Tt(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4670
4680
|
if (["diamond", "decision"].includes(R.type))
|
|
4671
|
-
return At(fe,
|
|
4681
|
+
return At(fe, Ee, R.x + 10, R.y + 10, R.width - 20, R.height - 20, R.angle);
|
|
4672
4682
|
if (["star", "trapezoid", "parallelogram"].includes(R.type)) {
|
|
4673
|
-
let
|
|
4674
|
-
return R.type === "star" ?
|
|
4683
|
+
let Pe = [];
|
|
4684
|
+
return R.type === "star" ? Pe = St(R.width - 20, R.height - 20) : R.type === "trapezoid" ? Pe = Ft(R.width - 20, R.height - 20) : R.type === "parallelogram" && (Pe = Ot(R.width - 20, R.height - 20)), Dt(fe, Ee, Pe, R.x + 10, R.y + 10, R.angle);
|
|
4675
4685
|
}
|
|
4676
4686
|
return !1;
|
|
4677
4687
|
})()) {
|
|
4678
|
-
const
|
|
4688
|
+
const Pe = R.x + R.width / 2, Ge = R.y + R.height / 2, [xt, ct] = me([fe, Ee], [Pe, Ge], -R.angle), pt = (xt - R.x) / R.width, kt = (ct - R.y) / R.height;
|
|
4679
4689
|
ue.fixedPoint = [pt, kt], ue.isBorder = !1;
|
|
4680
4690
|
} else {
|
|
4681
|
-
const
|
|
4682
|
-
|
|
4691
|
+
const Pe = R.x + R.width / 2, Ge = R.y + R.height / 2, xt = Math.atan2(Ee - Ge, fe - Pe), ct = Math.max(R.width, R.height) * 2, pt = [
|
|
4692
|
+
Pe + Math.cos(xt) * ct,
|
|
4683
4693
|
Ge + Math.sin(xt) * ct
|
|
4684
|
-
], kt = Pt(R, pt, [
|
|
4694
|
+
], kt = Pt(R, pt, [Pe, Ge]);
|
|
4685
4695
|
if (kt) {
|
|
4686
|
-
const [
|
|
4696
|
+
const [Ct, Wt] = me(kt, [Pe, Ge], -R.angle), Dn = (Ct - R.x) / R.width, Fn = (Wt - R.y) / R.height;
|
|
4687
4697
|
ue.fixedPoint = [Dn, Fn], ue.isBorder = !0;
|
|
4688
4698
|
}
|
|
4689
4699
|
}
|
|
4690
4700
|
Zt.endBinding = ue;
|
|
4691
4701
|
} else w.endBinding && (Zt.endBinding = w.endBinding);
|
|
4692
|
-
e.updateElement(w.id, Zt), (mt === 0 || mt === qe.length - 1) && w.type === "arrow" ? Yt(p, y, u) :
|
|
4702
|
+
e.updateElement(w.id, Zt), (mt === 0 || mt === qe.length - 1) && w.type === "arrow" ? Yt(p, y, u) : ze();
|
|
4693
4703
|
return;
|
|
4694
4704
|
}
|
|
4695
|
-
const F = w.x + w.width / 2, Q = w.y + w.height / 2, [K, Z] = me([y, u], [F, Q], -w.angle), [pe,
|
|
4696
|
-
let je = w.x, He = w.y,
|
|
4697
|
-
if (A.includes("e") && (
|
|
4705
|
+
const F = w.x + w.width / 2, Q = w.y + w.height / 2, [K, Z] = me([y, u], [F, Q], -w.angle), [pe, Ie] = me([ne.value.x, ne.value.y], [F, Q], -w.angle), be = K - pe, Ve = Z - Ie;
|
|
4706
|
+
let je = w.x, He = w.y, Me = w.width, Le = w.height;
|
|
4707
|
+
if (A.includes("e") && (Me += be), A.includes("w") && (je += be, Me -= be), A.includes("s") && (Le += Ve), A.includes("n") && (He += Ve, Le -= Ve), p.shiftKey && (["rectangle", "diamond", "ellipse", "star", "cylinder", "process", "decision", "trapezoid", "parallelogram"].includes(w.type) || w.id === "selection-group") || ["square", "circle"].includes(w.type)) {
|
|
4698
4708
|
const fe = w.width / w.height;
|
|
4699
|
-
Math.abs(
|
|
4709
|
+
Math.abs(Me) / fe > Math.abs(Le) ? Le = (Le < 0 ? -1 : 1) * Math.abs(Me / fe) : Me = (Me < 0 ? -1 : 1) * Math.abs(Le * fe), A.includes("w") && (je = w.x + w.width - Me), A.includes("n") && (He = w.y + w.height - Le);
|
|
4700
4710
|
}
|
|
4701
|
-
if (
|
|
4702
|
-
const fe =
|
|
4703
|
-
Object.values(
|
|
4704
|
-
const _n = rt.x - w.x, An = rt.y - w.y, qe = w.x + (je - w.x) + _n * fe, mt = w.y + (He - w.y) + An *
|
|
4711
|
+
if (Me < 0 && (je += Me, Me = Math.abs(Me)), Le < 0 && (He += Le, Le = Math.abs(Le)), Y.value && w.id === "selection-group") {
|
|
4712
|
+
const fe = Me / w.width, Ee = Le / w.height;
|
|
4713
|
+
Object.values(Y.value).forEach((rt) => {
|
|
4714
|
+
const _n = rt.x - w.x, An = rt.y - w.y, qe = w.x + (je - w.x) + _n * fe, mt = w.y + (He - w.y) + An * Ee, bt = rt.width * fe, R = rt.height * Ee, Ht = {
|
|
4705
4715
|
x: qe,
|
|
4706
4716
|
y: mt,
|
|
4707
|
-
width:
|
|
4717
|
+
width: bt,
|
|
4708
4718
|
height: R
|
|
4709
4719
|
};
|
|
4710
|
-
rt.type === "text" && (Ht.fontSize = (rt.fontSize || 20) * fe), rt.type === "freedraw" && (Ht.points = rt.points.map((Jt) => [Jt[0] * fe, Jt[1] *
|
|
4711
|
-
}),
|
|
4720
|
+
rt.type === "text" && (Ht.fontSize = (rt.fontSize || 20) * fe), rt.type === "freedraw" && (Ht.points = rt.points.map((Jt) => [Jt[0] * fe, Jt[1] * Ee])), e.updateElement(rt.id, Ht);
|
|
4721
|
+
}), ze();
|
|
4712
4722
|
return;
|
|
4713
4723
|
}
|
|
4714
|
-
const Je = { x: je, y: He, width:
|
|
4724
|
+
const Je = { x: je, y: He, width: Me, height: Le };
|
|
4715
4725
|
if (w.type === "text")
|
|
4716
4726
|
if (!w.containerId && !w.frameId)
|
|
4717
4727
|
if (A === "n" || A === "s")
|
|
4718
4728
|
Je.fontSize = Math.round((w.fontSize || 20) * (Le / w.height)), Je.width = w.width * (Le / w.height), Je.height = Le;
|
|
4719
4729
|
else if (A === "e" || A === "w") {
|
|
4720
4730
|
const fe = Ne(",", w.fontSize || 20, w.fontFamily || "sans-serif", void 0, { isBold: w.isBold, isItalic: w.isItalic }).width;
|
|
4721
|
-
|
|
4722
|
-
const
|
|
4723
|
-
Je.height =
|
|
4731
|
+
Me < fe && (Me = fe, A === "w" && (je = w.x + (w.width - fe)));
|
|
4732
|
+
const Ee = Ne(w.text || "", w.fontSize || 20, w.fontFamily || "sans-serif", Me, { isBold: w.isBold, isItalic: w.isItalic });
|
|
4733
|
+
Je.height = Ee.height, Je.width = Me, Je.x = je, Je.autoResize = !1;
|
|
4724
4734
|
} else
|
|
4725
|
-
Je.fontSize = Math.round((w.fontSize || 20) * (
|
|
4735
|
+
Je.fontSize = Math.round((w.fontSize || 20) * (Me / w.width)), Je.height = w.height * (Me / w.width);
|
|
4726
4736
|
else
|
|
4727
4737
|
Je.autoResize = !1;
|
|
4728
4738
|
else if (w.type === "freedraw") {
|
|
4729
|
-
const fe = w.width === 0 ? 1 :
|
|
4730
|
-
Je.points = w.points.map((rt) => [rt[0] * fe, rt[1] *
|
|
4739
|
+
const fe = w.width === 0 ? 1 : Me / w.width, Ee = w.height === 0 ? 1 : Le / w.height;
|
|
4740
|
+
Je.points = w.points.map((rt) => [rt[0] * fe, rt[1] * Ee]);
|
|
4731
4741
|
}
|
|
4732
4742
|
const $t = e.elements.find((fe) => fe.type === "text" && fe.containerId === w.id && !fe.isDeleted);
|
|
4733
4743
|
if ($t) {
|
|
4734
4744
|
const fe = Ne(",", w.fontSize || 20, w.fontFamily || "sans-serif", void 0, { isBold: w.isBold, isItalic: w.isItalic }).width;
|
|
4735
|
-
|
|
4736
|
-
const
|
|
4737
|
-
Le <
|
|
4745
|
+
Me < fe && (Me = fe, A.includes("w") && (je = w.x + (w.width - fe), Je.x = je)), Je.width = Me;
|
|
4746
|
+
const Ee = Ne($t.text || "", $t.fontSize || 20, $t.fontFamily || "sans-serif", Me, { isBold: $t.isBold, isItalic: $t.isItalic }).height;
|
|
4747
|
+
Le < Ee && (A.includes("n") && (He = w.y + (w.height - Ee), Je.y = He), Le = Ee), Je.height = Le, e.updateElement($t.id, {
|
|
4738
4748
|
...Je,
|
|
4739
|
-
width:
|
|
4749
|
+
width: Me,
|
|
4740
4750
|
height: Le
|
|
4741
4751
|
});
|
|
4742
4752
|
}
|
|
4743
4753
|
e.updateElement(w.id, {
|
|
4744
4754
|
...Je,
|
|
4745
|
-
width: Math.max(
|
|
4755
|
+
width: Math.max(Me, Je.width),
|
|
4746
4756
|
height: Math.max(Le, Je.height)
|
|
4747
|
-
}),
|
|
4757
|
+
}), ze();
|
|
4748
4758
|
return;
|
|
4749
4759
|
}
|
|
4750
4760
|
if (v.value && x === "eraser") {
|
|
4751
|
-
h.value.push({ x: y, y: u, timestamp: Date.now() }), h.value.length > 50 && h.value.shift(), Kt(y, u),
|
|
4761
|
+
h.value.push({ x: y, y: u, timestamp: Date.now() }), h.value.length > 50 && h.value.shift(), Kt(y, u), ze();
|
|
4752
4762
|
return;
|
|
4753
4763
|
}
|
|
4754
4764
|
if (x === "hand" && d.value || r.value) {
|
|
@@ -4763,22 +4773,22 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4763
4773
|
const F = Object.keys(e.appState.selectedElementIds);
|
|
4764
4774
|
let Q = y - Ue.value.x, K = u - Ue.value.y;
|
|
4765
4775
|
W.value = [], e.moveElements(F, Q, K), F.forEach((Z) => {
|
|
4766
|
-
const pe = e.elements.find((
|
|
4776
|
+
const pe = e.elements.find((Ie) => Ie.id === Z);
|
|
4767
4777
|
pe && pe.type === "arrow" && (pe.startBinding && !F.includes(pe.startBinding.elementId) && e.updateElement(pe.id, { startBinding: null }), pe.endBinding && !F.includes(pe.endBinding.elementId) && e.updateElement(pe.id, { endBinding: null }));
|
|
4768
4778
|
}), Ue.value = { x: y, y: u };
|
|
4769
4779
|
return;
|
|
4770
4780
|
}
|
|
4771
4781
|
if (I.value && x === "selection") {
|
|
4772
|
-
dn(),
|
|
4782
|
+
dn(), ze();
|
|
4773
4783
|
return;
|
|
4774
4784
|
}
|
|
4775
4785
|
if ((!d.value || !ee.value) && !d.value) {
|
|
4776
|
-
|
|
4786
|
+
ze();
|
|
4777
4787
|
return;
|
|
4778
4788
|
}
|
|
4779
4789
|
let S = y - ne.value.x, _ = u - ne.value.y;
|
|
4780
|
-
const E = p.shiftKey && ["rectangle", "diamond", "ellipse", "star", "cylinder", "trapezoid", "parallelogram", "process", "decision"].includes(x),
|
|
4781
|
-
if (E ||
|
|
4790
|
+
const E = p.shiftKey && ["rectangle", "diamond", "ellipse", "star", "cylinder", "trapezoid", "parallelogram", "process", "decision"].includes(x), V = ["square", "circle"].includes(x);
|
|
4791
|
+
if (E || V) {
|
|
4782
4792
|
const A = Math.max(Math.abs(S), Math.abs(_));
|
|
4783
4793
|
S = S < 0 ? -A : A, _ = _ < 0 ? -A : A;
|
|
4784
4794
|
}
|
|
@@ -4791,17 +4801,17 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4791
4801
|
else if (L.type === "line" || L.type === "arrow") {
|
|
4792
4802
|
let A = S, w = _;
|
|
4793
4803
|
if (p.shiftKey) {
|
|
4794
|
-
const je = Math.hypot(A, w), He = Math.atan2(w, A),
|
|
4795
|
-
A = je * Math.cos(
|
|
4804
|
+
const je = Math.hypot(A, w), He = Math.atan2(w, A), Me = Math.round(He / (15 * Math.PI / 180)) * (15 * Math.PI / 180);
|
|
4805
|
+
A = je * Math.cos(Me), w = je * Math.sin(Me);
|
|
4796
4806
|
}
|
|
4797
|
-
const F = ne.value.x + A, Q = ne.value.y + w, K = A < 0 ? F : ne.value.x, Z = w < 0 ? Q : ne.value.y, pe = ne.value.x - K,
|
|
4807
|
+
const F = ne.value.x + A, Q = ne.value.y + w, K = A < 0 ? F : ne.value.x, Z = w < 0 ? Q : ne.value.y, pe = ne.value.x - K, Ie = ne.value.y - Z, be = F - K, Ve = Q - Z;
|
|
4798
4808
|
if (ee.value) {
|
|
4799
4809
|
let je = {
|
|
4800
4810
|
x: K,
|
|
4801
4811
|
y: Z,
|
|
4802
4812
|
width: Math.abs(A),
|
|
4803
4813
|
height: Math.abs(w),
|
|
4804
|
-
points: [[pe,
|
|
4814
|
+
points: [[pe, Ie], [be, Ve]]
|
|
4805
4815
|
};
|
|
4806
4816
|
e.updateElement(ee.value, je);
|
|
4807
4817
|
}
|
|
@@ -4816,7 +4826,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4816
4826
|
F.id !== L.id && !F.isDeleted && F.type !== "frame" && !F.frameId && F.x >= A.x && F.y >= A.y && F.x + F.width <= A.x + A.width && F.y + F.height <= A.y + A.height && (w[F.id] = !0);
|
|
4817
4827
|
}), Fe.value = w;
|
|
4818
4828
|
}
|
|
4819
|
-
|
|
4829
|
+
ze();
|
|
4820
4830
|
}
|
|
4821
4831
|
}, Yt = (p, x, y) => {
|
|
4822
4832
|
const u = p.movementX, C = p.movementY, g = 20;
|
|
@@ -4825,19 +4835,19 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4825
4835
|
const _ = Math.abs(u) > Math.abs(C);
|
|
4826
4836
|
if (e.elements.forEach((E) => {
|
|
4827
4837
|
if (E.isDeleted || E.locked || E.type === "frame" || E.type === "line" || E.type === "arrow" || E.type === "freedraw" || E.type === "text" && E.containerId) return;
|
|
4828
|
-
const
|
|
4838
|
+
const V = E.x, L = E.y, A = E.width, w = E.height;
|
|
4829
4839
|
if (_) {
|
|
4830
4840
|
if (y >= L - g && y <= L + w + g) {
|
|
4831
4841
|
let F = 1 / 0;
|
|
4832
|
-
if (x >=
|
|
4842
|
+
if (x >= V && x <= V + A)
|
|
4833
4843
|
F = 0;
|
|
4834
4844
|
else {
|
|
4835
|
-
const Q = Math.abs(x -
|
|
4845
|
+
const Q = Math.abs(x - V), K = Math.abs(x - (V + A));
|
|
4836
4846
|
F = Math.min(Q, K);
|
|
4837
4847
|
}
|
|
4838
4848
|
F <= g && F < S && (S = F, P = E);
|
|
4839
4849
|
}
|
|
4840
|
-
} else if (x >=
|
|
4850
|
+
} else if (x >= V - g && x <= V + A + g) {
|
|
4841
4851
|
let F = 1 / 0;
|
|
4842
4852
|
if (y >= L && y <= L + w)
|
|
4843
4853
|
F = 0;
|
|
@@ -4855,15 +4865,15 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4855
4865
|
const L = Object.keys(e.appState.selectedElementIds);
|
|
4856
4866
|
L.length === 1 && (E = L[0]);
|
|
4857
4867
|
}
|
|
4858
|
-
const
|
|
4859
|
-
if (
|
|
4860
|
-
H.value =
|
|
4868
|
+
const V = vt(x, y, E);
|
|
4869
|
+
if (V && V.type !== "freedraw" && !V.locked)
|
|
4870
|
+
H.value = V.id;
|
|
4861
4871
|
else {
|
|
4862
4872
|
const L = ln(x, y, E);
|
|
4863
4873
|
H.value = L;
|
|
4864
4874
|
}
|
|
4865
4875
|
}
|
|
4866
|
-
|
|
4876
|
+
ze();
|
|
4867
4877
|
}
|
|
4868
4878
|
}, Cn = (p) => {
|
|
4869
4879
|
if (e.appState.isPanningCanvas = !1, r.value) {
|
|
@@ -4887,20 +4897,20 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4887
4897
|
if (u)
|
|
4888
4898
|
u.type === "frame" && ne.value.x > u.x + 10 && ne.value.x < u.x + u.width - 10 && ne.value.y > u.y + 10 && ne.value.y < u.y + u.height - 10 && (u = null), y = u ? u.id : null;
|
|
4889
4899
|
else if (D.value) {
|
|
4890
|
-
const E = e.elements.find((
|
|
4900
|
+
const E = e.elements.find((V) => V.id === D.value);
|
|
4891
4901
|
E && !E.isDeleted && (E.type === "frame" && ne.value.x > E.x + 10 && ne.value.x < E.x + E.width - 10 && ne.value.y > E.y + 10 && ne.value.y < E.y + E.height - 10 || (y = E.id, u = E));
|
|
4892
4902
|
}
|
|
4893
4903
|
if (y && u) {
|
|
4894
|
-
let
|
|
4904
|
+
let V = !1;
|
|
4895
4905
|
if (["rectangle", "image", "text", "frame", "square", "process"].includes(u.type))
|
|
4896
|
-
|
|
4906
|
+
V = ft(ne.value.x, ne.value.y, u.x + 10, u.y + 10, u.width - 20, u.height - 20, u.angle);
|
|
4897
4907
|
else if (["ellipse", "circle", "cylinder"].includes(u.type))
|
|
4898
|
-
|
|
4908
|
+
V = Tt(ne.value.x, ne.value.y, u.x + 10, u.y + 10, u.width - 20, u.height - 20, u.angle);
|
|
4899
4909
|
else if (["diamond", "decision"].includes(u.type))
|
|
4900
|
-
|
|
4910
|
+
V = At(ne.value.x, ne.value.y, u.x + 10, u.y + 10, u.width - 20, u.height - 20, u.angle);
|
|
4901
4911
|
else if (["star", "trapezoid", "parallelogram"].includes(u.type)) {
|
|
4902
4912
|
let L = [];
|
|
4903
|
-
u.type === "star" ? L =
|
|
4913
|
+
u.type === "star" ? L = St(u.width - 20, u.height - 20) : u.type === "trapezoid" ? L = Ft(u.width - 20, u.height - 20) : u.type === "parallelogram" && (L = Ot(u.width - 20, u.height - 20)), V = Dt(ne.value.x, ne.value.y, L, u.x + 10, u.y + 10, u.angle);
|
|
4904
4914
|
}
|
|
4905
4915
|
{
|
|
4906
4916
|
const L = u.x + u.width / 2, A = u.y + u.height / 2, [w, F] = me([ne.value.x, ne.value.y], [L, A], -u.angle), Q = (w - u.x) / u.width, K = (F - u.y) / u.height;
|
|
@@ -4910,54 +4920,54 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4910
4920
|
focus: 0,
|
|
4911
4921
|
gap: 10,
|
|
4912
4922
|
fixedPoint: [Q, K],
|
|
4913
|
-
isBorder: !
|
|
4923
|
+
isBorder: !V
|
|
4914
4924
|
}
|
|
4915
4925
|
});
|
|
4916
4926
|
}
|
|
4917
4927
|
}
|
|
4918
|
-
let C = null, g = vt(
|
|
4928
|
+
let C = null, g = vt(oe.value.x, oe.value.y, x.id);
|
|
4919
4929
|
if (g)
|
|
4920
|
-
g.type === "frame" &&
|
|
4930
|
+
g.type === "frame" && oe.value.x > g.x + 10 && oe.value.x < g.x + g.width - 10 && oe.value.y > g.y + 10 && oe.value.y < g.y + g.height - 10 && (g = null), C = g ? g.id : null;
|
|
4921
4931
|
else if (H.value) {
|
|
4922
|
-
const E = e.elements.find((
|
|
4923
|
-
E && !E.isDeleted && (E.type === "frame" &&
|
|
4932
|
+
const E = e.elements.find((V) => V.id === H.value);
|
|
4933
|
+
E && !E.isDeleted && (E.type === "frame" && oe.value.x > E.x + 10 && oe.value.x < E.x + E.width - 10 && oe.value.y > E.y + 10 && oe.value.y < E.y + E.height - 10 || (C = E.id, g = E));
|
|
4924
4934
|
}
|
|
4925
4935
|
if (C && g) {
|
|
4926
|
-
let
|
|
4936
|
+
let V = !1;
|
|
4927
4937
|
if (["rectangle", "image", "text", "frame", "square", "process"].includes(g.type))
|
|
4928
|
-
|
|
4938
|
+
V = ft(oe.value.x, oe.value.y, g.x + 10, g.y + 10, g.width - 20, g.height - 20, g.angle);
|
|
4929
4939
|
else if (["ellipse", "circle", "cylinder"].includes(g.type))
|
|
4930
|
-
|
|
4940
|
+
V = Tt(oe.value.x, oe.value.y, g.x + 10, g.y + 10, g.width - 20, g.height - 20, g.angle);
|
|
4931
4941
|
else if (["diamond", "decision"].includes(g.type))
|
|
4932
|
-
|
|
4942
|
+
V = At(oe.value.x, oe.value.y, g.x + 10, g.y + 10, g.width - 20, g.height - 20, g.angle);
|
|
4933
4943
|
else if (["star", "trapezoid", "parallelogram"].includes(g.type)) {
|
|
4934
4944
|
let L = [];
|
|
4935
|
-
g.type === "star" ? L =
|
|
4945
|
+
g.type === "star" ? L = St(g.width - 20, g.height - 20) : g.type === "trapezoid" ? L = Ft(g.width - 20, g.height - 20) : g.type === "parallelogram" && (L = Ot(g.width - 20, g.height - 20)), V = Dt(oe.value.x, oe.value.y, L, g.x + 10, g.y + 10, g.angle);
|
|
4936
4946
|
}
|
|
4937
4947
|
{
|
|
4938
|
-
const L = g.x + g.width / 2, A = g.y + g.height / 2, [w, F] = me([
|
|
4948
|
+
const L = g.x + g.width / 2, A = g.y + g.height / 2, [w, F] = me([oe.value.x, oe.value.y], [L, A], -g.angle), Q = (w - g.x) / g.width, K = (F - g.y) / g.height;
|
|
4939
4949
|
e.updateElement(x.id, {
|
|
4940
4950
|
endBinding: {
|
|
4941
4951
|
elementId: C,
|
|
4942
4952
|
focus: 0,
|
|
4943
4953
|
gap: 10,
|
|
4944
4954
|
fixedPoint: [Q, K],
|
|
4945
|
-
isBorder: !
|
|
4955
|
+
isBorder: !V
|
|
4946
4956
|
}
|
|
4947
4957
|
});
|
|
4948
4958
|
}
|
|
4949
4959
|
}
|
|
4950
|
-
const P = ne.value, S =
|
|
4960
|
+
const P = ne.value, S = oe.value;
|
|
4951
4961
|
let _ = null;
|
|
4952
4962
|
for (const E of e.elements)
|
|
4953
4963
|
if (E.type === "frame" && !E.isDeleted) {
|
|
4954
|
-
const
|
|
4955
|
-
|
|
4964
|
+
const V = P.x >= E.x && P.x <= E.x + E.width && P.y >= E.y && P.y <= E.y + E.height, L = S.x >= E.x && S.x <= E.x + E.width && S.y >= E.y && S.y <= E.y + E.height;
|
|
4965
|
+
V && L && (_ = E.id);
|
|
4956
4966
|
}
|
|
4957
4967
|
if (_ && e.updateElement(x.id, { frameId: _ }), (x.type === "line" || x.type === "arrow" && x.arrowType !== "elbow") && x.points.length === 2) {
|
|
4958
|
-
const E = x.points[0],
|
|
4959
|
-
if (E &&
|
|
4960
|
-
const L = (E[0] +
|
|
4968
|
+
const E = x.points[0], V = x.points[1];
|
|
4969
|
+
if (E && V) {
|
|
4970
|
+
const L = (E[0] + V[0]) / 2, A = (E[1] + V[1]) / 2, F = { points: [E, [L, A], V] };
|
|
4961
4971
|
x.type === "line" ? F.arrowType = "round" : x.type, e.updateElement(x.id, F);
|
|
4962
4972
|
}
|
|
4963
4973
|
}
|
|
@@ -4985,15 +4995,15 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
4985
4995
|
}
|
|
4986
4996
|
}
|
|
4987
4997
|
if (["rectangle", "diamond", "ellipse", "frame", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram"].includes(x.type) && (x.width < 10 || x.height < 10)) {
|
|
4988
|
-
e.deleteElement(x.id), ee.value = null, d.value = !1,
|
|
4998
|
+
e.deleteElement(x.id), ee.value = null, d.value = !1, ze();
|
|
4989
4999
|
return;
|
|
4990
5000
|
}
|
|
4991
5001
|
x.type !== "arrow" && x.type !== "freedraw" && e.setSelectedElementIds([ee.value]), x.type !== "freedraw" && !e.appState.lockedTool && e.setTool("selection"), (ee.value || Object.keys(e.appState.selectedElementIds).length > 0) && e.recordHistory();
|
|
4992
5002
|
}
|
|
4993
|
-
|
|
5003
|
+
ke.value.forEach((x) => {
|
|
4994
5004
|
const y = e.elements.find((u) => u.id === x);
|
|
4995
5005
|
if (y && y.type != "frame") {
|
|
4996
|
-
const u =
|
|
5006
|
+
const u = Ce.value;
|
|
4997
5007
|
let C = !0;
|
|
4998
5008
|
if (u === null && y.frameId)
|
|
4999
5009
|
if (e.appState.selectedElementIds[y.frameId])
|
|
@@ -5012,22 +5022,22 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5012
5022
|
}
|
|
5013
5023
|
});
|
|
5014
5024
|
}
|
|
5015
|
-
v.value && Object.keys(
|
|
5025
|
+
v.value && Object.keys(we.value).length > 0 && (Object.keys(we.value).forEach((x) => {
|
|
5016
5026
|
e.deleteElement(x);
|
|
5017
|
-
}),
|
|
5027
|
+
}), we.value = {}, e.recordHistory()), (T.value || b.value) && e.recordHistory(), d.value = !1, v.value = !1, I.value = !1, e.appState.isBoxSelecting = !1, ee.value = null, b.value = null, H.value = null, D.value = null, T.value = !1, Ce.value = null, Fe.value = {}, e.appState.activeTool === "laser" || ze();
|
|
5018
5028
|
}
|
|
5019
5029
|
}, cn = () => {
|
|
5020
5030
|
if (O) return;
|
|
5021
5031
|
const p = () => {
|
|
5022
5032
|
const x = Date.now(), y = 1e3;
|
|
5023
5033
|
let u = !1;
|
|
5024
|
-
tt.value = tt.value.map((C) => C.filter((g) => x - g.time < y)).filter((C) => C.length > 0), u = tt.value.length > 0,
|
|
5034
|
+
tt.value = tt.value.map((C) => C.filter((g) => x - g.time < y)).filter((C) => C.length > 0), u = tt.value.length > 0, ze(), u || d.value && e.appState.activeTool === "laser" ? O = requestAnimationFrame(p) : O = null;
|
|
5025
5035
|
};
|
|
5026
5036
|
p();
|
|
5027
5037
|
};
|
|
5028
5038
|
J("");
|
|
5029
5039
|
const Vt = J(""), Nt = (p) => {
|
|
5030
|
-
|
|
5040
|
+
xe.value = !0, Vt.value = te.value + "";
|
|
5031
5041
|
}, Tn = (p) => {
|
|
5032
5042
|
const x = e.elements.find((y) => y.id === G.value);
|
|
5033
5043
|
if (x && !x.containerId && x.type === "text") {
|
|
@@ -5035,13 +5045,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5035
5045
|
e.updateElement(G.value, { width: x.autoResize !== !1 ? u.width : x.width, height: u.height });
|
|
5036
5046
|
}
|
|
5037
5047
|
}, Pn = (p) => {
|
|
5038
|
-
|
|
5048
|
+
xe.value = !1;
|
|
5039
5049
|
}, Bn = (p) => {
|
|
5040
|
-
|
|
5050
|
+
xe.value || (te.value = p.target.value);
|
|
5041
5051
|
};
|
|
5042
|
-
|
|
5052
|
+
Mt(() => te.value, (p) => {
|
|
5043
5053
|
if (G.value) {
|
|
5044
|
-
p && s.value ? et.value =
|
|
5054
|
+
p && s.value ? et.value = pa(s.value, 1, null).height : et.value = "23px";
|
|
5045
5055
|
const x = e.elements.find((y) => y.id === G.value);
|
|
5046
5056
|
if (x && x.type === "text")
|
|
5047
5057
|
if (x.containerId) {
|
|
@@ -5070,13 +5080,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5070
5080
|
name: te.value
|
|
5071
5081
|
}) : te.value.trim() ? e.updateElement(G.value, {
|
|
5072
5082
|
text: te.value
|
|
5073
|
-
}) : e.deleteElement(G.value), e.recordHistory()), G.value = null, e.setTool("selection"),
|
|
5083
|
+
}) : e.deleteElement(G.value), e.recordHistory()), G.value = null, e.setTool("selection"), ze();
|
|
5074
5084
|
} else
|
|
5075
|
-
e.deleteElement(G.value), G.value = null, e.setTool("selection"),
|
|
5085
|
+
e.deleteElement(G.value), G.value = null, e.setTool("selection"), ze();
|
|
5076
5086
|
}, dn = () => {
|
|
5077
|
-
const p = Math.min(ne.value.x,
|
|
5087
|
+
const p = Math.min(ne.value.x, oe.value.x), x = Math.min(ne.value.y, oe.value.y), y = Math.max(ne.value.x, oe.value.x), u = Math.max(ne.value.y, oe.value.y);
|
|
5078
5088
|
let C = e.elements.filter((S) => !S.isDeleted && !S.locked).filter((S) => {
|
|
5079
|
-
const _ =
|
|
5089
|
+
const _ = Zs(S);
|
|
5080
5090
|
return _.minX >= p && _.maxX <= y && _.minY >= x && _.maxY <= u;
|
|
5081
5091
|
});
|
|
5082
5092
|
const g = new Set(C.map((S) => S.id)), P = /* @__PURE__ */ new Set();
|
|
@@ -5093,30 +5103,30 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5093
5103
|
if (["rectangle", "frame", "square", "process"].includes(u.type))
|
|
5094
5104
|
C = ft(p, x, u.x, u.y, u.width, u.height, u.angle);
|
|
5095
5105
|
else if (["ellipse", "circle", "cylinder"].includes(u.type))
|
|
5096
|
-
C =
|
|
5106
|
+
C = Tt(p, x, u.x, u.y, u.width, u.height, u.angle);
|
|
5097
5107
|
else if (["diamond", "decision"].includes(u.type))
|
|
5098
5108
|
C = At(p, x, u.x, u.y, u.width, u.height, u.angle);
|
|
5099
5109
|
else if (["star", "trapezoid", "parallelogram"].includes(u.type)) {
|
|
5100
5110
|
let g = [];
|
|
5101
|
-
u.type === "star" ? g =
|
|
5111
|
+
u.type === "star" ? g = St(u.width, u.height) : u.type === "trapezoid" ? g = Ft(u.width, u.height) : u.type === "parallelogram" && (g = Ot(u.width, u.height)), C = Dt(p, x, g, u.x, u.y, u.angle) || ls(p, x, g, u.x, u.y, u.angle);
|
|
5102
5112
|
} else u.type === "text" || u.type === "image" ? C = p >= u.x && p <= u.x + u.width && x >= u.y && x <= u.y + u.height : (u.type === "line" || u.type === "arrow" || u.type === "freedraw") && (C = Rn(10, p, x, u));
|
|
5103
5113
|
if (C) {
|
|
5104
5114
|
if (u.groupIds && u.groupIds.length > 0) {
|
|
5105
5115
|
const g = new Set(u.groupIds);
|
|
5106
5116
|
t.elements.forEach((P) => {
|
|
5107
|
-
!P.isDeleted && P.groupIds && P.groupIds.some((S) => g.has(S)) && (
|
|
5117
|
+
!P.isDeleted && P.groupIds && P.groupIds.some((S) => g.has(S)) && (we.value[P.id] = !0);
|
|
5108
5118
|
});
|
|
5109
5119
|
} else
|
|
5110
|
-
|
|
5120
|
+
we.value[u.id] = !0;
|
|
5111
5121
|
u.type === "frame" && t.elements.forEach((g) => {
|
|
5112
|
-
!g.isDeleted && g.frameId === u.id && (
|
|
5113
|
-
}),
|
|
5122
|
+
!g.isDeleted && g.frameId === u.id && (we.value[g.id] = !0);
|
|
5123
|
+
}), ze();
|
|
5114
5124
|
}
|
|
5115
5125
|
}
|
|
5116
5126
|
}, z = (p) => {
|
|
5117
5127
|
const x = Object.keys(e.appState.selectedElementIds);
|
|
5118
5128
|
if (x.length !== 1) return;
|
|
5119
|
-
const y = e.elements.find((
|
|
5129
|
+
const y = e.elements.find((Me) => Me.id === x[0]);
|
|
5120
5130
|
if (!y || y.isDeleted || y.type === "line" || y.type === "arrow" || y.type === "freedraw")
|
|
5121
5131
|
return;
|
|
5122
5132
|
const u = 150;
|
|
@@ -5137,7 +5147,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5137
5147
|
}
|
|
5138
5148
|
const P = {
|
|
5139
5149
|
...y,
|
|
5140
|
-
id:
|
|
5150
|
+
id: It(),
|
|
5141
5151
|
x: C,
|
|
5142
5152
|
y: g,
|
|
5143
5153
|
seed: Math.floor(Math.random() * 2 ** 31),
|
|
@@ -5145,19 +5155,19 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5145
5155
|
updated: Date.now()
|
|
5146
5156
|
};
|
|
5147
5157
|
P.type === "text" && (P.text = ""), e.addElement(P);
|
|
5148
|
-
const S = y.x + y.width / 2, _ = y.y + y.height / 2, E = P.x + P.width / 2,
|
|
5149
|
-
let Q = S, K = _, Z = E, pe =
|
|
5158
|
+
const S = y.x + y.width / 2, _ = y.y + y.height / 2, E = P.x + P.width / 2, V = P.y + P.height / 2, L = [S, _], A = [E, V], w = Pt(y, A, L, 5), F = Pt(P, L, A, 5);
|
|
5159
|
+
let Q = S, K = _, Z = E, pe = V;
|
|
5150
5160
|
w && (Q = w[0], K = w[1]), F && (Z = F[0], pe = F[1]);
|
|
5151
|
-
const
|
|
5161
|
+
const Ie = Math.min(Q, Z), be = Math.min(K, pe), Ve = Math.max(Q, Z), je = Math.max(K, pe), He = tn("arrow", Ie, be, {
|
|
5152
5162
|
strokeColor: y.strokeColor || e.appState.currentItemStrokeColor,
|
|
5153
5163
|
backgroundColor: y.backgroundColor || e.appState.currentItemBackgroundColor,
|
|
5154
5164
|
strokeWidth: y.strokeWidth || e.appState.currentItemStrokeWidth,
|
|
5155
5165
|
strokeStyle: y.strokeStyle || e.appState.currentItemStrokeStyle,
|
|
5156
5166
|
roughness: y.roughness || e.appState.currentItemRoughness
|
|
5157
5167
|
});
|
|
5158
|
-
He.width = Ve -
|
|
5159
|
-
[Q -
|
|
5160
|
-
[Z -
|
|
5168
|
+
He.width = Ve - Ie, He.height = je - be, He.points = [
|
|
5169
|
+
[Q - Ie, K - be],
|
|
5170
|
+
[Z - Ie, pe - be]
|
|
5161
5171
|
], He.startBinding = {
|
|
5162
5172
|
elementId: y.id,
|
|
5163
5173
|
focus: 0,
|
|
@@ -5166,7 +5176,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5166
5176
|
elementId: P.id,
|
|
5167
5177
|
focus: 0,
|
|
5168
5178
|
gap: 5
|
|
5169
|
-
}, He.endArrowhead = "arrow", e.addElement(He), e.appState.selectedElementIds = { [P.id]: !0 },
|
|
5179
|
+
}, He.endArrowhead = "arrow", e.addElement(He), e.appState.selectedElementIds = { [P.id]: !0 }, ze();
|
|
5170
5180
|
}, $ = (p) => {
|
|
5171
5181
|
if (G.value) return;
|
|
5172
5182
|
const x = p.target;
|
|
@@ -5178,7 +5188,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5178
5188
|
}
|
|
5179
5189
|
if (p.key === "Escape") {
|
|
5180
5190
|
if (!d.value && ee.value && e.appState.activeTool !== "selection") {
|
|
5181
|
-
p.preventDefault(), e.deleteElement(ee.value), ee.value = null, d.value = !1,
|
|
5191
|
+
p.preventDefault(), e.deleteElement(ee.value), ee.value = null, d.value = !1, ze();
|
|
5182
5192
|
return;
|
|
5183
5193
|
}
|
|
5184
5194
|
if (!d.value && e.appState.activeTool !== "selection") {
|
|
@@ -5189,7 +5199,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5189
5199
|
}
|
|
5190
5200
|
if ((p.ctrlKey || p.metaKey) && (p.key === "d" || p.key === "D")) {
|
|
5191
5201
|
p.preventDefault(), e.duplicateElements(Object.keys(e.appState.selectedElementIds), (g) => {
|
|
5192
|
-
e.setSelectedElementIds(g),
|
|
5202
|
+
e.setSelectedElementIds(g), ze();
|
|
5193
5203
|
});
|
|
5194
5204
|
return;
|
|
5195
5205
|
}
|
|
@@ -5202,11 +5212,11 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5202
5212
|
if ((p.key === "i" || p.key === "I") && !(p.metaKey || p.ctrlKey) && !G.value) {
|
|
5203
5213
|
p.preventDefault();
|
|
5204
5214
|
const g = e.appState.activeTool;
|
|
5205
|
-
e.setTool("image"),
|
|
5215
|
+
e.setTool("image"), Ms().then((P) => {
|
|
5206
5216
|
if (P) {
|
|
5207
5217
|
const S = window.innerWidth / 2 / e.appState.zoom - e.appState.scrollX, _ = window.innerHeight / 2 / e.appState.zoom - e.appState.scrollY;
|
|
5208
|
-
let E = S - P.width / 2,
|
|
5209
|
-
|
|
5218
|
+
let E = S - P.width / 2, V = _ - P.height / 2;
|
|
5219
|
+
oe.value.x !== 0 && oe.value.y !== 0 && (E = oe.value.x - P.width / 2, V = oe.value.y - P.height / 2), e.insertImage(P.dataURL, E, V, P.width, P.height);
|
|
5210
5220
|
}
|
|
5211
5221
|
e.setTool(g);
|
|
5212
5222
|
});
|
|
@@ -5219,7 +5229,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5219
5229
|
p.preventDefault(), z(p.key);
|
|
5220
5230
|
return;
|
|
5221
5231
|
}
|
|
5222
|
-
(p.key === "a" || p.key === "A") && (p.preventDefault(), e.selectAll(),
|
|
5232
|
+
(p.key === "a" || p.key === "A") && (p.preventDefault(), e.selectAll(), ze()), (p.key === "c" || p.key === "C") && (p.preventDefault(), e.copyElements()), (p.key === "v" || p.key === "V") && e.pasteElements(oe.value), (p.key === "x" || p.key === "X") && (p.preventDefault(), e.cutElements()), (p.key === "z" || p.key === "Z") && (p.preventDefault(), u ? e.redo() : e.undo()), (p.key === "g" || p.key === "G") && (p.preventDefault(), u ? e.ungroupElements(Object.keys(e.appState.selectedElementIds)) : e.groupElements(Object.keys(e.appState.selectedElementIds)), ze()), p.key === "'" && (p.preventDefault(), e.toggleGrid()), (p.key === "=" || p.key === "+") && (p.preventDefault(), e.zoomIn()), p.key === "-" && (p.preventDefault(), e.zoomOut()), p.key === "0" && (p.preventDefault(), e.setZoom(1));
|
|
5223
5233
|
} else {
|
|
5224
5234
|
if (G.value) return;
|
|
5225
5235
|
if (p.key === "[") {
|
|
@@ -5236,7 +5246,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5236
5246
|
p.key === "ArrowUp" && (S = -g), p.key === "ArrowDown" && (S = g), p.key === "ArrowLeft" && (P = -g), p.key === "ArrowRight" && (P = g);
|
|
5237
5247
|
const _ = Object.keys(e.appState.selectedElementIds);
|
|
5238
5248
|
if (_.length > 0) {
|
|
5239
|
-
p.preventDefault(), p.repeat || e.recordHistory(), e.moveElements(_, P, S),
|
|
5249
|
+
p.preventDefault(), p.repeat || e.recordHistory(), e.moveElements(_, P, S), ze();
|
|
5240
5250
|
return;
|
|
5241
5251
|
}
|
|
5242
5252
|
}
|
|
@@ -5264,7 +5274,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5264
5274
|
g = Math.round(g * 100) / 100, g = Math.min(Math.max(0.1, g), 5);
|
|
5265
5275
|
const P = n.value?.getBoundingClientRect();
|
|
5266
5276
|
if (P) {
|
|
5267
|
-
const S = p.clientX - P.left, _ = p.clientY - P.top, E = S / t.zoom - t.scrollX,
|
|
5277
|
+
const S = p.clientX - P.left, _ = p.clientY - P.top, E = S / t.zoom - t.scrollX, V = _ / t.zoom - t.scrollY, L = S / g - t.scrollX, A = _ / g - t.scrollY, w = L - E, F = A - V;
|
|
5268
5278
|
e.setZoom(g), e.setScroll && e.setScroll(
|
|
5269
5279
|
t.scrollX + w,
|
|
5270
5280
|
t.scrollY + F
|
|
@@ -5278,7 +5288,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5278
5288
|
e.appState.scrollX - x / t.zoom,
|
|
5279
5289
|
e.appState.scrollY - y / t.zoom
|
|
5280
5290
|
);
|
|
5281
|
-
},
|
|
5291
|
+
}, Te = (p) => {
|
|
5282
5292
|
if (e.appState.viewLocked) return;
|
|
5283
5293
|
const { x, y } = de(p), u = vt(x, y, null, !0);
|
|
5284
5294
|
if (u && !u.locked && e.appState.selectedElementIds[u.id]) {
|
|
@@ -5337,7 +5347,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5337
5347
|
});
|
|
5338
5348
|
p.width = 200, p.height = 100, p.fillStyle = "solid", p.strokeWidth = 2, p.roughness = 0, e.addElement(p);
|
|
5339
5349
|
}
|
|
5340
|
-
|
|
5350
|
+
ze();
|
|
5341
5351
|
});
|
|
5342
5352
|
const un = async (p) => {
|
|
5343
5353
|
await hn(p);
|
|
@@ -5377,8 +5387,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5377
5387
|
const A = S / _;
|
|
5378
5388
|
S > _ ? (S = E, _ = E / A) : (_ = E, S = E * A);
|
|
5379
5389
|
}
|
|
5380
|
-
const
|
|
5381
|
-
e.insertImage && e.insertImage(g,
|
|
5390
|
+
const V = S, L = _;
|
|
5391
|
+
e.insertImage && e.insertImage(g, oe.value.x - V / 2, oe.value.y - L / 2, V, L);
|
|
5382
5392
|
}, P.src = g;
|
|
5383
5393
|
}
|
|
5384
5394
|
}, u.onerror = () => {
|
|
@@ -5394,10 +5404,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5394
5404
|
p.code === "Space" && e.appState.activeTool === "hand" && e.appState.lastActiveTool && (e.setTool(e.appState.lastActiveTool), e.appState.lastActiveTool = null);
|
|
5395
5405
|
};
|
|
5396
5406
|
let lt = null, zt = 0;
|
|
5397
|
-
const
|
|
5407
|
+
const ze = () => {
|
|
5398
5408
|
zt && cancelAnimationFrame(zt), zt = requestAnimationFrame(() => {
|
|
5399
5409
|
if (n.value) {
|
|
5400
|
-
if (
|
|
5410
|
+
if (ca(
|
|
5401
5411
|
n.value,
|
|
5402
5412
|
t.elements,
|
|
5403
5413
|
t.scrollX,
|
|
@@ -5405,13 +5415,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5405
5415
|
t.zoom,
|
|
5406
5416
|
e.appState.selectedElementIds,
|
|
5407
5417
|
G.value,
|
|
5408
|
-
|
|
5409
|
-
|
|
5418
|
+
we.value,
|
|
5419
|
+
Ce.value,
|
|
5410
5420
|
Fe.value,
|
|
5411
5421
|
e.appState.showGrid ? e.appState.gridType : "none",
|
|
5412
|
-
|
|
5422
|
+
Be.value,
|
|
5413
5423
|
e.appState.viewBackgroundColor
|
|
5414
|
-
), tt.value.length > 0 &&
|
|
5424
|
+
), tt.value.length > 0 && ua(
|
|
5415
5425
|
n.value,
|
|
5416
5426
|
tt.value,
|
|
5417
5427
|
e.appState.zoom,
|
|
@@ -5432,28 +5442,28 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5432
5442
|
if (S.length < 3) return S;
|
|
5433
5443
|
let _ = [...S];
|
|
5434
5444
|
for (let E = 0; E < 2; E++) {
|
|
5435
|
-
const
|
|
5436
|
-
|
|
5445
|
+
const V = [];
|
|
5446
|
+
V.push(_[0]);
|
|
5437
5447
|
for (let L = 0; L < _.length - 1; L++) {
|
|
5438
5448
|
const A = _[L], w = _[L + 1];
|
|
5439
|
-
|
|
5449
|
+
V.push({
|
|
5440
5450
|
x: 0.75 * A.x + 0.25 * w.x,
|
|
5441
5451
|
y: 0.75 * A.y + 0.25 * w.y,
|
|
5442
5452
|
timestamp: 0.75 * A.timestamp + 0.25 * w.timestamp
|
|
5443
|
-
}),
|
|
5453
|
+
}), V.push({
|
|
5444
5454
|
x: 0.25 * A.x + 0.75 * w.x,
|
|
5445
5455
|
y: 0.25 * A.y + 0.75 * w.y,
|
|
5446
5456
|
timestamp: 0.25 * A.timestamp + 0.75 * w.timestamp
|
|
5447
5457
|
});
|
|
5448
5458
|
}
|
|
5449
|
-
|
|
5459
|
+
V.push(_[_.length - 1]), _ = V;
|
|
5450
5460
|
}
|
|
5451
5461
|
return _;
|
|
5452
5462
|
})(h.value);
|
|
5453
5463
|
for (let S = 0; S < P.length - 1; S++) {
|
|
5454
5464
|
const _ = P[S], E = P[S + 1];
|
|
5455
5465
|
if (!_ || !E) continue;
|
|
5456
|
-
const
|
|
5466
|
+
const V = x - _.timestamp, L = Math.max(0, 1 - V / 450);
|
|
5457
5467
|
if (L <= 0) continue;
|
|
5458
5468
|
u.beginPath();
|
|
5459
5469
|
const A = (_.x + t.scrollX) * t.zoom, w = (_.y + t.scrollY) * t.zoom, F = (E.x + t.scrollX) * t.zoom, Q = (E.y + t.scrollY) * t.zoom;
|
|
@@ -5464,7 +5474,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5464
5474
|
u.restore(), y.save(), y.setTransform(1, 0, 0, 1, 0, 0), y.globalAlpha = 0.6, y.drawImage(lt, 0, 0), y.restore();
|
|
5465
5475
|
}
|
|
5466
5476
|
}
|
|
5467
|
-
h.value.length > 0 && (cancelAnimationFrame(M), M = requestAnimationFrame(
|
|
5477
|
+
h.value.length > 0 && (cancelAnimationFrame(M), M = requestAnimationFrame(ze));
|
|
5468
5478
|
}
|
|
5469
5479
|
if (I.value) {
|
|
5470
5480
|
const x = n.value.getContext("2d");
|
|
@@ -5472,7 +5482,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5472
5482
|
x.save();
|
|
5473
5483
|
const y = window.devicePixelRatio || 1;
|
|
5474
5484
|
x.setTransform(y, 0, 0, y, 0, 0), x.strokeStyle = "rgba(30, 111, 255, 0.9)", x.fillStyle = "rgba(30, 111, 255, 0.1)", x.lineWidth = 1;
|
|
5475
|
-
const u = Math.min(ne.value.x + t.scrollX,
|
|
5485
|
+
const u = Math.min(ne.value.x + t.scrollX, oe.value.x + t.scrollX) * t.zoom, C = Math.min(ne.value.y + t.scrollY, oe.value.y + t.scrollY) * t.zoom, g = Math.abs(ne.value.x - oe.value.x) * t.zoom, P = Math.abs(ne.value.y - oe.value.y) * t.zoom;
|
|
5476
5486
|
x.strokeRect(u, C, g, P), x.fillRect(u, C, g, P), x.restore();
|
|
5477
5487
|
}
|
|
5478
5488
|
}
|
|
@@ -5503,13 +5513,13 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5503
5513
|
const C = window.devicePixelRatio || 1;
|
|
5504
5514
|
u.setTransform(C, 0, 0, C, 0, 0), u.fillStyle = "#ffffff", u.strokeStyle = "#6965db", u.lineWidth = 1;
|
|
5505
5515
|
for (const [g, P] of Object.entries(y)) {
|
|
5506
|
-
const [S, _, E] = P,
|
|
5507
|
-
u.beginPath(), g === "rotation" || g.startsWith("point-") ? u.arc(S, _,
|
|
5516
|
+
const [S, _, E] = P, V = E;
|
|
5517
|
+
u.beginPath(), g === "rotation" || g.startsWith("point-") ? u.arc(S, _, V / 2, 0, Math.PI * 2) : u.roundRect ? u.roundRect(S - V / 2, _ - V / 2, V, V, 2) : u.rect(S - V / 2, _ - V / 2, V, V), u.fill(), u.stroke();
|
|
5508
5518
|
}
|
|
5509
5519
|
if (b.value === "rotation" && y.rotation) {
|
|
5510
|
-
const [g, P, S] = y.rotation, _ = Math.round(
|
|
5520
|
+
const [g, P, S] = y.rotation, _ = Math.round(ie.value * 180 / Math.PI), E = `${_ > 0 ? "+" : ""}${_}°`, V = 8, L = 22;
|
|
5511
5521
|
u.font = "12px sans-serif";
|
|
5512
|
-
const w = u.measureText(E).width +
|
|
5522
|
+
const w = u.measureText(E).width + V * 2, F = g, K = P - S / 2 - 4 - L / 2;
|
|
5513
5523
|
u.save(), u.fillStyle = "#363B4C";
|
|
5514
5524
|
const Z = F - w / 2, pe = K - L / 2;
|
|
5515
5525
|
u.roundRect ? (u.beginPath(), u.roundRect(Z, pe, w, L, 4), u.fill()) : u.fillRect(Z, pe, w, L), u.textAlign = "center", u.textBaseline = "middle", u.fillStyle = "#ffffff", u.fillText(E, F, K), u.restore();
|
|
@@ -5533,17 +5543,17 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5533
5543
|
g.save();
|
|
5534
5544
|
const P = window.devicePixelRatio || 1;
|
|
5535
5545
|
if (g.setTransform(P, 0, 0, P, 0, 0), b.value === "rotation" && C.rotation) {
|
|
5536
|
-
const [A, w, F] = C.rotation, Q = Math.round(
|
|
5546
|
+
const [A, w, F] = C.rotation, Q = Math.round(ie.value * 180 / Math.PI), K = `${Q > 0 ? "+" : ""}${Q}°`, Z = 8, pe = 22;
|
|
5537
5547
|
g.font = "12px sans-serif";
|
|
5538
5548
|
const be = g.measureText(K).width + Z * 2, Ve = A, He = w - F / 2 - 2 - pe / 2;
|
|
5539
5549
|
g.save(), g.fillStyle = "#363B4C";
|
|
5540
|
-
const
|
|
5541
|
-
g.roundRect ? (g.beginPath(), g.roundRect(
|
|
5550
|
+
const Me = Ve - be / 2, Le = He - pe / 2;
|
|
5551
|
+
g.roundRect ? (g.beginPath(), g.roundRect(Me, Le, be, pe, 4), g.fill()) : g.fillRect(Me, Le, be, pe), g.textAlign = "center", g.textBaseline = "middle", g.fillStyle = "#ffffff", g.fillText(K, Ve, He), g.restore();
|
|
5542
5552
|
}
|
|
5543
|
-
const S = (u.x + t.scrollX) * t.zoom, _ = (u.y + t.scrollY) * t.zoom, E = u.width * t.zoom,
|
|
5553
|
+
const S = (u.x + t.scrollX) * t.zoom, _ = (u.y + t.scrollY) * t.zoom, E = u.width * t.zoom, V = u.height * t.zoom;
|
|
5544
5554
|
g.strokeStyle = "#6965db", g.lineWidth = 1, g.setLineDash([5, 5]);
|
|
5545
5555
|
const L = 4;
|
|
5546
|
-
if (g.strokeRect(S - L, _ - L, E + L * 2,
|
|
5556
|
+
if (g.strokeRect(S - L, _ - L, E + L * 2, V + L * 2), g.setLineDash([]), C) {
|
|
5547
5557
|
g.fillStyle = "#ffffff", g.strokeStyle = "#6965db", g.lineWidth = 1;
|
|
5548
5558
|
for (const [A, w] of Object.entries(C)) {
|
|
5549
5559
|
const [F, Q, K] = w, Z = K;
|
|
@@ -5557,14 +5567,14 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5557
5567
|
if (H.value) {
|
|
5558
5568
|
const x = H.value, y = e.elements.find((C) => C.id === x);
|
|
5559
5569
|
let u = !0;
|
|
5560
|
-
if (y && y.type === "frame" && (
|
|
5570
|
+
if (y && y.type === "frame" && (oe.value.x, oe.value.x > y.x + 10 && oe.value.x < y.x + y.width - 10 && oe.value.y > y.y + 10 && oe.value.y < y.y + y.height - 10 && (u = !1)), y && u && y.type !== "arrow" && y.type !== "line" && !y.locked) {
|
|
5561
5571
|
const C = n.value.getContext("2d");
|
|
5562
5572
|
if (C) {
|
|
5563
5573
|
C.save();
|
|
5564
5574
|
const g = window.devicePixelRatio || 1;
|
|
5565
5575
|
C.setTransform(g, 0, 0, g, 0, 0);
|
|
5566
|
-
const P = (y.x + t.scrollX) * t.zoom, S = (y.y + t.scrollY) * t.zoom, _ = y.width * t.zoom, E = y.height * t.zoom,
|
|
5567
|
-
C.translate(L, A), C.rotate(
|
|
5576
|
+
const P = (y.x + t.scrollX) * t.zoom, S = (y.y + t.scrollY) * t.zoom, _ = y.width * t.zoom, E = y.height * t.zoom, V = y.angle, L = P + _ / 2, A = S + E / 2;
|
|
5577
|
+
C.translate(L, A), C.rotate(V), C.translate(-L, -A), C.strokeStyle = "#1e6fff", C.lineWidth = 3;
|
|
5568
5578
|
const w = 0;
|
|
5569
5579
|
if (["ellipse", "circle"].includes(y.type))
|
|
5570
5580
|
C.beginPath(), C.ellipse(P + _ / 2, S + E / 2, _ / 2 + w, E / 2 + w, 0, 0, 2 * Math.PI), C.stroke();
|
|
@@ -5582,7 +5592,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5582
5592
|
C.beginPath(), C.moveTo(P + _ * 0.25 - w, S - w), C.lineTo(P + _ + w, S - w), C.lineTo(P + _ * 0.75 + w, S + E + w), C.lineTo(P - w, S + E + w), C.closePath(), C.stroke();
|
|
5583
5593
|
else if (y.type === "star") {
|
|
5584
5594
|
C.beginPath();
|
|
5585
|
-
const F =
|
|
5595
|
+
const F = St(_, E);
|
|
5586
5596
|
if (F && F.length > 0) {
|
|
5587
5597
|
const Q = F[0];
|
|
5588
5598
|
C.moveTo(P + Q[0], S + Q[1]);
|
|
@@ -5601,10 +5611,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5601
5611
|
}
|
|
5602
5612
|
});
|
|
5603
5613
|
};
|
|
5604
|
-
function
|
|
5614
|
+
function Ls() {
|
|
5605
5615
|
s.value && s.value.focus();
|
|
5606
5616
|
}
|
|
5607
|
-
return
|
|
5617
|
+
return Mt([
|
|
5608
5618
|
() => t.elements,
|
|
5609
5619
|
() => t.zoom,
|
|
5610
5620
|
() => t.scrollX,
|
|
@@ -5615,12 +5625,12 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5615
5625
|
() => e.appState.viewBackgroundColor,
|
|
5616
5626
|
() => e.appState.gridType,
|
|
5617
5627
|
() => e.appState.showGrid
|
|
5618
|
-
],
|
|
5628
|
+
], ze, { deep: !0 }), nn(() => {
|
|
5619
5629
|
e.loadFromLocalStorage(), e.$subscribe(() => {
|
|
5620
5630
|
e.saveToLocalStorage();
|
|
5621
5631
|
}, { detached: !0 });
|
|
5622
|
-
}),
|
|
5623
|
-
}), (p, x) => (
|
|
5632
|
+
}), Mt(() => e.elements, () => {
|
|
5633
|
+
}), (p, x) => (X(), j("div", ka, [
|
|
5624
5634
|
m("canvas", {
|
|
5625
5635
|
id: "canvas-container",
|
|
5626
5636
|
ref_key: "canvas",
|
|
@@ -5631,10 +5641,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5631
5641
|
onPointerdown: Mn,
|
|
5632
5642
|
onPointermove: En,
|
|
5633
5643
|
onPointerup: Cn,
|
|
5634
|
-
onDblclick:
|
|
5635
|
-
onContextmenu:
|
|
5636
|
-
}, null, 44,
|
|
5637
|
-
|
|
5644
|
+
onDblclick: Te,
|
|
5645
|
+
onContextmenu: Et(f, ["prevent"])
|
|
5646
|
+
}, null, 44, wa),
|
|
5647
|
+
ae(xa, {
|
|
5638
5648
|
visible: Oe.value.visible,
|
|
5639
5649
|
x: Oe.value.x,
|
|
5640
5650
|
y: Oe.value.y,
|
|
@@ -5647,9 +5657,9 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5647
5657
|
m("div", {
|
|
5648
5658
|
class: "excalidraw-textContainer",
|
|
5649
5659
|
style: Ke({ ...De.value }),
|
|
5650
|
-
onClick:
|
|
5660
|
+
onClick: Ls
|
|
5651
5661
|
}, [
|
|
5652
|
-
G.value ?
|
|
5662
|
+
G.value ? Hs((X(), j("textarea", {
|
|
5653
5663
|
key: 0,
|
|
5654
5664
|
ref_key: "textInput",
|
|
5655
5665
|
ref: s,
|
|
@@ -5665,23 +5675,23 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5665
5675
|
...Ye.value ? {} : { height: `${et.value}` }
|
|
5666
5676
|
}),
|
|
5667
5677
|
onBlur: zn,
|
|
5668
|
-
onKeydown: x[2] || (x[2] =
|
|
5678
|
+
onKeydown: x[2] || (x[2] = Et(() => {
|
|
5669
5679
|
}, ["stop"]))
|
|
5670
5680
|
}, null, 36)), [
|
|
5671
|
-
[
|
|
5672
|
-
]) :
|
|
5681
|
+
[Ws, te.value]
|
|
5682
|
+
]) : ye("", !0)
|
|
5673
5683
|
], 4)
|
|
5674
5684
|
], 512));
|
|
5675
5685
|
}
|
|
5676
|
-
}),
|
|
5686
|
+
}), Ia = /* @__PURE__ */ st(Sa, [["__scopeId", "data-v-5aa831b1"]]), Ma = { class: "color-box" }, Ea = ["onClick"], Ca = /* @__PURE__ */ Qe({
|
|
5677
5687
|
__name: "colorStyle",
|
|
5678
5688
|
props: {
|
|
5679
5689
|
modelValue: {},
|
|
5680
5690
|
modelModifiers: {}
|
|
5681
5691
|
},
|
|
5682
|
-
emits: /* @__PURE__ */
|
|
5692
|
+
emits: /* @__PURE__ */ Us(["colorChange"], ["update:modelValue"]),
|
|
5683
5693
|
setup(i, { emit: t }) {
|
|
5684
|
-
const e =
|
|
5694
|
+
const e = qs(i, "modelValue"), n = t, s = J([
|
|
5685
5695
|
"#FFFFFF",
|
|
5686
5696
|
"#1E6FFF",
|
|
5687
5697
|
"#FF194C",
|
|
@@ -5707,7 +5717,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5707
5717
|
]), a = function(o) {
|
|
5708
5718
|
e.value = o, n("colorChange", o);
|
|
5709
5719
|
};
|
|
5710
|
-
return (o, l) => (
|
|
5720
|
+
return (o, l) => (X(), j("div", Ma, [
|
|
5711
5721
|
m("div", {
|
|
5712
5722
|
class: Xe(["trans-icon", { active: e.value === "transparent" }]),
|
|
5713
5723
|
onClick: l[0] || (l[0] = (r) => a("transparent"))
|
|
@@ -5716,12 +5726,12 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5716
5726
|
m("use", { "xlink:href": "#icon-wuyanse" })
|
|
5717
5727
|
], -1)
|
|
5718
5728
|
])], 2),
|
|
5719
|
-
(
|
|
5729
|
+
(X(!0), j(We, null, ut(s.value, (r, c) => (X(), j("div", {
|
|
5720
5730
|
key: c,
|
|
5721
5731
|
class: Xe(["color-item", { active: e.value === r }]),
|
|
5722
5732
|
style: Ke({ background: r }),
|
|
5723
5733
|
onClick: (f) => a(r)
|
|
5724
|
-
}, null, 14,
|
|
5734
|
+
}, null, 14, Ea))), 128)),
|
|
5725
5735
|
l[2] || (l[2] = m("div", { class: "color-item-add" }, [
|
|
5726
5736
|
m("svg", { class: "svg-icon" }, [
|
|
5727
5737
|
m("use", { "xlink:href": "#icon-tianjiayanse" })
|
|
@@ -5729,14 +5739,14 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5729
5739
|
], -1))
|
|
5730
5740
|
]));
|
|
5731
5741
|
}
|
|
5732
|
-
}), qt = /* @__PURE__ */ st(
|
|
5742
|
+
}), qt = /* @__PURE__ */ st(Ca, [["__scopeId", "data-v-9b04b94a"]]), Ta = { class: "menu-list" }, Pa = { class: "preferences-list" }, Ba = { class: "preferences-list grid-list" }, za = ["onClick"], $a = { class: "svg-icon" }, _a = ["xlink:href"], Aa = {
|
|
5733
5743
|
class: "preferences-list",
|
|
5734
5744
|
style: { padding: "12px", display: "flex", "justify-content": "center" }
|
|
5735
|
-
},
|
|
5745
|
+
}, Da = { class: "preference-item" }, Fa = { class: "preference-info" }, Oa = { class: "preference-title" }, La = { class: "preference-item" }, Ra = { class: "preference-info" }, Xa = { class: "preference-title" }, Ya = {
|
|
5736
5746
|
key: 1,
|
|
5737
5747
|
class: "board-name-input",
|
|
5738
5748
|
style: { width: "195px", padding: "1px 23px 5px" }
|
|
5739
|
-
},
|
|
5749
|
+
}, Va = /* @__PURE__ */ Qe({
|
|
5740
5750
|
__name: "BoardName",
|
|
5741
5751
|
setup(i) {
|
|
5742
5752
|
const t = ot(), e = J(!1), n = J(), s = J("");
|
|
@@ -5770,7 +5780,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5770
5780
|
});
|
|
5771
5781
|
nn(() => {
|
|
5772
5782
|
s.value = t.appState.name + "";
|
|
5773
|
-
}),
|
|
5783
|
+
}), Mt(() => t.appState.name, (v) => {
|
|
5774
5784
|
s.value = v + "";
|
|
5775
5785
|
});
|
|
5776
5786
|
const c = () => {
|
|
@@ -5789,11 +5799,11 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5789
5799
|
}
|
|
5790
5800
|
return (v, h) => {
|
|
5791
5801
|
const M = it("el-popover"), I = it("el-switch"), T = it("el-input");
|
|
5792
|
-
return
|
|
5802
|
+
return X(), j("div", {
|
|
5793
5803
|
class: "board-name-container",
|
|
5794
5804
|
style: Ke({ pointerEvents: a.value ? "none" : "auto" })
|
|
5795
5805
|
}, [
|
|
5796
|
-
|
|
5806
|
+
ae(M, {
|
|
5797
5807
|
placement: "bottom-start",
|
|
5798
5808
|
ref_key: "firstPopoverRef",
|
|
5799
5809
|
ref: o,
|
|
@@ -5811,8 +5821,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5811
5821
|
], -1)
|
|
5812
5822
|
])]),
|
|
5813
5823
|
default: Ae(() => [
|
|
5814
|
-
m("div",
|
|
5815
|
-
|
|
5824
|
+
m("div", Ta, [
|
|
5825
|
+
ae(M, {
|
|
5816
5826
|
placement: "right-start",
|
|
5817
5827
|
trigger: "click",
|
|
5818
5828
|
width: 320,
|
|
@@ -5843,8 +5853,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5843
5853
|
], -1)
|
|
5844
5854
|
])]),
|
|
5845
5855
|
default: Ae(() => [
|
|
5846
|
-
m("div",
|
|
5847
|
-
|
|
5856
|
+
m("div", Pa, [
|
|
5857
|
+
ae(M, {
|
|
5848
5858
|
placement: "right-start",
|
|
5849
5859
|
trigger: "click",
|
|
5850
5860
|
width: 176,
|
|
@@ -5875,24 +5885,24 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5875
5885
|
], -1)
|
|
5876
5886
|
])]),
|
|
5877
5887
|
default: Ae(() => [
|
|
5878
|
-
m("div",
|
|
5879
|
-
(
|
|
5888
|
+
m("div", Ba, [
|
|
5889
|
+
(X(!0), j(We, null, ut(l.value, (b, B) => (X(), j("div", {
|
|
5880
5890
|
key: B,
|
|
5881
5891
|
class: Xe(["grid-item", { active: b.value === r.value }]),
|
|
5882
|
-
onClick: (
|
|
5892
|
+
onClick: (Y) => d(b)
|
|
5883
5893
|
}, [
|
|
5884
|
-
(
|
|
5894
|
+
(X(), j("svg", $a, [
|
|
5885
5895
|
m("use", {
|
|
5886
5896
|
"xlink:href": `#${b.value === r.value ? b.activeIcon : b.icon}`
|
|
5887
|
-
}, null, 8,
|
|
5897
|
+
}, null, 8, _a)
|
|
5888
5898
|
])),
|
|
5889
5899
|
m("div", null, nt(b.label), 1)
|
|
5890
|
-
], 10,
|
|
5900
|
+
], 10, za))), 128))
|
|
5891
5901
|
])
|
|
5892
5902
|
]),
|
|
5893
5903
|
_: 1
|
|
5894
5904
|
}),
|
|
5895
|
-
|
|
5905
|
+
ae(M, {
|
|
5896
5906
|
placement: "right-start",
|
|
5897
5907
|
trigger: "click",
|
|
5898
5908
|
width: 260,
|
|
@@ -5923,37 +5933,37 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5923
5933
|
], -1)
|
|
5924
5934
|
])]),
|
|
5925
5935
|
default: Ae(() => [
|
|
5926
|
-
m("div",
|
|
5936
|
+
m("div", Aa, [
|
|
5927
5937
|
h[8] || (h[8] = m("div", { class: "title" }, "背景颜色", -1)),
|
|
5928
|
-
|
|
5929
|
-
modelValue:
|
|
5930
|
-
"onUpdate:modelValue": h[0] || (h[0] = (b) =>
|
|
5938
|
+
ae(qt, {
|
|
5939
|
+
modelValue: Se(t).appState.viewBackgroundColor,
|
|
5940
|
+
"onUpdate:modelValue": h[0] || (h[0] = (b) => Se(t).appState.viewBackgroundColor = b)
|
|
5931
5941
|
}, null, 8, ["modelValue"])
|
|
5932
5942
|
])
|
|
5933
5943
|
]),
|
|
5934
5944
|
_: 1
|
|
5935
5945
|
}),
|
|
5936
5946
|
h[13] || (h[13] = m("div", { class: "line" }, null, -1)),
|
|
5937
|
-
m("div",
|
|
5938
|
-
m("div",
|
|
5939
|
-
m("div",
|
|
5947
|
+
m("div", Da, [
|
|
5948
|
+
m("div", Fa, [
|
|
5949
|
+
m("div", Oa, [
|
|
5940
5950
|
h[9] || (h[9] = m("div", null, "使用滚轮缩放画布", -1)),
|
|
5941
|
-
|
|
5942
|
-
modelValue:
|
|
5943
|
-
"onUpdate:modelValue": h[1] || (h[1] = (b) =>
|
|
5951
|
+
ae(I, {
|
|
5952
|
+
modelValue: Se(t).appState.useWheelZoom,
|
|
5953
|
+
"onUpdate:modelValue": h[1] || (h[1] = (b) => Se(t).appState.useWheelZoom = b),
|
|
5944
5954
|
size: "small"
|
|
5945
5955
|
}, null, 8, ["modelValue"])
|
|
5946
5956
|
]),
|
|
5947
5957
|
h[10] || (h[10] = m("div", { class: "preference-desc" }, "开启后,可通过鼠标滚轮进行缩放画布", -1))
|
|
5948
5958
|
])
|
|
5949
5959
|
]),
|
|
5950
|
-
m("div",
|
|
5951
|
-
m("div",
|
|
5952
|
-
m("div",
|
|
5960
|
+
m("div", La, [
|
|
5961
|
+
m("div", Ra, [
|
|
5962
|
+
m("div", Xa, [
|
|
5953
5963
|
h[11] || (h[11] = m("div", null, " 右键拖拽平移画布 ", -1)),
|
|
5954
|
-
|
|
5955
|
-
modelValue:
|
|
5956
|
-
"onUpdate:modelValue": h[2] || (h[2] = (b) =>
|
|
5964
|
+
ae(I, {
|
|
5965
|
+
modelValue: Se(t).appState.rightClickPan,
|
|
5966
|
+
"onUpdate:modelValue": h[2] || (h[2] = (b) => Se(t).appState.rightClickPan = b),
|
|
5957
5967
|
size: "small"
|
|
5958
5968
|
}, null, 8, ["modelValue"])
|
|
5959
5969
|
]),
|
|
@@ -5982,7 +5992,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5982
5992
|
]),
|
|
5983
5993
|
_: 1
|
|
5984
5994
|
}, 512),
|
|
5985
|
-
e.value ? (
|
|
5995
|
+
e.value ? (X(), wt(T, {
|
|
5986
5996
|
key: 0,
|
|
5987
5997
|
ref_key: "inputRef",
|
|
5988
5998
|
ref: n,
|
|
@@ -5991,8 +6001,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
5991
6001
|
class: "board-name-input",
|
|
5992
6002
|
placeholder: "Untitled Document",
|
|
5993
6003
|
onBlur: f
|
|
5994
|
-
}, null, 8, ["modelValue"])) : (
|
|
5995
|
-
e.value ?
|
|
6004
|
+
}, null, 8, ["modelValue"])) : (X(), j("div", Ya, nt(s.value), 1)),
|
|
6005
|
+
e.value ? ye("", !0) : (X(), j("div", {
|
|
5996
6006
|
key: 2,
|
|
5997
6007
|
class: "action-item",
|
|
5998
6008
|
onClick: c
|
|
@@ -6004,11 +6014,11 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6004
6014
|
], 4);
|
|
6005
6015
|
};
|
|
6006
6016
|
}
|
|
6007
|
-
}),
|
|
6017
|
+
}), ja = /* @__PURE__ */ st(Va, [["__scopeId", "data-v-59262e76"]]), Ha = { class: "history-controls glass" }, Wa = { class: "svg-icon" }, Ua = ["xlink:href"], qa = { class: "svg-icon" }, Ga = ["xlink:href"], Na = { class: "zoom-controls glass" }, Ka = /* @__PURE__ */ Qe({
|
|
6008
6018
|
__name: "Footer",
|
|
6009
6019
|
setup(i) {
|
|
6010
6020
|
const t = ot(), e = () => {
|
|
6011
|
-
|
|
6021
|
+
Ks.confirm(
|
|
6012
6022
|
"确定要清空画布吗?",
|
|
6013
6023
|
"提示",
|
|
6014
6024
|
{
|
|
@@ -6028,38 +6038,38 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6028
6038
|
function o() {
|
|
6029
6039
|
t.appState.activeTool === "hand" ? t.setTool("selection") : t.setTool("hand");
|
|
6030
6040
|
}
|
|
6031
|
-
return (l, r) => (
|
|
6041
|
+
return (l, r) => (X(), j("div", {
|
|
6032
6042
|
class: "footer-controls footer",
|
|
6033
6043
|
style: Ke({
|
|
6034
|
-
right:
|
|
6044
|
+
right: Se(t).appState.isPropertiesPanelOpen ? "345px" : "24px",
|
|
6035
6045
|
pointerEvents: n.value ? "none" : "auto"
|
|
6036
6046
|
})
|
|
6037
6047
|
}, [
|
|
6038
|
-
m("div",
|
|
6048
|
+
m("div", Ha, [
|
|
6039
6049
|
m("div", {
|
|
6040
6050
|
onClick: s,
|
|
6041
|
-
class: Xe(["tool-item", { disabled:
|
|
6051
|
+
class: Xe(["tool-item", { disabled: Se(t).historyStep <= 0 }])
|
|
6042
6052
|
}, [
|
|
6043
|
-
(
|
|
6053
|
+
(X(), j("svg", Wa, [
|
|
6044
6054
|
m("use", {
|
|
6045
|
-
"xlink:href": `${
|
|
6046
|
-
}, null, 8,
|
|
6055
|
+
"xlink:href": `${Se(t).historyStep <= 0 ? "#icon-chexiao-copy" : "#icon-chexiao"}`
|
|
6056
|
+
}, null, 8, Ua)
|
|
6047
6057
|
]))
|
|
6048
6058
|
], 2),
|
|
6049
6059
|
m("div", {
|
|
6050
6060
|
onClick: a,
|
|
6051
|
-
class: Xe(["tool-item", { disabled:
|
|
6061
|
+
class: Xe(["tool-item", { disabled: Se(t).historyStep >= Se(t).history.length - 1 }])
|
|
6052
6062
|
}, [
|
|
6053
|
-
(
|
|
6063
|
+
(X(), j("svg", qa, [
|
|
6054
6064
|
m("use", {
|
|
6055
|
-
"xlink:href": `${
|
|
6056
|
-
}, null, 8,
|
|
6065
|
+
"xlink:href": `${Se(t).historyStep >= Se(t).history.length - 1 ? "#icon-huifu-copy" : "#icon-huifu"}`
|
|
6066
|
+
}, null, 8, Ga)
|
|
6057
6067
|
]))
|
|
6058
6068
|
], 2)
|
|
6059
6069
|
]),
|
|
6060
|
-
m("div",
|
|
6070
|
+
m("div", Na, [
|
|
6061
6071
|
m("div", {
|
|
6062
|
-
class: Xe(["tool-item", { active:
|
|
6072
|
+
class: Xe(["tool-item", { active: Se(t).appState.activeTool === "hand" }]),
|
|
6063
6073
|
onClick: r[0] || (r[0] = (c) => o())
|
|
6064
6074
|
}, [...r[5] || (r[5] = [
|
|
6065
6075
|
m("svg", { class: "svg-icon" }, [
|
|
@@ -6068,7 +6078,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6068
6078
|
])], 2),
|
|
6069
6079
|
r[10] || (r[10] = m("div", { class: "separator" }, null, -1)),
|
|
6070
6080
|
m("div", {
|
|
6071
|
-
onClick: r[1] || (r[1] = (c) =>
|
|
6081
|
+
onClick: r[1] || (r[1] = (c) => Se(t).zoomOut()),
|
|
6072
6082
|
class: "tool-item"
|
|
6073
6083
|
}, [...r[6] || (r[6] = [
|
|
6074
6084
|
m("svg", { class: "svg-icon" }, [
|
|
@@ -6076,12 +6086,12 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6076
6086
|
], -1)
|
|
6077
6087
|
])]),
|
|
6078
6088
|
m("span", {
|
|
6079
|
-
onClick: r[2] || (r[2] = (c) =>
|
|
6089
|
+
onClick: r[2] || (r[2] = (c) => Se(t).setZoom(1)),
|
|
6080
6090
|
title: "Reset Zoom",
|
|
6081
6091
|
style: { cursor: "pointer" }
|
|
6082
|
-
}, nt(Math.round(
|
|
6092
|
+
}, nt(Math.round(Se(t).appState.zoom * 100)) + "%", 1),
|
|
6083
6093
|
m("div", {
|
|
6084
|
-
onClick: r[3] || (r[3] = (c) =>
|
|
6094
|
+
onClick: r[3] || (r[3] = (c) => Se(t).zoomIn()),
|
|
6085
6095
|
class: "tool-item"
|
|
6086
6096
|
}, [...r[7] || (r[7] = [
|
|
6087
6097
|
m("svg", { class: "svg-icon" }, [
|
|
@@ -6090,8 +6100,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6090
6100
|
])]),
|
|
6091
6101
|
r[11] || (r[11] = m("div", { class: "separator" }, null, -1)),
|
|
6092
6102
|
m("div", {
|
|
6093
|
-
class: Xe(["tool-item", { active:
|
|
6094
|
-
onClick: r[4] || (r[4] = (c) =>
|
|
6103
|
+
class: Xe(["tool-item", { active: Se(t).appState.viewLocked }]),
|
|
6104
|
+
onClick: r[4] || (r[4] = (c) => Se(t).toggleViewLock())
|
|
6095
6105
|
}, [...r[8] || (r[8] = [
|
|
6096
6106
|
m("svg", { class: "svg-icon" }, [
|
|
6097
6107
|
m("use", { "xlink:href": "#icon-suoding" })
|
|
@@ -6108,17 +6118,17 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6108
6118
|
])
|
|
6109
6119
|
], 4));
|
|
6110
6120
|
}
|
|
6111
|
-
}),
|
|
6121
|
+
}), Ja = /* @__PURE__ */ st(Ka, [["__scopeId", "data-v-06dd6954"]]), Za = /* @__PURE__ */ Qe({
|
|
6112
6122
|
__name: "HelpDialog",
|
|
6113
6123
|
setup(i) {
|
|
6114
6124
|
const t = ot(), e = () => {
|
|
6115
6125
|
t.appState.showHelp = !1;
|
|
6116
6126
|
};
|
|
6117
|
-
return (n, s) =>
|
|
6127
|
+
return (n, s) => Se(t).appState.showHelp ? (X(), j("div", {
|
|
6118
6128
|
key: 0,
|
|
6119
6129
|
class: "modal-overlay",
|
|
6120
|
-
onClick:
|
|
6121
|
-
style: Ke({ pointerEvents:
|
|
6130
|
+
onClick: Et(e, ["self"]),
|
|
6131
|
+
style: Ke({ pointerEvents: Se(t).appState.isDraggingElement ? "none" : "auto" })
|
|
6122
6132
|
}, [
|
|
6123
6133
|
m("div", { class: "help-dialog glass" }, [
|
|
6124
6134
|
m("div", { class: "header" }, [
|
|
@@ -6130,44 +6140,44 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6130
6140
|
m("i", { class: "ri-close-line" }, null, -1)
|
|
6131
6141
|
])])
|
|
6132
6142
|
]),
|
|
6133
|
-
s[2] || (s[2] =
|
|
6143
|
+
s[2] || (s[2] = Gs('<div class="content" data-v-0caac542><div class="column" data-v-0caac542><h3 data-v-0caac542>工具</h3><div class="shortcut-list" data-v-0caac542><div class="item" data-v-0caac542><span data-v-0caac542>抓手 (平移工具)</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>H</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>选择</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>V</kbd> 或 <kbd data-v-0caac542>1</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>图形</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>R</kbd> 或 <kbd data-v-0caac542>2</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>箭头</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>A</kbd> 或 <kbd data-v-0caac542>5</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>线条</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>L</kbd> 或 <kbd data-v-0caac542>6</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>自由书写</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>P</kbd> 或 <kbd data-v-0caac542>7</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>文字</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>T</kbd> 或 <kbd data-v-0caac542>8</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>橡皮</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>E</kbd> 或 <kbd data-v-0caac542>0</kbd></span></div></div><h3 data-v-0caac542>视图</h3><div class="shortcut-list" data-v-0caac542><div class="item" data-v-0caac542><span data-v-0caac542>放大</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>+</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>缩小</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>-</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>重置缩放</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>0</kbd></span></div></div></div><div class="column" data-v-0caac542><h3 data-v-0caac542>编辑器</h3><div class="shortcut-list" data-v-0caac542><div class="item" data-v-0caac542><span data-v-0caac542>全选</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>A</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>删除</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Delete</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>复制</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>C</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>粘贴</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>V</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>剪切</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>X</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>撤销</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>Z</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>重做</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>Shift</kbd><kbd data-v-0caac542>Z</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>组合</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>G</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>取消组合</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Cmd</kbd><kbd data-v-0caac542>Shift</kbd><kbd data-v-0caac542>G</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>置于顶层</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>]</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>置于底层</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>[</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>上移一层</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Option</kbd><kbd data-v-0caac542>]</kbd></span></div><div class="item" data-v-0caac542><span data-v-0caac542>下移一层</span><span class="keys" data-v-0caac542><kbd data-v-0caac542>Option</kbd><kbd data-v-0caac542>[</kbd></span></div></div></div></div>', 1))
|
|
6134
6144
|
])
|
|
6135
|
-
], 4)) :
|
|
6145
|
+
], 4)) : ye("", !0);
|
|
6136
6146
|
}
|
|
6137
|
-
}),
|
|
6147
|
+
}), Qa = /* @__PURE__ */ st(Za, [["__scopeId", "data-v-0caac542"]]), el = { class: "popovers-container" }, tl = { class: "popover-content" }, nl = { class: "sub-tools-container" }, sl = ["onClick"], il = { class: "svg-icon" }, ol = ["xlink:href"], al = {
|
|
6138
6148
|
key: 1,
|
|
6139
6149
|
class: "divider"
|
|
6140
|
-
},
|
|
6150
|
+
}, ll = {
|
|
6141
6151
|
class: "settings-btn",
|
|
6142
6152
|
title: "背景颜色"
|
|
6143
|
-
},
|
|
6153
|
+
}, rl = {
|
|
6144
6154
|
key: 0,
|
|
6145
6155
|
class: "svg-icon"
|
|
6146
|
-
},
|
|
6156
|
+
}, cl = { class: "popover-content" }, dl = ["title"], ul = {
|
|
6147
6157
|
key: 0,
|
|
6148
6158
|
class: "svg-icon"
|
|
6149
|
-
},
|
|
6159
|
+
}, hl = {
|
|
6150
6160
|
key: 1,
|
|
6151
6161
|
class: "svg-icon"
|
|
6152
|
-
},
|
|
6162
|
+
}, pl = ["xlink:href"], fl = { class: "popover-content" }, gl = { class: "title" }, vl = { class: "title" }, ml = { class: "title" }, yl = { class: "title" }, xl = {
|
|
6153
6163
|
key: 4,
|
|
6154
6164
|
class: "divider"
|
|
6155
|
-
},
|
|
6165
|
+
}, kl = {
|
|
6156
6166
|
class: "settings-btn",
|
|
6157
6167
|
title: "箭头颜色"
|
|
6158
|
-
},
|
|
6168
|
+
}, wl = {
|
|
6159
6169
|
key: 0,
|
|
6160
6170
|
class: "svg-icon"
|
|
6161
|
-
},
|
|
6171
|
+
}, bl = { class: "popover-content" }, Sl = { class: "popover-content" }, Il = {
|
|
6162
6172
|
key: 7,
|
|
6163
6173
|
class: "divider"
|
|
6164
|
-
},
|
|
6174
|
+
}, Ml = {
|
|
6165
6175
|
class: "settings-btn",
|
|
6166
6176
|
title: "文本颜色"
|
|
6167
|
-
},
|
|
6177
|
+
}, El = ["fill"], Cl = ["fill"], Tl = ["fill"], Pl = { class: "popover-content" }, Bl = {
|
|
6168
6178
|
key: 9,
|
|
6169
6179
|
class: "font-size-select"
|
|
6170
|
-
},
|
|
6180
|
+
}, zl = /* @__PURE__ */ Qe({
|
|
6171
6181
|
__name: "FloatingPopovers",
|
|
6172
6182
|
setup(i) {
|
|
6173
6183
|
const t = ot(), e = J(!1), n = J(!1), s = J(!1), a = J(!1), o = J(!1), l = J(!1), r = J(!1), c = J(null), f = J([
|
|
@@ -6214,7 +6224,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6214
6224
|
}), B = U(() => {
|
|
6215
6225
|
const O = I();
|
|
6216
6226
|
return ["rectangle", "ellipse", "diamond", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram", "arrow", "line", "freedraw", "frame"].includes(O);
|
|
6217
|
-
}),
|
|
6227
|
+
}), Y = U(() => {
|
|
6218
6228
|
const O = I();
|
|
6219
6229
|
return ["rectangle", "ellipse", "diamond", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram", "arrow", "line"].includes(O);
|
|
6220
6230
|
}), q = U(() => {
|
|
@@ -6226,7 +6236,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6226
6236
|
}), le = U(() => {
|
|
6227
6237
|
const O = I();
|
|
6228
6238
|
return ["arrow", "line"].includes(O);
|
|
6229
|
-
}),
|
|
6239
|
+
}), ie = U(() => {
|
|
6230
6240
|
const O = d();
|
|
6231
6241
|
return O ? O.arrowType : t.appState.currentItemArrowType;
|
|
6232
6242
|
}), ee = U(
|
|
@@ -6236,7 +6246,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6236
6246
|
return O ? O.strokeColor : t.appState.currentItemStrokeColor;
|
|
6237
6247
|
},
|
|
6238
6248
|
set(O) {
|
|
6239
|
-
|
|
6249
|
+
Be(O);
|
|
6240
6250
|
}
|
|
6241
6251
|
}
|
|
6242
6252
|
), G = U({
|
|
@@ -6277,7 +6287,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6277
6287
|
return O ? O.strokeOpacity ?? 100 : t.appState.currentItemStrokeOpacity ?? 100;
|
|
6278
6288
|
},
|
|
6279
6289
|
set(O) {
|
|
6280
|
-
|
|
6290
|
+
oe(O);
|
|
6281
6291
|
}
|
|
6282
6292
|
}), te = U({
|
|
6283
6293
|
get() {
|
|
@@ -6295,7 +6305,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6295
6305
|
const O = d();
|
|
6296
6306
|
return O ? O.roughness : t.appState.currentItemRoughness ?? 0;
|
|
6297
6307
|
});
|
|
6298
|
-
const
|
|
6308
|
+
const xe = U({
|
|
6299
6309
|
get() {
|
|
6300
6310
|
const O = d();
|
|
6301
6311
|
return O ? O.roundness ?? 0 : t.appState.currentItemRoundness;
|
|
@@ -6303,7 +6313,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6303
6313
|
set(O) {
|
|
6304
6314
|
et(O);
|
|
6305
6315
|
}
|
|
6306
|
-
}),
|
|
6316
|
+
}), we = U({
|
|
6307
6317
|
get: () => {
|
|
6308
6318
|
const O = d();
|
|
6309
6319
|
return O && "fontSize" in O ? O.fontSize : t.appState.currentItemFontSize;
|
|
@@ -6322,7 +6332,7 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6322
6332
|
const O = d();
|
|
6323
6333
|
return O && "verticalAlign" in O ? O.verticalAlign : t.appState.currentItemVerticalAlign;
|
|
6324
6334
|
});
|
|
6325
|
-
const
|
|
6335
|
+
const Ce = [12, 14, 16, 18, 20, 24, 28, 32, 36], Be = (O) => {
|
|
6326
6336
|
t.updateSelectedElements({ strokeColor: O });
|
|
6327
6337
|
}, Fe = (O) => {
|
|
6328
6338
|
const W = O;
|
|
@@ -6332,48 +6342,48 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6332
6342
|
t.updateSelectedElements({ backgroundColor: W });
|
|
6333
6343
|
}, Ue = (O) => {
|
|
6334
6344
|
t.updateSelectedElements({ strokeWidth: O });
|
|
6335
|
-
},
|
|
6345
|
+
}, oe = (O) => {
|
|
6336
6346
|
t.updateSelectedElements({ strokeOpacity: O });
|
|
6337
6347
|
}, et = (O) => {
|
|
6338
6348
|
t.updateSelectedElements({ roundness: O });
|
|
6339
6349
|
}, ht = (O) => {
|
|
6340
6350
|
Object.keys(t.appState.selectedElementIds).forEach(($e) => {
|
|
6341
|
-
const De = t.elements.find((
|
|
6351
|
+
const De = t.elements.find((ke) => ke.id === $e);
|
|
6342
6352
|
if (De && De.type === "text") {
|
|
6343
|
-
const
|
|
6344
|
-
if (
|
|
6345
|
-
const Ye = Ne(
|
|
6353
|
+
const ke = De;
|
|
6354
|
+
if (ke.autoResize) {
|
|
6355
|
+
const Ye = Ne(ke.text || "", O, ke.fontFamily || "sans-serif", void 0, { isBold: ke.isBold, isItalic: ke.isItalic });
|
|
6346
6356
|
t.updateElement($e, { fontSize: O, width: Ye.width, height: Ye.height });
|
|
6347
6357
|
} else {
|
|
6348
|
-
const Ye = Ne(
|
|
6358
|
+
const Ye = Ne(ke.text || "", O, ke.fontFamily || "sans-serif", De.width, { isBold: ke.isBold, isItalic: ke.isItalic });
|
|
6349
6359
|
t.updateElement($e, { fontSize: O, height: Ye.height });
|
|
6350
6360
|
}
|
|
6351
6361
|
} else {
|
|
6352
6362
|
t.updateElement($e, { fontSize: O });
|
|
6353
|
-
const
|
|
6354
|
-
if (
|
|
6355
|
-
const Ye = Ne(
|
|
6356
|
-
t.updateElement(
|
|
6363
|
+
const ke = t.elements.find((Ye) => Ye.type === "text" && Ye.containerId === $e && !Ye.isDeleted);
|
|
6364
|
+
if (ke) {
|
|
6365
|
+
const Ye = Ne(ke.text || "", O, ke.fontFamily || "sans-serif", ke.width);
|
|
6366
|
+
t.updateElement(ke.id, { fontSize: O, height: Math.max(Ye.height, De?.height) });
|
|
6357
6367
|
}
|
|
6358
6368
|
}
|
|
6359
6369
|
});
|
|
6360
6370
|
}, at = (O) => {
|
|
6361
6371
|
t.updateSelectedElements({ fontColor: O }), Object.keys(t.appState.selectedElementIds).forEach(($e) => {
|
|
6362
|
-
const De = t.elements.find((
|
|
6372
|
+
const De = t.elements.find((ke) => ke.type === "text" && ke.containerId === $e && !ke.isDeleted);
|
|
6363
6373
|
De && t.updateElement(De.id, { fontColor: O });
|
|
6364
6374
|
});
|
|
6365
6375
|
}, Oe = (O) => {
|
|
6366
6376
|
t.updateSelectedElements({ fontBgColor: O }), Object.keys(t.appState.selectedElementIds).forEach(($e) => {
|
|
6367
|
-
const De = t.elements.find((
|
|
6377
|
+
const De = t.elements.find((ke) => ke.type === "text" && ke.containerId === $e && !ke.isDeleted);
|
|
6368
6378
|
De && t.updateElement(De.id, { fontBgColor: O });
|
|
6369
6379
|
});
|
|
6370
6380
|
}, tt = (O) => {
|
|
6371
6381
|
t.updateSelectedElements({ type: O });
|
|
6372
6382
|
};
|
|
6373
6383
|
return (O, W) => {
|
|
6374
|
-
const $e = it("el-popover"), De = it("el-slider"),
|
|
6375
|
-
return
|
|
6376
|
-
T.value ? (
|
|
6384
|
+
const $e = it("el-popover"), De = it("el-slider"), ke = it("el-option"), Ye = it("el-select");
|
|
6385
|
+
return X(), j("div", el, [
|
|
6386
|
+
T.value ? (X(), wt($e, {
|
|
6377
6387
|
key: 0,
|
|
6378
6388
|
placement: "top",
|
|
6379
6389
|
width: 224,
|
|
@@ -6394,26 +6404,26 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6394
6404
|
], -1)
|
|
6395
6405
|
])]),
|
|
6396
6406
|
default: Ae(() => [
|
|
6397
|
-
m("div",
|
|
6398
|
-
m("div",
|
|
6399
|
-
(
|
|
6407
|
+
m("div", tl, [
|
|
6408
|
+
m("div", nl, [
|
|
6409
|
+
(X(!0), j(We, null, ut(f.value, (de) => (X(), j("div", {
|
|
6400
6410
|
key: de.name,
|
|
6401
6411
|
class: Xe(["sub-tool-item", { active: I() === de.name }]),
|
|
6402
6412
|
onClick: (on) => tt(de.name)
|
|
6403
6413
|
}, [
|
|
6404
|
-
(
|
|
6414
|
+
(X(), j("svg", il, [
|
|
6405
6415
|
m("use", {
|
|
6406
6416
|
"xlink:href": `${de.icon}`
|
|
6407
|
-
}, null, 8,
|
|
6417
|
+
}, null, 8, ol)
|
|
6408
6418
|
]))
|
|
6409
|
-
], 10,
|
|
6419
|
+
], 10, sl))), 128))
|
|
6410
6420
|
])
|
|
6411
6421
|
])
|
|
6412
6422
|
]),
|
|
6413
6423
|
_: 1
|
|
6414
|
-
}, 8, ["visible"])) :
|
|
6415
|
-
T.value ? (
|
|
6416
|
-
b.value ? (
|
|
6424
|
+
}, 8, ["visible"])) : ye("", !0),
|
|
6425
|
+
T.value ? (X(), j("div", al)) : ye("", !0),
|
|
6426
|
+
b.value ? (X(), wt($e, {
|
|
6417
6427
|
key: 2,
|
|
6418
6428
|
placement: "top",
|
|
6419
6429
|
width: 248,
|
|
@@ -6424,10 +6434,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6424
6434
|
"onUpdate:visible": W[3] || (W[3] = (de) => e.value = de)
|
|
6425
6435
|
}, {
|
|
6426
6436
|
reference: Ae(() => [
|
|
6427
|
-
m("div",
|
|
6428
|
-
G.value == "transparent" || !G.value ? (
|
|
6437
|
+
m("div", ll, [
|
|
6438
|
+
G.value == "transparent" || !G.value ? (X(), j("svg", rl, [...W[16] || (W[16] = [
|
|
6429
6439
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
6430
|
-
])])) : (
|
|
6440
|
+
])])) : (X(), j("div", {
|
|
6431
6441
|
key: 1,
|
|
6432
6442
|
class: "color-box",
|
|
6433
6443
|
style: Ke({ background: G.value })
|
|
@@ -6435,11 +6445,11 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6435
6445
|
])
|
|
6436
6446
|
]),
|
|
6437
6447
|
default: Ae(() => [
|
|
6438
|
-
m("div",
|
|
6448
|
+
m("div", cl, [
|
|
6439
6449
|
W[17] || (W[17] = m("div", { class: "title" }, "填充样式", -1)),
|
|
6440
|
-
|
|
6450
|
+
ae(Es),
|
|
6441
6451
|
W[18] || (W[18] = m("div", { class: "title" }, "透明度", -1)),
|
|
6442
|
-
|
|
6452
|
+
ae(De, {
|
|
6443
6453
|
modelValue: D.value,
|
|
6444
6454
|
"onUpdate:modelValue": W[1] || (W[1] = (de) => D.value = de),
|
|
6445
6455
|
"show-input": "",
|
|
@@ -6448,15 +6458,15 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6448
6458
|
W[19] || (W[19] = m("div", { class: "title" }, [
|
|
6449
6459
|
m("span", null, "默认颜色")
|
|
6450
6460
|
], -1)),
|
|
6451
|
-
|
|
6461
|
+
ae(qt, {
|
|
6452
6462
|
modelValue: G.value,
|
|
6453
6463
|
"onUpdate:modelValue": W[2] || (W[2] = (de) => G.value = de)
|
|
6454
6464
|
}, null, 8, ["modelValue"])
|
|
6455
6465
|
])
|
|
6456
6466
|
]),
|
|
6457
6467
|
_: 1
|
|
6458
|
-
}, 8, ["visible"])) :
|
|
6459
|
-
B.value ? (
|
|
6468
|
+
}, 8, ["visible"])) : ye("", !0),
|
|
6469
|
+
B.value ? (X(), wt($e, {
|
|
6460
6470
|
key: 3,
|
|
6461
6471
|
placement: "top",
|
|
6462
6472
|
width: 248,
|
|
@@ -6471,31 +6481,31 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6471
6481
|
class: "settings-btn",
|
|
6472
6482
|
title: I() == "arrow" ? "箭头" : "边框"
|
|
6473
6483
|
}, [
|
|
6474
|
-
I() !== "arrow" && I() !== "line" ? (
|
|
6475
|
-
ee.value == "transparent" || !ee.value ? (
|
|
6484
|
+
I() !== "arrow" && I() !== "line" ? (X(), j(We, { key: 0 }, [
|
|
6485
|
+
ee.value == "transparent" || !ee.value ? (X(), j("svg", ul, [...W[20] || (W[20] = [
|
|
6476
6486
|
m("use", { "xlink:href": "#icon-wubiankuang" }, null, -1)
|
|
6477
|
-
])])) : (
|
|
6487
|
+
])])) : (X(), j("div", {
|
|
6478
6488
|
key: 1,
|
|
6479
6489
|
class: "border-box",
|
|
6480
6490
|
style: Ke({ borderColor: ee.value })
|
|
6481
6491
|
}, null, 4))
|
|
6482
|
-
], 64)) : (
|
|
6492
|
+
], 64)) : (X(), j("svg", hl, [
|
|
6483
6493
|
m("use", {
|
|
6484
|
-
"xlink:href": `#${I() == "line" ? "icon-zhixian" :
|
|
6485
|
-
}, null, 8,
|
|
6494
|
+
"xlink:href": `#${I() == "line" ? "icon-zhixian" : ie.value == "sharp" ? "icon-zhixianlianjiexian" : "icon-quxian"}`
|
|
6495
|
+
}, null, 8, pl)
|
|
6486
6496
|
]))
|
|
6487
|
-
], 8,
|
|
6497
|
+
], 8, dl)
|
|
6488
6498
|
]),
|
|
6489
6499
|
default: Ae(() => [
|
|
6490
|
-
m("div",
|
|
6491
|
-
|
|
6492
|
-
m("div",
|
|
6493
|
-
|
|
6494
|
-
], 64)) :
|
|
6500
|
+
m("div", fl, [
|
|
6501
|
+
Y.value ? (X(), j(We, { key: 0 }, [
|
|
6502
|
+
m("div", gl, nt(["arrow", "line"].includes(I()) ? "线条" : "描边") + "样式", 1),
|
|
6503
|
+
ae(Cs)
|
|
6504
|
+
], 64)) : ye("", !0),
|
|
6495
6505
|
W[22] || (W[22] = m("div", { class: "title" }, "线条风格", -1)),
|
|
6496
|
-
|
|
6497
|
-
m("div",
|
|
6498
|
-
|
|
6506
|
+
ae(Ts),
|
|
6507
|
+
m("div", vl, nt(["arrow", "line"].includes(I()) ? "线条" : "描边") + "粗细", 1),
|
|
6508
|
+
ae(De, {
|
|
6499
6509
|
modelValue: te.value,
|
|
6500
6510
|
"onUpdate:modelValue": W[4] || (W[4] = (de) => te.value = de),
|
|
6501
6511
|
"show-input": "",
|
|
@@ -6503,32 +6513,32 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6503
6513
|
min: 1,
|
|
6504
6514
|
max: 10
|
|
6505
6515
|
}, null, 8, ["modelValue"]),
|
|
6506
|
-
m("div",
|
|
6507
|
-
|
|
6516
|
+
m("div", ml, nt(["arrow", "line"].includes(I()) ? "" : "描边") + "透明度", 1),
|
|
6517
|
+
ae(De, {
|
|
6508
6518
|
modelValue: N.value,
|
|
6509
6519
|
"onUpdate:modelValue": W[5] || (W[5] = (de) => N.value = de),
|
|
6510
6520
|
"show-input": "",
|
|
6511
6521
|
"show-input-controls": !1
|
|
6512
6522
|
}, null, 8, ["modelValue"]),
|
|
6513
|
-
le.value ?
|
|
6523
|
+
le.value ? ye("", !0) : (X(), j(We, { key: 1 }, [
|
|
6514
6524
|
W[21] || (W[21] = m("div", { class: "title" }, [
|
|
6515
6525
|
m("span", null, "默认颜色")
|
|
6516
6526
|
], -1)),
|
|
6517
|
-
|
|
6527
|
+
ae(qt, {
|
|
6518
6528
|
modelValue: ee.value,
|
|
6519
6529
|
"onUpdate:modelValue": W[6] || (W[6] = (de) => ee.value = de)
|
|
6520
6530
|
}, null, 8, ["modelValue"])
|
|
6521
6531
|
], 64)),
|
|
6522
|
-
le.value ? (
|
|
6523
|
-
m("div",
|
|
6524
|
-
|
|
6525
|
-
], 64)) :
|
|
6532
|
+
le.value ? (X(), j(We, { key: 2 }, [
|
|
6533
|
+
m("div", yl, nt(I() == "arrow" ? "箭头" : "线条") + "类型", 1),
|
|
6534
|
+
ae(zs)
|
|
6535
|
+
], 64)) : ye("", !0)
|
|
6526
6536
|
])
|
|
6527
6537
|
]),
|
|
6528
6538
|
_: 1
|
|
6529
|
-
}, 8, ["visible"])) :
|
|
6530
|
-
le.value ? (
|
|
6531
|
-
le.value ? (
|
|
6539
|
+
}, 8, ["visible"])) : ye("", !0),
|
|
6540
|
+
le.value ? (X(), j("div", xl)) : ye("", !0),
|
|
6541
|
+
le.value ? (X(), wt($e, {
|
|
6532
6542
|
key: 5,
|
|
6533
6543
|
placement: "top",
|
|
6534
6544
|
width: 248,
|
|
@@ -6539,10 +6549,10 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6539
6549
|
"onUpdate:visible": W[9] || (W[9] = (de) => s.value = de)
|
|
6540
6550
|
}, {
|
|
6541
6551
|
reference: Ae(() => [
|
|
6542
|
-
m("div",
|
|
6543
|
-
ee.value == "transparent" || !ee.value ? (
|
|
6552
|
+
m("div", kl, [
|
|
6553
|
+
ee.value == "transparent" || !ee.value ? (X(), j("svg", wl, [...W[23] || (W[23] = [
|
|
6544
6554
|
m("use", { "xlink:href": "#icon-wuyanse" }, null, -1)
|
|
6545
|
-
])])) : (
|
|
6555
|
+
])])) : (X(), j("div", {
|
|
6546
6556
|
key: 1,
|
|
6547
6557
|
class: "color-box",
|
|
6548
6558
|
style: Ke({ background: ee.value })
|
|
@@ -6550,19 +6560,19 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6550
6560
|
])
|
|
6551
6561
|
]),
|
|
6552
6562
|
default: Ae(() => [
|
|
6553
|
-
m("div",
|
|
6563
|
+
m("div", bl, [
|
|
6554
6564
|
W[24] || (W[24] = m("div", { class: "title" }, [
|
|
6555
6565
|
m("span", null, "默认颜色")
|
|
6556
6566
|
], -1)),
|
|
6557
|
-
|
|
6567
|
+
ae(qt, {
|
|
6558
6568
|
modelValue: ee.value,
|
|
6559
6569
|
"onUpdate:modelValue": W[8] || (W[8] = (de) => ee.value = de)
|
|
6560
6570
|
}, null, 8, ["modelValue"])
|
|
6561
6571
|
])
|
|
6562
6572
|
]),
|
|
6563
6573
|
_: 1
|
|
6564
|
-
}, 8, ["visible"])) :
|
|
6565
|
-
q.value ? (
|
|
6574
|
+
}, 8, ["visible"])) : ye("", !0),
|
|
6575
|
+
q.value ? (X(), wt($e, {
|
|
6566
6576
|
key: 6,
|
|
6567
6577
|
placement: "top",
|
|
6568
6578
|
width: 248,
|
|
@@ -6581,11 +6591,11 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6581
6591
|
], -1)
|
|
6582
6592
|
])]),
|
|
6583
6593
|
default: Ae(() => [
|
|
6584
|
-
m("div",
|
|
6594
|
+
m("div", Sl, [
|
|
6585
6595
|
W[26] || (W[26] = m("div", { class: "title" }, "圆角", -1)),
|
|
6586
|
-
|
|
6587
|
-
modelValue:
|
|
6588
|
-
"onUpdate:modelValue": W[10] || (W[10] = (de) =>
|
|
6596
|
+
ae(De, {
|
|
6597
|
+
modelValue: xe.value,
|
|
6598
|
+
"onUpdate:modelValue": W[10] || (W[10] = (de) => xe.value = de),
|
|
6589
6599
|
"show-input": "",
|
|
6590
6600
|
"show-input-controls": !1,
|
|
6591
6601
|
min: 0,
|
|
@@ -6594,9 +6604,9 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6594
6604
|
])
|
|
6595
6605
|
]),
|
|
6596
6606
|
_: 1
|
|
6597
|
-
})) :
|
|
6598
|
-
se.value && b.value ? (
|
|
6599
|
-
se.value ? (
|
|
6607
|
+
})) : ye("", !0),
|
|
6608
|
+
se.value && b.value ? (X(), j("div", Il)) : ye("", !0),
|
|
6609
|
+
se.value ? (X(), wt($e, {
|
|
6600
6610
|
key: 8,
|
|
6601
6611
|
placement: "top",
|
|
6602
6612
|
width: 248,
|
|
@@ -6607,8 +6617,8 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6607
6617
|
"onUpdate:visible": W[13] || (W[13] = (de) => o.value = de)
|
|
6608
6618
|
}, {
|
|
6609
6619
|
reference: Ae(() => [
|
|
6610
|
-
m("div",
|
|
6611
|
-
(
|
|
6620
|
+
m("div", Ml, [
|
|
6621
|
+
(X(), j("svg", {
|
|
6612
6622
|
class: "svg-icon",
|
|
6613
6623
|
viewBox: "0 0 1024 1024",
|
|
6614
6624
|
style: Ke({ backgroundColor: H.value })
|
|
@@ -6617,57 +6627,57 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6617
6627
|
d: "M772.144762 747.52L566.369524 223.817143a24.137143 24.137143 0 0 0-24.380953-16.579048H484.449524c-11.702857 0-19.992381 5.36381-24.380953 16.579048L254.293333 747.52c-6.339048 16.579048-4.87619 32.182857 5.36381 46.811429 10.24 14.628571 23.893333 21.942857 41.935238 21.942857 22.918095 0 38.521905-10.727619 47.299048-32.182857l48.761904-123.855239h232.106667l48.761905 123.855239c8.289524 21.455238 23.893333 32.182857 46.811428 32.182857 18.041905 0 31.695238-7.314286 41.935238-21.942857 10.24-14.628571 11.702857-30.232381 5.36381-46.811429h-0.487619z m-25.356191 33.645714c-5.36381 7.801905-12.190476 11.215238-21.455238 11.215238-11.702857 0-19.992381-5.36381-24.380952-16.579047l-49.737143-126.780953a18.870857 18.870857 0 0 0-18.529524-12.678095H394.727619c-9.264762 0-15.60381 4.388571-18.529524 12.678095l-49.737143 126.780953c-4.388571 11.215238-12.678095 16.579048-24.380952 16.579047-9.264762 0-16.579048-3.900952-21.942857-11.702857a24.380952 24.380952 0 0 1-2.925714-24.380952L482.986667 232.594286s0.975238-0.975238 1.950476-0.975238h57.539047s1.462857 0 1.950477 0.975238l205.775238 523.702857a24.380952 24.380952 0 0 1-2.925715 24.380952l-0.487619 0.487619z",
|
|
6618
6628
|
fill: he.value == "transparent" ? "#EEEFF0" : he.value,
|
|
6619
6629
|
"p-id": "4210"
|
|
6620
|
-
}, null, 8,
|
|
6630
|
+
}, null, 8, El),
|
|
6621
6631
|
m("path", {
|
|
6622
6632
|
d: "M529.310476 338.895238c-2.925714-7.314286-8.289524-10.727619-16.091428-10.727619s-13.165714 3.413333-16.091429 10.727619l-86.79619 220.40381c-2.438095 5.36381-1.462857 10.727619 1.950476 16.091428 3.413333 4.87619 8.289524 7.314286 14.140952 7.314286h173.104762c5.851429 0 10.727619-2.438095 14.140952-7.314286 3.413333-4.87619 3.900952-10.24 1.950477-16.091428l-86.308572-220.40381z m-91.672381 219.428572l76.068572-193.097143 75.580952 193.097143H437.638095z",
|
|
6623
6633
|
fill: he.value == "transparent" ? "#EEEFF0" : he.value,
|
|
6624
6634
|
"p-id": "4211"
|
|
6625
|
-
}, null, 8,
|
|
6635
|
+
}, null, 8, Cl),
|
|
6626
6636
|
m("path", {
|
|
6627
6637
|
d: "M700.952381 775.801905c4.388571 11.215238 12.678095 16.579048 24.380952 16.579047 9.264762 0 16.579048-3.900952 21.455238-11.215238a24.380952 24.380952 0 0 0 2.925715-24.380952L543.939048 233.081905s-0.975238-0.975238-1.950477-0.975238H484.449524s-1.462857 0-1.950476 0.975238L276.72381 756.784762a24.380952 24.380952 0 0 0 2.925714 24.380952c5.36381 7.801905 12.678095 11.702857 21.942857 11.702857 11.702857 0 19.992381-5.36381 24.380952-16.579047l49.737143-126.780953c3.413333-8.289524 9.752381-12.678095 18.529524-12.678095h237.958095c9.264762 0 15.60381 4.388571 18.529524 12.678095l49.737143 126.780953 0.487619-0.487619z m-274.529524-193.097143c-5.851429 0-10.727619-2.438095-14.140952-7.314286a17.066667 17.066667 0 0 1-1.950476-16.091428l86.79619-220.40381c2.925714-7.314286 8.289524-10.727619 16.091429-10.727619s13.165714 3.413333 16.091428 10.727619l86.308572 220.40381c2.438095 5.36381 1.462857 10.727619-1.950477 16.091428-3.413333 4.87619-8.289524 7.314286-14.140952 7.314286H426.422857z",
|
|
6628
6638
|
fill: he.value,
|
|
6629
6639
|
"p-id": "4212"
|
|
6630
|
-
}, null, 8,
|
|
6640
|
+
}, null, 8, Tl)
|
|
6631
6641
|
], 4))
|
|
6632
6642
|
])
|
|
6633
6643
|
]),
|
|
6634
6644
|
default: Ae(() => [
|
|
6635
|
-
m("div",
|
|
6645
|
+
m("div", Pl, [
|
|
6636
6646
|
W[27] || (W[27] = m("div", { class: "title" }, [
|
|
6637
6647
|
m("span", null, "文本样式")
|
|
6638
6648
|
], -1)),
|
|
6639
|
-
|
|
6649
|
+
ae(Ps),
|
|
6640
6650
|
W[28] || (W[28] = m("div", { class: "title" }, [
|
|
6641
6651
|
m("span", null, "对齐方式")
|
|
6642
6652
|
], -1)),
|
|
6643
|
-
|
|
6653
|
+
ae(Bs),
|
|
6644
6654
|
W[29] || (W[29] = m("div", { class: "title" }, [
|
|
6645
6655
|
m("span", null, "字体颜色")
|
|
6646
6656
|
], -1)),
|
|
6647
|
-
|
|
6657
|
+
ae(qt, {
|
|
6648
6658
|
modelValue: he.value,
|
|
6649
6659
|
"onUpdate:modelValue": W[11] || (W[11] = (de) => he.value = de)
|
|
6650
6660
|
}, null, 8, ["modelValue"]),
|
|
6651
6661
|
W[30] || (W[30] = m("div", { class: "title" }, [
|
|
6652
6662
|
m("span", null, "背景颜色")
|
|
6653
6663
|
], -1)),
|
|
6654
|
-
|
|
6664
|
+
ae(qt, {
|
|
6655
6665
|
modelValue: H.value,
|
|
6656
6666
|
"onUpdate:modelValue": W[12] || (W[12] = (de) => H.value = de)
|
|
6657
6667
|
}, null, 8, ["modelValue"])
|
|
6658
6668
|
])
|
|
6659
6669
|
]),
|
|
6660
6670
|
_: 1
|
|
6661
|
-
}, 8, ["visible"])) :
|
|
6662
|
-
se.value ? (
|
|
6663
|
-
|
|
6664
|
-
modelValue:
|
|
6665
|
-
"onUpdate:modelValue": W[14] || (W[14] = (de) =>
|
|
6671
|
+
}, 8, ["visible"])) : ye("", !0),
|
|
6672
|
+
se.value ? (X(), j("div", Bl, [
|
|
6673
|
+
ae(Ye, {
|
|
6674
|
+
modelValue: we.value,
|
|
6675
|
+
"onUpdate:modelValue": W[14] || (W[14] = (de) => we.value = de),
|
|
6666
6676
|
style: { width: "68px" },
|
|
6667
6677
|
onChange: ht
|
|
6668
6678
|
}, {
|
|
6669
6679
|
default: Ae(() => [
|
|
6670
|
-
(
|
|
6680
|
+
(X(), j(We, null, ut(Ce, (de) => ae(ke, {
|
|
6671
6681
|
key: de,
|
|
6672
6682
|
label: `${de}`,
|
|
6673
6683
|
value: de
|
|
@@ -6675,14 +6685,14 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6675
6685
|
]),
|
|
6676
6686
|
_: 1
|
|
6677
6687
|
}, 8, ["modelValue"])
|
|
6678
|
-
])) :
|
|
6688
|
+
])) : ye("", !0)
|
|
6679
6689
|
]);
|
|
6680
6690
|
};
|
|
6681
6691
|
}
|
|
6682
|
-
}),
|
|
6692
|
+
}), $l = /* @__PURE__ */ st(zl, [["__scopeId", "data-v-1fe4c384"]]), _l = {
|
|
6683
6693
|
key: 0,
|
|
6684
6694
|
class: "divider"
|
|
6685
|
-
},
|
|
6695
|
+
}, Al = ["title"], Dl = { class: "svg-icon" }, Fl = ["xlink:href"], Ol = /* @__PURE__ */ Qe({
|
|
6686
6696
|
__name: "FloatingPropertiesBar",
|
|
6687
6697
|
props: {
|
|
6688
6698
|
zoom: {},
|
|
@@ -6691,28 +6701,28 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6691
6701
|
},
|
|
6692
6702
|
setup(i) {
|
|
6693
6703
|
const t = i, e = ot(), n = J(!1), s = J({ x: 0, y: 0 });
|
|
6694
|
-
|
|
6704
|
+
Mt(() => e.appState.selectedElementIds, () => {
|
|
6695
6705
|
e.appState.floatingToolbarOffset = { x: 0, y: 0 };
|
|
6696
6706
|
}, { deep: !0 });
|
|
6697
6707
|
const a = U(() => e.appState.activeTool), o = U(() => Object.keys(e.appState.selectedElementIds)), l = U(() => o.value.length > 0), r = () => {
|
|
6698
6708
|
if (a.value === "selection") {
|
|
6699
6709
|
if (!l.value) return "none";
|
|
6700
|
-
const
|
|
6710
|
+
const Y = o.value[0], q = e.elements.find((se) => se.id === Y);
|
|
6701
6711
|
return q ? q.type : "none";
|
|
6702
6712
|
}
|
|
6703
6713
|
return a.value === "shapes" ? e.appState.activeToolType : a.value;
|
|
6704
6714
|
}, c = U(() => {
|
|
6705
|
-
const
|
|
6706
|
-
return ["arrow", "line"].includes(
|
|
6715
|
+
const Y = r();
|
|
6716
|
+
return ["arrow", "line"].includes(Y);
|
|
6707
6717
|
}), f = U(() => {
|
|
6708
|
-
const
|
|
6709
|
-
return ["rectangle", "ellipse", "diamond", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram"].includes(
|
|
6718
|
+
const Y = r();
|
|
6719
|
+
return ["rectangle", "ellipse", "diamond", "square", "star", "circle", "cylinder", "process", "decision", "trapezoid", "parallelogram"].includes(Y);
|
|
6710
6720
|
}), k = U(() => o.value.length > 1), d = U(() => e.appState.isDraggingElement || e.appState.isBoxSelecting), v = U(() => {
|
|
6711
|
-
const
|
|
6712
|
-
if (
|
|
6713
|
-
const q = Gt(
|
|
6721
|
+
const Y = e.elements.filter((he) => e.appState.selectedElementIds[he.id]);
|
|
6722
|
+
if (Y.length === 0) return { display: "none" };
|
|
6723
|
+
const q = Gt(Y);
|
|
6714
6724
|
if (!q) return { display: "none" };
|
|
6715
|
-
const se = (q.x + t.scrollX) * t.zoom, le = (q.y + t.scrollY) * t.zoom,
|
|
6725
|
+
const se = (q.x + t.scrollX) * t.zoom, le = (q.y + t.scrollY) * t.zoom, ie = q.width * t.zoom, ee = se + ie / 2 + e.appState.floatingToolbarOffset.x, G = le - 32 - 40 + e.appState.floatingToolbarOffset.y;
|
|
6716
6726
|
return {
|
|
6717
6727
|
left: `${ee}px`,
|
|
6718
6728
|
top: `${Math.max(10, G)}px`,
|
|
@@ -6720,15 +6730,15 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6720
6730
|
transform: "translateX(-50%)",
|
|
6721
6731
|
pointerEvents: d.value ? "none" : "auto"
|
|
6722
6732
|
};
|
|
6723
|
-
}), h = (
|
|
6733
|
+
}), h = (Y) => {
|
|
6724
6734
|
n.value = !0, s.value = {
|
|
6725
|
-
x:
|
|
6726
|
-
y:
|
|
6735
|
+
x: Y.clientX - e.appState.floatingToolbarOffset.x,
|
|
6736
|
+
y: Y.clientY - e.appState.floatingToolbarOffset.y
|
|
6727
6737
|
}, document.addEventListener("mousemove", M), document.addEventListener("mouseup", I);
|
|
6728
|
-
}, M = (
|
|
6738
|
+
}, M = (Y) => {
|
|
6729
6739
|
n.value && (e.appState.floatingToolbarOffset = {
|
|
6730
|
-
x:
|
|
6731
|
-
y:
|
|
6740
|
+
x: Y.clientX - s.value.x,
|
|
6741
|
+
y: Y.clientY - s.value.y
|
|
6732
6742
|
});
|
|
6733
6743
|
}, I = () => {
|
|
6734
6744
|
n.value = !1, document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", I);
|
|
@@ -6736,15 +6746,15 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6736
6746
|
e.appState.isPropertiesPanelOpen = !0;
|
|
6737
6747
|
}, b = U(() => {
|
|
6738
6748
|
if (o.value.length < 2) return !1;
|
|
6739
|
-
const
|
|
6749
|
+
const Y = e.elements.filter((le) => e.appState.selectedElementIds[le.id]), q = Y[0]?.groupIds || [];
|
|
6740
6750
|
return q.length === 0 ? !1 : q.filter(
|
|
6741
|
-
(le) =>
|
|
6751
|
+
(le) => Y.every((ie) => ie.groupIds && ie.groupIds.includes(le))
|
|
6742
6752
|
).length > 0;
|
|
6743
6753
|
}), B = () => {
|
|
6744
|
-
const
|
|
6745
|
-
b.value ? e.ungroupElements(
|
|
6754
|
+
const Y = Object.keys(e.appState.selectedElementIds);
|
|
6755
|
+
b.value ? e.ungroupElements(Y) : e.groupElements(Y);
|
|
6746
6756
|
};
|
|
6747
|
-
return (
|
|
6757
|
+
return (Y, q) => Se(e).shouldShowFloatingToolbar ? (X(), j("div", {
|
|
6748
6758
|
key: 0,
|
|
6749
6759
|
class: "floating-toolbar",
|
|
6750
6760
|
style: Ke({
|
|
@@ -6755,39 +6765,39 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6755
6765
|
m("div", {
|
|
6756
6766
|
class: "drag-handle",
|
|
6757
6767
|
title: "拖动",
|
|
6758
|
-
onMousedown:
|
|
6768
|
+
onMousedown: Et(h, ["stop"])
|
|
6759
6769
|
}, [...q[0] || (q[0] = [
|
|
6760
6770
|
m("svg", { class: "svg-icon" }, [
|
|
6761
6771
|
m("use", { "xlink:href": "#icon-tuodong" })
|
|
6762
6772
|
], -1)
|
|
6763
6773
|
])], 32),
|
|
6764
|
-
!c.value && !f.value ? (
|
|
6765
|
-
|
|
6774
|
+
!c.value && !f.value ? (X(), j("div", _l)) : ye("", !0),
|
|
6775
|
+
ae($l),
|
|
6766
6776
|
q[2] || (q[2] = m("div", { class: "divider" }, null, -1)),
|
|
6767
|
-
k.value ? (
|
|
6777
|
+
k.value ? (X(), j("div", {
|
|
6768
6778
|
key: 1,
|
|
6769
6779
|
class: "settings-btn",
|
|
6770
|
-
onClick:
|
|
6780
|
+
onClick: Et(B, ["stop"]),
|
|
6771
6781
|
title: b.value ? "解除编组" : "编组"
|
|
6772
6782
|
}, [
|
|
6773
|
-
(
|
|
6783
|
+
(X(), j("svg", Dl, [
|
|
6774
6784
|
m("use", {
|
|
6775
6785
|
"xlink:href": b.value ? "#icon-quxiaobianzu" : "#icon-bianzu"
|
|
6776
|
-
}, null, 8,
|
|
6786
|
+
}, null, 8, Fl)
|
|
6777
6787
|
]))
|
|
6778
|
-
], 8,
|
|
6788
|
+
], 8, Al)) : ye("", !0),
|
|
6779
6789
|
m("div", {
|
|
6780
6790
|
class: "settings-btn",
|
|
6781
|
-
onClick:
|
|
6791
|
+
onClick: Et(T, ["stop"]),
|
|
6782
6792
|
title: "右侧面板"
|
|
6783
6793
|
}, [...q[1] || (q[1] = [
|
|
6784
6794
|
m("svg", { class: "svg-icon" }, [
|
|
6785
6795
|
m("use", { "xlink:href": "#icon-youcemianban" })
|
|
6786
6796
|
], -1)
|
|
6787
6797
|
])])
|
|
6788
|
-
], 4)) :
|
|
6798
|
+
], 4)) : ye("", !0);
|
|
6789
6799
|
}
|
|
6790
|
-
}),
|
|
6800
|
+
}), Ll = /* @__PURE__ */ st(Ol, [["__scopeId", "data-v-206d2632"]]), Rl = { class: "app-container" }, ws = /* @__PURE__ */ Qe({
|
|
6791
6801
|
__name: "App",
|
|
6792
6802
|
setup(i) {
|
|
6793
6803
|
const t = ot();
|
|
@@ -6796,30 +6806,31 @@ const fa = { key: 0 }, ga = { key: 1 }, va = /* @__PURE__ */ Qe({
|
|
|
6796
6806
|
const e = JSON.parse(JSON.stringify(t.elements)), n = JSON.parse(JSON.stringify(t.appState));
|
|
6797
6807
|
return console.log("Canvas Elements:", e), console.log("Canvas Config (AppState):", n), { elements: e, appState: n };
|
|
6798
6808
|
};
|
|
6799
|
-
}), (e, n) => (
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
elements:
|
|
6805
|
-
zoom:
|
|
6806
|
-
scrollX:
|
|
6807
|
-
scrollY:
|
|
6809
|
+
}), (e, n) => (X(), j("div", Rl, [
|
|
6810
|
+
Se(t).appConfig.showToolbar !== !1 ? (X(), wt(Ci, { key: 0 })) : ye("", !0),
|
|
6811
|
+
Se(t).appConfig.showPropertiesPanel !== !1 ? (X(), wt(jo, { key: 1 })) : ye("", !0),
|
|
6812
|
+
Se(t).appConfig.showBoardName !== !1 ? (X(), wt(ja, { key: 2 })) : ye("", !0),
|
|
6813
|
+
ae(Ia, {
|
|
6814
|
+
elements: Se(t).elements,
|
|
6815
|
+
zoom: Se(t).appState.zoom,
|
|
6816
|
+
scrollX: Se(t).appState.scrollX,
|
|
6817
|
+
scrollY: Se(t).appState.scrollY
|
|
6808
6818
|
}, null, 8, ["elements", "zoom", "scrollX", "scrollY"]),
|
|
6809
|
-
|
|
6810
|
-
zoom:
|
|
6811
|
-
scrollX:
|
|
6812
|
-
scrollY:
|
|
6819
|
+
ae(Ll, {
|
|
6820
|
+
zoom: Se(t).appState.zoom,
|
|
6821
|
+
scrollX: Se(t).appState.scrollX,
|
|
6822
|
+
scrollY: Se(t).appState.scrollY
|
|
6813
6823
|
}, null, 8, ["zoom", "scrollX", "scrollY"]),
|
|
6814
|
-
|
|
6815
|
-
|
|
6824
|
+
Se(t).appConfig.showFooter !== !1 ? (X(), wt(Ja, { key: 3 })) : ye("", !0),
|
|
6825
|
+
ae(Qa)
|
|
6816
6826
|
]));
|
|
6817
6827
|
}
|
|
6818
6828
|
});
|
|
6819
|
-
ws.install = function(i) {
|
|
6820
|
-
i.component("JvsDraw", ws);
|
|
6829
|
+
ws.install = function(i, t) {
|
|
6830
|
+
t && di(t), i.component("JvsDraw", ws);
|
|
6821
6831
|
};
|
|
6822
6832
|
export {
|
|
6823
6833
|
ws as JvsDraw,
|
|
6824
|
-
ws as default
|
|
6834
|
+
ws as default,
|
|
6835
|
+
di as setConfig
|
|
6825
6836
|
};
|