@hankchen/canvas-editor-vue 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/CanvasSurface.d.ts +28 -1
- package/dist/canvas/{ContentTypePill.d.ts → EditOverlayToolbar.d.ts} +19 -0
- package/dist/canvas/TextEditingOverlay.d.ts +31 -3
- package/dist/canvas/index.d.ts +1 -1
- package/dist/canvas/useTextEditing.d.ts +30 -8
- package/dist/{canvas-ZMyaouKe.js → canvas-DqQislJ_.js} +813 -434
- package/dist/canvas.js +2 -2
- package/dist/index.js +15 -14
- package/dist/{layer-panel-CEyB57XM.js → layer-panel-DskyCgF5.js} +7 -7
- package/dist/layer-panel.js +1 -1
- package/dist/panel-theme.css +24 -0
- package/dist/{completionAnchor-Da8VhzMQ.js → popupPosition-Ck5Gsvjy.js} +163 -107
- package/dist/property-panel/PropertyField.d.ts +6 -0
- package/dist/property-panel/fieldSchema.d.ts +7 -1
- package/dist/property-panel/fields/ImageSrcField.d.ts +5 -1
- package/dist/property-panel/fields/ResourceValueField.d.ts +19 -0
- package/dist/property-panel/fields/TextareaField.d.ts +1 -0
- package/dist/property-panel/fields/ValueTypeSegmented.d.ts +3 -1
- package/dist/property-panel/index.d.ts +5 -3
- package/dist/property-panel/usePropertyPanel.d.ts +16 -4
- package/dist/{property-panel-DmSf_GPu.js → property-panel-B32ZBQdf.js} +472 -376
- package/dist/property-panel.js +3 -2
- package/dist/resourceTemplate-cdcQtp9a.js +246 -0
- package/dist/shared/ExpressionPathPicker.d.ts +25 -0
- package/dist/shared/completion.d.ts +14 -10
- package/dist/shared/expressionContext.d.ts +2 -2
- package/dist/shared/index.d.ts +14 -1
- package/dist/shared/mergeKey.d.ts +2 -0
- package/dist/shared/pathPickerModel.d.ts +11 -0
- package/dist/shared/popupPosition.d.ts +41 -0
- package/dist/shared/resourceTemplate.d.ts +7 -0
- package/dist/shared/useExpressionCompletion.d.ts +0 -7
- package/dist/shared/useExpressionDiagnostics.d.ts +15 -0
- package/dist/shared.js +10 -9
- package/dist/style.css +1 -1
- package/dist/uploadFile-D1RY-ji0.js +516 -0
- package/dist/usePathCompletion-Do17CQ6l.js +220 -0
- package/package.json +2 -2
- package/dist/uploadFile-DXAEX9kG.js +0 -455
- package/dist/usePathCompletion-C52F4phW.js +0 -229
- /package/dist/{property-panel → shared}/fontPicker.d.ts +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as e } from "./createLucideIcon-SCvtEGVf.js";
|
|
2
|
-
import { c as t, d as n, f as r, l as i,
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
var
|
|
2
|
+
import { c as t, d as n, f as r, l as i, n as a, o, p as s, r as c, s as l, u } from "./dist-DGtNmLwo.js";
|
|
3
|
+
import { i as d, n as f, o as p } from "./layerPath-uy2ywyld.js";
|
|
4
|
+
import { o as m, s as h } from "./popupPosition-Ck5Gsvjy.js";
|
|
5
|
+
import { c as g, n as _, r as v, s as y, t as b, u as x } from "./useTransientFeedback-CTjmMmFF.js";
|
|
6
|
+
import { a as S, c as C, i as w, l as T, n as E, o as D, s as O, t as k } from "./uploadFile-D1RY-ji0.js";
|
|
7
|
+
import { n as A, t as j } from "./useViewport-D9Ipevzs.js";
|
|
8
|
+
import { Fragment as M, computed as N, createBlock as P, createCommentVNode as F, createElementBlock as I, createElementVNode as L, createVNode as R, defineComponent as z, mergeProps as B, nextTick as V, normalizeClass as H, normalizeStyle as U, onBeforeUnmount as W, onMounted as ee, onScopeDispose as G, openBlock as K, ref as q, renderList as J, shallowRef as Y, toDisplayString as X, unref as Z, vModelText as te, vShow as ne, watch as Q, withDirectives as re, withKeys as ie, withModifiers as $ } from "vue";
|
|
9
|
+
var ae = e({
|
|
10
10
|
name: "arrow-down-left",
|
|
11
11
|
size: 24,
|
|
12
12
|
node: [["path", {
|
|
@@ -16,7 +16,7 @@ var Q = e({
|
|
|
16
16
|
d: "M17 17H7V7",
|
|
17
17
|
key: "1org7z"
|
|
18
18
|
}]]
|
|
19
|
-
}),
|
|
19
|
+
}), oe = e({
|
|
20
20
|
name: "arrow-down-right",
|
|
21
21
|
size: 24,
|
|
22
22
|
node: [["path", {
|
|
@@ -26,7 +26,7 @@ var Q = e({
|
|
|
26
26
|
d: "M17 7v10H7",
|
|
27
27
|
key: "6fjiku"
|
|
28
28
|
}]]
|
|
29
|
-
}),
|
|
29
|
+
}), se = e({
|
|
30
30
|
name: "arrow-up-left",
|
|
31
31
|
size: 24,
|
|
32
32
|
node: [["path", {
|
|
@@ -36,7 +36,7 @@ var Q = e({
|
|
|
36
36
|
d: "M17 17 7 7",
|
|
37
37
|
key: "2786uv"
|
|
38
38
|
}]]
|
|
39
|
-
}),
|
|
39
|
+
}), ce = e({
|
|
40
40
|
name: "arrow-up-right",
|
|
41
41
|
size: 24,
|
|
42
42
|
node: [["path", {
|
|
@@ -46,14 +46,53 @@ var Q = e({
|
|
|
46
46
|
d: "M7 17 17 7",
|
|
47
47
|
key: "1vkiza"
|
|
48
48
|
}]]
|
|
49
|
-
}),
|
|
49
|
+
}), le = e({
|
|
50
50
|
name: "chevron-up",
|
|
51
51
|
size: 24,
|
|
52
52
|
node: [["path", {
|
|
53
53
|
d: "m18 15-6-6-6 6",
|
|
54
54
|
key: "153udz"
|
|
55
55
|
}]]
|
|
56
|
-
}),
|
|
56
|
+
}), ue = e({
|
|
57
|
+
name: "minus",
|
|
58
|
+
size: 24,
|
|
59
|
+
node: [["path", {
|
|
60
|
+
d: "M5 12h14",
|
|
61
|
+
key: "1ays0h"
|
|
62
|
+
}]]
|
|
63
|
+
}), de = e({
|
|
64
|
+
name: "plus",
|
|
65
|
+
size: 24,
|
|
66
|
+
node: [["path", {
|
|
67
|
+
d: "M5 12h14",
|
|
68
|
+
key: "1ays0h"
|
|
69
|
+
}], ["path", {
|
|
70
|
+
d: "M12 5v14",
|
|
71
|
+
key: "s699le"
|
|
72
|
+
}]]
|
|
73
|
+
}), fe = e({
|
|
74
|
+
name: "text-wrap",
|
|
75
|
+
size: 24,
|
|
76
|
+
node: [
|
|
77
|
+
["path", {
|
|
78
|
+
d: "m16 16-3 3 3 3",
|
|
79
|
+
key: "117b85"
|
|
80
|
+
}],
|
|
81
|
+
["path", {
|
|
82
|
+
d: "M3 12h14.5a1 1 0 0 1 0 7H13",
|
|
83
|
+
key: "18xa6z"
|
|
84
|
+
}],
|
|
85
|
+
["path", {
|
|
86
|
+
d: "M3 19h6",
|
|
87
|
+
key: "1ygdsz"
|
|
88
|
+
}],
|
|
89
|
+
["path", {
|
|
90
|
+
d: "M3 5h18",
|
|
91
|
+
key: "1u36vt"
|
|
92
|
+
}]
|
|
93
|
+
],
|
|
94
|
+
aliases: ["wrap-text"]
|
|
95
|
+
}), pe = e({
|
|
57
96
|
name: "x",
|
|
58
97
|
size: 24,
|
|
59
98
|
node: [["path", {
|
|
@@ -66,7 +105,7 @@ var Q = e({
|
|
|
66
105
|
});
|
|
67
106
|
//#endregion
|
|
68
107
|
//#region ../canvas-editor/src/spatial/camera.ts
|
|
69
|
-
function
|
|
108
|
+
function me(e, t) {
|
|
70
109
|
if (!(t > 0)) return e;
|
|
71
110
|
let n = e.zoom * t;
|
|
72
111
|
return {
|
|
@@ -75,19 +114,19 @@ function oe(e, t) {
|
|
|
75
114
|
zoom: e.zoom
|
|
76
115
|
};
|
|
77
116
|
}
|
|
78
|
-
function
|
|
117
|
+
function he(e) {
|
|
79
118
|
return 6 / e;
|
|
80
119
|
}
|
|
81
|
-
function
|
|
120
|
+
function ge(e, t, n) {
|
|
82
121
|
let r = [];
|
|
83
122
|
for (let i = 0; i < e.layers.length; i += 1) {
|
|
84
123
|
if (t !== null && i === t) continue;
|
|
85
|
-
let
|
|
86
|
-
|
|
124
|
+
let a = e.layers[i];
|
|
125
|
+
a.visible !== !1 && r.push(o(a, 0, 0, e.width, e.height, n));
|
|
87
126
|
}
|
|
88
127
|
return r;
|
|
89
128
|
}
|
|
90
|
-
function
|
|
129
|
+
function _e(e, t, n, r) {
|
|
91
130
|
let i = [];
|
|
92
131
|
for (let e of n) i.push({
|
|
93
132
|
orientation: "vertical",
|
|
@@ -130,7 +169,7 @@ function le(e, t, n, r) {
|
|
|
130
169
|
});
|
|
131
170
|
return i;
|
|
132
171
|
}
|
|
133
|
-
function
|
|
172
|
+
function ve(e, t, n, r) {
|
|
134
173
|
let i = null;
|
|
135
174
|
for (let a of t) if (a.orientation === n) for (let t of e) {
|
|
136
175
|
let e = a.position - t, n = Math.abs(e);
|
|
@@ -141,16 +180,16 @@ function ue(e, t, n, r) {
|
|
|
141
180
|
}
|
|
142
181
|
return i;
|
|
143
182
|
}
|
|
144
|
-
function
|
|
145
|
-
let r =
|
|
183
|
+
function ye(e, t, n) {
|
|
184
|
+
let r = ve(e.vertical, t, "vertical", n), i = ve(e.horizontal, t, "horizontal", n);
|
|
146
185
|
return {
|
|
147
186
|
dx: r ? r.delta : 0,
|
|
148
187
|
dy: i ? i.delta : 0,
|
|
149
188
|
axes: [...r ? [r.axis] : [], ...i ? [i.axis] : []]
|
|
150
189
|
};
|
|
151
190
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
191
|
+
function be(e, t, n) {
|
|
192
|
+
return ye({
|
|
154
193
|
vertical: [
|
|
155
194
|
e.x,
|
|
156
195
|
e.x + e.width / 2,
|
|
@@ -165,7 +204,7 @@ function fe(e, t, n) {
|
|
|
165
204
|
}
|
|
166
205
|
//#endregion
|
|
167
206
|
//#region ../canvas-editor/src/spatial/resize.ts
|
|
168
|
-
function
|
|
207
|
+
function xe(e, t) {
|
|
169
208
|
let n = e.x + e.width, r = e.y + e.height;
|
|
170
209
|
switch (t) {
|
|
171
210
|
case "nw": return {
|
|
@@ -204,45 +243,45 @@ function pe(e, t) {
|
|
|
204
243
|
}
|
|
205
244
|
//#endregion
|
|
206
245
|
//#region ../canvas-editor/src/spatial/wheel.ts
|
|
207
|
-
function
|
|
246
|
+
function Se(e) {
|
|
208
247
|
return e.ctrlKey || e.metaKey ? "zoom" : e.shiftKey ? "pan-x" : "pan";
|
|
209
248
|
}
|
|
210
249
|
//#endregion
|
|
211
250
|
//#region ../canvas-browser-renderer/src/fonts.ts
|
|
212
|
-
function
|
|
251
|
+
function Ce(e) {
|
|
213
252
|
return e === "" || /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e.trim());
|
|
214
253
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
254
|
+
function we(e) {
|
|
255
|
+
return Ce(e) ? "sans-serif" : `${Te(e)}, sans-serif`;
|
|
217
256
|
}
|
|
218
|
-
function
|
|
257
|
+
function Te(e) {
|
|
219
258
|
let t = 2166136261;
|
|
220
259
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
221
260
|
return `canvas-font-${(t >>> 0).toString(36)}`;
|
|
222
261
|
}
|
|
223
262
|
//#endregion
|
|
224
263
|
//#region src/canvas/AlignFloatBar.vue?vue&type=script&setup=true&lang.ts
|
|
225
|
-
var
|
|
264
|
+
var Ee = ["aria-disabled"], De = {
|
|
226
265
|
key: 0,
|
|
227
266
|
class: "cn-align-float__divider",
|
|
228
267
|
"aria-hidden": "true"
|
|
229
|
-
},
|
|
268
|
+
}, Oe = { class: "cn-align-float__group" }, ke = [
|
|
230
269
|
"disabled",
|
|
231
270
|
"title",
|
|
232
271
|
"aria-label",
|
|
233
272
|
"onClick"
|
|
234
|
-
],
|
|
273
|
+
], Ae = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
235
274
|
__name: "AlignFloatBar",
|
|
236
275
|
props: { editor: {} },
|
|
237
276
|
setup(e) {
|
|
238
|
-
let a = e,
|
|
277
|
+
let a = e, o = A(a.editor), c = N(() => o.value !== null), l = (e) => `贴${e}角(边距 40px)`, d = [
|
|
239
278
|
{ keys: [{
|
|
240
279
|
mode: "h-center",
|
|
241
280
|
icon: r,
|
|
242
281
|
title: "水平居中"
|
|
243
282
|
}, {
|
|
244
283
|
mode: "v-center",
|
|
245
|
-
icon:
|
|
284
|
+
icon: s,
|
|
246
285
|
title: "垂直居中"
|
|
247
286
|
}] },
|
|
248
287
|
{ keys: [
|
|
@@ -253,7 +292,7 @@ var ve = ["aria-disabled"], ye = {
|
|
|
253
292
|
},
|
|
254
293
|
{
|
|
255
294
|
mode: "right",
|
|
256
|
-
icon:
|
|
295
|
+
icon: u,
|
|
257
296
|
title: "贴右"
|
|
258
297
|
},
|
|
259
298
|
{
|
|
@@ -270,102 +309,102 @@ var ve = ["aria-disabled"], ye = {
|
|
|
270
309
|
{ keys: [
|
|
271
310
|
{
|
|
272
311
|
mode: "corner-tl",
|
|
273
|
-
icon:
|
|
274
|
-
title:
|
|
312
|
+
icon: se,
|
|
313
|
+
title: l("左上")
|
|
275
314
|
},
|
|
276
315
|
{
|
|
277
316
|
mode: "corner-tr",
|
|
278
|
-
icon:
|
|
279
|
-
title:
|
|
317
|
+
icon: ce,
|
|
318
|
+
title: l("右上")
|
|
280
319
|
},
|
|
281
320
|
{
|
|
282
321
|
mode: "corner-bl",
|
|
283
|
-
icon:
|
|
284
|
-
title:
|
|
322
|
+
icon: ae,
|
|
323
|
+
title: l("左下")
|
|
285
324
|
},
|
|
286
325
|
{
|
|
287
326
|
mode: "corner-br",
|
|
288
|
-
icon:
|
|
289
|
-
title:
|
|
327
|
+
icon: oe,
|
|
328
|
+
title: l("右下")
|
|
290
329
|
}
|
|
291
330
|
] }
|
|
292
331
|
];
|
|
293
|
-
function
|
|
332
|
+
function f(e) {
|
|
294
333
|
return { [`data-align-${e}`]: "" };
|
|
295
334
|
}
|
|
296
|
-
function
|
|
297
|
-
let t =
|
|
335
|
+
function p(e) {
|
|
336
|
+
let t = o.value;
|
|
298
337
|
t && (e.startsWith("corner-") ? a.editor.alignToCanvas(t, e, { margin: 40 }) : a.editor.alignToCanvas(t, e));
|
|
299
338
|
}
|
|
300
|
-
return (e, t) => (
|
|
301
|
-
class:
|
|
339
|
+
return (e, t) => (K(), I("div", {
|
|
340
|
+
class: H(["cn-align-float", { "cn-align-float--disabled": !c.value }]),
|
|
302
341
|
role: "toolbar",
|
|
303
342
|
"aria-label": "对齐画布",
|
|
304
343
|
"data-align-float": "",
|
|
305
|
-
"aria-disabled":
|
|
306
|
-
}, [(
|
|
344
|
+
"aria-disabled": c.value ? void 0 : "true"
|
|
345
|
+
}, [(K(), I(M, null, J(d, (e, t) => (K(), I(M, { key: t }, [t > 0 ? (K(), I("span", De)) : F("", !0), L("span", Oe, [(K(!0), I(M, null, J(e.keys, (e) => (K(), I("button", B({
|
|
307
346
|
key: e.mode,
|
|
308
347
|
type: "button",
|
|
309
348
|
class: "cn-align-float__key",
|
|
310
|
-
disabled: !
|
|
349
|
+
disabled: !c.value,
|
|
311
350
|
title: e.title,
|
|
312
351
|
"aria-label": e.title
|
|
313
|
-
}, { ref_for: !0 },
|
|
352
|
+
}, { ref_for: !0 }, f(e.mode), { onClick: (t) => p(e.mode) }), [R(h, { icon: e.icon }, null, 8, ["icon"])], 16, ke))), 128))])], 64))), 64))], 10, Ee));
|
|
314
353
|
}
|
|
315
|
-
}), [["__scopeId", "data-v-9a761d37"]]),
|
|
354
|
+
}), [["__scopeId", "data-v-9a761d37"]]), je = {
|
|
316
355
|
key: 0,
|
|
317
356
|
class: "cn-context-menu__form"
|
|
318
|
-
},
|
|
357
|
+
}, Me = { class: "cn-context-menu__hint" }, Ne = ["onKeydown"], Pe = {
|
|
319
358
|
key: 0,
|
|
320
359
|
class: "cn-context-menu__hint cn-context-menu__hint--error"
|
|
321
|
-
},
|
|
360
|
+
}, Fe = [
|
|
322
361
|
"disabled",
|
|
323
362
|
"title",
|
|
324
363
|
"onClick"
|
|
325
|
-
],
|
|
364
|
+
], Ie = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
326
365
|
__name: "ContextMenu",
|
|
327
366
|
props: { editor: {} },
|
|
328
367
|
setup(e, { expose: t }) {
|
|
329
|
-
let n = e, r =
|
|
368
|
+
let n = e, r = q(null), i = q(!1), a = q({
|
|
330
369
|
x: 0,
|
|
331
370
|
y: 0
|
|
332
|
-
}), o =
|
|
371
|
+
}), o = y(), s = `先 ${g("copyStyle", o)} 复制样式`, c = `图层已锁定(${g("toggleLayerLock", o)} 解锁后可删除)`, l = A(n.editor), u = N(() => l.value !== null && f(l.value)), d = N(() => l.value !== null && n.editor.canCopySelection), m = N(() => (i.value, l.value !== null && n.editor.canCopyStyle)), h = N(() => (i.value, l.value !== null && n.editor.canPasteStyle)), _ = N(() => {
|
|
333
372
|
let e = l.value, t = n.editor.store.doc;
|
|
334
|
-
return !e || !t || !
|
|
335
|
-
}),
|
|
373
|
+
return !e || !t || !f(e) ? !0 : p(t, e)?.visible ?? !0;
|
|
374
|
+
}), v = N(() => {
|
|
336
375
|
let e = l.value, t = n.editor.store.doc;
|
|
337
|
-
return !e || !t ? null :
|
|
376
|
+
return !e || !t ? null : p(t, e);
|
|
338
377
|
});
|
|
339
378
|
function b() {
|
|
340
379
|
let e = l.value;
|
|
341
380
|
return !e || typeof e[1] != "number" ? null : ["layers", e[1]];
|
|
342
381
|
}
|
|
343
|
-
let x =
|
|
344
|
-
let e =
|
|
382
|
+
let x = N(() => v.value?.type === "TableLayer" && v.value.template !== null), S = N(() => l.value?.[l.value.length - 1] === "template"), C = N(() => l.value !== null && n.editor.isLocked(l.value)), w = N(() => {
|
|
383
|
+
let e = v.value;
|
|
345
384
|
if (!e || e.type !== "TableLayer" || e.template !== null) return !1;
|
|
346
385
|
let t = e.rows[e.rows.length - 1];
|
|
347
386
|
return t !== void 0 && t.cells.length > 0;
|
|
348
|
-
}),
|
|
349
|
-
let e =
|
|
387
|
+
}), T = N(() => {
|
|
388
|
+
let e = v.value;
|
|
350
389
|
return !e || e.type !== "TableLayer" ? "" : `模板取自末行,其余 ${Math.max(e.rows.length - 1, 0)} 行将移除(可撤销)`;
|
|
351
|
-
}),
|
|
352
|
-
function
|
|
353
|
-
|
|
390
|
+
}), E = q(!1), D = q(""), O = q(!1);
|
|
391
|
+
function k() {
|
|
392
|
+
E.value = !0, D.value = "", O.value = !1;
|
|
354
393
|
}
|
|
355
|
-
function
|
|
356
|
-
let e = b(), t =
|
|
394
|
+
function j() {
|
|
395
|
+
let e = b(), t = D.value.trim();
|
|
357
396
|
if (!e || t === "") {
|
|
358
|
-
|
|
397
|
+
O.value = !0;
|
|
359
398
|
return;
|
|
360
399
|
}
|
|
361
|
-
n.editor.convertTableToTemplate(e, t),
|
|
400
|
+
n.editor.convertTableToTemplate(e, t), z();
|
|
362
401
|
}
|
|
363
|
-
let
|
|
402
|
+
let P = N(() => [
|
|
364
403
|
{
|
|
365
404
|
key: "visibility",
|
|
366
|
-
label:
|
|
367
|
-
enabled:
|
|
368
|
-
title:
|
|
405
|
+
label: _.value ? "隐藏" : "显示",
|
|
406
|
+
enabled: u.value,
|
|
407
|
+
title: u.value ? void 0 : "显示/隐藏仅作用于根图层",
|
|
369
408
|
run: () => {
|
|
370
409
|
let e = l.value;
|
|
371
410
|
e && n.editor.toggleLayerVisibility(e);
|
|
@@ -374,15 +413,15 @@ var ve = ["aria-disabled"], ye = {
|
|
|
374
413
|
{
|
|
375
414
|
key: "duplicate",
|
|
376
415
|
label: "创建副本",
|
|
377
|
-
enabled:
|
|
378
|
-
title:
|
|
416
|
+
enabled: d.value,
|
|
417
|
+
title: d.value ? void 0 : "行/格/行模板是容器内结构,不可复制",
|
|
379
418
|
run: () => n.editor.duplicateSelection()
|
|
380
419
|
},
|
|
381
420
|
{
|
|
382
421
|
key: "copy-style",
|
|
383
422
|
label: "复制样式",
|
|
384
|
-
enabled:
|
|
385
|
-
title: !
|
|
423
|
+
enabled: m.value,
|
|
424
|
+
title: !m.value && S.value ? "行模板替身无样式可复制" : void 0,
|
|
386
425
|
run: () => {
|
|
387
426
|
let e = l.value;
|
|
388
427
|
e && n.editor.copyStyle(e);
|
|
@@ -391,8 +430,8 @@ var ve = ["aria-disabled"], ye = {
|
|
|
391
430
|
{
|
|
392
431
|
key: "paste-style",
|
|
393
432
|
label: "粘贴样式",
|
|
394
|
-
enabled:
|
|
395
|
-
title:
|
|
433
|
+
enabled: h.value,
|
|
434
|
+
title: h.value ? void 0 : s,
|
|
396
435
|
run: () => {
|
|
397
436
|
let e = l.value;
|
|
398
437
|
e && n.editor.pasteStyle(e);
|
|
@@ -401,29 +440,29 @@ var ve = ["aria-disabled"], ye = {
|
|
|
401
440
|
{
|
|
402
441
|
key: "forward",
|
|
403
442
|
label: "前移一层",
|
|
404
|
-
enabled:
|
|
405
|
-
title:
|
|
443
|
+
enabled: u.value,
|
|
444
|
+
title: u.value ? void 0 : "前移/后移仅对根图层生效",
|
|
406
445
|
run: () => n.editor.bringForward()
|
|
407
446
|
},
|
|
408
447
|
{
|
|
409
448
|
key: "backward",
|
|
410
449
|
label: "后移一层",
|
|
411
|
-
enabled:
|
|
412
|
-
title:
|
|
450
|
+
enabled: u.value,
|
|
451
|
+
title: u.value ? void 0 : "前移/后移仅对根图层生效",
|
|
413
452
|
run: () => n.editor.sendBackward()
|
|
414
453
|
},
|
|
415
454
|
{
|
|
416
455
|
key: "front",
|
|
417
456
|
label: "置顶",
|
|
418
|
-
enabled:
|
|
419
|
-
title:
|
|
457
|
+
enabled: u.value,
|
|
458
|
+
title: u.value ? void 0 : "置顶/置底仅对根图层生效",
|
|
420
459
|
run: () => n.editor.bringToFront()
|
|
421
460
|
},
|
|
422
461
|
{
|
|
423
462
|
key: "back",
|
|
424
463
|
label: "置底",
|
|
425
|
-
enabled:
|
|
426
|
-
title:
|
|
464
|
+
enabled: u.value,
|
|
465
|
+
title: u.value ? void 0 : "置顶/置底仅对根图层生效",
|
|
427
466
|
run: () => n.editor.sendToBack()
|
|
428
467
|
},
|
|
429
468
|
...x.value ? [{
|
|
@@ -435,13 +474,13 @@ var ve = ["aria-disabled"], ye = {
|
|
|
435
474
|
let e = b();
|
|
436
475
|
e && n.editor.convertTableToRows(e);
|
|
437
476
|
}
|
|
438
|
-
}] :
|
|
477
|
+
}] : v.value?.type === "TableLayer" ? [{
|
|
439
478
|
key: "to-template",
|
|
440
479
|
label: "转为模板表…",
|
|
441
|
-
enabled:
|
|
442
|
-
title:
|
|
480
|
+
enabled: w.value,
|
|
481
|
+
title: w.value ? T.value : v.value.rows.length === 0 ? "空表无可转换行" : "末行为空——先为末行加格",
|
|
443
482
|
keepsOpen: !0,
|
|
444
|
-
run: () =>
|
|
483
|
+
run: () => k()
|
|
445
484
|
}] : [],
|
|
446
485
|
{
|
|
447
486
|
key: "delete",
|
|
@@ -454,11 +493,11 @@ var ve = ["aria-disabled"], ye = {
|
|
|
454
493
|
}
|
|
455
494
|
}
|
|
456
495
|
]);
|
|
457
|
-
async function
|
|
496
|
+
async function R(e, t) {
|
|
458
497
|
a.value = {
|
|
459
498
|
x: e,
|
|
460
499
|
y: t
|
|
461
|
-
}, i.value = !0, await
|
|
500
|
+
}, i.value = !0, await V();
|
|
462
501
|
let n = r.value, o = n?.parentElement;
|
|
463
502
|
if (!n || !o) return;
|
|
464
503
|
let s = n.getBoundingClientRect(), c = o.clientWidth - s.width - 2, l = o.clientHeight - s.height - 2;
|
|
@@ -467,69 +506,69 @@ var ve = ["aria-disabled"], ye = {
|
|
|
467
506
|
y: Math.max(2, Math.min(a.value.y, l))
|
|
468
507
|
};
|
|
469
508
|
}
|
|
470
|
-
function
|
|
471
|
-
i.value = !1,
|
|
509
|
+
function z() {
|
|
510
|
+
i.value = !1, E.value = !1, D.value = "", O.value = !1;
|
|
472
511
|
}
|
|
473
|
-
function
|
|
474
|
-
e.run(), e.keepsOpen !== !0 &&
|
|
512
|
+
function B(e) {
|
|
513
|
+
e.run(), e.keepsOpen !== !0 && z();
|
|
475
514
|
}
|
|
476
515
|
return t({
|
|
477
|
-
openAt:
|
|
478
|
-
close:
|
|
479
|
-
}), (e, t) => i.value ? (
|
|
516
|
+
openAt: R,
|
|
517
|
+
close: z
|
|
518
|
+
}), (e, t) => i.value ? (K(), I("div", {
|
|
480
519
|
key: 0,
|
|
481
520
|
ref_key: "rootRef",
|
|
482
521
|
ref: r,
|
|
483
522
|
class: "cn-context-menu",
|
|
484
523
|
role: "menu",
|
|
485
524
|
"aria-label": "图层操作菜单",
|
|
486
|
-
style:
|
|
525
|
+
style: U({
|
|
487
526
|
left: `${a.value.x}px`,
|
|
488
527
|
top: `${a.value.y}px`
|
|
489
528
|
}),
|
|
490
|
-
onPointerdown: t[1] ||=
|
|
491
|
-
onContextmenu: t[2] ||=
|
|
492
|
-
}, [
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
529
|
+
onPointerdown: t[1] ||= $(() => {}, ["stop"]),
|
|
530
|
+
onContextmenu: t[2] ||= $(() => {}, ["prevent"])
|
|
531
|
+
}, [E.value ? (K(), I("div", je, [
|
|
532
|
+
L("p", Me, X(T.value), 1),
|
|
533
|
+
re(L("input", {
|
|
534
|
+
"onUpdate:modelValue": t[0] ||= (e) => D.value = e,
|
|
496
535
|
"data-convert-rows-path": "",
|
|
497
536
|
type: "text",
|
|
498
537
|
placeholder: "数据行路径,如 order.items",
|
|
499
|
-
class:
|
|
500
|
-
onKeydown:
|
|
501
|
-
}, null, 42,
|
|
502
|
-
|
|
503
|
-
|
|
538
|
+
class: H(["cn-context-menu__input", { "cn-context-menu__input--invalid": O.value }]),
|
|
539
|
+
onKeydown: ie($(j, ["prevent"]), ["enter"])
|
|
540
|
+
}, null, 42, Ne), [[te, D.value]]),
|
|
541
|
+
O.value ? (K(), I("p", Pe, " rowsPath 必填 ")) : F("", !0),
|
|
542
|
+
L("div", { class: "cn-context-menu__form-actions" }, [L("button", {
|
|
504
543
|
type: "button",
|
|
505
544
|
class: "cn-context-menu__item cn-context-menu__item--confirm",
|
|
506
|
-
onClick:
|
|
507
|
-
}, " 确认转换 "),
|
|
545
|
+
onClick: j
|
|
546
|
+
}, " 确认转换 "), L("button", {
|
|
508
547
|
type: "button",
|
|
509
548
|
class: "cn-context-menu__item",
|
|
510
|
-
onClick:
|
|
549
|
+
onClick: z
|
|
511
550
|
}, "取消")])
|
|
512
|
-
])) : (
|
|
551
|
+
])) : (K(!0), I(M, { key: 1 }, J(P.value, (e) => (K(), I("button", {
|
|
513
552
|
key: e.key,
|
|
514
553
|
type: "button",
|
|
515
554
|
role: "menuitem",
|
|
516
|
-
class:
|
|
555
|
+
class: H(["cn-context-menu__item", [`cn-context-menu__item--${e.key}`]]),
|
|
517
556
|
disabled: !e.enabled,
|
|
518
557
|
title: e.title,
|
|
519
|
-
onClick: (t) =>
|
|
520
|
-
},
|
|
558
|
+
onClick: (t) => B(e)
|
|
559
|
+
}, X(e.label), 11, Fe))), 128))], 36)) : F("", !0);
|
|
521
560
|
}
|
|
522
561
|
}), [["__scopeId", "data-v-e554ef38"]]);
|
|
523
562
|
//#endregion
|
|
524
563
|
//#region src/canvas/useFindSession.ts
|
|
525
|
-
function
|
|
526
|
-
let t =
|
|
564
|
+
function Le(e) {
|
|
565
|
+
let t = Y(e.store.ui.find.open), n = Y(e.store.ui.find.query), r = Y(e.store.ui.find.replacement), i = Y(e.listFindMatches()), a = Y(e.findCursor), o = () => {
|
|
527
566
|
let o = e.store.ui.find;
|
|
528
567
|
t.value = o.open, n.value = o.query, r.value = o.replacement, i.value = e.listFindMatches(), a.value = e.findCursor;
|
|
529
568
|
}, s = e.subscribe((e) => {
|
|
530
569
|
(e.scope === "doc" || e.scope === "ui" && e.branch === "find") && o();
|
|
531
570
|
});
|
|
532
|
-
return
|
|
571
|
+
return G(s, !0), {
|
|
533
572
|
open: t,
|
|
534
573
|
query: n,
|
|
535
574
|
replacement: r,
|
|
@@ -539,22 +578,22 @@ function ke(e) {
|
|
|
539
578
|
}
|
|
540
579
|
//#endregion
|
|
541
580
|
//#region src/canvas/FindBar.vue?vue&type=script&setup=true&lang.ts
|
|
542
|
-
var
|
|
581
|
+
var Re = ["value"], ze = ["value"], Be = {
|
|
543
582
|
class: "cn-find-bar__count",
|
|
544
583
|
"data-find-count": ""
|
|
545
|
-
},
|
|
584
|
+
}, Ve = {
|
|
546
585
|
key: 0,
|
|
547
586
|
class: "cn-find-bar__note",
|
|
548
587
|
"data-find-note": ""
|
|
549
|
-
},
|
|
588
|
+
}, He = ["disabled"], Ue = ["disabled"], We = ["disabled"], Ge = ["disabled"], Ke = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
550
589
|
__name: "FindBar",
|
|
551
590
|
props: { editor: {} },
|
|
552
591
|
setup(e, { expose: t }) {
|
|
553
|
-
let n = e, { open: r, query: i, replacement: a, matches: o, cursor:
|
|
592
|
+
let n = e, { open: r, query: i, replacement: a, matches: o, cursor: s } = Le(n.editor), c = q(null), u = q(null), d = N(() => {
|
|
554
593
|
let e = o.value.length;
|
|
555
|
-
return e === 0 ? i.value === "" ? "" : "无结果" : `第 ${
|
|
556
|
-
}),
|
|
557
|
-
function
|
|
594
|
+
return e === 0 ? i.value === "" ? "" : "无结果" : `第 ${s.value + 1}/${e} 处`;
|
|
595
|
+
}), f = N(() => o.value.length > 0), p = N(() => f.value && s.value > 0), m = N(() => f.value && s.value < o.value.length - 1);
|
|
596
|
+
function g(e) {
|
|
558
597
|
let t = o.value[e];
|
|
559
598
|
if (!t) return;
|
|
560
599
|
n.editor.setSelection(t.path);
|
|
@@ -564,15 +603,15 @@ var Ae = ["value"], je = ["value"], Me = {
|
|
|
564
603
|
function v(e) {
|
|
565
604
|
let t = o.value.length;
|
|
566
605
|
if (t === 0) return;
|
|
567
|
-
let r = Math.min(Math.max(
|
|
568
|
-
n.editor.setFindCursor(r),
|
|
606
|
+
let r = Math.min(Math.max(s.value + e, 0), t - 1);
|
|
607
|
+
n.editor.setFindCursor(r), g(r);
|
|
569
608
|
}
|
|
570
609
|
function y() {
|
|
571
|
-
n.editor.replaceOne() &&
|
|
610
|
+
n.editor.replaceOne() && g(s.value);
|
|
572
611
|
}
|
|
573
612
|
function b() {
|
|
574
613
|
let e = n.editor.replaceAll();
|
|
575
|
-
e !== 0 && (u.value = `已替换 ${e} 处`,
|
|
614
|
+
e !== 0 && (u.value = `已替换 ${e} 处`, g(s.value));
|
|
576
615
|
}
|
|
577
616
|
function x() {
|
|
578
617
|
n.editor.closeFind(), u.value = null;
|
|
@@ -592,98 +631,98 @@ var Ae = ["value"], je = ["value"], Me = {
|
|
|
592
631
|
function w(e) {
|
|
593
632
|
n.editor.setFindReplacement(e.target.value);
|
|
594
633
|
}
|
|
595
|
-
|
|
596
|
-
e &&
|
|
634
|
+
Q(r, (e) => {
|
|
635
|
+
e && c.value?.focus({ preventScroll: !0 });
|
|
597
636
|
}, {
|
|
598
637
|
immediate: !0,
|
|
599
638
|
flush: "post"
|
|
600
639
|
});
|
|
601
640
|
function T(e) {
|
|
602
|
-
r.value && (e.key.toLowerCase() !== "f" || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey ||
|
|
641
|
+
r.value && (e.key.toLowerCase() !== "f" || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || _(e.target) || c.value?.focus({ preventScroll: !0 }));
|
|
603
642
|
}
|
|
604
|
-
return window.addEventListener("keydown", T),
|
|
643
|
+
return window.addEventListener("keydown", T), W(() => window.removeEventListener("keydown", T)), Q(i, () => {
|
|
605
644
|
u.value = null;
|
|
606
|
-
}), t({ close: x }), (e, t) =>
|
|
645
|
+
}), t({ close: x }), (e, t) => Z(r) ? (K(), I("div", {
|
|
607
646
|
key: 0,
|
|
608
647
|
class: "cn-find-bar",
|
|
609
648
|
"data-find-bar": "",
|
|
610
649
|
role: "search",
|
|
611
650
|
"aria-label": "查找替换",
|
|
612
|
-
onPointerdown: t[2] ||=
|
|
651
|
+
onPointerdown: t[2] ||= $(() => {}, ["stop"])
|
|
613
652
|
}, [
|
|
614
|
-
|
|
653
|
+
L("input", {
|
|
615
654
|
ref_key: "queryInput",
|
|
616
|
-
ref:
|
|
655
|
+
ref: c,
|
|
617
656
|
class: "cn-find-bar__input",
|
|
618
657
|
"data-find-query": "",
|
|
619
658
|
type: "text",
|
|
620
|
-
value:
|
|
659
|
+
value: Z(i),
|
|
621
660
|
placeholder: "查找",
|
|
622
661
|
"aria-label": "查找",
|
|
623
662
|
spellcheck: "false",
|
|
624
663
|
autocomplete: "off",
|
|
625
664
|
onInput: C,
|
|
626
665
|
onKeydown: S
|
|
627
|
-
}, null, 40,
|
|
628
|
-
|
|
666
|
+
}, null, 40, Re),
|
|
667
|
+
L("input", {
|
|
629
668
|
class: "cn-find-bar__input",
|
|
630
669
|
"data-find-replace": "",
|
|
631
670
|
type: "text",
|
|
632
|
-
value:
|
|
671
|
+
value: Z(a),
|
|
633
672
|
placeholder: "替换",
|
|
634
673
|
"aria-label": "替换",
|
|
635
674
|
spellcheck: "false",
|
|
636
675
|
autocomplete: "off",
|
|
637
676
|
onInput: w,
|
|
638
677
|
onKeydown: S
|
|
639
|
-
}, null, 40,
|
|
640
|
-
|
|
641
|
-
u.value ? (
|
|
642
|
-
|
|
678
|
+
}, null, 40, ze),
|
|
679
|
+
L("span", Be, X(d.value), 1),
|
|
680
|
+
u.value ? (K(), I("span", Ve, X(u.value), 1)) : F("", !0),
|
|
681
|
+
L("button", {
|
|
643
682
|
type: "button",
|
|
644
683
|
class: "cn-find-bar__key",
|
|
645
684
|
"data-find-prev": "",
|
|
646
|
-
disabled: !
|
|
685
|
+
disabled: !p.value,
|
|
647
686
|
title: "上一处(Shift+Enter)",
|
|
648
687
|
"aria-label": "上一处",
|
|
649
688
|
onClick: t[0] ||= (e) => v(-1)
|
|
650
|
-
}, [
|
|
651
|
-
|
|
689
|
+
}, [R(h, { icon: Z(le) }, null, 8, ["icon"])], 8, He),
|
|
690
|
+
L("button", {
|
|
652
691
|
type: "button",
|
|
653
692
|
class: "cn-find-bar__key",
|
|
654
693
|
"data-find-next": "",
|
|
655
|
-
disabled: !
|
|
694
|
+
disabled: !m.value,
|
|
656
695
|
title: "下一处(Enter)",
|
|
657
696
|
"aria-label": "下一处",
|
|
658
697
|
onClick: t[1] ||= (e) => v(1)
|
|
659
|
-
}, [
|
|
660
|
-
|
|
698
|
+
}, [R(h, { icon: Z(l) }, null, 8, ["icon"])], 8, Ue),
|
|
699
|
+
L("button", {
|
|
661
700
|
type: "button",
|
|
662
701
|
class: "cn-find-bar__action",
|
|
663
702
|
"data-find-replace-one": "",
|
|
664
|
-
disabled: !
|
|
703
|
+
disabled: !f.value,
|
|
665
704
|
title: "替换当前处",
|
|
666
705
|
onClick: y
|
|
667
|
-
}, " 替换 ", 8,
|
|
668
|
-
|
|
706
|
+
}, " 替换 ", 8, We),
|
|
707
|
+
L("button", {
|
|
669
708
|
type: "button",
|
|
670
709
|
class: "cn-find-bar__action",
|
|
671
710
|
"data-find-replace-all": "",
|
|
672
|
-
disabled: !
|
|
711
|
+
disabled: !f.value,
|
|
673
712
|
title: "全部替换",
|
|
674
713
|
onClick: b
|
|
675
|
-
}, " 全部替换 ", 8,
|
|
676
|
-
|
|
714
|
+
}, " 全部替换 ", 8, Ge),
|
|
715
|
+
L("button", {
|
|
677
716
|
type: "button",
|
|
678
717
|
class: "cn-find-bar__key",
|
|
679
718
|
"data-find-close": "",
|
|
680
719
|
title: "关闭(Esc)",
|
|
681
720
|
"aria-label": "关闭查找替换",
|
|
682
721
|
onClick: x
|
|
683
|
-
}, [
|
|
684
|
-
], 32)) :
|
|
722
|
+
}, [R(h, { icon: Z(pe) }, null, 8, ["icon"])])
|
|
723
|
+
], 32)) : F("", !0);
|
|
685
724
|
}
|
|
686
|
-
}), [["__scopeId", "data-v-71f0a3ae"]]),
|
|
725
|
+
}), [["__scopeId", "data-v-71f0a3ae"]]), qe = {
|
|
687
726
|
nw: "nwse-resize",
|
|
688
727
|
se: "nwse-resize",
|
|
689
728
|
ne: "nesw-resize",
|
|
@@ -692,123 +731,421 @@ var Ae = ["value"], je = ["value"], Me = {
|
|
|
692
731
|
s: "ns-resize",
|
|
693
732
|
e: "ew-resize",
|
|
694
733
|
w: "ew-resize"
|
|
695
|
-
},
|
|
734
|
+
}, Je = {
|
|
735
|
+
class: "cn-edit-toolbar__segment",
|
|
736
|
+
role: "group",
|
|
737
|
+
"aria-label": "内容类型",
|
|
738
|
+
"data-content-pill": ""
|
|
739
|
+
}, Ye = [
|
|
696
740
|
"aria-pressed",
|
|
697
741
|
"data-pill-static",
|
|
698
742
|
"data-pill-expression",
|
|
699
743
|
"onClick"
|
|
700
|
-
],
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
744
|
+
], Xe = { class: "cn-edit-toolbar__segment" }, Ze = ["value"], Qe = ["value"], $e = {
|
|
745
|
+
class: "cn-edit-toolbar__segment",
|
|
746
|
+
role: "group",
|
|
747
|
+
"aria-label": "字号"
|
|
748
|
+
}, et = { class: "cn-edit-toolbar__segment" }, tt = ["value"], nt = {
|
|
749
|
+
class: "cn-edit-toolbar__segment",
|
|
750
|
+
role: "group",
|
|
751
|
+
"aria-label": "水平对齐",
|
|
752
|
+
"data-toolbar-align-horizontal": ""
|
|
753
|
+
}, rt = [
|
|
754
|
+
"aria-pressed",
|
|
755
|
+
"title",
|
|
756
|
+
"data-align-h",
|
|
757
|
+
"onClick"
|
|
758
|
+
], it = {
|
|
759
|
+
class: "cn-edit-toolbar__segment",
|
|
760
|
+
role: "group",
|
|
761
|
+
"aria-label": "垂直对齐",
|
|
762
|
+
"data-toolbar-align-vertical": ""
|
|
763
|
+
}, at = [
|
|
764
|
+
"aria-pressed",
|
|
765
|
+
"title",
|
|
766
|
+
"data-align-v",
|
|
767
|
+
"onClick"
|
|
768
|
+
], ot = { class: "cn-edit-toolbar__segment" }, st = ["aria-pressed"], ct = 1, lt = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
769
|
+
__name: "EditOverlayToolbar",
|
|
770
|
+
props: {
|
|
771
|
+
mode: {},
|
|
772
|
+
font: {},
|
|
773
|
+
fontSize: {},
|
|
774
|
+
fontColor: {},
|
|
775
|
+
horizontalAlign: {},
|
|
776
|
+
verticalAlign: {},
|
|
777
|
+
autowrap: { type: Boolean }
|
|
778
|
+
},
|
|
779
|
+
emits: ["change", "styleWrite"],
|
|
780
|
+
setup(e, { expose: o, emit: l }) {
|
|
781
|
+
let d = e, f = l, p = q(null);
|
|
782
|
+
o({ rootEl: p });
|
|
783
|
+
function m(e, t, n) {
|
|
784
|
+
f("styleWrite", {
|
|
785
|
+
key: e,
|
|
786
|
+
value: t,
|
|
787
|
+
final: n
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
let g = [{
|
|
708
791
|
value: "static",
|
|
709
792
|
label: "静态"
|
|
710
793
|
}, {
|
|
711
794
|
value: "expression",
|
|
712
795
|
label: "表达式"
|
|
713
796
|
}];
|
|
714
|
-
function
|
|
715
|
-
e !==
|
|
797
|
+
function _(e) {
|
|
798
|
+
e !== d.mode && f("change", e);
|
|
716
799
|
}
|
|
717
|
-
|
|
800
|
+
let v = w(), y = N(() => {
|
|
801
|
+
let e = [{
|
|
802
|
+
label: "内置默认字体",
|
|
803
|
+
value: ""
|
|
804
|
+
}];
|
|
805
|
+
if (v !== null) for (let t of v.entries.value) t.ref !== "" && e.push({
|
|
806
|
+
label: t.label,
|
|
807
|
+
value: t.ref
|
|
808
|
+
});
|
|
809
|
+
let t = d.font;
|
|
810
|
+
return t !== "" && !e.some((e) => e.value === t) && e.push({
|
|
811
|
+
label: b(t),
|
|
812
|
+
value: t
|
|
813
|
+
}), e;
|
|
814
|
+
});
|
|
815
|
+
function b(e) {
|
|
816
|
+
return e.startsWith("data:") ? "自定义字体(内联)" : e.split("/").pop() || e;
|
|
817
|
+
}
|
|
818
|
+
function x(e) {
|
|
819
|
+
m(["font"], e.target.value, !0);
|
|
820
|
+
}
|
|
821
|
+
let S = q(String(d.fontSize)), C = q(!1);
|
|
822
|
+
Q(() => d.fontSize, (e) => {
|
|
823
|
+
C.value || (S.value = String(e));
|
|
824
|
+
});
|
|
825
|
+
function T(e) {
|
|
826
|
+
return Math.max(ct, Math.trunc(e));
|
|
827
|
+
}
|
|
828
|
+
function E(e) {
|
|
829
|
+
if (e.value.trim() === "") return null;
|
|
830
|
+
let t = Number(e.value);
|
|
831
|
+
return Number.isFinite(t) ? t : null;
|
|
832
|
+
}
|
|
833
|
+
function D(e) {
|
|
834
|
+
let t = e.target;
|
|
835
|
+
S.value = t.value;
|
|
836
|
+
let n = E(t);
|
|
837
|
+
n !== null && m(["fontSize"], T(n), !1);
|
|
838
|
+
}
|
|
839
|
+
function O(e) {
|
|
840
|
+
let t = e.target, n = E(t);
|
|
841
|
+
if (n === null) {
|
|
842
|
+
S.value = String(d.fontSize);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
let r = T(n);
|
|
846
|
+
S.value = String(r), m(["fontSize"], r, !0);
|
|
847
|
+
}
|
|
848
|
+
function k(e) {
|
|
849
|
+
let t = T(d.fontSize + e);
|
|
850
|
+
S.value = String(t), m(["fontSize"], t, !1);
|
|
851
|
+
}
|
|
852
|
+
let A = N(() => /^#[0-9a-fA-F]{6}$/.test(d.fontColor) ? d.fontColor : "#000000");
|
|
853
|
+
function j(e) {
|
|
854
|
+
m(["fontColor"], e.target.value, !1);
|
|
855
|
+
}
|
|
856
|
+
function P(e) {
|
|
857
|
+
m(["fontColor"], e.target.value, !0);
|
|
858
|
+
}
|
|
859
|
+
let F = {
|
|
860
|
+
left: {
|
|
861
|
+
icon: t,
|
|
862
|
+
title: "左对齐"
|
|
863
|
+
},
|
|
864
|
+
center: {
|
|
865
|
+
icon: r,
|
|
866
|
+
title: "居中对齐"
|
|
867
|
+
},
|
|
868
|
+
right: {
|
|
869
|
+
icon: u,
|
|
870
|
+
title: "右对齐"
|
|
871
|
+
}
|
|
872
|
+
}, z = {
|
|
873
|
+
top: {
|
|
874
|
+
icon: i,
|
|
875
|
+
title: "顶对齐"
|
|
876
|
+
},
|
|
877
|
+
center: {
|
|
878
|
+
icon: s,
|
|
879
|
+
title: "居中对齐"
|
|
880
|
+
},
|
|
881
|
+
bottom: {
|
|
882
|
+
icon: n,
|
|
883
|
+
title: "底对齐"
|
|
884
|
+
}
|
|
885
|
+
}, B = a.map((e) => ({
|
|
886
|
+
value: e,
|
|
887
|
+
...F[e]
|
|
888
|
+
})), V = c.map((e) => ({
|
|
889
|
+
value: e,
|
|
890
|
+
...z[e]
|
|
891
|
+
}));
|
|
892
|
+
function U(e, t) {
|
|
893
|
+
t !== (e === "horizontal" ? d.horizontalAlign : d.verticalAlign) && m(e === "horizontal" ? ["align", "horizontal"] : ["align", "vertical"], t, !0);
|
|
894
|
+
}
|
|
895
|
+
function W() {
|
|
896
|
+
m(["autowrap"], !d.autowrap, !0);
|
|
897
|
+
}
|
|
898
|
+
return (t, n) => (K(), I("div", {
|
|
718
899
|
ref_key: "rootRef",
|
|
719
|
-
ref:
|
|
720
|
-
class: "cn-
|
|
721
|
-
role: "
|
|
722
|
-
"aria-label": "
|
|
723
|
-
"data-
|
|
724
|
-
onPointerdown: n[
|
|
725
|
-
}, [
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
900
|
+
ref: p,
|
|
901
|
+
class: "cn-edit-toolbar",
|
|
902
|
+
role: "toolbar",
|
|
903
|
+
"aria-label": "文本编辑",
|
|
904
|
+
"data-edit-toolbar": "",
|
|
905
|
+
onPointerdown: n[7] ||= $(() => {}, ["prevent"])
|
|
906
|
+
}, [
|
|
907
|
+
L("span", Je, [(K(), I(M, null, J(g, (t) => L("button", {
|
|
908
|
+
key: t.value,
|
|
909
|
+
type: "button",
|
|
910
|
+
class: H(["cn-edit-toolbar__item", { "cn-edit-toolbar__item--active": t.value === e.mode }]),
|
|
911
|
+
"aria-pressed": t.value === e.mode,
|
|
912
|
+
"data-pill-static": t.value === "static" || void 0,
|
|
913
|
+
"data-pill-expression": t.value === "expression" || void 0,
|
|
914
|
+
onClick: (e) => _(t.value)
|
|
915
|
+
}, X(t.label), 11, Ye)), 64))]),
|
|
916
|
+
L("span", Xe, [L("select", {
|
|
917
|
+
class: "cn-edit-toolbar__font",
|
|
918
|
+
"data-toolbar-font": "",
|
|
919
|
+
value: e.font,
|
|
920
|
+
title: "字体",
|
|
921
|
+
onPointerdown: n[0] ||= $(() => {}, ["stop"]),
|
|
922
|
+
onChange: x
|
|
923
|
+
}, [(K(!0), I(M, null, J(y.value, (e) => (K(), I("option", {
|
|
924
|
+
key: e.value,
|
|
925
|
+
value: e.value
|
|
926
|
+
}, X(e.label), 9, Qe))), 128))], 40, Ze)]),
|
|
927
|
+
L("span", $e, [
|
|
928
|
+
L("button", {
|
|
929
|
+
type: "button",
|
|
930
|
+
class: "cn-edit-toolbar__mini",
|
|
931
|
+
"data-toolbar-font-size-dec": "",
|
|
932
|
+
title: "字号减 1",
|
|
933
|
+
onClick: n[1] ||= (e) => k(-1)
|
|
934
|
+
}, [R(h, {
|
|
935
|
+
icon: Z(ue),
|
|
936
|
+
size: 11
|
|
937
|
+
}, null, 8, ["icon"])]),
|
|
938
|
+
re(L("input", {
|
|
939
|
+
"onUpdate:modelValue": n[2] ||= (e) => S.value = e,
|
|
940
|
+
class: "cn-edit-toolbar__size",
|
|
941
|
+
"data-toolbar-font-size": "",
|
|
942
|
+
type: "number",
|
|
943
|
+
min: ct,
|
|
944
|
+
step: 1,
|
|
945
|
+
"aria-label": "字号(场景像素)",
|
|
946
|
+
title: "字号(场景像素)",
|
|
947
|
+
onPointerdown: n[3] ||= $(() => {}, ["stop"]),
|
|
948
|
+
onInput: D,
|
|
949
|
+
onChange: O,
|
|
950
|
+
onBlur: O,
|
|
951
|
+
onFocus: n[4] ||= (e) => C.value = !0
|
|
952
|
+
}, null, 544), [[te, S.value]]),
|
|
953
|
+
L("button", {
|
|
954
|
+
type: "button",
|
|
955
|
+
class: "cn-edit-toolbar__mini",
|
|
956
|
+
"data-toolbar-font-size-inc": "",
|
|
957
|
+
title: "字号加 1",
|
|
958
|
+
onClick: n[5] ||= (e) => k(1)
|
|
959
|
+
}, [R(h, {
|
|
960
|
+
icon: Z(de),
|
|
961
|
+
size: 11
|
|
962
|
+
}, null, 8, ["icon"])])
|
|
963
|
+
]),
|
|
964
|
+
L("span", et, [L("input", {
|
|
965
|
+
class: "cn-edit-toolbar__color",
|
|
966
|
+
"data-toolbar-font-color": "",
|
|
967
|
+
type: "color",
|
|
968
|
+
value: A.value,
|
|
969
|
+
"aria-label": "字色",
|
|
970
|
+
title: "字色",
|
|
971
|
+
onPointerdown: n[6] ||= $(() => {}, ["stop"]),
|
|
972
|
+
onInput: j,
|
|
973
|
+
onChange: P
|
|
974
|
+
}, null, 40, tt)]),
|
|
975
|
+
L("span", nt, [(K(!0), I(M, null, J(Z(B), (t) => (K(), I("button", {
|
|
976
|
+
key: t.value,
|
|
977
|
+
type: "button",
|
|
978
|
+
class: H(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.horizontalAlign }]),
|
|
979
|
+
"aria-pressed": t.value === e.horizontalAlign,
|
|
980
|
+
title: `水平对齐:${t.title}`,
|
|
981
|
+
"data-align-h": t.value,
|
|
982
|
+
onClick: (e) => U("horizontal", t.value)
|
|
983
|
+
}, [R(h, {
|
|
984
|
+
icon: t.icon,
|
|
985
|
+
size: 12
|
|
986
|
+
}, null, 8, ["icon"])], 10, rt))), 128))]),
|
|
987
|
+
L("span", it, [(K(!0), I(M, null, J(Z(V), (t) => (K(), I("button", {
|
|
988
|
+
key: t.value,
|
|
989
|
+
type: "button",
|
|
990
|
+
class: H(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.verticalAlign }]),
|
|
991
|
+
"aria-pressed": t.value === e.verticalAlign,
|
|
992
|
+
title: `垂直对齐:${t.title}`,
|
|
993
|
+
"data-align-v": t.value,
|
|
994
|
+
onClick: (e) => U("vertical", t.value)
|
|
995
|
+
}, [R(h, {
|
|
996
|
+
icon: t.icon,
|
|
997
|
+
size: 12
|
|
998
|
+
}, null, 8, ["icon"])], 10, at))), 128))]),
|
|
999
|
+
L("span", ot, [L("button", {
|
|
1000
|
+
type: "button",
|
|
1001
|
+
class: H(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": e.autowrap }]),
|
|
1002
|
+
"aria-pressed": e.autowrap,
|
|
1003
|
+
"data-toolbar-autowrap": "",
|
|
1004
|
+
title: "自动换行",
|
|
1005
|
+
onClick: W
|
|
1006
|
+
}, [R(h, {
|
|
1007
|
+
icon: Z(fe),
|
|
1008
|
+
size: 12
|
|
1009
|
+
}, null, 8, ["icon"])], 10, st)])
|
|
1010
|
+
], 544));
|
|
734
1011
|
}
|
|
735
|
-
}), [["__scopeId", "data-v-
|
|
1012
|
+
}), [["__scopeId", "data-v-dcead501"]]);
|
|
736
1013
|
//#endregion
|
|
737
1014
|
//#region src/canvas/useDpr.ts
|
|
738
|
-
function
|
|
1015
|
+
function ut(e) {
|
|
739
1016
|
let t = null, n = () => {
|
|
740
1017
|
t?.removeEventListener("change", n), e(window.devicePixelRatio || 1), t = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`), t.addEventListener("change", n);
|
|
741
1018
|
};
|
|
742
1019
|
return n(), () => t?.removeEventListener("change", n);
|
|
743
1020
|
}
|
|
744
|
-
function
|
|
745
|
-
let e =
|
|
1021
|
+
function dt() {
|
|
1022
|
+
let e = Y(window.devicePixelRatio || 1), t = ut((t) => {
|
|
746
1023
|
e.value = t;
|
|
747
1024
|
});
|
|
748
|
-
return
|
|
1025
|
+
return G(t, !0), e;
|
|
749
1026
|
}
|
|
750
1027
|
//#endregion
|
|
751
1028
|
//#region src/canvas/useTextEditing.ts
|
|
752
|
-
var
|
|
753
|
-
function
|
|
754
|
-
let n = `${e}|${t}`, r =
|
|
1029
|
+
var ft = /* @__PURE__ */ new Map();
|
|
1030
|
+
function pt(e, t) {
|
|
1031
|
+
let n = `${e}|${t}`, r = ft.get(n);
|
|
755
1032
|
if (r !== void 0) return r;
|
|
756
1033
|
let i = t * 1.2;
|
|
757
1034
|
try {
|
|
758
1035
|
let n = document.createElement("canvas").getContext("2d");
|
|
759
1036
|
if (n) {
|
|
760
|
-
n.font = `${t}px ${
|
|
1037
|
+
n.font = `${t}px ${we(e)}`;
|
|
761
1038
|
let r = n.measureText("字"), a = (r.fontBoundingBoxAscent ?? r.actualBoundingBoxAscent) + (r.fontBoundingBoxDescent ?? r.actualBoundingBoxDescent);
|
|
762
1039
|
a > 0 && (i = a);
|
|
763
1040
|
}
|
|
764
1041
|
} catch {}
|
|
765
|
-
return
|
|
1042
|
+
return ft.set(n, i), i;
|
|
766
1043
|
}
|
|
767
|
-
function
|
|
768
|
-
let n =
|
|
769
|
-
|
|
1044
|
+
function mt(e, t) {
|
|
1045
|
+
let n = Y(e.store.ui.editing), r = Y(0), i = e.subscribe((t) => {
|
|
1046
|
+
t.scope === "doc" ? (r.value += 1, n.value = e.store.ui.editing) : t.scope === "ui" && t.branch === "editing" && (n.value = e.store.ui.editing);
|
|
770
1047
|
});
|
|
771
|
-
|
|
772
|
-
let
|
|
1048
|
+
G(i, !0);
|
|
1049
|
+
let a = N(() => n.value?.path ?? null), o = dt(), s = j(e), c = N(() => {
|
|
1050
|
+
r.value;
|
|
773
1051
|
let t = n.value;
|
|
774
1052
|
return t ? e.textEditLayout(t.path) : null;
|
|
775
|
-
}),
|
|
776
|
-
function
|
|
777
|
-
let { x: n, y: r, zoom: i } =
|
|
1053
|
+
}), l = N(() => me(s.value, o.value));
|
|
1054
|
+
function u(e, t) {
|
|
1055
|
+
let { x: n, y: r, zoom: i } = l.value;
|
|
778
1056
|
return {
|
|
779
1057
|
left: (e - n) * i,
|
|
780
1058
|
top: (t - r) * i,
|
|
781
1059
|
zoom: i
|
|
782
1060
|
};
|
|
783
1061
|
}
|
|
784
|
-
let
|
|
785
|
-
let e =
|
|
1062
|
+
let d = N(() => {
|
|
1063
|
+
let e = c.value;
|
|
786
1064
|
if (!e) return null;
|
|
787
|
-
let { left: t, top: n, zoom: r } =
|
|
1065
|
+
let { left: t, top: n, zoom: r } = u(e.box.x, e.box.y);
|
|
788
1066
|
return {
|
|
789
1067
|
transform: `translate(${t}px, ${n}px) scale(${r})`,
|
|
790
1068
|
transformOrigin: "0 0",
|
|
791
1069
|
width: `${e.box.width}px`,
|
|
792
1070
|
height: `${e.box.height}px`,
|
|
793
1071
|
color: e.fontColor,
|
|
794
|
-
fontFamily:
|
|
1072
|
+
fontFamily: we(e.font),
|
|
795
1073
|
fontSize: `${e.fontSize}px`,
|
|
796
1074
|
lineHeight: `${e.lineHeightPx}px`,
|
|
797
|
-
...
|
|
1075
|
+
...x(e),
|
|
798
1076
|
textAlign: e.horizontalAlign,
|
|
799
1077
|
whiteSpace: e.autowrap ? "pre-wrap" : "pre"
|
|
800
1078
|
};
|
|
801
|
-
}),
|
|
802
|
-
|
|
1079
|
+
}), f = Y({
|
|
1080
|
+
width: 0,
|
|
1081
|
+
height: 0
|
|
1082
|
+
}), p = Y({
|
|
1083
|
+
width: 0,
|
|
1084
|
+
height: 0
|
|
1085
|
+
}), m = () => {
|
|
1086
|
+
let t = e.getSurfaceSize();
|
|
1087
|
+
f.value = {
|
|
1088
|
+
width: t.width,
|
|
1089
|
+
height: t.height
|
|
1090
|
+
};
|
|
1091
|
+
}, h = () => {
|
|
1092
|
+
let e = t.getToolbar?.() ?? null;
|
|
1093
|
+
p.value = e === null ? {
|
|
1094
|
+
width: 0,
|
|
1095
|
+
height: 0
|
|
1096
|
+
} : {
|
|
1097
|
+
width: e.offsetWidth,
|
|
1098
|
+
height: e.offsetHeight
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
Q(a, (e) => {
|
|
1102
|
+
e !== null && m();
|
|
1103
|
+
}, { flush: "post" });
|
|
1104
|
+
let g = null;
|
|
1105
|
+
Q(() => t.getToolbar?.() ?? null, (e) => {
|
|
1106
|
+
g?.disconnect(), g = null, e !== null && (h(), typeof ResizeObserver == "function" && (g = new ResizeObserver(h), g.observe(e)));
|
|
1107
|
+
}, { flush: "post" });
|
|
1108
|
+
let _ = null;
|
|
1109
|
+
ee(() => {
|
|
1110
|
+
let e = t.getHost();
|
|
1111
|
+
e !== null && typeof ResizeObserver == "function" && (_ = new ResizeObserver(() => {
|
|
1112
|
+
f.value = {
|
|
1113
|
+
width: e.clientWidth,
|
|
1114
|
+
height: e.clientHeight
|
|
1115
|
+
};
|
|
1116
|
+
}), _.observe(e));
|
|
1117
|
+
}), G(() => {
|
|
1118
|
+
_?.disconnect(), g?.disconnect();
|
|
1119
|
+
}, !0);
|
|
1120
|
+
let v = N(() => {
|
|
1121
|
+
let e = c.value;
|
|
803
1122
|
if (!e) return null;
|
|
804
|
-
let {
|
|
1123
|
+
let { width: t, height: n } = p.value, r = u(e.box.x + e.box.width / 2, e.box.y), i = u(e.box.x + e.box.width / 2, e.box.y + e.box.height), a = r.top - 4 - n < 0, o = a ? i.top + 4 : r.top - 4 - n;
|
|
805
1124
|
return {
|
|
806
|
-
|
|
807
|
-
|
|
1125
|
+
left: Math.min(Math.max(r.left - t / 2, 0), Math.max(0, f.value.width - t)),
|
|
1126
|
+
top: o,
|
|
1127
|
+
height: n,
|
|
1128
|
+
flipped: a
|
|
808
1129
|
};
|
|
1130
|
+
}), y = N(() => {
|
|
1131
|
+
let e = v.value;
|
|
1132
|
+
return e ? {
|
|
1133
|
+
left: `${e.left}px`,
|
|
1134
|
+
top: `${e.top}px`
|
|
1135
|
+
} : null;
|
|
1136
|
+
}), b = N(() => {
|
|
1137
|
+
let e = v.value;
|
|
1138
|
+
return e ? e.flipped ? {
|
|
1139
|
+
left: `${e.left}px`,
|
|
1140
|
+
top: `${e.top + e.height + 4}px`
|
|
1141
|
+
} : {
|
|
1142
|
+
left: `${e.left}px`,
|
|
1143
|
+
top: `${e.top - 4}px`,
|
|
1144
|
+
transform: "translateY(-100%)"
|
|
1145
|
+
} : null;
|
|
809
1146
|
});
|
|
810
|
-
function
|
|
811
|
-
let t = e.padding.top + e.verticalAnchorY, n = e.lineHeightPx, r =
|
|
1147
|
+
function x(e) {
|
|
1148
|
+
let t = e.padding.top + e.verticalAnchorY, n = e.lineHeightPx, r = pt(e.font, e.fontSize), i;
|
|
812
1149
|
return i = e.verticalAlign === "center" ? t - n / 2 : e.verticalAlign === "bottom" ? t - (n + r) / 2 : t - (n - r) / 2, {
|
|
813
1150
|
paddingTop: `${Math.max(0, i)}px`,
|
|
814
1151
|
paddingRight: `${e.padding.right}px`,
|
|
@@ -816,170 +1153,212 @@ function Ge(e, t) {
|
|
|
816
1153
|
paddingLeft: `${e.padding.left}px`
|
|
817
1154
|
};
|
|
818
1155
|
}
|
|
819
|
-
let
|
|
1156
|
+
let S = (t, n) => {
|
|
820
1157
|
let r = e.hitTest(t, n);
|
|
821
1158
|
return r !== null && e.beginTextEdit(r);
|
|
822
|
-
},
|
|
1159
|
+
}, C = (t) => e.beginTextEdit(t), w = (t) => {
|
|
823
1160
|
let n = e.store.ui.editing;
|
|
824
1161
|
n && n.expression !== t && e.store.setEditing({
|
|
825
|
-
|
|
1162
|
+
...n,
|
|
826
1163
|
expression: t
|
|
827
1164
|
});
|
|
828
|
-
},
|
|
1165
|
+
}, T = (t, n, r) => {
|
|
1166
|
+
let i = e.store.ui.editing?.path;
|
|
1167
|
+
if (!i) return;
|
|
1168
|
+
let a = E(i, t);
|
|
1169
|
+
e.updateSpec(i, t, n, { mergeKey: a }), r && e.store.closeMerge(a);
|
|
1170
|
+
}, D = null, O = !1, k = !1, A = () => {
|
|
829
1171
|
e.commitTextEdit(t.getTextarea()?.value ?? "");
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
},
|
|
833
|
-
if (
|
|
834
|
-
|
|
1172
|
+
}, M = () => {
|
|
1173
|
+
D !== null && clearTimeout(D), D = null;
|
|
1174
|
+
}, P = () => {
|
|
1175
|
+
if (M(), F.value) {
|
|
1176
|
+
k = !0;
|
|
835
1177
|
return;
|
|
836
1178
|
}
|
|
837
|
-
|
|
838
|
-
},
|
|
839
|
-
|
|
840
|
-
},
|
|
841
|
-
if (
|
|
842
|
-
if (
|
|
843
|
-
|
|
1179
|
+
A();
|
|
1180
|
+
}, F = Y(!1), I = (e) => {
|
|
1181
|
+
F.value = e, !e && k && (k = !1, a.value !== null && A());
|
|
1182
|
+
}, L = () => {
|
|
1183
|
+
if (a.value !== null) {
|
|
1184
|
+
if (M(), O) {
|
|
1185
|
+
O = !1;
|
|
844
1186
|
return;
|
|
845
1187
|
}
|
|
846
|
-
|
|
847
|
-
|
|
1188
|
+
D = setTimeout(() => {
|
|
1189
|
+
D = null;
|
|
848
1190
|
let e = t.getTextarea();
|
|
849
1191
|
if (e === null || document.activeElement !== e) {
|
|
850
|
-
if (
|
|
851
|
-
|
|
1192
|
+
if (F.value) {
|
|
1193
|
+
k = !0;
|
|
852
1194
|
return;
|
|
853
1195
|
}
|
|
854
|
-
|
|
1196
|
+
A();
|
|
855
1197
|
}
|
|
856
1198
|
}, 0);
|
|
857
1199
|
}
|
|
858
|
-
},
|
|
1200
|
+
}, R = (e) => {
|
|
859
1201
|
if (!(e instanceof Node)) return !1;
|
|
860
|
-
let n = t.
|
|
1202
|
+
let n = t.getToolbar?.() ?? null;
|
|
861
1203
|
if (n !== null && n.contains(e)) return !0;
|
|
862
1204
|
let r = t.getTextarea();
|
|
863
1205
|
return r !== null && r.contains(e);
|
|
864
|
-
},
|
|
865
|
-
if (
|
|
866
|
-
let n = t.
|
|
867
|
-
n !== null && n.contains(e.target)
|
|
868
|
-
|
|
869
|
-
|
|
1206
|
+
}, z = (e) => {
|
|
1207
|
+
if (a.value === null) return;
|
|
1208
|
+
let n = t.getToolbar?.() ?? null;
|
|
1209
|
+
if (n !== null && e.target instanceof Node && n.contains(e.target)) {
|
|
1210
|
+
O = !0;
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
if (R(e.target)) return;
|
|
1214
|
+
let r = t.getHost();
|
|
1215
|
+
r !== null && r.contains(e.target) || (O = !0);
|
|
1216
|
+
}, B = () => {
|
|
1217
|
+
O = !1;
|
|
870
1218
|
};
|
|
871
|
-
return window.addEventListener("pointerdown",
|
|
872
|
-
window.removeEventListener("pointerdown",
|
|
1219
|
+
return window.addEventListener("pointerdown", z, !0), window.addEventListener("pointerup", B, !0), G(() => {
|
|
1220
|
+
window.removeEventListener("pointerdown", z, !0), window.removeEventListener("pointerup", B, !0), M();
|
|
873
1221
|
}, !0), {
|
|
874
|
-
editing:
|
|
875
|
-
layout:
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1222
|
+
editing: a,
|
|
1223
|
+
layout: c,
|
|
1224
|
+
draftSeq: N(() => n.value?.draftSeq),
|
|
1225
|
+
style: d,
|
|
1226
|
+
toolbarStyle: y,
|
|
1227
|
+
toolbarTagStyle: b,
|
|
1228
|
+
scale: N(() => l.value.zoom),
|
|
1229
|
+
composing: N(() => F.value),
|
|
1230
|
+
setComposing: I,
|
|
1231
|
+
beginAt: S,
|
|
1232
|
+
beginTextEdit: C,
|
|
1233
|
+
commitNow: P,
|
|
1234
|
+
setExpressionMode: w,
|
|
1235
|
+
updateStyleField: T,
|
|
1236
|
+
armBlurCommit: L,
|
|
1237
|
+
ownsEventTarget: R
|
|
887
1238
|
};
|
|
888
1239
|
}
|
|
889
1240
|
//#endregion
|
|
890
1241
|
//#region src/canvas/TextEditingOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
891
|
-
var
|
|
1242
|
+
var ht = ["wrap"], gt = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
892
1243
|
__name: "TextEditingOverlay",
|
|
893
1244
|
props: { editor: {} },
|
|
894
1245
|
setup(e, { expose: t }) {
|
|
895
|
-
let n = e, r =
|
|
1246
|
+
let n = e, r = q(null), i = q(null), a = q(null), o = q(null), s = mt(n.editor, {
|
|
896
1247
|
getTextarea: () => i.value,
|
|
897
1248
|
getHost: () => r.value?.parentElement ?? null,
|
|
898
|
-
|
|
899
|
-
}), { editing: c, style: l, composing: u,
|
|
1249
|
+
getToolbar: () => a.value?.rootEl ?? null
|
|
1250
|
+
}), { editing: c, style: l, composing: u, toolbarStyle: d, toolbarTagStyle: f } = s, p = s.layout, h = N(() => p.value?.expressionMode === !0), { diagnostics: g, refresh: _ } = D({
|
|
900
1251
|
target: i,
|
|
901
|
-
enabled:
|
|
1252
|
+
enabled: h
|
|
1253
|
+
}), v = N(() => h.value ? S(g.value) : ""), { popup: y, accept: b } = O({
|
|
1254
|
+
target: i,
|
|
1255
|
+
enabled: h,
|
|
902
1256
|
resolve: (e) => {
|
|
903
1257
|
let t = n.editor.store.ui.dataSourceSchema, r = c.value;
|
|
904
1258
|
if (t === null || r === null) return null;
|
|
905
|
-
let i =
|
|
1259
|
+
let i = C(t, T(t, n.editor.store.doc, r));
|
|
906
1260
|
return i === null ? null : i(e);
|
|
907
1261
|
},
|
|
908
1262
|
popupEl: () => o.value?.rootEl ?? null,
|
|
909
1263
|
scale: s.scale
|
|
910
1264
|
});
|
|
911
|
-
|
|
1265
|
+
Q(c, async (e) => {
|
|
912
1266
|
if (!e) return;
|
|
913
|
-
await
|
|
1267
|
+
await V();
|
|
914
1268
|
let t = i.value, n = s.layout.value;
|
|
915
|
-
t && n && (t.value = n.text, t.focus({ preventScroll: !0 }), t.select());
|
|
916
|
-
}),
|
|
1269
|
+
t && n && (t.value = n.text, _(), t.focus({ preventScroll: !0 }), t.select());
|
|
1270
|
+
}), Q(s.draftSeq, async () => {
|
|
1271
|
+
await V();
|
|
1272
|
+
let e = i.value, t = s.layout.value;
|
|
1273
|
+
e && t && (e.value = t.text, _());
|
|
1274
|
+
}), Q(l, async (e, t) => {
|
|
917
1275
|
if (!t || !e) return;
|
|
918
1276
|
let n = i.value;
|
|
919
1277
|
if (!n || u.value) return;
|
|
920
1278
|
let r = n.selectionStart, a = n.selectionEnd;
|
|
921
|
-
await
|
|
1279
|
+
await V(), i.value === n && (n.selectionStart !== r || n.selectionEnd !== a) && n.setSelectionRange(r, a);
|
|
922
1280
|
}, { flush: "post" });
|
|
923
|
-
let
|
|
924
|
-
e.isComposing || e.keyCode === 229 || (e.key === "Escape" || e.key === "Enter" && (e.ctrlKey || e.metaKey)) && (e.key === "Escape" &&
|
|
925
|
-
},
|
|
1281
|
+
let x = (e) => {
|
|
1282
|
+
e.isComposing || e.keyCode === 229 || (e.key === "Escape" || e.key === "Enter" && (e.ctrlKey || e.metaKey)) && (e.key === "Escape" && y.open || (e.preventDefault(), s.commitNow()));
|
|
1283
|
+
}, w = () => s.armBlurCommit();
|
|
926
1284
|
return t({
|
|
927
1285
|
beginAt: s.beginAt,
|
|
928
1286
|
beginTextEdit: s.beginTextEdit,
|
|
929
1287
|
commitEditing: () => s.commitNow(),
|
|
930
1288
|
isEditing: () => c.value !== null,
|
|
931
1289
|
ownsEventTarget: (e) => s.ownsEventTarget(e)
|
|
932
|
-
}), (e, t) => (
|
|
1290
|
+
}), (e, t) => (K(), I("div", {
|
|
933
1291
|
ref_key: "rootRef",
|
|
934
1292
|
ref: r,
|
|
935
1293
|
class: "cn-text-overlay"
|
|
936
1294
|
}, [
|
|
937
|
-
|
|
938
|
-
key:
|
|
1295
|
+
Z(c) && Z(l) ? (K(), I("textarea", {
|
|
1296
|
+
key: Z(c).join(""),
|
|
939
1297
|
ref_key: "textareaRef",
|
|
940
1298
|
ref: i,
|
|
941
1299
|
class: "cn-text-overlay__textarea",
|
|
942
|
-
style:
|
|
943
|
-
wrap:
|
|
1300
|
+
style: U(Z(l)),
|
|
1301
|
+
wrap: Z(l).whiteSpace === "pre" ? "off" : "soft",
|
|
944
1302
|
spellcheck: "false",
|
|
945
1303
|
autocomplete: "off",
|
|
946
|
-
onKeydown:
|
|
947
|
-
onBlur:
|
|
948
|
-
onCompositionstart: t[0] ||= (e) =>
|
|
949
|
-
onCompositionend: t[1] ||= (e) =>
|
|
950
|
-
}, null, 44,
|
|
951
|
-
|
|
1304
|
+
onKeydown: x,
|
|
1305
|
+
onBlur: w,
|
|
1306
|
+
onCompositionstart: t[0] ||= (e) => Z(s).setComposing(!0),
|
|
1307
|
+
onCompositionend: t[1] ||= (e) => Z(s).setComposing(!1)
|
|
1308
|
+
}, null, 44, ht)) : F("", !0),
|
|
1309
|
+
Z(c) && Z(d) ? (K(), P(lt, {
|
|
952
1310
|
key: 1,
|
|
953
|
-
ref_key: "
|
|
1311
|
+
ref_key: "toolbarRef",
|
|
954
1312
|
ref: a,
|
|
955
|
-
style:
|
|
956
|
-
mode:
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1313
|
+
style: U(Z(d)),
|
|
1314
|
+
mode: h.value ? "expression" : "static",
|
|
1315
|
+
font: Z(p)?.font ?? "",
|
|
1316
|
+
"font-size": Z(p)?.fontSize ?? 16,
|
|
1317
|
+
"font-color": Z(p)?.fontColor ?? "#000000",
|
|
1318
|
+
"horizontal-align": Z(p)?.horizontalAlign ?? "left",
|
|
1319
|
+
"vertical-align": Z(p)?.verticalAlign ?? "top",
|
|
1320
|
+
autowrap: Z(p)?.autowrap ?? !1,
|
|
1321
|
+
onChange: t[2] ||= (e) => Z(s).setExpressionMode(e === "expression"),
|
|
1322
|
+
onStyleWrite: t[3] ||= (e) => Z(s).updateStyleField(e.key, e.value, e.final)
|
|
1323
|
+
}, null, 8, [
|
|
1324
|
+
"style",
|
|
1325
|
+
"mode",
|
|
1326
|
+
"font",
|
|
1327
|
+
"font-size",
|
|
1328
|
+
"font-color",
|
|
1329
|
+
"horizontal-align",
|
|
1330
|
+
"vertical-align",
|
|
1331
|
+
"autowrap"
|
|
1332
|
+
])) : F("", !0),
|
|
1333
|
+
Z(c) && v.value ? (K(), I("span", {
|
|
1334
|
+
key: 2,
|
|
1335
|
+
class: "cn-text-overlay__diagnostic",
|
|
1336
|
+
style: U(Z(f))
|
|
1337
|
+
}, X(v.value), 5)) : F("", !0),
|
|
1338
|
+
R(m, {
|
|
960
1339
|
ref_key: "popupRef",
|
|
961
1340
|
ref: o,
|
|
962
|
-
state:
|
|
963
|
-
onSelect:
|
|
1341
|
+
state: Z(y),
|
|
1342
|
+
onSelect: Z(b)
|
|
964
1343
|
}, null, 8, ["state", "onSelect"])
|
|
965
1344
|
], 512));
|
|
966
1345
|
}
|
|
967
|
-
}), [["__scopeId", "data-v-
|
|
1346
|
+
}), [["__scopeId", "data-v-9e96d660"]]), _t = {
|
|
968
1347
|
key: 0,
|
|
969
1348
|
class: "cn-surface__drop-hint",
|
|
970
1349
|
"data-drop-hint": ""
|
|
971
|
-
},
|
|
1350
|
+
}, vt = 16, yt = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
972
1351
|
__name: "CanvasSurface",
|
|
973
1352
|
props: { editor: {} },
|
|
974
1353
|
emits: ["ready"],
|
|
975
1354
|
setup(e, { emit: t }) {
|
|
976
|
-
let n = e, r = t, i =
|
|
1355
|
+
let n = e, r = t, i = q(null), a = q(null), o = q(null), s = q(null), c = q(null), l = q(null), u = q(!1), d = q(!1), f = q(null), p = q(null), m = q(n.editor.store.ui.armedCreate), h = q(!1), g = N(() => d.value ? "cn-surface--panning" : u.value ? "cn-surface--pannable" : ""), y = N(() => {
|
|
977
1356
|
if (d.value) return;
|
|
978
|
-
if (m.value !== null ||
|
|
1357
|
+
if (m.value !== null || h.value) return u.value ? void 0 : { cursor: "crosshair" };
|
|
979
1358
|
let e = p.value ?? f.value;
|
|
980
|
-
return e === null ? void 0 : { cursor:
|
|
981
|
-
}), x =
|
|
982
|
-
function
|
|
1359
|
+
return e === null ? void 0 : { cursor: qe[e] };
|
|
1360
|
+
}), x = q(!1), S = b();
|
|
1361
|
+
function C(e) {
|
|
983
1362
|
return new Promise((t, n) => {
|
|
984
1363
|
let r = URL.createObjectURL(e), i = new Image();
|
|
985
1364
|
i.onload = () => {
|
|
@@ -992,28 +1371,28 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
992
1371
|
}, i.src = r;
|
|
993
1372
|
});
|
|
994
1373
|
}
|
|
995
|
-
let
|
|
996
|
-
return
|
|
997
|
-
let e = i.value, t = a.value,
|
|
998
|
-
if (!e || !t || !
|
|
1374
|
+
let w = [];
|
|
1375
|
+
return ee(() => {
|
|
1376
|
+
let e = i.value, t = a.value, g = o.value;
|
|
1377
|
+
if (!e || !t || !g) return;
|
|
999
1378
|
let y = n.editor, b = () => {
|
|
1000
1379
|
let n = window.devicePixelRatio, r = Math.max(1, Math.round(e.clientWidth * n)), i = Math.max(1, Math.round(e.clientHeight * n));
|
|
1001
|
-
for (let e of [t,
|
|
1380
|
+
for (let e of [t, g]) e.width !== r && (e.width = r), e.height !== i && (e.height = i);
|
|
1002
1381
|
y.flushPendingFrames();
|
|
1003
|
-
},
|
|
1382
|
+
}, T = () => {
|
|
1004
1383
|
y.setSurfaceSize(e.clientWidth, e.clientHeight), b();
|
|
1005
1384
|
};
|
|
1006
|
-
y.setDevicePixelRatio(window.devicePixelRatio),
|
|
1007
|
-
let
|
|
1385
|
+
y.setDevicePixelRatio(window.devicePixelRatio), T();
|
|
1386
|
+
let E = y.subscribe((e) => {
|
|
1008
1387
|
(e.scope === "doc" || e.scope === "ui" && e.branch === "armedCreate") && (m.value = y.store.ui.armedCreate);
|
|
1009
1388
|
});
|
|
1010
|
-
|
|
1011
|
-
let
|
|
1012
|
-
|
|
1013
|
-
let
|
|
1389
|
+
w.push(E);
|
|
1390
|
+
let D = new ResizeObserver(T);
|
|
1391
|
+
D.observe(e), w.push(() => D.disconnect());
|
|
1392
|
+
let O = ut(() => {
|
|
1014
1393
|
y.setDevicePixelRatio(window.devicePixelRatio), b();
|
|
1015
1394
|
});
|
|
1016
|
-
|
|
1395
|
+
w.push(O);
|
|
1017
1396
|
let A = (t) => {
|
|
1018
1397
|
let n = e.getBoundingClientRect();
|
|
1019
1398
|
return {
|
|
@@ -1022,10 +1401,10 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1022
1401
|
};
|
|
1023
1402
|
}, j = (e) => e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? 100 : 1, M = (e) => {
|
|
1024
1403
|
e.preventDefault();
|
|
1025
|
-
let t = j(e), n = A(e), r =
|
|
1404
|
+
let t = j(e), n = A(e), r = Se(e);
|
|
1026
1405
|
r === "zoom" ? y.zoomByWheel(n.x, n.y, e.deltaY * t) : r === "pan-x" ? y.panBy(-(e.deltaY || e.deltaX) * t, 0) : y.panBy(-e.deltaX * t, -e.deltaY * t);
|
|
1027
1406
|
};
|
|
1028
|
-
e.addEventListener("wheel", M, { passive: !1 }),
|
|
1407
|
+
e.addEventListener("wheel", M, { passive: !1 }), w.push(() => e.removeEventListener("wheel", M));
|
|
1029
1408
|
let N = null, P = {
|
|
1030
1409
|
x: 0,
|
|
1031
1410
|
y: 0
|
|
@@ -1055,7 +1434,7 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1055
1434
|
N = {
|
|
1056
1435
|
id: t.pointerId,
|
|
1057
1436
|
mode: "create"
|
|
1058
|
-
},
|
|
1437
|
+
}, h.value = !0, f.value = null, e.setPointerCapture(t.pointerId);
|
|
1059
1438
|
return;
|
|
1060
1439
|
}
|
|
1061
1440
|
let r = y.resizeHandleAt(n.x, n.y);
|
|
@@ -1111,7 +1490,7 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1111
1490
|
if (N.mode === "drag") y.endDrag();
|
|
1112
1491
|
else if (N.mode === "resize") y.endResize(), p.value = null;
|
|
1113
1492
|
else if (N.mode === "create") {
|
|
1114
|
-
|
|
1493
|
+
h.value = !1;
|
|
1115
1494
|
let e = y.endCreate();
|
|
1116
1495
|
e !== null && s.value?.beginTextEdit(e);
|
|
1117
1496
|
} else d.value = !1;
|
|
@@ -1137,15 +1516,15 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1137
1516
|
}, H = () => {
|
|
1138
1517
|
N === null && (y.setHovered(null), f.value = null);
|
|
1139
1518
|
};
|
|
1140
|
-
e.addEventListener("pointerdown", I), e.addEventListener("pointermove", L), e.addEventListener("pointerup", R), e.addEventListener("pointercancel", R), e.addEventListener("pointerleave", H), e.addEventListener("mousedown", z), e.addEventListener("dblclick", B),
|
|
1519
|
+
e.addEventListener("pointerdown", I), e.addEventListener("pointermove", L), e.addEventListener("pointerup", R), e.addEventListener("pointercancel", R), e.addEventListener("pointerleave", H), e.addEventListener("mousedown", z), e.addEventListener("dblclick", B), w.push(() => {
|
|
1141
1520
|
e.removeEventListener("pointerdown", I), e.removeEventListener("pointermove", L), e.removeEventListener("pointerup", R), e.removeEventListener("pointercancel", R), e.removeEventListener("pointerleave", H), e.removeEventListener("mousedown", z), e.removeEventListener("dblclick", B);
|
|
1142
1521
|
});
|
|
1143
|
-
let U =
|
|
1522
|
+
let U = _, W = (e) => {
|
|
1144
1523
|
e.code !== "Space" || e.repeat || U(e.target) || (e.preventDefault(), u.value = !0);
|
|
1145
|
-
},
|
|
1524
|
+
}, ee = (e) => {
|
|
1146
1525
|
e.code === "Space" && (u.value = !1);
|
|
1147
|
-
},
|
|
1148
|
-
if (!(e.key !== "Escape" ||
|
|
1526
|
+
}, G = (e) => {
|
|
1527
|
+
if (!(e.key !== "Escape" || v(e.target))) {
|
|
1149
1528
|
if (y.store.ui.armedCreate !== null || y.store.ui.create !== null) {
|
|
1150
1529
|
y.cancelCreate();
|
|
1151
1530
|
return;
|
|
@@ -1153,10 +1532,10 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1153
1532
|
c.value?.close(), l.value?.close(), y.escapeSelection();
|
|
1154
1533
|
}
|
|
1155
1534
|
};
|
|
1156
|
-
window.addEventListener("keydown", W), window.addEventListener("keyup",
|
|
1157
|
-
window.removeEventListener("keydown", W), window.removeEventListener("keyup",
|
|
1158
|
-
}), e.addEventListener("contextmenu", V),
|
|
1159
|
-
let
|
|
1535
|
+
window.addEventListener("keydown", W), window.addEventListener("keyup", ee), window.addEventListener("keydown", G), w.push(() => {
|
|
1536
|
+
window.removeEventListener("keydown", W), window.removeEventListener("keyup", ee), window.removeEventListener("keydown", G);
|
|
1537
|
+
}), e.addEventListener("contextmenu", V), w.push(() => e.removeEventListener("contextmenu", V));
|
|
1538
|
+
let K = (e) => {
|
|
1160
1539
|
let t = e.dataTransfer?.items;
|
|
1161
1540
|
if (!t) return !1;
|
|
1162
1541
|
for (let e = 0; e < t.length; e += 1) {
|
|
@@ -1165,7 +1544,7 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1165
1544
|
}
|
|
1166
1545
|
return !1;
|
|
1167
1546
|
}, q = (e) => {
|
|
1168
|
-
|
|
1547
|
+
K(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), x.value = !0);
|
|
1169
1548
|
}, J = (t) => {
|
|
1170
1549
|
t.relatedTarget !== null && e.contains(t.relatedTarget) || (x.value = !1);
|
|
1171
1550
|
}, Y = (e) => {
|
|
@@ -1187,11 +1566,11 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1187
1566
|
for (let t = 0; t < e.length; t += 1) {
|
|
1188
1567
|
let r = e[t];
|
|
1189
1568
|
if (r) try {
|
|
1190
|
-
let e = await
|
|
1191
|
-
await y.uploadImageAsLayer(await
|
|
1569
|
+
let e = await C(r);
|
|
1570
|
+
await y.uploadImageAsLayer(await k(r), {
|
|
1192
1571
|
at: {
|
|
1193
|
-
x: n.x + t *
|
|
1194
|
-
y: n.y + t *
|
|
1572
|
+
x: n.x + t * vt,
|
|
1573
|
+
y: n.y + t * vt
|
|
1195
1574
|
},
|
|
1196
1575
|
size: e
|
|
1197
1576
|
});
|
|
@@ -1201,90 +1580,90 @@ var Ke = ["wrap"], qe = /*#__PURE__*/ y(/* @__PURE__ */ N({
|
|
|
1201
1580
|
}
|
|
1202
1581
|
}
|
|
1203
1582
|
};
|
|
1204
|
-
e.addEventListener("dragover", q), e.addEventListener("dragleave", J), e.addEventListener("drop", Y),
|
|
1583
|
+
e.addEventListener("dragover", q), e.addEventListener("dragleave", J), e.addEventListener("drop", Y), w.push(() => {
|
|
1205
1584
|
e.removeEventListener("dragover", q), e.removeEventListener("dragleave", J), e.removeEventListener("drop", Y);
|
|
1206
1585
|
});
|
|
1207
|
-
let Z = () => y.invalidate("both"),
|
|
1208
|
-
t.addEventListener("contextlost",
|
|
1209
|
-
t.removeEventListener("contextlost",
|
|
1586
|
+
let Z = () => y.invalidate("both"), te = (e) => e.preventDefault();
|
|
1587
|
+
t.addEventListener("contextlost", te), t.addEventListener("contextrestored", Z), g.addEventListener("contextlost", te), g.addEventListener("contextrestored", Z), w.push(() => {
|
|
1588
|
+
t.removeEventListener("contextlost", te), t.removeEventListener("contextrestored", Z), g.removeEventListener("contextlost", te), g.removeEventListener("contextrestored", Z);
|
|
1210
1589
|
}), r("ready", {
|
|
1211
1590
|
contentCanvas: t,
|
|
1212
|
-
overlayCanvas:
|
|
1591
|
+
overlayCanvas: g
|
|
1213
1592
|
});
|
|
1214
|
-
}),
|
|
1215
|
-
|
|
1216
|
-
}), (t, n) => (
|
|
1593
|
+
}), W(() => {
|
|
1594
|
+
w.forEach((e) => e()), w.length = 0, n.editor.detachSurfaces();
|
|
1595
|
+
}), (t, n) => (K(), I("div", {
|
|
1217
1596
|
ref_key: "hostRef",
|
|
1218
1597
|
ref: i,
|
|
1219
|
-
class:
|
|
1220
|
-
style:
|
|
1598
|
+
class: H(["cn-surface", g.value]),
|
|
1599
|
+
style: U(y.value)
|
|
1221
1600
|
}, [
|
|
1222
|
-
|
|
1601
|
+
L("canvas", {
|
|
1223
1602
|
ref_key: "contentRef",
|
|
1224
1603
|
ref: a,
|
|
1225
1604
|
class: "cn-surface__canvas"
|
|
1226
1605
|
}, null, 512),
|
|
1227
|
-
|
|
1606
|
+
L("canvas", {
|
|
1228
1607
|
ref_key: "overlayRef",
|
|
1229
1608
|
ref: o,
|
|
1230
1609
|
class: "cn-surface__canvas cn-surface__canvas--overlay"
|
|
1231
1610
|
}, null, 512),
|
|
1232
|
-
|
|
1611
|
+
R(gt, {
|
|
1233
1612
|
ref_key: "textEditRef",
|
|
1234
1613
|
ref: s,
|
|
1235
1614
|
editor: e.editor
|
|
1236
1615
|
}, null, 8, ["editor"]),
|
|
1237
|
-
|
|
1616
|
+
R(Ie, {
|
|
1238
1617
|
ref_key: "contextMenuRef",
|
|
1239
1618
|
ref: c,
|
|
1240
1619
|
editor: e.editor
|
|
1241
1620
|
}, null, 8, ["editor"]),
|
|
1242
|
-
|
|
1621
|
+
R(Ke, {
|
|
1243
1622
|
ref_key: "findBarRef",
|
|
1244
1623
|
ref: l,
|
|
1245
1624
|
editor: e.editor
|
|
1246
1625
|
}, null, 8, ["editor"]),
|
|
1247
|
-
x.value ? (
|
|
1626
|
+
x.value ? (K(), I("div", _t, [...n[0] ||= [L("span", { class: "cn-surface__drop-hint-text" }, "松开以上传图片", -1)]])) : F("", !0)
|
|
1248
1627
|
], 6));
|
|
1249
1628
|
}
|
|
1250
1629
|
}), [["__scopeId", "data-v-f2b89db2"]]);
|
|
1251
1630
|
//#endregion
|
|
1252
1631
|
//#region src/canvas/guideSnap.ts
|
|
1253
|
-
function
|
|
1632
|
+
function bt(e, t, n, r) {
|
|
1254
1633
|
let i = e.store.doc;
|
|
1255
1634
|
if (!i) return n;
|
|
1256
|
-
let a = r === void 0 ? e.listGuides() : e.listGuides().filter((e) => e.id !== r), o =
|
|
1635
|
+
let a = r === void 0 ? e.listGuides() : e.listGuides().filter((e) => e.id !== r), o = be({
|
|
1257
1636
|
x: n,
|
|
1258
1637
|
y: n,
|
|
1259
1638
|
width: 0,
|
|
1260
1639
|
height: 0
|
|
1261
|
-
},
|
|
1640
|
+
}, _e(i.width, i.height, ge(i, -1, e.textPolicies), a), he(e.store.ui.viewport.zoom));
|
|
1262
1641
|
return t === "vertical" ? n + o.dx : n + o.dy;
|
|
1263
1642
|
}
|
|
1264
1643
|
//#endregion
|
|
1265
1644
|
//#region src/canvas/GuidesOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
1266
|
-
var
|
|
1645
|
+
var xt = [
|
|
1267
1646
|
"data-snap-orientation",
|
|
1268
1647
|
"data-snap-position",
|
|
1269
1648
|
"data-snap-source"
|
|
1270
|
-
],
|
|
1649
|
+
], St = [
|
|
1271
1650
|
"data-guide-line",
|
|
1272
1651
|
"data-guide-orientation",
|
|
1273
1652
|
"data-guide-position",
|
|
1274
1653
|
"data-guide-dragging",
|
|
1275
1654
|
"onPointerdown"
|
|
1276
|
-
],
|
|
1655
|
+
], Ct = ["data-guide-orientation", "data-guide-position"], wt = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
1277
1656
|
__name: "GuidesOverlay",
|
|
1278
1657
|
props: { editor: {} },
|
|
1279
1658
|
setup(e, { expose: t }) {
|
|
1280
|
-
let n = e, r =
|
|
1659
|
+
let n = e, r = j(n.editor), i = Y(n.editor.store.doc), a = Y(n.editor.listGuides()), o = Y(n.editor.listSnapAxes()), s = n.editor.subscribe((e) => {
|
|
1281
1660
|
if (e.scope === "doc") {
|
|
1282
1661
|
i.value = n.editor.store.doc, a.value = n.editor.listGuides(), o.value = n.editor.listSnapAxes();
|
|
1283
1662
|
return;
|
|
1284
1663
|
}
|
|
1285
1664
|
e.branch === "guides" ? a.value = n.editor.listGuides() : e.branch === "snapAxes" && (o.value = n.editor.listSnapAxes());
|
|
1286
1665
|
});
|
|
1287
|
-
|
|
1666
|
+
G(s, !0);
|
|
1288
1667
|
function c(e, t) {
|
|
1289
1668
|
let n = i.value, a = r.value;
|
|
1290
1669
|
return n ? e === "vertical" ? {
|
|
@@ -1300,11 +1679,11 @@ var Qe = [
|
|
|
1300
1679
|
function l(e) {
|
|
1301
1680
|
return String(Math.round(e * 100) / 100);
|
|
1302
1681
|
}
|
|
1303
|
-
let u =
|
|
1682
|
+
let u = q(null);
|
|
1304
1683
|
function d(e) {
|
|
1305
1684
|
return {
|
|
1306
1685
|
orientation: e.orientation,
|
|
1307
|
-
position:
|
|
1686
|
+
position: bt(n.editor, e.orientation, e.position)
|
|
1308
1687
|
};
|
|
1309
1688
|
}
|
|
1310
1689
|
function f(e) {
|
|
@@ -1331,7 +1710,7 @@ var Qe = [
|
|
|
1331
1710
|
endGuideDrag: m,
|
|
1332
1711
|
cancelGuideDrag: h
|
|
1333
1712
|
});
|
|
1334
|
-
let g =
|
|
1713
|
+
let g = q(null), _ = N(() => a.value.map((e) => {
|
|
1335
1714
|
let t = g.value;
|
|
1336
1715
|
return t !== null && t.id === e.id ? {
|
|
1337
1716
|
id: e.id,
|
|
@@ -1346,7 +1725,7 @@ var Qe = [
|
|
|
1346
1725
|
dragging: !1,
|
|
1347
1726
|
overRuler: !1
|
|
1348
1727
|
};
|
|
1349
|
-
})), v =
|
|
1728
|
+
})), v = q(null);
|
|
1350
1729
|
function y(e, t) {
|
|
1351
1730
|
let n = v.value?.getBoundingClientRect(), i = r.value, a = n?.left ?? 0, o = n?.top ?? 0;
|
|
1352
1731
|
return t === "vertical" ? i.x + (e.clientX - a) / i.zoom : i.y + (e.clientY - o) / i.zoom;
|
|
@@ -1378,11 +1757,11 @@ var Qe = [
|
|
|
1378
1757
|
let t = g.value;
|
|
1379
1758
|
t !== null && e.pointerId === t.pointerId && (g.value = {
|
|
1380
1759
|
...t,
|
|
1381
|
-
current:
|
|
1760
|
+
current: bt(n.editor, t.orientation, y(e, t.orientation), t.id),
|
|
1382
1761
|
overRuler: b(e.clientX, e.clientY)
|
|
1383
1762
|
});
|
|
1384
1763
|
}
|
|
1385
|
-
function
|
|
1764
|
+
function T(e) {
|
|
1386
1765
|
let t = g.value;
|
|
1387
1766
|
if (t !== null && e.pointerId === t.pointerId) {
|
|
1388
1767
|
if (g.value = null, S(e), b(e.clientX, e.clientY)) {
|
|
@@ -1392,28 +1771,28 @@ var Qe = [
|
|
|
1392
1771
|
n.editor.listGuides().some((e) => e.id !== t.id && e.orientation === t.orientation && Math.abs(e.position - t.current) < 1e-6) ? n.editor.removeGuide(t.id) : n.editor.updateGuide(t.id, t.current);
|
|
1393
1772
|
}
|
|
1394
1773
|
}
|
|
1395
|
-
function
|
|
1774
|
+
function E(e) {
|
|
1396
1775
|
let t = g.value;
|
|
1397
1776
|
t !== null && e.pointerId === t.pointerId && (g.value = null, S(e));
|
|
1398
1777
|
}
|
|
1399
|
-
return (e, t) => (
|
|
1778
|
+
return (e, t) => (K(), I("div", {
|
|
1400
1779
|
ref_key: "rootRef",
|
|
1401
1780
|
ref: v,
|
|
1402
1781
|
class: "cn-guides",
|
|
1403
1782
|
"data-guide-overlay": ""
|
|
1404
1783
|
}, [
|
|
1405
|
-
(
|
|
1784
|
+
(K(!0), I(M, null, J(o.value, (e, t) => (K(), I("div", {
|
|
1406
1785
|
key: `${e.orientation}-${e.position}-${t}`,
|
|
1407
|
-
class:
|
|
1786
|
+
class: H(["cn-guides__snap", `cn-guides__snap--${e.orientation}`]),
|
|
1408
1787
|
"data-snap-line": "",
|
|
1409
1788
|
"data-snap-orientation": e.orientation,
|
|
1410
1789
|
"data-snap-position": l(e.position),
|
|
1411
1790
|
"data-snap-source": e.source,
|
|
1412
|
-
style:
|
|
1413
|
-
}, null, 14,
|
|
1414
|
-
(
|
|
1791
|
+
style: U(c(e.orientation, e.position))
|
|
1792
|
+
}, null, 14, xt))), 128)),
|
|
1793
|
+
(K(!0), I(M, null, J(_.value, (e) => (K(), I("div", {
|
|
1415
1794
|
key: e.id,
|
|
1416
|
-
class:
|
|
1795
|
+
class: H(["cn-guides__guide", [`cn-guides__guide--${e.orientation}`, {
|
|
1417
1796
|
"cn-guides__guide--grabbed": e.dragging,
|
|
1418
1797
|
"cn-guides__guide--will-delete": e.overRuler
|
|
1419
1798
|
}]]),
|
|
@@ -1421,32 +1800,32 @@ var Qe = [
|
|
|
1421
1800
|
"data-guide-orientation": e.orientation,
|
|
1422
1801
|
"data-guide-position": l(e.position),
|
|
1423
1802
|
"data-guide-dragging": e.dragging ? "" : void 0,
|
|
1424
|
-
style:
|
|
1803
|
+
style: U(c(e.orientation, e.position)),
|
|
1425
1804
|
onPointerdown: (t) => C(t, e),
|
|
1426
1805
|
onPointermove: w,
|
|
1427
|
-
onPointerup:
|
|
1428
|
-
onPointercancel:
|
|
1429
|
-
}, null, 46,
|
|
1430
|
-
u.value ? (
|
|
1806
|
+
onPointerup: T,
|
|
1807
|
+
onPointercancel: E
|
|
1808
|
+
}, null, 46, St))), 128)),
|
|
1809
|
+
u.value ? (K(), I("div", {
|
|
1431
1810
|
key: 0,
|
|
1432
|
-
class:
|
|
1811
|
+
class: H(["cn-guides__guide cn-guides__guide--preview", `cn-guides__guide--${u.value.orientation}`]),
|
|
1433
1812
|
"data-guide-preview": "",
|
|
1434
1813
|
"data-guide-orientation": u.value.orientation,
|
|
1435
1814
|
"data-guide-position": l(u.value.position),
|
|
1436
|
-
style:
|
|
1437
|
-
}, null, 14,
|
|
1815
|
+
style: U(c(u.value.orientation, u.value.position))
|
|
1816
|
+
}, null, 14, Ct)) : F("", !0)
|
|
1438
1817
|
], 512));
|
|
1439
1818
|
}
|
|
1440
|
-
}), [["__scopeId", "data-v-61872121"]]),
|
|
1819
|
+
}), [["__scopeId", "data-v-61872121"]]), Tt = {
|
|
1441
1820
|
class: "cn-ruler",
|
|
1442
1821
|
"data-ruler": ""
|
|
1443
|
-
},
|
|
1822
|
+
}, Et = {
|
|
1444
1823
|
key: 0,
|
|
1445
1824
|
class: "cn-ruler__label"
|
|
1446
|
-
},
|
|
1825
|
+
}, Dt = {
|
|
1447
1826
|
key: 0,
|
|
1448
1827
|
class: "cn-ruler__label"
|
|
1449
|
-
},
|
|
1828
|
+
}, Ot = 10, kt = 5, At = /*#__PURE__*/ x(/* @__PURE__ */ z({
|
|
1450
1829
|
__name: "Ruler",
|
|
1451
1830
|
props: { editor: {} },
|
|
1452
1831
|
emits: [
|
|
@@ -1456,10 +1835,10 @@ var Qe = [
|
|
|
1456
1835
|
"guide-drag-cancel"
|
|
1457
1836
|
],
|
|
1458
1837
|
setup(e, { emit: t }) {
|
|
1459
|
-
let n = e, r = t, i =
|
|
1838
|
+
let n = e, r = t, i = j(n.editor), a = Y(n.editor.store.ui.rulersVisible), o = n.editor.subscribe((e) => {
|
|
1460
1839
|
e.scope === "ui" && e.branch === "rulersVisible" && (a.value = n.editor.store.ui.rulersVisible);
|
|
1461
1840
|
});
|
|
1462
|
-
|
|
1841
|
+
G(o, !0);
|
|
1463
1842
|
let s = [
|
|
1464
1843
|
1,
|
|
1465
1844
|
2,
|
|
@@ -1478,11 +1857,11 @@ var Qe = [
|
|
|
1478
1857
|
function c(e, t, n) {
|
|
1479
1858
|
if (!(t > 0) || !(n > 0) || !Number.isFinite(e)) return [];
|
|
1480
1859
|
let r = s[s.length - 1];
|
|
1481
|
-
for (let e of s) if (e * n >=
|
|
1860
|
+
for (let e of s) if (e * n >= Ot) {
|
|
1482
1861
|
r = e;
|
|
1483
1862
|
break;
|
|
1484
1863
|
}
|
|
1485
|
-
let i = r *
|
|
1864
|
+
let i = r * kt, a = Math.floor(e / r) * r, o = [];
|
|
1486
1865
|
for (let s = 0;; s++) {
|
|
1487
1866
|
let c = a + s * r, l = (c - e) * n;
|
|
1488
1867
|
if (l > t) break;
|
|
@@ -1497,13 +1876,13 @@ var Qe = [
|
|
|
1497
1876
|
}
|
|
1498
1877
|
return o;
|
|
1499
1878
|
}
|
|
1500
|
-
let l =
|
|
1879
|
+
let l = q(null), u = q(null), d = q(0), f = q(0), p = () => {
|
|
1501
1880
|
d.value = l.value?.clientWidth ?? 0, f.value = u.value?.clientHeight ?? 0;
|
|
1502
1881
|
}, m = null;
|
|
1503
|
-
|
|
1882
|
+
ee(() => {
|
|
1504
1883
|
p(), m = new ResizeObserver(() => p()), l.value && m.observe(l.value), u.value && m.observe(u.value);
|
|
1505
|
-
}),
|
|
1506
|
-
let h =
|
|
1884
|
+
}), W(() => m?.disconnect());
|
|
1885
|
+
let h = N(() => c(i.value.x, d.value, i.value.zoom)), g = N(() => c(i.value.y, f.value, i.value.zoom)), _ = q(null);
|
|
1507
1886
|
function v(e, t, n) {
|
|
1508
1887
|
let r = e.getBoundingClientRect(), a = i.value;
|
|
1509
1888
|
return {
|
|
@@ -1538,8 +1917,8 @@ var Qe = [
|
|
|
1538
1917
|
let a = v(n, i.orientation, e);
|
|
1539
1918
|
r(t === "guide-drag-end" ? "guide-drag-end" : "guide-drag-cancel", a);
|
|
1540
1919
|
}
|
|
1541
|
-
return (e, t) =>
|
|
1542
|
-
|
|
1920
|
+
return (e, t) => re((K(), I("div", Tt, [
|
|
1921
|
+
L("div", {
|
|
1543
1922
|
ref_key: "topRef",
|
|
1544
1923
|
ref: l,
|
|
1545
1924
|
class: "cn-ruler__bar cn-ruler__bar--top",
|
|
@@ -1551,12 +1930,12 @@ var Qe = [
|
|
|
1551
1930
|
onPointermove: t[1] ||= (e) => b(e),
|
|
1552
1931
|
onPointerup: t[2] ||= (e) => x(e, "guide-drag-end"),
|
|
1553
1932
|
onPointercancel: t[3] ||= (e) => x(e, "guide-drag-cancel")
|
|
1554
|
-
}, [(
|
|
1933
|
+
}, [(K(!0), I(M, null, J(h.value, (e) => (K(), I("span", {
|
|
1555
1934
|
key: e.scene,
|
|
1556
|
-
class:
|
|
1557
|
-
style:
|
|
1558
|
-
}, [e.label === null ?
|
|
1559
|
-
|
|
1935
|
+
class: H(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
|
|
1936
|
+
style: U({ left: `${e.position}px` })
|
|
1937
|
+
}, [e.label === null ? F("", !0) : (K(), I("span", Et, X(e.label), 1))], 6))), 128))], 544),
|
|
1938
|
+
L("div", {
|
|
1560
1939
|
ref_key: "leftRef",
|
|
1561
1940
|
ref: u,
|
|
1562
1941
|
class: "cn-ruler__bar cn-ruler__bar--left",
|
|
@@ -1568,43 +1947,43 @@ var Qe = [
|
|
|
1568
1947
|
onPointermove: t[5] ||= (e) => b(e),
|
|
1569
1948
|
onPointerup: t[6] ||= (e) => x(e, "guide-drag-end"),
|
|
1570
1949
|
onPointercancel: t[7] ||= (e) => x(e, "guide-drag-cancel")
|
|
1571
|
-
}, [(
|
|
1950
|
+
}, [(K(!0), I(M, null, J(g.value, (e) => (K(), I("span", {
|
|
1572
1951
|
key: e.scene,
|
|
1573
|
-
class:
|
|
1574
|
-
style:
|
|
1575
|
-
}, [e.label === null ?
|
|
1576
|
-
t[8] ||=
|
|
1952
|
+
class: H(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
|
|
1953
|
+
style: U({ top: `${e.position}px` })
|
|
1954
|
+
}, [e.label === null ? F("", !0) : (K(), I("span", Dt, X(e.label), 1))], 6))), 128))], 544),
|
|
1955
|
+
t[8] ||= L("div", {
|
|
1577
1956
|
class: "cn-ruler__corner",
|
|
1578
1957
|
"data-ruler-corner": "",
|
|
1579
1958
|
"aria-hidden": "true"
|
|
1580
1959
|
}, null, -1)
|
|
1581
|
-
], 512)), [[
|
|
1960
|
+
], 512)), [[ne, a.value]]);
|
|
1582
1961
|
}
|
|
1583
|
-
}), [["__scopeId", "data-v-5bd7248c"]]),
|
|
1584
|
-
function
|
|
1962
|
+
}), [["__scopeId", "data-v-5bd7248c"]]), jt = "#2563eb", Mt = "rgba(37, 99, 235, 0.08)", Nt = [4, 3], Pt = 1, Ft = "rgba(11, 18, 32, 0.9)", It = "#ffffff", Lt = 11, Rt = 6, zt = 3, Bt = 3, Vt = 6;
|
|
1963
|
+
function Ht(e, t, n) {
|
|
1585
1964
|
let r = t.store.ui.create;
|
|
1586
1965
|
if (!r) return;
|
|
1587
1966
|
let { x: i, y: a, width: o, height: s } = r.rect;
|
|
1588
1967
|
if (o === 0 && s === 0) return;
|
|
1589
1968
|
let c = n.viewport.zoom;
|
|
1590
|
-
e.fillStyle =
|
|
1591
|
-
let l =
|
|
1969
|
+
e.fillStyle = Mt, e.fillRect(i, a, o, s), e.strokeStyle = jt, e.lineWidth = Pt / c, e.setLineDash(Nt.map((e) => e / c)), e.strokeRect(i, a, o, s), e.setLineDash([]);
|
|
1970
|
+
let l = Lt / c, u = Rt / c, d = zt / c;
|
|
1592
1971
|
e.font = `${l}px system-ui, sans-serif`;
|
|
1593
|
-
let f = `${Math.round(o)} × ${Math.round(s)}`, p = e.measureText(f).width + u * 2, m = l + d * 2, h = i + o +
|
|
1594
|
-
e.fillStyle =
|
|
1972
|
+
let f = `${Math.round(o)} × ${Math.round(s)}`, p = e.measureText(f).width + u * 2, m = l + d * 2, h = i + o + Vt / c, g = a + s + Vt / c;
|
|
1973
|
+
e.fillStyle = Ft, e.beginPath(), e.roundRect(h, g, p, m, Bt / c), e.fill(), e.fillStyle = It, e.textBaseline = "middle", e.fillText(f, h + u, g + m / 2);
|
|
1595
1974
|
}
|
|
1596
1975
|
//#endregion
|
|
1597
1976
|
//#region src/canvas/findHighlight.ts
|
|
1598
|
-
var
|
|
1977
|
+
var Ut = {
|
|
1599
1978
|
matchColor: "#f59e0b",
|
|
1600
1979
|
currentColor: "#38bdf8",
|
|
1601
1980
|
currentFill: "rgba(56, 189, 248, 0.12)",
|
|
1602
1981
|
lineWidth: 2
|
|
1603
1982
|
};
|
|
1604
|
-
function
|
|
1983
|
+
function Wt(e, t, n, r) {
|
|
1605
1984
|
if (!n.doc || !t.store.ui.find.open) return;
|
|
1606
1985
|
let i = {
|
|
1607
|
-
...
|
|
1986
|
+
...Ut,
|
|
1608
1987
|
...r
|
|
1609
1988
|
}, a = t.listFindMatches();
|
|
1610
1989
|
if (a.length === 0) return;
|
|
@@ -1618,57 +1997,57 @@ function xt(e, t, n, r) {
|
|
|
1618
1997
|
}
|
|
1619
1998
|
//#endregion
|
|
1620
1999
|
//#region src/canvas/gizmo.ts
|
|
1621
|
-
var
|
|
2000
|
+
var Gt = {
|
|
1622
2001
|
selectionColor: "#2563eb",
|
|
1623
2002
|
hoverColor: "rgba(37, 99, 235, 0.55)",
|
|
1624
2003
|
selectionWidth: 2,
|
|
1625
2004
|
handleSize: 8,
|
|
1626
2005
|
handleFill: "#ffffff"
|
|
1627
2006
|
};
|
|
1628
|
-
function
|
|
1629
|
-
return
|
|
2007
|
+
function Kt(e, t) {
|
|
2008
|
+
return p(e, t)?.visible === !1;
|
|
1630
2009
|
}
|
|
1631
|
-
function
|
|
2010
|
+
function qt(e, t, n, r) {
|
|
1632
2011
|
let i = {
|
|
1633
|
-
...
|
|
2012
|
+
...Gt,
|
|
1634
2013
|
...r
|
|
1635
2014
|
}, { selection: a, hovered: o } = t.store.ui, s = n.doc;
|
|
1636
2015
|
if (s) {
|
|
1637
|
-
if (o && !
|
|
2016
|
+
if (o && !d(o, a) && !Kt(s, o) && !t.isLocked(o)) {
|
|
1638
2017
|
let r = t.layerBoxAt(o);
|
|
1639
2018
|
r && (e.strokeStyle = i.hoverColor, e.lineWidth = i.selectionWidth / 2 / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height));
|
|
1640
2019
|
}
|
|
1641
|
-
if (a && !
|
|
2020
|
+
if (a && !Kt(s, a)) {
|
|
1642
2021
|
let r = t.layerBoxAt(a);
|
|
1643
|
-
r && (e.strokeStyle = i.selectionColor, e.lineWidth = i.selectionWidth / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height),
|
|
2022
|
+
r && (e.strokeStyle = i.selectionColor, e.lineWidth = i.selectionWidth / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height), Jt(e, t, a, r, n.viewport.zoom, i));
|
|
1644
2023
|
}
|
|
1645
2024
|
}
|
|
1646
2025
|
}
|
|
1647
|
-
function
|
|
2026
|
+
function Jt(e, t, n, r, i, a) {
|
|
1648
2027
|
let o = t.resizeHandlesAt(n);
|
|
1649
2028
|
if (o.length === 0) return;
|
|
1650
2029
|
let s = a.handleSize / i, c = s / 2;
|
|
1651
2030
|
e.fillStyle = a.handleFill, e.strokeStyle = a.selectionColor, e.lineWidth = a.selectionWidth / i;
|
|
1652
2031
|
for (let t of o) {
|
|
1653
|
-
let n =
|
|
2032
|
+
let n = xe(r, t);
|
|
1654
2033
|
e.fillRect(n.x - c, n.y - c, s, s), e.strokeRect(n.x - c, n.y - c, s, s);
|
|
1655
2034
|
}
|
|
1656
2035
|
}
|
|
1657
|
-
function
|
|
2036
|
+
function Yt(e, t, n) {
|
|
1658
2037
|
return (r) => {
|
|
1659
2038
|
if (!t) return;
|
|
1660
2039
|
t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, t.canvas.width, t.canvas.height);
|
|
1661
2040
|
let i = r.dpr * r.viewport.zoom;
|
|
1662
|
-
t.setTransform(i, 0, 0, i, -r.viewport.x * i, -r.viewport.y * i),
|
|
2041
|
+
t.setTransform(i, 0, 0, i, -r.viewport.x * i, -r.viewport.y * i), qt(t, e, r, n);
|
|
1663
2042
|
};
|
|
1664
2043
|
}
|
|
1665
2044
|
//#endregion
|
|
1666
2045
|
//#region src/canvas/scheduler.ts
|
|
1667
|
-
function
|
|
2046
|
+
function Xt() {
|
|
1668
2047
|
return (e) => {
|
|
1669
2048
|
let t = window.requestAnimationFrame(() => e());
|
|
1670
2049
|
return () => window.cancelAnimationFrame(t);
|
|
1671
2050
|
};
|
|
1672
2051
|
}
|
|
1673
2052
|
//#endregion
|
|
1674
|
-
export {
|
|
2053
|
+
export { Ae as _, Ht as a, yt as c, dt as d, ut as f, Ie as g, Le as h, Wt as i, gt as l, Ke as m, Yt as n, At as o, lt as p, qt as r, wt as s, Xt as t, mt as u };
|