@hankchen/canvas-editor-vue 0.7.0 → 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/{canvas-D3fFnBqG.js → canvas-DuvO27sj.js} +169 -147
- package/dist/canvas.js +1 -1
- package/dist/index.js +2 -2
- package/dist/property-panel/fieldSchema.d.ts +12 -0
- package/dist/property-panel/fields/intrinsicSize.d.ts +9 -0
- package/dist/{property-panel-DJQJzioT.js → property-panel-BkfqRva4.js} +239 -197
- package/dist/property-panel.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import { c as m, o as h, t as g } from "./ExpressionPathPicker-DchGsK70.js";
|
|
|
5
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
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
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
|
|
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
9
|
var ce = e({
|
|
10
10
|
name: "arrow-down-left",
|
|
11
11
|
size: 24,
|
|
@@ -336,13 +336,13 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
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) => (
|
|
339
|
+
return (e, t) => (K(), z("div", {
|
|
340
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
|
-
}, [(
|
|
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",
|
|
@@ -362,7 +362,7 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
362
362
|
__name: "ContextMenu",
|
|
363
363
|
props: { editor: {} },
|
|
364
364
|
setup(e, { expose: t }) {
|
|
365
|
-
let n = e, r =
|
|
365
|
+
let n = e, r = q(null), i = q(!1), a = q({
|
|
366
366
|
x: 0,
|
|
367
367
|
y: 0
|
|
368
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(() => {
|
|
@@ -381,23 +381,38 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
381
381
|
if (!e || e.type !== "TableLayer" || e.template !== null) return !1;
|
|
382
382
|
let t = e.rows[e.rows.length - 1];
|
|
383
383
|
return t !== void 0 && t.cells.length > 0;
|
|
384
|
-
}), k =
|
|
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(() => {
|
|
385
400
|
let e = S.value;
|
|
386
401
|
return !e || e.type !== "TableLayer" ? "" : `模板取自末行,其余 ${Math.max(e.rows.length - 1, 0)} 行将移除(可撤销)`;
|
|
387
|
-
}),
|
|
388
|
-
if (
|
|
389
|
-
if (O.value) return
|
|
402
|
+
}), P = I(() => {
|
|
403
|
+
if (A.value === null) return y;
|
|
404
|
+
if (O.value) return M.value;
|
|
390
405
|
let e = S.value;
|
|
391
406
|
return e !== null && e.type === "TableLayer" && e.rows.length === 0 ? "空表无可转换行" : "末行为空——先为末行加格";
|
|
392
|
-
}),
|
|
393
|
-
function
|
|
394
|
-
|
|
407
|
+
}), L = q(!1), H = q("");
|
|
408
|
+
function te() {
|
|
409
|
+
L.value = !0, H.value = "";
|
|
395
410
|
}
|
|
396
|
-
function
|
|
411
|
+
function re() {
|
|
397
412
|
let e = C();
|
|
398
|
-
e &&
|
|
413
|
+
e && H.value !== "" && (n.editor.convertTableToTemplate(e, H.value), Y());
|
|
399
414
|
}
|
|
400
|
-
let
|
|
415
|
+
let ie = I(() => [
|
|
401
416
|
{
|
|
402
417
|
key: "visibility",
|
|
403
418
|
label: x.value ? "隐藏" : "显示",
|
|
@@ -463,6 +478,13 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
463
478
|
title: u.value ? void 0 : "置顶/置底仅对根图层生效",
|
|
464
479
|
run: () => n.editor.sendToBack()
|
|
465
480
|
},
|
|
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
|
+
}] : [],
|
|
466
488
|
...T.value ? [{
|
|
467
489
|
key: "to-rows",
|
|
468
490
|
label: "转回普通表",
|
|
@@ -475,10 +497,10 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
475
497
|
}] : S.value?.type === "TableLayer" ? [{
|
|
476
498
|
key: "to-template",
|
|
477
499
|
label: "转为模板表…",
|
|
478
|
-
enabled:
|
|
479
|
-
title:
|
|
500
|
+
enabled: A.value !== null && O.value,
|
|
501
|
+
title: P.value,
|
|
480
502
|
keepsOpen: !0,
|
|
481
|
-
run: () =>
|
|
503
|
+
run: () => te()
|
|
482
504
|
}] : [],
|
|
483
505
|
{
|
|
484
506
|
key: "delete",
|
|
@@ -491,7 +513,7 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
491
513
|
}
|
|
492
514
|
}
|
|
493
515
|
]);
|
|
494
|
-
async function
|
|
516
|
+
async function G(e, t) {
|
|
495
517
|
a.value = {
|
|
496
518
|
x: e,
|
|
497
519
|
y: t
|
|
@@ -504,16 +526,16 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
504
526
|
y: Math.max(2, Math.min(a.value.y, l))
|
|
505
527
|
};
|
|
506
528
|
}
|
|
507
|
-
function
|
|
508
|
-
i.value = !1,
|
|
529
|
+
function Y() {
|
|
530
|
+
i.value = !1, L.value = !1, H.value = "";
|
|
509
531
|
}
|
|
510
|
-
function
|
|
511
|
-
e.run(), e.keepsOpen !== !0 &&
|
|
532
|
+
function Z(e) {
|
|
533
|
+
e.run(), e.keepsOpen !== !0 && Y();
|
|
512
534
|
}
|
|
513
535
|
return t({
|
|
514
|
-
openAt:
|
|
515
|
-
close:
|
|
516
|
-
}), (e, t) => i.value ? (
|
|
536
|
+
openAt: G,
|
|
537
|
+
close: Y
|
|
538
|
+
}), (e, t) => i.value ? (K(), z("div", {
|
|
517
539
|
key: 0,
|
|
518
540
|
ref_key: "rootRef",
|
|
519
541
|
ref: r,
|
|
@@ -524,50 +546,50 @@ var ke = ["aria-disabled"], Ae = {
|
|
|
524
546
|
left: `${a.value.x}px`,
|
|
525
547
|
top: `${a.value.y}px`
|
|
526
548
|
}),
|
|
527
|
-
onPointerdown: t[1] ||=
|
|
528
|
-
onContextmenu: t[2] ||=
|
|
529
|
-
}, [
|
|
530
|
-
B("p", Fe,
|
|
549
|
+
onPointerdown: t[1] ||= $(() => {}, ["stop"]),
|
|
550
|
+
onContextmenu: t[2] ||= $(() => {}, ["prevent"])
|
|
551
|
+
}, [L.value ? (K(), z("div", Pe, [
|
|
552
|
+
B("p", Fe, X(M.value), 1),
|
|
531
553
|
V(g, {
|
|
532
|
-
modelValue:
|
|
533
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
554
|
+
modelValue: H.value,
|
|
555
|
+
"onUpdate:modelValue": t[0] ||= (e) => H.value = e,
|
|
534
556
|
"data-convert-rows-path": "",
|
|
535
557
|
mode: "rowsPath",
|
|
536
|
-
source:
|
|
558
|
+
source: j.value,
|
|
537
559
|
"aria-label": "取行路径",
|
|
538
560
|
placeholder: "未选择行路径"
|
|
539
561
|
}, null, 8, ["modelValue", "source"]),
|
|
540
562
|
B("div", Ie, [B("button", {
|
|
541
563
|
type: "button",
|
|
542
564
|
class: "cn-context-menu__item cn-context-menu__item--confirm",
|
|
543
|
-
disabled:
|
|
544
|
-
onClick:
|
|
565
|
+
disabled: H.value === "",
|
|
566
|
+
onClick: re
|
|
545
567
|
}, " 确认转换 ", 8, Le), B("button", {
|
|
546
568
|
type: "button",
|
|
547
569
|
class: "cn-context-menu__item",
|
|
548
|
-
onClick:
|
|
570
|
+
onClick: Y
|
|
549
571
|
}, "取消")])
|
|
550
|
-
])) : (
|
|
572
|
+
])) : (K(!0), z(F, { key: 1 }, J(ie.value, (e) => (K(), z("button", {
|
|
551
573
|
key: e.key,
|
|
552
574
|
type: "button",
|
|
553
575
|
role: "menuitem",
|
|
554
576
|
class: U(["cn-context-menu__item", [`cn-context-menu__item--${e.key}`]]),
|
|
555
577
|
disabled: !e.enabled,
|
|
556
578
|
title: e.title,
|
|
557
|
-
onClick: (t) =>
|
|
558
|
-
},
|
|
579
|
+
onClick: (t) => Z(e)
|
|
580
|
+
}, X(e.label), 11, Re))), 128))], 36)) : R("", !0);
|
|
559
581
|
}
|
|
560
|
-
}), [["__scopeId", "data-v-
|
|
582
|
+
}), [["__scopeId", "data-v-99fabe20"]]);
|
|
561
583
|
//#endregion
|
|
562
584
|
//#region src/canvas/useFindSession.ts
|
|
563
585
|
function Be(e) {
|
|
564
|
-
let t =
|
|
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 = () => {
|
|
565
587
|
let o = e.store.ui.find;
|
|
566
588
|
t.value = o.open, n.value = o.query, r.value = o.replacement, i.value = e.listFindMatches(), a.value = e.findCursor;
|
|
567
589
|
}, s = e.subscribe((e) => {
|
|
568
590
|
(e.scope === "doc" || e.scope === "ui" && e.branch === "find") && o();
|
|
569
591
|
});
|
|
570
|
-
return
|
|
592
|
+
return G(s, !0), {
|
|
571
593
|
open: t,
|
|
572
594
|
query: n,
|
|
573
595
|
replacement: r,
|
|
@@ -588,7 +610,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
588
610
|
__name: "FindBar",
|
|
589
611
|
props: { editor: {} },
|
|
590
612
|
setup(e, { expose: t }) {
|
|
591
|
-
let n = e, { open: r, query: i, replacement: a, matches: o, cursor: s } = Be(n.editor), c =
|
|
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(() => {
|
|
592
614
|
let e = o.value.length;
|
|
593
615
|
return e === 0 ? i.value === "" ? "" : "无结果" : `第 ${s.value + 1}/${e} 处`;
|
|
594
616
|
}), f = I(() => o.value.length > 0), p = I(() => f.value && s.value > 0), h = I(() => f.value && s.value < o.value.length - 1);
|
|
@@ -630,7 +652,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
630
652
|
function w(e) {
|
|
631
653
|
n.editor.setFindReplacement(e.target.value);
|
|
632
654
|
}
|
|
633
|
-
|
|
655
|
+
Q(r, (e) => {
|
|
634
656
|
e && c.value?.focus({ preventScroll: !0 });
|
|
635
657
|
}, {
|
|
636
658
|
immediate: !0,
|
|
@@ -639,15 +661,15 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
639
661
|
function T(e) {
|
|
640
662
|
r.value && (e.key.toLowerCase() !== "f" || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || b(e.target) || c.value?.focus({ preventScroll: !0 }));
|
|
641
663
|
}
|
|
642
|
-
return window.addEventListener("keydown", T), re(() => window.removeEventListener("keydown", T)),
|
|
664
|
+
return window.addEventListener("keydown", T), re(() => window.removeEventListener("keydown", T)), Q(i, () => {
|
|
643
665
|
u.value = null;
|
|
644
|
-
}), t({ close: x }), (e, t) =>
|
|
666
|
+
}), t({ close: x }), (e, t) => Z(r) ? (K(), z("div", {
|
|
645
667
|
key: 0,
|
|
646
668
|
class: "cn-find-bar",
|
|
647
669
|
"data-find-bar": "",
|
|
648
670
|
role: "search",
|
|
649
671
|
"aria-label": "查找替换",
|
|
650
|
-
onPointerdown: t[2] ||=
|
|
672
|
+
onPointerdown: t[2] ||= $(() => {}, ["stop"])
|
|
651
673
|
}, [
|
|
652
674
|
B("input", {
|
|
653
675
|
ref_key: "queryInput",
|
|
@@ -655,7 +677,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
655
677
|
class: "cn-find-bar__input",
|
|
656
678
|
"data-find-query": "",
|
|
657
679
|
type: "text",
|
|
658
|
-
value:
|
|
680
|
+
value: Z(i),
|
|
659
681
|
placeholder: "查找",
|
|
660
682
|
"aria-label": "查找",
|
|
661
683
|
spellcheck: "false",
|
|
@@ -667,7 +689,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
667
689
|
class: "cn-find-bar__input",
|
|
668
690
|
"data-find-replace": "",
|
|
669
691
|
type: "text",
|
|
670
|
-
value:
|
|
692
|
+
value: Z(a),
|
|
671
693
|
placeholder: "替换",
|
|
672
694
|
"aria-label": "替换",
|
|
673
695
|
spellcheck: "false",
|
|
@@ -675,8 +697,8 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
675
697
|
onInput: w,
|
|
676
698
|
onKeydown: S
|
|
677
699
|
}, null, 40, He),
|
|
678
|
-
B("span", Ue,
|
|
679
|
-
u.value ? (
|
|
700
|
+
B("span", Ue, X(d.value), 1),
|
|
701
|
+
u.value ? (K(), z("span", We, X(u.value), 1)) : R("", !0),
|
|
680
702
|
B("button", {
|
|
681
703
|
type: "button",
|
|
682
704
|
class: "cn-find-bar__key",
|
|
@@ -685,7 +707,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
685
707
|
title: "上一处(Shift+Enter)",
|
|
686
708
|
"aria-label": "上一处",
|
|
687
709
|
onClick: t[0] ||= (e) => _(-1)
|
|
688
|
-
}, [V(m, { icon:
|
|
710
|
+
}, [V(m, { icon: Z(fe) }, null, 8, ["icon"])], 8, Ge),
|
|
689
711
|
B("button", {
|
|
690
712
|
type: "button",
|
|
691
713
|
class: "cn-find-bar__key",
|
|
@@ -694,7 +716,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
694
716
|
title: "下一处(Enter)",
|
|
695
717
|
"aria-label": "下一处",
|
|
696
718
|
onClick: t[1] ||= (e) => _(1)
|
|
697
|
-
}, [V(m, { icon:
|
|
719
|
+
}, [V(m, { icon: Z(l) }, null, 8, ["icon"])], 8, Ke),
|
|
698
720
|
B("button", {
|
|
699
721
|
type: "button",
|
|
700
722
|
class: "cn-find-bar__action",
|
|
@@ -718,7 +740,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
718
740
|
title: "关闭(Esc)",
|
|
719
741
|
"aria-label": "关闭查找替换",
|
|
720
742
|
onClick: x
|
|
721
|
-
}, [V(m, { icon:
|
|
743
|
+
}, [V(m, { icon: Z(ge) }, null, 8, ["icon"])])
|
|
722
744
|
], 32)) : R("", !0);
|
|
723
745
|
}
|
|
724
746
|
}), [["__scopeId", "data-v-71f0a3ae"]]), Xe = {
|
|
@@ -777,7 +799,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
777
799
|
},
|
|
778
800
|
emits: ["change", "styleWrite"],
|
|
779
801
|
setup(e, { expose: o, emit: l }) {
|
|
780
|
-
let d = e, f = l, p =
|
|
802
|
+
let d = e, f = l, p = q(null);
|
|
781
803
|
o({ rootEl: p });
|
|
782
804
|
function h(e, t, n) {
|
|
783
805
|
f("styleWrite", {
|
|
@@ -817,8 +839,8 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
817
839
|
function x(e) {
|
|
818
840
|
h(["font"], e.target.value, !0);
|
|
819
841
|
}
|
|
820
|
-
let S =
|
|
821
|
-
|
|
842
|
+
let S = q(String(d.fontSize)), C = q(!1);
|
|
843
|
+
Q(() => d.fontSize, (e) => {
|
|
822
844
|
C.value || (S.value = String(e));
|
|
823
845
|
});
|
|
824
846
|
function w(e) {
|
|
@@ -894,16 +916,16 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
894
916
|
function H() {
|
|
895
917
|
h(["autowrap"], !d.autowrap, !0);
|
|
896
918
|
}
|
|
897
|
-
return (t, n) => (
|
|
919
|
+
return (t, n) => (K(), z("div", {
|
|
898
920
|
ref_key: "rootRef",
|
|
899
921
|
ref: p,
|
|
900
922
|
class: "cn-edit-toolbar",
|
|
901
923
|
role: "toolbar",
|
|
902
924
|
"aria-label": "文本编辑",
|
|
903
925
|
"data-edit-toolbar": "",
|
|
904
|
-
onPointerdown: n[7] ||=
|
|
926
|
+
onPointerdown: n[7] ||= $(() => {}, ["prevent"])
|
|
905
927
|
}, [
|
|
906
|
-
B("span", Ze, [(
|
|
928
|
+
B("span", Ze, [(K(), z(F, null, J(g, (t) => B("button", {
|
|
907
929
|
key: t.value,
|
|
908
930
|
type: "button",
|
|
909
931
|
class: U(["cn-edit-toolbar__item", { "cn-edit-toolbar__item--active": t.value === e.mode }]),
|
|
@@ -911,18 +933,18 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
911
933
|
"data-pill-static": t.value === "static" || void 0,
|
|
912
934
|
"data-pill-expression": t.value === "expression" || void 0,
|
|
913
935
|
onClick: (e) => _(t.value)
|
|
914
|
-
},
|
|
936
|
+
}, X(t.label), 11, Qe)), 64))]),
|
|
915
937
|
B("span", $e, [B("select", {
|
|
916
938
|
class: "cn-edit-toolbar__font",
|
|
917
939
|
"data-toolbar-font": "",
|
|
918
940
|
value: e.font,
|
|
919
941
|
title: "字体",
|
|
920
|
-
onPointerdown: n[0] ||=
|
|
942
|
+
onPointerdown: n[0] ||= $(() => {}, ["stop"]),
|
|
921
943
|
onChange: x
|
|
922
|
-
}, [(
|
|
944
|
+
}, [(K(!0), z(F, null, J(y.value, (e) => (K(), z("option", {
|
|
923
945
|
key: e.value,
|
|
924
946
|
value: e.value
|
|
925
|
-
},
|
|
947
|
+
}, X(e.label), 9, tt))), 128))], 40, et)]),
|
|
926
948
|
B("span", nt, [
|
|
927
949
|
B("button", {
|
|
928
950
|
type: "button",
|
|
@@ -931,10 +953,10 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
931
953
|
title: "字号减 1",
|
|
932
954
|
onClick: n[1] ||= (e) => k(-1)
|
|
933
955
|
}, [V(m, {
|
|
934
|
-
icon:
|
|
956
|
+
icon: Z(pe),
|
|
935
957
|
size: 11
|
|
936
958
|
}, null, 8, ["icon"])]),
|
|
937
|
-
|
|
959
|
+
se(B("input", {
|
|
938
960
|
"onUpdate:modelValue": n[2] ||= (e) => S.value = e,
|
|
939
961
|
class: "cn-edit-toolbar__size",
|
|
940
962
|
"data-toolbar-font-size": "",
|
|
@@ -943,12 +965,12 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
943
965
|
step: 1,
|
|
944
966
|
"aria-label": "字号(场景像素)",
|
|
945
967
|
title: "字号(场景像素)",
|
|
946
|
-
onPointerdown: n[3] ||=
|
|
968
|
+
onPointerdown: n[3] ||= $(() => {}, ["stop"]),
|
|
947
969
|
onInput: E,
|
|
948
970
|
onChange: O,
|
|
949
971
|
onBlur: O,
|
|
950
972
|
onFocus: n[4] ||= (e) => C.value = !0
|
|
951
|
-
}, null, 544), [[
|
|
973
|
+
}, null, 544), [[ae, S.value]]),
|
|
952
974
|
B("button", {
|
|
953
975
|
type: "button",
|
|
954
976
|
class: "cn-edit-toolbar__mini",
|
|
@@ -956,7 +978,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
956
978
|
title: "字号加 1",
|
|
957
979
|
onClick: n[5] ||= (e) => k(1)
|
|
958
980
|
}, [V(m, {
|
|
959
|
-
icon:
|
|
981
|
+
icon: Z(me),
|
|
960
982
|
size: 11
|
|
961
983
|
}, null, 8, ["icon"])])
|
|
962
984
|
]),
|
|
@@ -967,11 +989,11 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
967
989
|
value: ee.value,
|
|
968
990
|
"aria-label": "字色",
|
|
969
991
|
title: "字色",
|
|
970
|
-
onPointerdown: n[6] ||=
|
|
992
|
+
onPointerdown: n[6] ||= $(() => {}, ["stop"]),
|
|
971
993
|
onInput: A,
|
|
972
994
|
onChange: j
|
|
973
995
|
}, null, 40, it)]),
|
|
974
|
-
B("span", at, [(
|
|
996
|
+
B("span", at, [(K(!0), z(F, null, J(Z(P), (t) => (K(), z("button", {
|
|
975
997
|
key: t.value,
|
|
976
998
|
type: "button",
|
|
977
999
|
class: U(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.horizontalAlign }]),
|
|
@@ -983,7 +1005,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
983
1005
|
icon: t.icon,
|
|
984
1006
|
size: 12
|
|
985
1007
|
}, null, 8, ["icon"])], 10, ot))), 128))]),
|
|
986
|
-
B("span", st, [(
|
|
1008
|
+
B("span", st, [(K(!0), z(F, null, J(Z(L), (t) => (K(), z("button", {
|
|
987
1009
|
key: t.value,
|
|
988
1010
|
type: "button",
|
|
989
1011
|
class: U(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.verticalAlign }]),
|
|
@@ -1003,7 +1025,7 @@ var Ve = ["value"], He = ["value"], Ue = {
|
|
|
1003
1025
|
title: "自动换行",
|
|
1004
1026
|
onClick: H
|
|
1005
1027
|
}, [V(m, {
|
|
1006
|
-
icon:
|
|
1028
|
+
icon: Z(he),
|
|
1007
1029
|
size: 12
|
|
1008
1030
|
}, null, 8, ["icon"])], 10, ut)])
|
|
1009
1031
|
], 544));
|
|
@@ -1018,10 +1040,10 @@ function pt(e) {
|
|
|
1018
1040
|
return n(), () => t?.removeEventListener("change", n);
|
|
1019
1041
|
}
|
|
1020
1042
|
function mt() {
|
|
1021
|
-
let e =
|
|
1043
|
+
let e = Y(window.devicePixelRatio || 1), t = pt((t) => {
|
|
1022
1044
|
e.value = t;
|
|
1023
1045
|
});
|
|
1024
|
-
return
|
|
1046
|
+
return G(t, !0), e;
|
|
1025
1047
|
}
|
|
1026
1048
|
//#endregion
|
|
1027
1049
|
//#region src/canvas/useTextEditing.ts
|
|
@@ -1041,10 +1063,10 @@ function gt(e, t) {
|
|
|
1041
1063
|
return ht.set(n, i), i;
|
|
1042
1064
|
}
|
|
1043
1065
|
function _t(e, t) {
|
|
1044
|
-
let n =
|
|
1066
|
+
let n = Y(e.store.ui.editing), r = Y(0), i = e.subscribe((t) => {
|
|
1045
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);
|
|
1046
1068
|
});
|
|
1047
|
-
|
|
1069
|
+
G(i, !0);
|
|
1048
1070
|
let a = I(() => n.value?.path ?? null), o = mt(), s = P(e), c = I(() => {
|
|
1049
1071
|
r.value;
|
|
1050
1072
|
let t = n.value;
|
|
@@ -1075,10 +1097,10 @@ function _t(e, t) {
|
|
|
1075
1097
|
textAlign: e.horizontalAlign,
|
|
1076
1098
|
whiteSpace: e.autowrap ? "pre-wrap" : "pre"
|
|
1077
1099
|
};
|
|
1078
|
-
}), f =
|
|
1100
|
+
}), f = Y({
|
|
1079
1101
|
width: 0,
|
|
1080
1102
|
height: 0
|
|
1081
|
-
}), p =
|
|
1103
|
+
}), p = Y({
|
|
1082
1104
|
width: 0,
|
|
1083
1105
|
height: 0
|
|
1084
1106
|
}), m = () => {
|
|
@@ -1097,15 +1119,15 @@ function _t(e, t) {
|
|
|
1097
1119
|
height: e.offsetHeight
|
|
1098
1120
|
};
|
|
1099
1121
|
};
|
|
1100
|
-
|
|
1122
|
+
Q(a, (e) => {
|
|
1101
1123
|
e !== null && m();
|
|
1102
1124
|
}, { flush: "post" });
|
|
1103
1125
|
let g = null;
|
|
1104
|
-
|
|
1126
|
+
Q(() => t.getToolbar?.() ?? null, (e) => {
|
|
1105
1127
|
g?.disconnect(), g = null, e !== null && (h(), typeof ResizeObserver == "function" && (g = new ResizeObserver(h), g.observe(e)));
|
|
1106
1128
|
}, { flush: "post" });
|
|
1107
1129
|
let _ = null;
|
|
1108
|
-
|
|
1130
|
+
ie(() => {
|
|
1109
1131
|
let e = t.getHost();
|
|
1110
1132
|
e !== null && typeof ResizeObserver == "function" && (_ = new ResizeObserver(() => {
|
|
1111
1133
|
f.value = {
|
|
@@ -1113,7 +1135,7 @@ function _t(e, t) {
|
|
|
1113
1135
|
height: e.clientHeight
|
|
1114
1136
|
};
|
|
1115
1137
|
}), _.observe(e));
|
|
1116
|
-
}),
|
|
1138
|
+
}), G(() => {
|
|
1117
1139
|
_?.disconnect(), g?.disconnect();
|
|
1118
1140
|
}, !0);
|
|
1119
1141
|
let v = I(() => {
|
|
@@ -1176,7 +1198,7 @@ function _t(e, t) {
|
|
|
1176
1198
|
return;
|
|
1177
1199
|
}
|
|
1178
1200
|
k();
|
|
1179
|
-
}, M =
|
|
1201
|
+
}, M = Y(!1), N = (e) => {
|
|
1180
1202
|
M.value = e, !e && O && (O = !1, a.value !== null && k());
|
|
1181
1203
|
}, F = () => {
|
|
1182
1204
|
if (a.value !== null) {
|
|
@@ -1215,7 +1237,7 @@ function _t(e, t) {
|
|
|
1215
1237
|
}, z = () => {
|
|
1216
1238
|
D = !1;
|
|
1217
1239
|
};
|
|
1218
|
-
return window.addEventListener("pointerdown", R, !0), window.addEventListener("pointerup", z, !0),
|
|
1240
|
+
return window.addEventListener("pointerdown", R, !0), window.addEventListener("pointerup", z, !0), G(() => {
|
|
1219
1241
|
window.removeEventListener("pointerdown", R, !0), window.removeEventListener("pointerup", z, !0), A();
|
|
1220
1242
|
}, !0), {
|
|
1221
1243
|
editing: a,
|
|
@@ -1242,7 +1264,7 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1242
1264
|
__name: "TextEditingOverlay",
|
|
1243
1265
|
props: { editor: {} },
|
|
1244
1266
|
setup(e, { expose: t }) {
|
|
1245
|
-
let n = e, r =
|
|
1267
|
+
let n = e, r = q(null), i = q(null), a = q(null), o = q(null), s = _t(n.editor, {
|
|
1246
1268
|
getTextarea: () => i.value,
|
|
1247
1269
|
getHost: () => r.value?.parentElement ?? null,
|
|
1248
1270
|
getToolbar: () => a.value?.rootEl ?? null
|
|
@@ -1261,16 +1283,16 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1261
1283
|
popupEl: () => o.value?.rootEl ?? null,
|
|
1262
1284
|
scale: s.scale
|
|
1263
1285
|
});
|
|
1264
|
-
|
|
1286
|
+
Q(c, async (e) => {
|
|
1265
1287
|
if (!e) return;
|
|
1266
1288
|
await ne();
|
|
1267
1289
|
let t = i.value, n = s.layout.value;
|
|
1268
1290
|
t && n && (t.value = n.text, g(), t.focus({ preventScroll: !0 }), t.select());
|
|
1269
|
-
}),
|
|
1291
|
+
}), Q(s.draftSeq, async () => {
|
|
1270
1292
|
await ne();
|
|
1271
1293
|
let e = i.value, t = s.layout.value;
|
|
1272
1294
|
e && t && (e.value = t.text, g());
|
|
1273
|
-
}),
|
|
1295
|
+
}), Q(l, async (e, t) => {
|
|
1274
1296
|
if (!t || !e) return;
|
|
1275
1297
|
let n = i.value;
|
|
1276
1298
|
if (!n || u.value) return;
|
|
@@ -1286,39 +1308,39 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1286
1308
|
commitEditing: () => s.commitNow(),
|
|
1287
1309
|
isEditing: () => c.value !== null,
|
|
1288
1310
|
ownsEventTarget: (e) => s.ownsEventTarget(e)
|
|
1289
|
-
}), (e, t) => (
|
|
1311
|
+
}), (e, t) => (K(), z("div", {
|
|
1290
1312
|
ref_key: "rootRef",
|
|
1291
1313
|
ref: r,
|
|
1292
1314
|
class: "cn-text-overlay"
|
|
1293
1315
|
}, [
|
|
1294
|
-
|
|
1295
|
-
key:
|
|
1316
|
+
Z(c) && Z(l) ? (K(), z("textarea", {
|
|
1317
|
+
key: Z(c).join(""),
|
|
1296
1318
|
ref_key: "textareaRef",
|
|
1297
1319
|
ref: i,
|
|
1298
1320
|
class: "cn-text-overlay__textarea",
|
|
1299
|
-
style: W(
|
|
1300
|
-
wrap:
|
|
1321
|
+
style: W(Z(l)),
|
|
1322
|
+
wrap: Z(l).whiteSpace === "pre" ? "off" : "soft",
|
|
1301
1323
|
spellcheck: "false",
|
|
1302
1324
|
autocomplete: "off",
|
|
1303
1325
|
onKeydown: b,
|
|
1304
1326
|
onBlur: x,
|
|
1305
|
-
onCompositionstart: t[0] ||= (e) =>
|
|
1306
|
-
onCompositionend: t[1] ||= (e) =>
|
|
1327
|
+
onCompositionstart: t[0] ||= (e) => Z(s).setComposing(!0),
|
|
1328
|
+
onCompositionend: t[1] ||= (e) => Z(s).setComposing(!1)
|
|
1307
1329
|
}, null, 44, vt)) : R("", !0),
|
|
1308
|
-
|
|
1330
|
+
Z(c) && Z(d) ? (K(), L(ft, {
|
|
1309
1331
|
key: 1,
|
|
1310
1332
|
ref_key: "toolbarRef",
|
|
1311
1333
|
ref: a,
|
|
1312
|
-
style: W(
|
|
1334
|
+
style: W(Z(d)),
|
|
1313
1335
|
mode: m.value ? "expression" : "static",
|
|
1314
|
-
font:
|
|
1315
|
-
"font-size":
|
|
1316
|
-
"font-color":
|
|
1317
|
-
"horizontal-align":
|
|
1318
|
-
"vertical-align":
|
|
1319
|
-
autowrap:
|
|
1320
|
-
onChange: t[2] ||= (e) =>
|
|
1321
|
-
onStyleWrite: t[3] ||= (e) =>
|
|
1336
|
+
font: Z(p)?.font ?? "",
|
|
1337
|
+
"font-size": Z(p)?.fontSize ?? 16,
|
|
1338
|
+
"font-color": Z(p)?.fontColor ?? "#000000",
|
|
1339
|
+
"horizontal-align": Z(p)?.horizontalAlign ?? "left",
|
|
1340
|
+
"vertical-align": Z(p)?.verticalAlign ?? "top",
|
|
1341
|
+
autowrap: Z(p)?.autowrap ?? !1,
|
|
1342
|
+
onChange: t[2] ||= (e) => Z(s).setExpressionMode(e === "expression"),
|
|
1343
|
+
onStyleWrite: t[3] ||= (e) => Z(s).updateStyleField(e.key, e.value, e.final)
|
|
1322
1344
|
}, null, 8, [
|
|
1323
1345
|
"style",
|
|
1324
1346
|
"mode",
|
|
@@ -1329,16 +1351,16 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1329
1351
|
"vertical-align",
|
|
1330
1352
|
"autowrap"
|
|
1331
1353
|
])) : R("", !0),
|
|
1332
|
-
|
|
1354
|
+
Z(c) && _.value ? (K(), z("span", {
|
|
1333
1355
|
key: 2,
|
|
1334
1356
|
class: "cn-text-overlay__diagnostic",
|
|
1335
|
-
style: W(
|
|
1336
|
-
},
|
|
1357
|
+
style: W(Z(f))
|
|
1358
|
+
}, X(_.value), 5)) : R("", !0),
|
|
1337
1359
|
V(k, {
|
|
1338
1360
|
ref_key: "popupRef",
|
|
1339
1361
|
ref: o,
|
|
1340
|
-
state:
|
|
1341
|
-
onSelect:
|
|
1362
|
+
state: Z(v),
|
|
1363
|
+
onSelect: Z(y)
|
|
1342
1364
|
}, null, 8, ["state", "onSelect"])
|
|
1343
1365
|
], 512));
|
|
1344
1366
|
}
|
|
@@ -1351,12 +1373,12 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1351
1373
|
props: { editor: {} },
|
|
1352
1374
|
emits: ["ready"],
|
|
1353
1375
|
setup(e, { emit: t }) {
|
|
1354
|
-
let n = e, r = t, i =
|
|
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(() => {
|
|
1355
1377
|
if (d.value) return;
|
|
1356
1378
|
if (m.value !== null || h.value) return u.value ? void 0 : { cursor: "crosshair" };
|
|
1357
1379
|
let e = p.value ?? f.value;
|
|
1358
1380
|
return e === null ? void 0 : { cursor: Xe[e] };
|
|
1359
|
-
}), v =
|
|
1381
|
+
}), v = q(!1), y = C();
|
|
1360
1382
|
function x(e) {
|
|
1361
1383
|
return new Promise((t, n) => {
|
|
1362
1384
|
let r = URL.createObjectURL(e), i = new Image();
|
|
@@ -1371,7 +1393,7 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1371
1393
|
});
|
|
1372
1394
|
}
|
|
1373
1395
|
let w = [];
|
|
1374
|
-
return
|
|
1396
|
+
return ie(() => {
|
|
1375
1397
|
let e = i.value, t = a.value, g = o.value;
|
|
1376
1398
|
if (!e || !t || !g) return;
|
|
1377
1399
|
let _ = n.editor, C = () => {
|
|
@@ -1506,8 +1528,8 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1506
1528
|
s.value.commitEditing();
|
|
1507
1529
|
}
|
|
1508
1530
|
e.preventDefault();
|
|
1509
|
-
let t = k(e), n = _.toScenePoint(t.x, t.y);
|
|
1510
|
-
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) {
|
|
1511
1533
|
c.value?.close();
|
|
1512
1534
|
return;
|
|
1513
1535
|
}
|
|
@@ -1544,9 +1566,9 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1544
1566
|
return !1;
|
|
1545
1567
|
}, re = (e) => {
|
|
1546
1568
|
W(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), v.value = !0);
|
|
1547
|
-
},
|
|
1569
|
+
}, ie = (t) => {
|
|
1548
1570
|
t.relatedTarget !== null && e.contains(t.relatedTarget) || (v.value = !1);
|
|
1549
|
-
},
|
|
1571
|
+
}, G = (e) => {
|
|
1550
1572
|
e.preventDefault(), v.value = !1;
|
|
1551
1573
|
let t = [], n = e.dataTransfer?.files;
|
|
1552
1574
|
for (let e = 0; n !== void 0 && e < n.length; e += 1) {
|
|
@@ -1558,9 +1580,9 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1558
1580
|
y.show("上传不可用:未接入上传实现,图片未添加");
|
|
1559
1581
|
return;
|
|
1560
1582
|
}
|
|
1561
|
-
s.value?.isEditing() && s.value.commitEditing(),
|
|
1583
|
+
s.value?.isEditing() && s.value.commitEditing(), K(t, k(e));
|
|
1562
1584
|
}
|
|
1563
|
-
},
|
|
1585
|
+
}, K = async (e, t) => {
|
|
1564
1586
|
let n = _.toScenePoint(t.x, t.y);
|
|
1565
1587
|
for (let t = 0; t < e.length; t += 1) {
|
|
1566
1588
|
let r = e[t];
|
|
@@ -1579,19 +1601,19 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1579
1601
|
}
|
|
1580
1602
|
}
|
|
1581
1603
|
};
|
|
1582
|
-
e.addEventListener("dragover", re), e.addEventListener("dragleave",
|
|
1583
|
-
e.removeEventListener("dragover", re), e.removeEventListener("dragleave",
|
|
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);
|
|
1584
1606
|
});
|
|
1585
|
-
let
|
|
1586
|
-
t.addEventListener("contextlost",
|
|
1587
|
-
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);
|
|
1588
1610
|
}), r("ready", {
|
|
1589
1611
|
contentCanvas: t,
|
|
1590
1612
|
overlayCanvas: g
|
|
1591
1613
|
});
|
|
1592
1614
|
}), re(() => {
|
|
1593
1615
|
w.forEach((e) => e()), w.length = 0, n.editor.detachSurfaces();
|
|
1594
|
-
}), (t, n) => (
|
|
1616
|
+
}), (t, n) => (K(), z("div", {
|
|
1595
1617
|
ref_key: "hostRef",
|
|
1596
1618
|
ref: i,
|
|
1597
1619
|
class: U(["cn-surface", g.value]),
|
|
@@ -1622,10 +1644,10 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
|
|
|
1622
1644
|
ref: l,
|
|
1623
1645
|
editor: e.editor
|
|
1624
1646
|
}, null, 8, ["editor"]),
|
|
1625
|
-
v.value ? (
|
|
1647
|
+
v.value ? (K(), z("div", bt, [...n[0] ||= [B("span", { class: "cn-surface__drop-hint-text" }, "松开以上传图片", -1)]])) : R("", !0)
|
|
1626
1648
|
], 6));
|
|
1627
1649
|
}
|
|
1628
|
-
}), [["__scopeId", "data-v-
|
|
1650
|
+
}), [["__scopeId", "data-v-e1d8373e"]]);
|
|
1629
1651
|
//#endregion
|
|
1630
1652
|
//#region src/canvas/guideSnap.ts
|
|
1631
1653
|
function Ct(e, t, n, r) {
|
|
@@ -1655,14 +1677,14 @@ var wt = [
|
|
|
1655
1677
|
__name: "GuidesOverlay",
|
|
1656
1678
|
props: { editor: {} },
|
|
1657
1679
|
setup(e, { expose: t }) {
|
|
1658
|
-
let n = e, r = P(n.editor), i =
|
|
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) => {
|
|
1659
1681
|
if (e.scope === "doc") {
|
|
1660
1682
|
i.value = n.editor.store.doc, a.value = n.editor.listGuides(), o.value = n.editor.listSnapAxes();
|
|
1661
1683
|
return;
|
|
1662
1684
|
}
|
|
1663
1685
|
e.branch === "guides" ? a.value = n.editor.listGuides() : e.branch === "snapAxes" && (o.value = n.editor.listSnapAxes());
|
|
1664
1686
|
});
|
|
1665
|
-
|
|
1687
|
+
G(s, !0);
|
|
1666
1688
|
function c(e, t) {
|
|
1667
1689
|
let n = i.value, a = r.value;
|
|
1668
1690
|
return n ? e === "vertical" ? {
|
|
@@ -1678,7 +1700,7 @@ var wt = [
|
|
|
1678
1700
|
function l(e) {
|
|
1679
1701
|
return String(Math.round(e * 100) / 100);
|
|
1680
1702
|
}
|
|
1681
|
-
let u =
|
|
1703
|
+
let u = q(null);
|
|
1682
1704
|
function d(e) {
|
|
1683
1705
|
return {
|
|
1684
1706
|
orientation: e.orientation,
|
|
@@ -1709,7 +1731,7 @@ var wt = [
|
|
|
1709
1731
|
endGuideDrag: m,
|
|
1710
1732
|
cancelGuideDrag: h
|
|
1711
1733
|
});
|
|
1712
|
-
let g =
|
|
1734
|
+
let g = q(null), _ = I(() => a.value.map((e) => {
|
|
1713
1735
|
let t = g.value;
|
|
1714
1736
|
return t !== null && t.id === e.id ? {
|
|
1715
1737
|
id: e.id,
|
|
@@ -1724,7 +1746,7 @@ var wt = [
|
|
|
1724
1746
|
dragging: !1,
|
|
1725
1747
|
overRuler: !1
|
|
1726
1748
|
};
|
|
1727
|
-
})), v =
|
|
1749
|
+
})), v = q(null);
|
|
1728
1750
|
function y(e, t) {
|
|
1729
1751
|
let n = v.value?.getBoundingClientRect(), i = r.value, a = n?.left ?? 0, o = n?.top ?? 0;
|
|
1730
1752
|
return t === "vertical" ? i.x + (e.clientX - a) / i.zoom : i.y + (e.clientY - o) / i.zoom;
|
|
@@ -1774,13 +1796,13 @@ var wt = [
|
|
|
1774
1796
|
let t = g.value;
|
|
1775
1797
|
t !== null && e.pointerId === t.pointerId && (g.value = null, S(e));
|
|
1776
1798
|
}
|
|
1777
|
-
return (e, t) => (
|
|
1799
|
+
return (e, t) => (K(), z("div", {
|
|
1778
1800
|
ref_key: "rootRef",
|
|
1779
1801
|
ref: v,
|
|
1780
1802
|
class: "cn-guides",
|
|
1781
1803
|
"data-guide-overlay": ""
|
|
1782
1804
|
}, [
|
|
1783
|
-
(
|
|
1805
|
+
(K(!0), z(F, null, J(o.value, (e, t) => (K(), z("div", {
|
|
1784
1806
|
key: `${e.orientation}-${e.position}-${t}`,
|
|
1785
1807
|
class: U(["cn-guides__snap", `cn-guides__snap--${e.orientation}`]),
|
|
1786
1808
|
"data-snap-line": "",
|
|
@@ -1789,7 +1811,7 @@ var wt = [
|
|
|
1789
1811
|
"data-snap-source": e.source,
|
|
1790
1812
|
style: W(c(e.orientation, e.position))
|
|
1791
1813
|
}, null, 14, wt))), 128)),
|
|
1792
|
-
(
|
|
1814
|
+
(K(!0), z(F, null, J(_.value, (e) => (K(), z("div", {
|
|
1793
1815
|
key: e.id,
|
|
1794
1816
|
class: U(["cn-guides__guide", [`cn-guides__guide--${e.orientation}`, {
|
|
1795
1817
|
"cn-guides__guide--grabbed": e.dragging,
|
|
@@ -1805,7 +1827,7 @@ var wt = [
|
|
|
1805
1827
|
onPointerup: T,
|
|
1806
1828
|
onPointercancel: E
|
|
1807
1829
|
}, null, 46, Tt))), 128)),
|
|
1808
|
-
u.value ? (
|
|
1830
|
+
u.value ? (K(), z("div", {
|
|
1809
1831
|
key: 0,
|
|
1810
1832
|
class: U(["cn-guides__guide cn-guides__guide--preview", `cn-guides__guide--${u.value.orientation}`]),
|
|
1811
1833
|
"data-guide-preview": "",
|
|
@@ -1834,10 +1856,10 @@ var wt = [
|
|
|
1834
1856
|
"guide-drag-cancel"
|
|
1835
1857
|
],
|
|
1836
1858
|
setup(e, { emit: t }) {
|
|
1837
|
-
let n = e, r = t, i = P(n.editor), a =
|
|
1859
|
+
let n = e, r = t, i = P(n.editor), a = Y(n.editor.store.ui.rulersVisible), o = n.editor.subscribe((e) => {
|
|
1838
1860
|
e.scope === "ui" && e.branch === "rulersVisible" && (a.value = n.editor.store.ui.rulersVisible);
|
|
1839
1861
|
});
|
|
1840
|
-
|
|
1862
|
+
G(o, !0);
|
|
1841
1863
|
let s = [
|
|
1842
1864
|
1,
|
|
1843
1865
|
2,
|
|
@@ -1875,13 +1897,13 @@ var wt = [
|
|
|
1875
1897
|
}
|
|
1876
1898
|
return o;
|
|
1877
1899
|
}
|
|
1878
|
-
let l =
|
|
1900
|
+
let l = q(null), u = q(null), d = q(0), f = q(0), p = () => {
|
|
1879
1901
|
d.value = l.value?.clientWidth ?? 0, f.value = u.value?.clientHeight ?? 0;
|
|
1880
1902
|
}, m = null;
|
|
1881
|
-
|
|
1903
|
+
ie(() => {
|
|
1882
1904
|
p(), m = new ResizeObserver(() => p()), l.value && m.observe(l.value), u.value && m.observe(u.value);
|
|
1883
1905
|
}), re(() => m?.disconnect());
|
|
1884
|
-
let h = I(() => c(i.value.x, d.value, i.value.zoom)), g = I(() => c(i.value.y, f.value, i.value.zoom)), _ =
|
|
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);
|
|
1885
1907
|
function v(e, t, n) {
|
|
1886
1908
|
let r = e.getBoundingClientRect(), a = i.value;
|
|
1887
1909
|
return {
|
|
@@ -1916,7 +1938,7 @@ var wt = [
|
|
|
1916
1938
|
let a = v(n, i.orientation, e);
|
|
1917
1939
|
r(t === "guide-drag-end" ? "guide-drag-end" : "guide-drag-cancel", a);
|
|
1918
1940
|
}
|
|
1919
|
-
return (e, t) =>
|
|
1941
|
+
return (e, t) => se((K(), z("div", Ot, [
|
|
1920
1942
|
B("div", {
|
|
1921
1943
|
ref_key: "topRef",
|
|
1922
1944
|
ref: l,
|
|
@@ -1929,11 +1951,11 @@ var wt = [
|
|
|
1929
1951
|
onPointermove: t[1] ||= (e) => b(e),
|
|
1930
1952
|
onPointerup: t[2] ||= (e) => x(e, "guide-drag-end"),
|
|
1931
1953
|
onPointercancel: t[3] ||= (e) => x(e, "guide-drag-cancel")
|
|
1932
|
-
}, [(
|
|
1954
|
+
}, [(K(!0), z(F, null, J(h.value, (e) => (K(), z("span", {
|
|
1933
1955
|
key: e.scene,
|
|
1934
1956
|
class: U(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
|
|
1935
1957
|
style: W({ left: `${e.position}px` })
|
|
1936
|
-
}, [e.label === null ? R("", !0) : (
|
|
1958
|
+
}, [e.label === null ? R("", !0) : (K(), z("span", kt, X(e.label), 1))], 6))), 128))], 544),
|
|
1937
1959
|
B("div", {
|
|
1938
1960
|
ref_key: "leftRef",
|
|
1939
1961
|
ref: u,
|
|
@@ -1946,17 +1968,17 @@ var wt = [
|
|
|
1946
1968
|
onPointermove: t[5] ||= (e) => b(e),
|
|
1947
1969
|
onPointerup: t[6] ||= (e) => x(e, "guide-drag-end"),
|
|
1948
1970
|
onPointercancel: t[7] ||= (e) => x(e, "guide-drag-cancel")
|
|
1949
|
-
}, [(
|
|
1971
|
+
}, [(K(!0), z(F, null, J(g.value, (e) => (K(), z("span", {
|
|
1950
1972
|
key: e.scene,
|
|
1951
1973
|
class: U(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
|
|
1952
1974
|
style: W({ top: `${e.position}px` })
|
|
1953
|
-
}, [e.label === null ? R("", !0) : (
|
|
1975
|
+
}, [e.label === null ? R("", !0) : (K(), z("span", At, X(e.label), 1))], 6))), 128))], 544),
|
|
1954
1976
|
t[8] ||= B("div", {
|
|
1955
1977
|
class: "cn-ruler__corner",
|
|
1956
1978
|
"data-ruler-corner": "",
|
|
1957
1979
|
"aria-hidden": "true"
|
|
1958
1980
|
}, null, -1)
|
|
1959
|
-
], 512)), [[
|
|
1981
|
+
], 512)), [[oe, a.value]]);
|
|
1960
1982
|
}
|
|
1961
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;
|
|
1962
1984
|
function Gt(e, t, n) {
|