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