mce 0.11.0 → 0.11.1
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/index.js +1041 -1042
- package/dist/mixins/1.upload.d.ts +1 -1
- package/dist/mixins/2.export/json.d.ts +2 -2
- package/dist/plugins/gif.d.ts +1 -1
- package/dist/plugins/image.d.ts +3 -3
- package/dist/plugins/menu.d.ts +11 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as V, computed as z, watch as pe, markRaw as fe, reactive as Ae, warn as Nt, shallowRef as Ze, inject as Se, provide as Le, defineComponent as X, createVNode as H, mergeProps as Oe, createElementVNode as I, toValue as dn, getCurrentInstance as Qe, onScopeDispose as mn, createElementBlock as P, openBlock as $, Fragment as se, renderList as _e, unref as
|
|
1
|
+
import { ref as V, computed as z, watch as pe, markRaw as fe, reactive as Ae, warn as Nt, shallowRef as Ze, inject as Se, provide as Le, defineComponent as X, createVNode as H, mergeProps as Oe, createElementVNode as I, toValue as dn, getCurrentInstance as Qe, onScopeDispose as mn, createElementBlock as P, openBlock as $, Fragment as se, renderList as _e, unref as M, normalizeStyle as q, normalizeClass as be, onBeforeUnmount as we, readonly as hn, toRef as Te, onMounted as He, useId as Pt, onDeactivated as fn, onActivated as pn, useAttrs as Rt, createBlock as oe, resolveDynamicComponent as Bt, useTemplateRef as ce, renderSlot as ee, Teleport as vn, createCommentVNode as Z, mergeModels as $e, useModel as ke, resolveComponent as yn, withCtx as ne, createTextVNode as gn, toDisplayString as K, createSlots as ht, normalizeProps as ft, guardReactiveProps as pt, withDirectives as ze, vShow as Ue, vModelText as bn, nextTick as Xe, withModifiers as We, onBeforeMount as vt, isRef as wn } from "vue";
|
|
2
2
|
import { useFileDialog as Lt, useEventListener as Dt, isClient as xn, useResizeObserver as Vt, useLocalStorage as _n, onClickOutside as kn, useMouse as Cn, useDebounceFn as jt } from "@vueuse/core";
|
|
3
3
|
import { Node as _t, Element2D as G, Timeline as An, Engine as Tn, Camera2D as En, DrawboardEffect as Sn, IN_BROWSER as yt, clamp as Mn, assets as Ut, TimelineNode as zn, Transform2D as On, DEG_TO_RAD as $n, render as gt, Animation as In } from "modern-canvas";
|
|
4
4
|
import { getObjectValueByPath as Fn, setObjectValueByPath as Nn, Observable as Xt, Reactivable as Pn, idGenerator as et, property as Rn, normalizeElement as Ht, normalizeTextContent as Bn } from "modern-idoc";
|
|
@@ -14,7 +14,7 @@ const Wn = (o) => {
|
|
|
14
14
|
const {
|
|
15
15
|
emit: e
|
|
16
16
|
} = o, t = V(/* @__PURE__ */ new Map()), n = (i) => {
|
|
17
|
-
Array.isArray(i) ? i.forEach((
|
|
17
|
+
Array.isArray(i) ? i.forEach((r) => n(r)) : t.value.set(i.command, i);
|
|
18
18
|
};
|
|
19
19
|
Object.assign(o, {
|
|
20
20
|
commands: t,
|
|
@@ -22,56 +22,56 @@ const Wn = (o) => {
|
|
|
22
22
|
unregisterCommand: (i) => {
|
|
23
23
|
t.value.delete(i);
|
|
24
24
|
},
|
|
25
|
-
exec: (i, ...
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
throw new Error(`Command "${
|
|
31
|
-
const h =
|
|
32
|
-
return e(`command:${
|
|
25
|
+
exec: (i, ...r) => {
|
|
26
|
+
const [c, u] = i.split(":");
|
|
27
|
+
u !== void 0 && r.unshift(u);
|
|
28
|
+
const l = t.value.get(c);
|
|
29
|
+
if (!l)
|
|
30
|
+
throw new Error(`Command "${c}" not found`);
|
|
31
|
+
const h = l.handle(...r);
|
|
32
|
+
return e(`command:${c}`, h), h;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}, Kn = (o) => {
|
|
36
36
|
const {
|
|
37
37
|
config: e
|
|
38
38
|
} = o;
|
|
39
|
-
function t(
|
|
40
|
-
return Fn(e.value,
|
|
39
|
+
function t(u, l) {
|
|
40
|
+
return Fn(e.value, u) ?? l;
|
|
41
41
|
}
|
|
42
|
-
function n(
|
|
43
|
-
Nn(e.value,
|
|
42
|
+
function n(u, l) {
|
|
43
|
+
Nn(e.value, u, l);
|
|
44
44
|
}
|
|
45
|
-
function s(
|
|
45
|
+
function s(u) {
|
|
46
46
|
return z({
|
|
47
|
-
get: () => t(
|
|
48
|
-
set: (
|
|
47
|
+
get: () => t(u),
|
|
48
|
+
set: (l) => n(u, l)
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
function a(
|
|
52
|
-
const h = s(
|
|
53
|
-
return h.value === void 0 && (h.value =
|
|
51
|
+
function a(u, l) {
|
|
52
|
+
const h = s(u);
|
|
53
|
+
return h.value === void 0 && (h.value = l), h;
|
|
54
54
|
}
|
|
55
55
|
function i() {
|
|
56
|
-
return new Promise((
|
|
57
|
-
const { onChange:
|
|
56
|
+
return new Promise((u) => {
|
|
57
|
+
const { onChange: l, open: h } = Lt({
|
|
58
58
|
accept: ".json",
|
|
59
59
|
reset: !0,
|
|
60
60
|
multiple: !1
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
l(async (k) => {
|
|
63
63
|
const f = k?.[0];
|
|
64
|
-
f && (e.value = JSON.parse(await f.text()),
|
|
64
|
+
f && (e.value = JSON.parse(await f.text()), u(e.value));
|
|
65
65
|
}), h();
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function r() {
|
|
69
69
|
return new Blob([JSON.stringify(e.value)], { type: "application/json" });
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function c(u = "settings.json") {
|
|
72
72
|
Yt(
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
r(),
|
|
74
|
+
u
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
Object.assign(o, {
|
|
@@ -80,8 +80,8 @@ const Wn = (o) => {
|
|
|
80
80
|
getConfig: s,
|
|
81
81
|
registerConfig: a,
|
|
82
82
|
importConfig: i,
|
|
83
|
-
exportConfig:
|
|
84
|
-
saveAsConfig:
|
|
83
|
+
exportConfig: r,
|
|
84
|
+
saveAsConfig: c
|
|
85
85
|
});
|
|
86
86
|
}, Jn = (o, e) => {
|
|
87
87
|
const {
|
|
@@ -367,18 +367,18 @@ function yo(o, e = {}, t, n = !1) {
|
|
|
367
367
|
...e?.meta ?? {}
|
|
368
368
|
}
|
|
369
369
|
}), a = s.id, i = new le.Array();
|
|
370
|
-
for (const
|
|
371
|
-
o.set(
|
|
370
|
+
for (const r in s)
|
|
371
|
+
o.set(r, s[r]);
|
|
372
372
|
return o.set("id", a), o.set("parentId", t), o.set("name", s.name ?? a), o.set("childrenIds", i), o.set("meta", new le.Map(Object.entries(s.meta ?? {}))), s?.meta?.inCanvasIs === "Element2D" && (o.set("style", new le.Map(Object.entries(s.style ?? {}))), o.set("background", new le.Map(Object.entries(s.background ?? {}))), o.set("shape", new le.Map(Object.entries(s.shape ?? {}))), o.set("fill", new le.Map(Object.entries(s.fill ?? {}))), o.set("outline", new le.Map(Object.entries(s.outline ?? {}))), o.set("text", new le.Map(Object.entries(s.text ?? {}))), o.set("foreground", new le.Map(Object.entries(s.foreground ?? {}))), o.set("shadow", new le.Map(Object.entries(s.shadow ?? {})))), {
|
|
373
373
|
normalized: s,
|
|
374
374
|
yChildrenIds: i
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
377
|
function en(o, e, t = !1) {
|
|
378
|
-
const n = [], s = new le.Map(), { normalized: a, yChildrenIds: i } = yo(s, o, e, t),
|
|
379
|
-
return n.push({ id:
|
|
380
|
-
const
|
|
381
|
-
i.push([
|
|
378
|
+
const n = [], s = new le.Map(), { normalized: a, yChildrenIds: i } = yo(s, o, e, t), r = a.id;
|
|
379
|
+
return n.push({ id: r, element: s }), a.children?.forEach((c) => {
|
|
380
|
+
const u = en(c, r, t);
|
|
381
|
+
i.push([u[0].id]), n.push(...u);
|
|
382
382
|
}), n;
|
|
383
383
|
}
|
|
384
384
|
class Ke extends fo {
|
|
@@ -429,10 +429,10 @@ class Ke extends fo {
|
|
|
429
429
|
this._debug("_onChildrenChange", e);
|
|
430
430
|
const { keysChanged: n, changes: s } = e;
|
|
431
431
|
n.forEach((a) => {
|
|
432
|
-
const i = s.keys.get(a),
|
|
432
|
+
const i = s.keys.get(a), r = this._yChildren.get(a);
|
|
433
433
|
switch (i?.action) {
|
|
434
434
|
case "add":
|
|
435
|
-
|
|
435
|
+
r && this._getOrCreateNode(r);
|
|
436
436
|
break;
|
|
437
437
|
case "delete":
|
|
438
438
|
this.nodeMap.get(a)?.remove(), this.nodeMap.delete(a);
|
|
@@ -446,9 +446,9 @@ class Ke extends fo {
|
|
|
446
446
|
_addElement(e, t = {}) {
|
|
447
447
|
const { parentId: n, index: s, regenId: a } = t, i = en(e, n, a);
|
|
448
448
|
i.forEach((h) => this._yChildren.set(h.id, h.element));
|
|
449
|
-
const
|
|
450
|
-
let
|
|
451
|
-
return n ? (
|
|
449
|
+
const c = i.map((h) => this._getOrCreateNode(h.element))[0];
|
|
450
|
+
let u, l;
|
|
451
|
+
return n ? (u = this.nodeMap.get(n), l = this._yChildren.get(n)?.get("childrenIds")) : (u = this.root, l = this._yChildrenIds), u && l && (s === void 0 ? (l.push([c.id]), u.appendChild(c)) : (l.insert(s, [c.id]), u.moveChild(c, s))), c;
|
|
452
452
|
}
|
|
453
453
|
addElement(e, t) {
|
|
454
454
|
return this.transact(() => this._addElement(e, t));
|
|
@@ -487,33 +487,33 @@ class Ke extends fo {
|
|
|
487
487
|
_proxyProps(e, t, n = !1) {
|
|
488
488
|
const s = {
|
|
489
489
|
getProperty: (i) => t.doc ? t.get(i) : void 0,
|
|
490
|
-
setProperty: (i,
|
|
491
|
-
this._transacting !== !1 && this.transact(() => t.set(i,
|
|
490
|
+
setProperty: (i, r) => {
|
|
491
|
+
this._transacting !== !1 && this.transact(() => t.set(i, r));
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
if (n) {
|
|
495
495
|
e._propertyAccessor = void 0;
|
|
496
496
|
const i = {};
|
|
497
|
-
t.forEach((
|
|
498
|
-
i[
|
|
499
|
-
}), e._propertyAccessor = fe(s), t.forEach((
|
|
500
|
-
const
|
|
501
|
-
|
|
497
|
+
t.forEach((r, c) => {
|
|
498
|
+
i[c] = e.getProperty(c);
|
|
499
|
+
}), e._propertyAccessor = fe(s), t.forEach((r, c) => {
|
|
500
|
+
const u = e.getProperty(c), l = i[c];
|
|
501
|
+
u !== void 0 && !Object.is(u, l) && (e.setProperty(c, u), e.requestUpdate(c, u, l));
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
504
|
e.setPropertyAccessor(s);
|
|
505
|
-
const a = (i,
|
|
506
|
-
this._isSelfTransaction(
|
|
507
|
-
const { keysChanged:
|
|
508
|
-
|
|
509
|
-
const h =
|
|
505
|
+
const a = (i, r) => {
|
|
506
|
+
this._isSelfTransaction(r) || (this._debug("_proxyProps", i, e), this.transact(() => {
|
|
507
|
+
const { keysChanged: c, changes: u } = i;
|
|
508
|
+
c.forEach((l) => {
|
|
509
|
+
const h = u.keys.get(l), k = h?.oldValue;
|
|
510
510
|
switch (h?.action) {
|
|
511
511
|
case "add":
|
|
512
512
|
case "update":
|
|
513
|
-
this.undoManager.stopCapturing(), e[
|
|
513
|
+
this.undoManager.stopCapturing(), e[l] = t.get(l), e.requestUpdate(l, t.get(l), k);
|
|
514
514
|
break;
|
|
515
515
|
case "delete":
|
|
516
|
-
this.undoManager.stopCapturing(), e[
|
|
516
|
+
this.undoManager.stopCapturing(), e[l] = void 0, e.requestUpdate(l, e[l], k);
|
|
517
517
|
break;
|
|
518
518
|
}
|
|
519
519
|
});
|
|
@@ -531,22 +531,22 @@ class Ke extends fo {
|
|
|
531
531
|
return;
|
|
532
532
|
this._debug("_proxyChildren", s, e);
|
|
533
533
|
const i = e.children;
|
|
534
|
-
let
|
|
535
|
-
s.changes.delta.forEach((
|
|
536
|
-
if (
|
|
537
|
-
for (let
|
|
538
|
-
i[
|
|
539
|
-
if (
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
let k = this.nodeMap.get(
|
|
543
|
-
const f = (
|
|
544
|
-
e.moveChild(
|
|
534
|
+
let r = 0;
|
|
535
|
+
s.changes.delta.forEach((c) => {
|
|
536
|
+
if (c.retain !== void 0 && (r += c.retain), c.delete)
|
|
537
|
+
for (let u = r; u < r + c.delete; u++)
|
|
538
|
+
i[u]?.remove();
|
|
539
|
+
if (c.insert) {
|
|
540
|
+
const u = Array.isArray(c.insert) ? c.insert : [c.insert];
|
|
541
|
+
u.forEach((l, h) => {
|
|
542
|
+
let k = this.nodeMap.get(l);
|
|
543
|
+
const f = (v) => {
|
|
544
|
+
e.moveChild(v, r + h);
|
|
545
545
|
};
|
|
546
546
|
k ? f(k) : setTimeout(() => {
|
|
547
|
-
k = this.nodeMap.get(
|
|
547
|
+
k = this.nodeMap.get(l), k && f(k);
|
|
548
548
|
}, 0);
|
|
549
|
-
}),
|
|
549
|
+
}), r += u.length;
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
552
|
};
|
|
@@ -603,11 +603,11 @@ const go = (o) => {
|
|
|
603
603
|
fe(s.renderer);
|
|
604
604
|
const a = V(new En({ internalMode: "front" })), i = V(new Sn({ internalMode: "back", effectMode: "before" }));
|
|
605
605
|
s.root.append(a.value), s.root.append(i.value);
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
const
|
|
606
|
+
const r = V(s);
|
|
607
|
+
r.value.start();
|
|
608
|
+
const c = V(), u = V({ left: 0, top: 0, width: 0, height: 0 }), l = V(new Ke()), h = z(() => l.value.root), k = V(), f = V(), v = V();
|
|
609
609
|
function w(x, O) {
|
|
610
|
-
switch (f.value = x,
|
|
610
|
+
switch (f.value = x, v.value = O, x) {
|
|
611
611
|
case "drawing":
|
|
612
612
|
d("crosshair");
|
|
613
613
|
break;
|
|
@@ -615,27 +615,27 @@ const go = (o) => {
|
|
|
615
615
|
e("setState", x);
|
|
616
616
|
}
|
|
617
617
|
function d(x) {
|
|
618
|
-
|
|
618
|
+
r.value.input.setCursor(x);
|
|
619
619
|
}
|
|
620
620
|
function p() {
|
|
621
621
|
const { x = 0, y: O = 0 } = k.value ?? {};
|
|
622
622
|
return a.value.toGlobal({
|
|
623
|
-
x: x -
|
|
624
|
-
y: O -
|
|
623
|
+
x: x - u.value.left,
|
|
624
|
+
y: O - u.value.top
|
|
625
625
|
}, { x: 0, y: 0 });
|
|
626
626
|
}
|
|
627
627
|
Object.assign(o, {
|
|
628
628
|
fonts: t,
|
|
629
|
-
renderEngine:
|
|
629
|
+
renderEngine: r,
|
|
630
630
|
timeline: n,
|
|
631
631
|
camera: a,
|
|
632
632
|
drawboardEffect: i,
|
|
633
633
|
root: h,
|
|
634
|
-
drawboardDom:
|
|
635
|
-
drawboardAabb:
|
|
636
|
-
doc:
|
|
634
|
+
drawboardDom: c,
|
|
635
|
+
drawboardAabb: u,
|
|
636
|
+
doc: l,
|
|
637
637
|
state: f,
|
|
638
|
-
stateContext:
|
|
638
|
+
stateContext: v,
|
|
639
639
|
setState: w,
|
|
640
640
|
setCursor: d,
|
|
641
641
|
drawboardPointer: k,
|
|
@@ -667,33 +667,33 @@ const go = (o) => {
|
|
|
667
667
|
emit: t,
|
|
668
668
|
fonts: n
|
|
669
669
|
} = o, s = V(!1);
|
|
670
|
-
async function a(
|
|
671
|
-
const
|
|
672
|
-
return console.log("loadFont",
|
|
670
|
+
async function a(c, u) {
|
|
671
|
+
const l = await n.load(c, u);
|
|
672
|
+
return console.log("loadFont", l), t("loadFont", l), l;
|
|
673
673
|
}
|
|
674
|
-
async function i(
|
|
674
|
+
async function i(c, u) {
|
|
675
675
|
s.value = !0;
|
|
676
676
|
try {
|
|
677
|
-
n.fallbackFont = await a(
|
|
677
|
+
n.fallbackFont = await a(c, u);
|
|
678
678
|
} finally {
|
|
679
679
|
s.value = !1;
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
-
async function
|
|
682
|
+
async function r() {
|
|
683
683
|
for (; s.value; )
|
|
684
|
-
await new Promise((
|
|
684
|
+
await new Promise((c) => setTimeout(c, 100));
|
|
685
685
|
return await n.waitUntilLoad();
|
|
686
686
|
}
|
|
687
687
|
return Object.assign(o, {
|
|
688
688
|
fonts: n,
|
|
689
689
|
loadFont: a,
|
|
690
690
|
setDefaultFont: i,
|
|
691
|
-
waitUntilFontLoad:
|
|
691
|
+
waitUntilFontLoad: r
|
|
692
692
|
}), () => {
|
|
693
693
|
const {
|
|
694
|
-
defaultFont:
|
|
694
|
+
defaultFont: c
|
|
695
695
|
} = e;
|
|
696
|
-
|
|
696
|
+
c && i(c);
|
|
697
697
|
};
|
|
698
698
|
}, xo = {
|
|
699
699
|
cancel: "Cancel",
|
|
@@ -778,7 +778,7 @@ const go = (o) => {
|
|
|
778
778
|
const {
|
|
779
779
|
locale: a,
|
|
780
780
|
fallback: i,
|
|
781
|
-
messages:
|
|
781
|
+
messages: r = {}
|
|
782
782
|
} = qt({
|
|
783
783
|
locale: "en",
|
|
784
784
|
fallback: "en",
|
|
@@ -788,13 +788,13 @@ const go = (o) => {
|
|
|
788
788
|
}, t);
|
|
789
789
|
return {
|
|
790
790
|
locale: a,
|
|
791
|
-
localeMessages:
|
|
792
|
-
fallbackMessages:
|
|
791
|
+
localeMessages: r[a],
|
|
792
|
+
fallbackMessages: r[i]
|
|
793
793
|
};
|
|
794
794
|
});
|
|
795
795
|
function s(a, i) {
|
|
796
|
-
const { locale:
|
|
797
|
-
return
|
|
796
|
+
const { locale: r, localeMessages: c, fallbackMessages: u } = n.value, l = e.t?.(a, i) ?? c?.[a ?? -1] ?? u?.[a ?? -1] ?? c?.[i ?? -1] ?? u?.[i ?? -1];
|
|
797
|
+
return l === void 0 && console.warn(`[mce] Not found '${a}' key in '${r}' locale messages.`), l ?? a ?? i;
|
|
798
798
|
}
|
|
799
799
|
Object.assign(o, {
|
|
800
800
|
t: s
|
|
@@ -803,31 +803,31 @@ const go = (o) => {
|
|
|
803
803
|
const {
|
|
804
804
|
root: e,
|
|
805
805
|
getAncestor: t
|
|
806
|
-
} = o, n = z(() => e.value.children.filter(
|
|
807
|
-
const { left:
|
|
808
|
-
return { left:
|
|
809
|
-
}),
|
|
810
|
-
function
|
|
811
|
-
return
|
|
806
|
+
} = o, n = z(() => e.value.children.filter(c) ?? []), s = V(-1), a = z(() => n.value[s.value]), i = z(() => {
|
|
807
|
+
const { left: l = 0, top: h = 0, width: k = 0, height: f = 0 } = a.value?.style ?? {};
|
|
808
|
+
return { left: l, top: h, width: k, height: f };
|
|
809
|
+
}), r = V([]);
|
|
810
|
+
function c(l) {
|
|
811
|
+
return l instanceof G && l.meta?.inEditorIs === "Frame";
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
const h = t(
|
|
815
|
-
return h &&
|
|
813
|
+
function u(l) {
|
|
814
|
+
const h = t(l);
|
|
815
|
+
return h && c(h) ? h : void 0;
|
|
816
816
|
}
|
|
817
817
|
return Object.assign(o, {
|
|
818
818
|
frames: n,
|
|
819
|
-
frameThumbs:
|
|
819
|
+
frameThumbs: r,
|
|
820
820
|
currentFrameIndex: s,
|
|
821
821
|
currentFrame: a,
|
|
822
822
|
currentFrameAabb: i,
|
|
823
|
-
isFrame:
|
|
824
|
-
getAncestorFrame:
|
|
823
|
+
isFrame: c,
|
|
824
|
+
getAncestorFrame: u
|
|
825
825
|
}), () => {
|
|
826
826
|
const {
|
|
827
|
-
selection:
|
|
827
|
+
selection: l
|
|
828
828
|
} = o;
|
|
829
|
-
pe(() =>
|
|
830
|
-
h &&
|
|
829
|
+
pe(() => l.value.length === 1 && l.value[0], (h) => {
|
|
830
|
+
h && c(h) && (s.value = n.value.findIndex((k) => k.equal(h)));
|
|
831
831
|
});
|
|
832
832
|
};
|
|
833
833
|
};
|
|
@@ -858,19 +858,19 @@ function Co(o, e) {
|
|
|
858
858
|
if (!o.rotate && !e.rotate)
|
|
859
859
|
return Re(o, e);
|
|
860
860
|
{
|
|
861
|
-
const t = ([
|
|
862
|
-
|
|
863
|
-
const
|
|
861
|
+
const t = ([r, c], [u, l]) => Math.abs(r * u + c * l), n = ({ width: r, height: c, rotate: u = 0 }) => {
|
|
862
|
+
u = -u % 180;
|
|
863
|
+
const l = u / 180 * Math.PI, h = [Math.cos(l), -Math.sin(l)], k = [Math.sin(l), Math.cos(l)];
|
|
864
864
|
return {
|
|
865
865
|
axis: [h, k],
|
|
866
|
-
projectionRadius: (f) =>
|
|
866
|
+
projectionRadius: (f) => r / 2 * t(f, h) + c / 2 * t(f, k)
|
|
867
867
|
};
|
|
868
868
|
}, s = n(o), a = n(e), i = [
|
|
869
869
|
o.left + o.width / 2 - (e.left + e.width / 2),
|
|
870
870
|
o.top + o.height / 2 - (e.top + e.height / 2)
|
|
871
871
|
];
|
|
872
|
-
for (const
|
|
873
|
-
if (s.projectionRadius(
|
|
872
|
+
for (const r of [...s.axis, ...a.axis])
|
|
873
|
+
if (s.projectionRadius(r) + a.projectionRadius(r) < t(r, i))
|
|
874
874
|
return !1;
|
|
875
875
|
return !0;
|
|
876
876
|
}
|
|
@@ -908,15 +908,15 @@ function Eo(o, e = {}) {
|
|
|
908
908
|
return a(new Error("empty url"));
|
|
909
909
|
const i = new Image();
|
|
910
910
|
t && (i.crossOrigin = "Anonymous");
|
|
911
|
-
let
|
|
912
|
-
typeof n == "number" && n > 0 && (
|
|
911
|
+
let r;
|
|
912
|
+
typeof n == "number" && n > 0 && (r = window.setTimeout(() => {
|
|
913
913
|
i.onload = null, i.onerror = null, a(new Error(`image load timeout (${n} ms)`));
|
|
914
914
|
}, n)), i.onload = function() {
|
|
915
|
-
|
|
916
|
-
const
|
|
917
|
-
!
|
|
915
|
+
r && clearTimeout(r);
|
|
916
|
+
const c = this.naturalWidth, u = this.naturalHeight;
|
|
917
|
+
!c || !u ? a(new Error("failed to read natural size")) : s({ width: c, height: u });
|
|
918
918
|
}, i.onerror = function() {
|
|
919
|
-
|
|
919
|
+
r && clearTimeout(r), a(new Error(`failed to load image: ${o}`));
|
|
920
920
|
}, i.src = o;
|
|
921
921
|
});
|
|
922
922
|
}
|
|
@@ -958,8 +958,8 @@ async function ut(o) {
|
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
960
|
function Mo(o, e) {
|
|
961
|
-
const t = o.clientX, n = o.clientY, s = e.getBoundingClientRect(), a = s.left, i = s.top,
|
|
962
|
-
return t >= a && t <=
|
|
961
|
+
const t = o.clientX, n = o.clientY, s = e.getBoundingClientRect(), a = s.left, i = s.top, r = s.right, c = s.bottom;
|
|
962
|
+
return t >= a && t <= r && n >= i && n <= c;
|
|
963
963
|
}
|
|
964
964
|
function zo(o) {
|
|
965
965
|
if (o && "$el" in o) {
|
|
@@ -1032,25 +1032,25 @@ const Ro = (o) => {
|
|
|
1032
1032
|
const {
|
|
1033
1033
|
registerConfig: e
|
|
1034
1034
|
} = o, t = e("hotkeys", No), n = V(/* @__PURE__ */ new Map());
|
|
1035
|
-
function s(
|
|
1036
|
-
if (Array.isArray(
|
|
1037
|
-
|
|
1035
|
+
function s(c) {
|
|
1036
|
+
if (Array.isArray(c))
|
|
1037
|
+
c.forEach((u) => s(u));
|
|
1038
1038
|
else {
|
|
1039
1039
|
const {
|
|
1040
|
-
when:
|
|
1041
|
-
handle:
|
|
1040
|
+
when: u,
|
|
1041
|
+
handle: l,
|
|
1042
1042
|
...h
|
|
1043
|
-
} =
|
|
1043
|
+
} = c, {
|
|
1044
1044
|
command: k
|
|
1045
1045
|
} = h;
|
|
1046
1046
|
t.value = [
|
|
1047
1047
|
...t.value.filter((f) => f.command !== k),
|
|
1048
1048
|
h
|
|
1049
|
-
], n.value.set(k,
|
|
1049
|
+
], n.value.set(k, c);
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
|
-
function a(
|
|
1053
|
-
t.value = t.value.filter((
|
|
1052
|
+
function a(c) {
|
|
1053
|
+
t.value = t.value.filter((u) => u.command !== c);
|
|
1054
1054
|
}
|
|
1055
1055
|
const i = {
|
|
1056
1056
|
ArrowUp: "↑",
|
|
@@ -1075,12 +1075,12 @@ const Ro = (o) => {
|
|
|
1075
1075
|
"™": "2",
|
|
1076
1076
|
Dead: "N"
|
|
1077
1077
|
};
|
|
1078
|
-
function
|
|
1079
|
-
if (!
|
|
1078
|
+
function r(c) {
|
|
1079
|
+
if (!c)
|
|
1080
1080
|
return "";
|
|
1081
|
-
let
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
1081
|
+
let u;
|
|
1082
|
+
const l = t.value.find((h) => h.command === c);
|
|
1083
|
+
return l ? u = Array.isArray(l.key) ? l.key : [l.key] : u = [c], u[0].split("+").map((h) => {
|
|
1084
1084
|
switch (h) {
|
|
1085
1085
|
case "Control":
|
|
1086
1086
|
return Fe ? "⌃" : "Ctrl";
|
|
@@ -1105,22 +1105,22 @@ const Ro = (o) => {
|
|
|
1105
1105
|
hotkeysData: t,
|
|
1106
1106
|
registerHotkey: s,
|
|
1107
1107
|
unregisterHotkey: a,
|
|
1108
|
-
getKbd:
|
|
1108
|
+
getKbd: r
|
|
1109
1109
|
}), () => {
|
|
1110
1110
|
const {
|
|
1111
|
-
exec:
|
|
1111
|
+
exec: c
|
|
1112
1112
|
} = o;
|
|
1113
1113
|
Dt(
|
|
1114
1114
|
xn ? window : void 0,
|
|
1115
1115
|
"keydown",
|
|
1116
|
-
(
|
|
1117
|
-
if (Po(
|
|
1116
|
+
(u) => {
|
|
1117
|
+
if (Po(u))
|
|
1118
1118
|
return;
|
|
1119
|
-
const
|
|
1120
|
-
(
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
!["Meta", "Control", "Alt", "Shift"].includes(
|
|
1119
|
+
const l = [
|
|
1120
|
+
(u.metaKey || u.ctrlKey) && "CmdOrCtrl",
|
|
1121
|
+
u.altKey && "Alt",
|
|
1122
|
+
u.shiftKey && "Shift",
|
|
1123
|
+
!["Meta", "Control", "Alt", "Shift"].includes(u.key) && u.key
|
|
1124
1124
|
].filter(Boolean).map((h) => h.toLowerCase()).sort().join("+");
|
|
1125
1125
|
t.value.forEach((h) => {
|
|
1126
1126
|
const k = h.command, f = n.value.get(k);
|
|
@@ -1135,7 +1135,7 @@ const Ro = (o) => {
|
|
|
1135
1135
|
return p;
|
|
1136
1136
|
}
|
|
1137
1137
|
}).filter(Boolean).map((p) => p.toLowerCase()).sort().join("+");
|
|
1138
|
-
|
|
1138
|
+
l === d && (!f?.when || f.when(u)) && (u.preventDefault(), f?.handle ? f.handle(u) : c(k), o.emit(`hotkey:${k}`, u));
|
|
1139
1139
|
});
|
|
1140
1140
|
});
|
|
1141
1141
|
},
|
|
@@ -1149,35 +1149,35 @@ const Ro = (o) => {
|
|
|
1149
1149
|
renderEngine: n
|
|
1150
1150
|
} = o, s = V(10), a = z({
|
|
1151
1151
|
get: () => t.value.currentTime,
|
|
1152
|
-
set: (
|
|
1153
|
-
const { startTime:
|
|
1154
|
-
t.value.currentTime = Mn(
|
|
1152
|
+
set: (u) => {
|
|
1153
|
+
const { startTime: l, endTime: h } = t.value;
|
|
1154
|
+
t.value.currentTime = Mn(u, l, h);
|
|
1155
1155
|
}
|
|
1156
|
-
}), i = z(() => t.value.startTime),
|
|
1157
|
-
const
|
|
1156
|
+
}), i = z(() => t.value.startTime), r = z(() => t.value.endTime), c = (u) => {
|
|
1157
|
+
const l = { startTime: 0, endTime: 0 };
|
|
1158
1158
|
function h(f) {
|
|
1159
|
-
return f instanceof zn && (
|
|
1159
|
+
return f instanceof zn && (l.startTime = Math.min(l.startTime, f.globalStartTime), l.endTime = Math.max(l.endTime, f.globalEndTime)), f instanceof G && (f.background.animatedTexture && (l.endTime = Math.max(l.endTime, f.globalStartTime + f.background.animatedTexture.duration)), f.foreground.animatedTexture && (l.endTime = Math.max(l.endTime, f.globalStartTime + f.foreground.animatedTexture.duration)), f.fill.animatedTexture && (l.endTime = Math.max(l.endTime, f.globalStartTime + f.fill.animatedTexture.duration)), f.outline.animatedTexture && (l.endTime = Math.max(l.endTime, f.globalStartTime + f.outline.animatedTexture.duration))), !1;
|
|
1160
1160
|
}
|
|
1161
|
-
return (Array.isArray(
|
|
1161
|
+
return (Array.isArray(u) ? u : [u]).forEach((f) => f.findOne(h)), l;
|
|
1162
1162
|
};
|
|
1163
1163
|
return Object.assign(o, {
|
|
1164
1164
|
msPerPx: s,
|
|
1165
1165
|
currentTime: a,
|
|
1166
1166
|
startTime: i,
|
|
1167
|
-
endTime:
|
|
1168
|
-
getTimeRange:
|
|
1167
|
+
endTime: r,
|
|
1168
|
+
getTimeRange: c
|
|
1169
1169
|
}), () => {
|
|
1170
1170
|
const {
|
|
1171
|
-
on:
|
|
1171
|
+
on: u
|
|
1172
1172
|
} = o;
|
|
1173
|
-
async function
|
|
1174
|
-
await n.value.nextTick(), t.value.endTime = e.value ?
|
|
1173
|
+
async function l() {
|
|
1174
|
+
await n.value.nextTick(), t.value.endTime = e.value ? c(e.value).endTime : 0;
|
|
1175
1175
|
}
|
|
1176
|
-
Ut.on("loaded",
|
|
1176
|
+
Ut.on("loaded", l), u("setDoc", l);
|
|
1177
1177
|
};
|
|
1178
1178
|
}, Lo = (o, e) => {
|
|
1179
1179
|
Object.assign(o, {
|
|
1180
|
-
upload: async (n) => e.
|
|
1180
|
+
upload: async (n) => e.customUpload ? await e.customUpload(n) : URL.createObjectURL(n)
|
|
1181
1181
|
});
|
|
1182
1182
|
};
|
|
1183
1183
|
function At(...o) {
|
|
@@ -1190,7 +1190,7 @@ const Do = (o) => {
|
|
|
1190
1190
|
getAncestorFrame: s
|
|
1191
1191
|
} = o;
|
|
1192
1192
|
function a(f) {
|
|
1193
|
-
const
|
|
1193
|
+
const v = {
|
|
1194
1194
|
minX: Number.MAX_SAFE_INTEGER,
|
|
1195
1195
|
minY: Number.MAX_SAFE_INTEGER,
|
|
1196
1196
|
maxX: Number.MIN_SAFE_INTEGER,
|
|
@@ -1200,14 +1200,14 @@ const Do = (o) => {
|
|
|
1200
1200
|
if (f.children.forEach((d) => {
|
|
1201
1201
|
if (d instanceof G) {
|
|
1202
1202
|
const p = d.getAabb().toMinmax();
|
|
1203
|
-
|
|
1203
|
+
v.minX = Math.min(v.minX, p.minX), v.minY = Math.min(v.minY, p.minY), v.maxX = Math.max(v.maxX, p.maxX), v.maxY = Math.max(v.maxY, p.maxY), w = !0;
|
|
1204
1204
|
}
|
|
1205
1205
|
}), w) {
|
|
1206
1206
|
const d = {
|
|
1207
|
-
left:
|
|
1208
|
-
top:
|
|
1209
|
-
width:
|
|
1210
|
-
height:
|
|
1207
|
+
left: v.minX,
|
|
1208
|
+
top: v.minY,
|
|
1209
|
+
width: v.maxX - v.minX,
|
|
1210
|
+
height: v.maxY - v.minY
|
|
1211
1211
|
}, p = {};
|
|
1212
1212
|
f.children.forEach((x, O) => {
|
|
1213
1213
|
x instanceof G && (p[O] = x.getGlobalAabb());
|
|
@@ -1220,16 +1220,16 @@ const Do = (o) => {
|
|
|
1220
1220
|
}), A = x.pivot, m = x.style, y = [
|
|
1221
1221
|
C.x - A.x,
|
|
1222
1222
|
C.y - A.y
|
|
1223
|
-
],
|
|
1224
|
-
m.left +=
|
|
1223
|
+
], g = new On().scale(x.scale.x, x.scale.y).skew(x.skew.x, x.skew.y).rotate(x.rotation).apply({ x: y[0], y: y[1] });
|
|
1224
|
+
m.left += g.x, m.top += g.y, x.updateGlobalTransform();
|
|
1225
1225
|
}
|
|
1226
1226
|
});
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
|
-
function i(f,
|
|
1229
|
+
function i(f, v) {
|
|
1230
1230
|
let w;
|
|
1231
1231
|
if (Array.isArray(f) && f.length > 0)
|
|
1232
|
-
f.length === 1 ? w = i(f[0]) : w = { ...
|
|
1232
|
+
f.length === 1 ? w = i(f[0]) : w = { ...c(f), rotate: 0 };
|
|
1233
1233
|
else if (f instanceof G) {
|
|
1234
1234
|
const d = f.style;
|
|
1235
1235
|
At([d.left, d.top, d.width, d.height, d.rotate]);
|
|
@@ -1243,10 +1243,10 @@ const Do = (o) => {
|
|
|
1243
1243
|
};
|
|
1244
1244
|
} else
|
|
1245
1245
|
w = { left: 0, top: 0, width: 0, height: 0, rotate: 0 };
|
|
1246
|
-
if (
|
|
1246
|
+
if (v === "drawboard") {
|
|
1247
1247
|
const d = e.value.zoom, p = e.value.position;
|
|
1248
1248
|
w.left *= d.x, w.top *= d.y, w.width *= d.x, w.height *= d.y, w.left += p.x, w.top += p.y;
|
|
1249
|
-
} else if (
|
|
1249
|
+
} else if (v === "frame") {
|
|
1250
1250
|
const d = Array.isArray(f) ? f[0] : f;
|
|
1251
1251
|
if (d instanceof G) {
|
|
1252
1252
|
const p = s(d);
|
|
@@ -1255,14 +1255,14 @@ const Do = (o) => {
|
|
|
1255
1255
|
}
|
|
1256
1256
|
return w;
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function r(f) {
|
|
1259
1259
|
return i(f, "drawboard");
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function c(f, v) {
|
|
1262
1262
|
let w;
|
|
1263
1263
|
if (Array.isArray(f) && f.length > 0)
|
|
1264
1264
|
if (f.length === 1)
|
|
1265
|
-
w =
|
|
1265
|
+
w = c(f[0]);
|
|
1266
1266
|
else {
|
|
1267
1267
|
const d = {
|
|
1268
1268
|
minX: Number.MAX_SAFE_INTEGER,
|
|
@@ -1272,7 +1272,7 @@ const Do = (o) => {
|
|
|
1272
1272
|
};
|
|
1273
1273
|
f.forEach((p) => {
|
|
1274
1274
|
if (p instanceof G) {
|
|
1275
|
-
const x =
|
|
1275
|
+
const x = c(p);
|
|
1276
1276
|
d.minX = Math.min(d.minX, x.left), d.minY = Math.min(d.minY, x.top), d.maxX = Math.max(d.maxX, x.left + x.width), d.maxY = Math.max(d.maxY, x.top + x.height);
|
|
1277
1277
|
}
|
|
1278
1278
|
}), w = {
|
|
@@ -1294,9 +1294,9 @@ const Do = (o) => {
|
|
|
1294
1294
|
};
|
|
1295
1295
|
} else
|
|
1296
1296
|
w = { left: 0, top: 0, width: 0, height: 0 };
|
|
1297
|
-
if (
|
|
1298
|
-
w =
|
|
1299
|
-
else if (
|
|
1297
|
+
if (v === "drawboard")
|
|
1298
|
+
w = l(w);
|
|
1299
|
+
else if (v === "frame") {
|
|
1300
1300
|
const d = Array.isArray(f) ? f[0] : f;
|
|
1301
1301
|
if (d instanceof G) {
|
|
1302
1302
|
const p = s(d);
|
|
@@ -1305,39 +1305,39 @@ const Do = (o) => {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
return w;
|
|
1307
1307
|
}
|
|
1308
|
-
function c(f) {
|
|
1309
|
-
return r(f, "drawboard");
|
|
1310
|
-
}
|
|
1311
1308
|
function u(f) {
|
|
1312
|
-
|
|
1313
|
-
|
|
1309
|
+
return c(f, "drawboard");
|
|
1310
|
+
}
|
|
1311
|
+
function l(f) {
|
|
1312
|
+
const v = { ...f }, w = e.value.zoom, d = e.value.position;
|
|
1313
|
+
return v.left *= w.x, v.top *= w.y, v.width *= w.x, v.height *= w.y, v.left += d.x, v.top += d.y, v;
|
|
1314
1314
|
}
|
|
1315
|
-
const h = z(() =>
|
|
1315
|
+
const h = z(() => c(t.value.children)), k = z(() => c(n.value));
|
|
1316
1316
|
Object.assign(o, {
|
|
1317
1317
|
obbToFit: a,
|
|
1318
1318
|
getObb: i,
|
|
1319
|
-
getObbInDrawboard:
|
|
1320
|
-
getAabb:
|
|
1321
|
-
getAabbInDrawboard:
|
|
1322
|
-
aabbToDrawboardAabb:
|
|
1319
|
+
getObbInDrawboard: r,
|
|
1320
|
+
getAabb: c,
|
|
1321
|
+
getAabbInDrawboard: u,
|
|
1322
|
+
aabbToDrawboardAabb: l,
|
|
1323
1323
|
rootAabb: h,
|
|
1324
1324
|
currentAabb: k
|
|
1325
1325
|
});
|
|
1326
1326
|
}, Vo = (o) => {
|
|
1327
|
-
const e = V(/* @__PURE__ */ new Map()), t = V(!1), n = V(0), s = (
|
|
1328
|
-
Array.isArray(
|
|
1329
|
-
}, a = (
|
|
1330
|
-
e.value.delete(
|
|
1331
|
-
}, i = (
|
|
1332
|
-
const
|
|
1333
|
-
...
|
|
1334
|
-
onProgress: (
|
|
1335
|
-
n.value =
|
|
1327
|
+
const e = V(/* @__PURE__ */ new Map()), t = V(!1), n = V(0), s = (r) => {
|
|
1328
|
+
Array.isArray(r) ? r.forEach((c) => s(c)) : e.value.set(r.name, r);
|
|
1329
|
+
}, a = (r) => {
|
|
1330
|
+
e.value.delete(r);
|
|
1331
|
+
}, i = (r, c = {}) => {
|
|
1332
|
+
const u = e.value.get(r)?.handle({
|
|
1333
|
+
...c,
|
|
1334
|
+
onProgress: (l) => {
|
|
1335
|
+
n.value = l, c.onProgress?.(l);
|
|
1336
1336
|
}
|
|
1337
1337
|
});
|
|
1338
|
-
return
|
|
1338
|
+
return u instanceof Promise ? (n.value = 0, t.value = !0, u.finally(() => {
|
|
1339
1339
|
t.value = !1;
|
|
1340
|
-
})) :
|
|
1340
|
+
})) : u;
|
|
1341
1341
|
};
|
|
1342
1342
|
Object.assign(o, {
|
|
1343
1343
|
exporters: e,
|
|
@@ -1362,28 +1362,28 @@ const Do = (o) => {
|
|
|
1362
1362
|
saveAs: (i) => new Blob([JSON.stringify(i)], { type: "application/json" }),
|
|
1363
1363
|
handle: (i) => {
|
|
1364
1364
|
const {
|
|
1365
|
-
selected:
|
|
1366
|
-
scale:
|
|
1365
|
+
selected: r = !1,
|
|
1366
|
+
scale: c = 1
|
|
1367
1367
|
} = i;
|
|
1368
|
-
let
|
|
1369
|
-
Array.isArray(
|
|
1370
|
-
const h = t(
|
|
1368
|
+
let u = et(), l = [];
|
|
1369
|
+
Array.isArray(r) ? l = r : (r === !0 && (l = n.value), l.length === 0 && s.value && (s.value.meta.id && (u = s.value.meta.id), l = s.value.children));
|
|
1370
|
+
const h = t(l, "frame");
|
|
1371
1371
|
return {
|
|
1372
|
-
id:
|
|
1372
|
+
id: u,
|
|
1373
1373
|
style: {
|
|
1374
|
-
width: h.width,
|
|
1375
|
-
height: h.height,
|
|
1376
|
-
|
|
1377
|
-
|
|
1374
|
+
width: h.width * c,
|
|
1375
|
+
height: h.height * c,
|
|
1376
|
+
transformOrigin: "left top",
|
|
1377
|
+
transform: `scale(${c})`
|
|
1378
1378
|
},
|
|
1379
|
-
children:
|
|
1379
|
+
children: l.map((k) => {
|
|
1380
1380
|
const f = k.toJSON();
|
|
1381
1381
|
return h.left && (f.style.left = (f.style.left ?? 0) - h.left), h.top && (f.style.top = (f.style.top ?? 0) - h.top), f.meta ??= {}, f.meta.inPptIs = "Slide", f;
|
|
1382
1382
|
}),
|
|
1383
1383
|
meta: {
|
|
1384
1384
|
inPptIs: "Pptx",
|
|
1385
|
-
inCanvasIs: "
|
|
1386
|
-
...a(
|
|
1385
|
+
inCanvasIs: "Element2D",
|
|
1386
|
+
...a(l)
|
|
1387
1387
|
}
|
|
1388
1388
|
};
|
|
1389
1389
|
}
|
|
@@ -1391,45 +1391,45 @@ const Do = (o) => {
|
|
|
1391
1391
|
}, Uo = (o) => {
|
|
1392
1392
|
const {
|
|
1393
1393
|
state: e
|
|
1394
|
-
} = o, t = V(/* @__PURE__ */ new Map()), n = (
|
|
1395
|
-
Array.isArray(
|
|
1394
|
+
} = o, t = V(/* @__PURE__ */ new Map()), n = (r) => {
|
|
1395
|
+
Array.isArray(r) ? r.forEach((c) => n(c)) : t.value.set(r.name, r);
|
|
1396
1396
|
};
|
|
1397
1397
|
Object.assign(o, {
|
|
1398
1398
|
loaders: t,
|
|
1399
1399
|
registerLoader: n,
|
|
1400
|
-
unregisterLoader: (
|
|
1401
|
-
t.value.delete(
|
|
1400
|
+
unregisterLoader: (r) => {
|
|
1401
|
+
t.value.delete(r);
|
|
1402
1402
|
},
|
|
1403
|
-
load: async (
|
|
1403
|
+
load: async (r) => {
|
|
1404
1404
|
e.value = "loading";
|
|
1405
|
-
let
|
|
1405
|
+
let c;
|
|
1406
1406
|
try {
|
|
1407
|
-
for (const
|
|
1408
|
-
if (await
|
|
1409
|
-
|
|
1407
|
+
for (const u of t.value.values())
|
|
1408
|
+
if (await u.test(r)) {
|
|
1409
|
+
c = await u.load(r);
|
|
1410
1410
|
break;
|
|
1411
1411
|
}
|
|
1412
1412
|
} finally {
|
|
1413
1413
|
e.value = void 0;
|
|
1414
1414
|
}
|
|
1415
|
-
if (
|
|
1416
|
-
throw new Error(`Failed to load source "${
|
|
1417
|
-
return
|
|
1415
|
+
if (c === void 0)
|
|
1416
|
+
throw new Error(`Failed to load source "${r}"`);
|
|
1417
|
+
return c;
|
|
1418
1418
|
},
|
|
1419
|
-
openFileDialog: (
|
|
1419
|
+
openFileDialog: (r = {}) => {
|
|
1420
1420
|
const {
|
|
1421
|
-
multiple:
|
|
1422
|
-
} =
|
|
1423
|
-
return new Promise((
|
|
1424
|
-
const
|
|
1425
|
-
for (const
|
|
1426
|
-
|
|
1427
|
-
const h =
|
|
1421
|
+
multiple: c = !1
|
|
1422
|
+
} = r;
|
|
1423
|
+
return new Promise((u) => {
|
|
1424
|
+
const l = [];
|
|
1425
|
+
for (const v of t.value.values())
|
|
1426
|
+
v.accept && l.push(v.accept);
|
|
1427
|
+
const h = l.join(","), { onChange: k, open: f } = Lt({
|
|
1428
1428
|
accept: h,
|
|
1429
1429
|
reset: !0,
|
|
1430
|
-
multiple:
|
|
1430
|
+
multiple: c
|
|
1431
1431
|
});
|
|
1432
|
-
k((
|
|
1432
|
+
k((v) => u(v ? Array.from(v) : [])), f();
|
|
1433
1433
|
});
|
|
1434
1434
|
}
|
|
1435
1435
|
});
|
|
@@ -1453,45 +1453,45 @@ const Do = (o) => {
|
|
|
1453
1453
|
currentFrameAabb: n,
|
|
1454
1454
|
config: s
|
|
1455
1455
|
} = o, a = z(() => s.value.viewMode === "frame" ? n.value : t.value);
|
|
1456
|
-
function i(
|
|
1457
|
-
function
|
|
1456
|
+
function i(r, c) {
|
|
1457
|
+
function u() {
|
|
1458
1458
|
const k = e.value.view;
|
|
1459
|
-
!k.width || !k.height || (
|
|
1459
|
+
!k.width || !k.height || (r.width = k.width, r.height = k.height, r.dataset.pixelRatio = k.dataset.pixelRatio, r.getContext("2d")?.drawImage(k, 0, 0, k.width, k.height));
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1462
|
-
|
|
1461
|
+
function l() {
|
|
1462
|
+
r._onRendered && e.value.off("rendered", r._onRendered), e.value.input.setTarget(e.value.view);
|
|
1463
1463
|
}
|
|
1464
1464
|
function h() {
|
|
1465
|
-
|
|
1465
|
+
l(), r._onRendered = u, e.value.on("rendered", u), c && e.value.input.setTarget(c);
|
|
1466
1466
|
}
|
|
1467
|
-
return h(),
|
|
1467
|
+
return h(), l;
|
|
1468
1468
|
}
|
|
1469
1469
|
return Object.assign(o, {
|
|
1470
1470
|
viewAabb: a,
|
|
1471
1471
|
bindRenderCanvas: i
|
|
1472
1472
|
}), () => {
|
|
1473
1473
|
const {
|
|
1474
|
-
root:
|
|
1475
|
-
currentFrame:
|
|
1476
|
-
on:
|
|
1477
|
-
exec:
|
|
1474
|
+
root: r,
|
|
1475
|
+
currentFrame: c,
|
|
1476
|
+
on: u,
|
|
1477
|
+
exec: l
|
|
1478
1478
|
} = o;
|
|
1479
1479
|
function h() {
|
|
1480
1480
|
switch (s.value.viewMode) {
|
|
1481
1481
|
case "frame":
|
|
1482
|
-
|
|
1483
|
-
k instanceof G && (k.visible = k.equal(
|
|
1482
|
+
r.value.children.forEach((k) => {
|
|
1483
|
+
k instanceof G && (k.visible = k.equal(c.value));
|
|
1484
1484
|
});
|
|
1485
1485
|
break;
|
|
1486
1486
|
case "edgeless":
|
|
1487
|
-
|
|
1487
|
+
r.value.children.forEach((k) => {
|
|
1488
1488
|
k instanceof G && (k.visible = !0);
|
|
1489
1489
|
});
|
|
1490
1490
|
break;
|
|
1491
1491
|
}
|
|
1492
|
-
|
|
1492
|
+
l("zoomToFit");
|
|
1493
1493
|
}
|
|
1494
|
-
pe(() => s.value.viewMode, h),
|
|
1494
|
+
pe(() => s.value.viewMode, h), u("setCurrentFrame", h), u("setDoc", h);
|
|
1495
1495
|
};
|
|
1496
1496
|
}, Yo = (o) => {
|
|
1497
1497
|
const {
|
|
@@ -1499,14 +1499,14 @@ const Do = (o) => {
|
|
|
1499
1499
|
} = o;
|
|
1500
1500
|
function t(s) {
|
|
1501
1501
|
function a(i) {
|
|
1502
|
-
const
|
|
1503
|
-
let
|
|
1504
|
-
|
|
1502
|
+
const r = i.text.base.characters;
|
|
1503
|
+
let c = 0, u;
|
|
1504
|
+
r.forEach((d) => {
|
|
1505
1505
|
const p = d.lineBox.left + d.lineBox.width;
|
|
1506
|
-
p >
|
|
1506
|
+
p > c && (u = d, c = p);
|
|
1507
1507
|
});
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1508
|
+
const l = {}, h = r.filter((d) => d.lineBox.top === u?.lineBox.top).map((d) => (Object.assign(
|
|
1509
|
+
l,
|
|
1510
1510
|
{ ...d.parent.style },
|
|
1511
1511
|
{ ...d.parent.parent.style }
|
|
1512
1512
|
), d.content)).join(""), { boundingBox: k } = it({
|
|
@@ -1517,13 +1517,13 @@ const Do = (o) => {
|
|
|
1517
1517
|
content: [
|
|
1518
1518
|
{
|
|
1519
1519
|
fragments: [
|
|
1520
|
-
{ ...
|
|
1520
|
+
{ ...l, content: h }
|
|
1521
1521
|
]
|
|
1522
1522
|
}
|
|
1523
1523
|
]
|
|
1524
|
-
}), f = (i.style.fontSize || 12) / 2,
|
|
1524
|
+
}), f = (i.style.fontSize || 12) / 2, v = (i.style.width ?? 0) / (k.width + f);
|
|
1525
1525
|
function w(d) {
|
|
1526
|
-
d.fontSize && (d.fontSize = d.fontSize *
|
|
1526
|
+
d.fontSize && (d.fontSize = d.fontSize * v), d.letterSpacing && (d.letterSpacing = d.letterSpacing * v);
|
|
1527
1527
|
}
|
|
1528
1528
|
w(i.style), i.text?.isValid?.() && Array.isArray(i.text?.content) && i.text.content.forEach((d) => {
|
|
1529
1529
|
w(d), d.fragments.forEach((p) => {
|
|
@@ -1541,25 +1541,25 @@ const Do = (o) => {
|
|
|
1541
1541
|
t(s);
|
|
1542
1542
|
return;
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1545
|
-
if (!
|
|
1544
|
+
function r(c) {
|
|
1545
|
+
if (!c.text?.isValid?.() || typeof c.text?.content != "object")
|
|
1546
1546
|
return;
|
|
1547
|
-
const
|
|
1547
|
+
const u = c.style.toJSON();
|
|
1548
1548
|
switch (i) {
|
|
1549
1549
|
case "autoWidth":
|
|
1550
|
-
|
|
1550
|
+
u.width = "auto";
|
|
1551
1551
|
break;
|
|
1552
1552
|
case "autoHeight":
|
|
1553
|
-
|
|
1553
|
+
u.height = "auto";
|
|
1554
1554
|
break;
|
|
1555
1555
|
}
|
|
1556
|
-
const { boundingBox:
|
|
1557
|
-
style:
|
|
1558
|
-
content:
|
|
1556
|
+
const { boundingBox: l } = it({
|
|
1557
|
+
style: u,
|
|
1558
|
+
content: c.text.content
|
|
1559
1559
|
});
|
|
1560
|
-
(
|
|
1560
|
+
(c.style.width !== l.width || c.style.height !== l.height) && (c.style.width = l.width, c.style.height = l.height, c.requestRedraw());
|
|
1561
1561
|
}
|
|
1562
|
-
|
|
1562
|
+
r(s), s.findOne((c) => (c instanceof G && r(c), !1));
|
|
1563
1563
|
}
|
|
1564
1564
|
return Object.assign(o, {
|
|
1565
1565
|
textFontSizeToFit: t,
|
|
@@ -1590,41 +1590,41 @@ const Do = (o) => {
|
|
|
1590
1590
|
emit: s,
|
|
1591
1591
|
textFontSizeToFit: a,
|
|
1592
1592
|
textToFit: i,
|
|
1593
|
-
log:
|
|
1594
|
-
root:
|
|
1595
|
-
isFrame:
|
|
1596
|
-
isLock:
|
|
1593
|
+
log: r,
|
|
1594
|
+
root: c,
|
|
1595
|
+
isFrame: u,
|
|
1596
|
+
isLock: l,
|
|
1597
1597
|
getObbInDrawboard: h,
|
|
1598
1598
|
config: k,
|
|
1599
1599
|
getAncestorFrame: f,
|
|
1600
|
-
getAabb:
|
|
1600
|
+
getAabb: v,
|
|
1601
1601
|
getGlobalPointer: w,
|
|
1602
1602
|
selection: d
|
|
1603
1603
|
} = o;
|
|
1604
1604
|
function p(y, _ = {}) {
|
|
1605
|
-
|
|
1605
|
+
r("addElement", y, _);
|
|
1606
1606
|
let {
|
|
1607
|
-
frame:
|
|
1607
|
+
frame: g,
|
|
1608
1608
|
positionToFit: b,
|
|
1609
1609
|
sizeToFit: T,
|
|
1610
|
-
position:
|
|
1610
|
+
position: S,
|
|
1611
1611
|
inPointerPosition: F,
|
|
1612
1612
|
active: R,
|
|
1613
1613
|
regenId: E
|
|
1614
1614
|
} = _;
|
|
1615
|
-
if (!
|
|
1615
|
+
if (!S && F && (S = w()), S && (b = !1), !g)
|
|
1616
1616
|
if (k.value.viewMode === "frame")
|
|
1617
|
-
|
|
1617
|
+
g = n.value;
|
|
1618
1618
|
else {
|
|
1619
1619
|
const U = d.value[0];
|
|
1620
|
-
U && (
|
|
1620
|
+
U && (u(U) ? g = U : g = f(U));
|
|
1621
1621
|
}
|
|
1622
1622
|
let N = t.value.top;
|
|
1623
1623
|
const B = t.value.left + t.value.width + k.value.frameGap, j = Array.isArray(y), D = e.value.transact(() => {
|
|
1624
1624
|
const W = (j ? y : [y]).map((he) => {
|
|
1625
|
-
const Y = e.value.addElement(he, { parentId:
|
|
1626
|
-
if (
|
|
1627
|
-
const { width: xe, height: ae } =
|
|
1625
|
+
const Y = e.value.addElement(he, { parentId: g?.id, regenId: E });
|
|
1626
|
+
if (g) {
|
|
1627
|
+
const { width: xe, height: ae } = g.style, ve = xe / 2, ye = ae / 2;
|
|
1628
1628
|
if (Y.style.width || (Y.style.width = ve), Y.style.height || (Y.style.height = ye), T) {
|
|
1629
1629
|
const J = Y.style.width / Y.style.height, me = J > 1 ? ve : ye * J, ue = J > 1 ? ve / J : ye;
|
|
1630
1630
|
C(
|
|
@@ -1641,11 +1641,11 @@ const Do = (o) => {
|
|
|
1641
1641
|
} else
|
|
1642
1642
|
b && (Y.style.top = Math.round(N), Y.style.left = Math.round(B), N += Y.style.height + k.value.frameGap);
|
|
1643
1643
|
return Y;
|
|
1644
|
-
}), Q =
|
|
1645
|
-
if (
|
|
1644
|
+
}), Q = v(W);
|
|
1645
|
+
if (S) {
|
|
1646
1646
|
const he = {
|
|
1647
|
-
x: Math.round(
|
|
1648
|
-
y: Math.round(
|
|
1647
|
+
x: Math.round(S.x - Q.left),
|
|
1648
|
+
y: Math.round(S.y - Q.top)
|
|
1649
1649
|
};
|
|
1650
1650
|
W.forEach((Y) => {
|
|
1651
1651
|
Y.style.left += he.x, Y.style.top += he.y;
|
|
@@ -1664,29 +1664,29 @@ const Do = (o) => {
|
|
|
1664
1664
|
function L(y) {
|
|
1665
1665
|
return e.value.nodeMap.get(y);
|
|
1666
1666
|
}
|
|
1667
|
-
function C(y, _,
|
|
1668
|
-
_ = Math.abs(_),
|
|
1667
|
+
function C(y, _, g, b = {}) {
|
|
1668
|
+
_ = Math.abs(_), g = Math.abs(g);
|
|
1669
1669
|
function T(F) {
|
|
1670
1670
|
const R = F.style;
|
|
1671
|
-
R.left = Math.round(R.left * _), R.top = Math.round(R.top *
|
|
1671
|
+
R.left = Math.round(R.left * _), R.top = Math.round(R.top * g), R.width = Math.round(R.width * _), R.height = Math.round(R.height * g), F?.requestRedraw?.();
|
|
1672
1672
|
}
|
|
1673
1673
|
T(y);
|
|
1674
|
-
function
|
|
1674
|
+
function S(F) {
|
|
1675
1675
|
F.children?.forEach((R) => {
|
|
1676
|
-
|
|
1676
|
+
S(R);
|
|
1677
1677
|
});
|
|
1678
1678
|
}
|
|
1679
|
-
b.deep &&
|
|
1679
|
+
b.deep && S(y), b.textToFit && i(y), b.textFontSizeToFit && a(y);
|
|
1680
1680
|
}
|
|
1681
1681
|
function A(y, _) {
|
|
1682
1682
|
if (y && (_?.ctrlKey || _?.shiftKey || _?.metaKey)) {
|
|
1683
|
-
let
|
|
1684
|
-
d.value.length === 1 ?
|
|
1683
|
+
let g;
|
|
1684
|
+
d.value.length === 1 ? g = [d.value[0], y] : d.value.findIndex((b) => b.equal(y)) > -1 ? g = d.value.filter((b) => b.equal(y)) : g = [...d.value, y], d.value = g;
|
|
1685
1685
|
} else
|
|
1686
1686
|
d.value = y ? [y] : [];
|
|
1687
1687
|
}
|
|
1688
1688
|
function m(y) {
|
|
1689
|
-
const _ =
|
|
1689
|
+
const _ = c.value?.children.flatMap((g) => u(g) ? g.children : [g]).filter((g) => "isVisibleInTree" in g && g.isVisibleInTree() && Co(y, h(g)) && !l(g)) ?? [];
|
|
1690
1690
|
return d.value = _, _;
|
|
1691
1691
|
}
|
|
1692
1692
|
Object.assign(o, {
|
|
@@ -1706,11 +1706,11 @@ const Do = (o) => {
|
|
|
1706
1706
|
currentFrameIndex: s,
|
|
1707
1707
|
frameThumbs: a,
|
|
1708
1708
|
emit: i,
|
|
1709
|
-
selection:
|
|
1710
|
-
frames:
|
|
1711
|
-
config:
|
|
1709
|
+
selection: r,
|
|
1710
|
+
frames: c,
|
|
1711
|
+
config: u
|
|
1712
1712
|
} = o;
|
|
1713
|
-
function
|
|
1713
|
+
function l(w = {}, d) {
|
|
1714
1714
|
const p = Ht({
|
|
1715
1715
|
...w,
|
|
1716
1716
|
id: void 0,
|
|
@@ -1720,9 +1720,9 @@ const Do = (o) => {
|
|
|
1720
1720
|
inEditorIs: "Frame"
|
|
1721
1721
|
}
|
|
1722
1722
|
});
|
|
1723
|
-
p.style ??= {}, p.style.left = n.value.left + n.value.width +
|
|
1724
|
-
const x = d ?? (s.value > -1 ? s.value + 1 :
|
|
1725
|
-
e.value.addElement(p, { index: x }),
|
|
1723
|
+
p.style ??= {}, p.style.left = n.value.left + n.value.width + u.value.frameGap, p.style.width ||= n.value.width, p.style.height ||= n.value.height;
|
|
1724
|
+
const x = d ?? (s.value > -1 ? s.value + 1 : c.value.length - 1);
|
|
1725
|
+
e.value.addElement(p, { index: x }), v(x), i("addFrame", x);
|
|
1726
1726
|
}
|
|
1727
1727
|
function h(w = s.value) {
|
|
1728
1728
|
const d = t.value.children[w];
|
|
@@ -1737,25 +1737,25 @@ const Do = (o) => {
|
|
|
1737
1737
|
d,
|
|
1738
1738
|
0,
|
|
1739
1739
|
a.value.splice(w, 1)[0]
|
|
1740
|
-
),
|
|
1740
|
+
), v(d), i("moveFrame", w, d));
|
|
1741
1741
|
}
|
|
1742
1742
|
function f(w = s.value) {
|
|
1743
1743
|
if (!t.value || t.value.children.length === 1)
|
|
1744
1744
|
return;
|
|
1745
1745
|
const d = t.value.children[w]?.id;
|
|
1746
|
-
d && (e.value.deleteElement(d), a.value.splice(w, 1),
|
|
1746
|
+
d && (e.value.deleteElement(d), a.value.splice(w, 1), v(w), i("deleteFrame", w));
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1749
|
-
w = Math.max(0, Math.min(
|
|
1748
|
+
function v(w = s.value) {
|
|
1749
|
+
w = Math.max(0, Math.min(c.value.length - 1, w));
|
|
1750
1750
|
const d = s.value;
|
|
1751
|
-
s.value = w,
|
|
1751
|
+
s.value = w, u.value.viewMode === "edgeless" ? r.value = [c.value[w]] : r.value = [], i("setCurrentFrame", w, d);
|
|
1752
1752
|
}
|
|
1753
1753
|
Object.assign(o, {
|
|
1754
|
-
addFrame:
|
|
1754
|
+
addFrame: l,
|
|
1755
1755
|
duplicateFrame: h,
|
|
1756
1756
|
moveFrame: k,
|
|
1757
1757
|
deleteFrame: f,
|
|
1758
|
-
setCurrentFrame:
|
|
1758
|
+
setCurrentFrame: v
|
|
1759
1759
|
});
|
|
1760
1760
|
}, Ko = (o, e) => {
|
|
1761
1761
|
const {
|
|
@@ -1764,16 +1764,16 @@ const Do = (o) => {
|
|
|
1764
1764
|
emit: s,
|
|
1765
1765
|
selection: a,
|
|
1766
1766
|
state: i,
|
|
1767
|
-
to:
|
|
1768
|
-
waitUntilFontLoad:
|
|
1769
|
-
config:
|
|
1770
|
-
load:
|
|
1767
|
+
to: r,
|
|
1768
|
+
waitUntilFontLoad: c,
|
|
1769
|
+
config: u,
|
|
1770
|
+
load: l
|
|
1771
1771
|
} = o, h = () => {
|
|
1772
1772
|
n.value.root.removeChildren(), n.value.root.children.length = 0, t.value.destroy(), t.value = new Ke(), a.value = [], s("clearDoc");
|
|
1773
|
-
}, k = () =>
|
|
1773
|
+
}, k = () => r("json");
|
|
1774
1774
|
async function f(d, p) {
|
|
1775
1775
|
await d.load(async () => {
|
|
1776
|
-
if (
|
|
1776
|
+
if (u.value.localDb)
|
|
1777
1777
|
try {
|
|
1778
1778
|
await d.loadIndexeddb();
|
|
1779
1779
|
} catch (x) {
|
|
@@ -1782,11 +1782,11 @@ const Do = (o) => {
|
|
|
1782
1782
|
p && typeof p != "string" && d.set(p);
|
|
1783
1783
|
}), d.on("update", Dn((x, O) => s("updateDoc", x, O), 200)), n.value.root.appendChild(d.root);
|
|
1784
1784
|
}
|
|
1785
|
-
const
|
|
1785
|
+
const v = async (d) => {
|
|
1786
1786
|
const p = new Ke(typeof d == "string" ? d : d.id);
|
|
1787
1787
|
i.value = "loading";
|
|
1788
1788
|
try {
|
|
1789
|
-
await
|
|
1789
|
+
await c(), h(), await f(p, d), t.value = p, s("setDoc", p);
|
|
1790
1790
|
} finally {
|
|
1791
1791
|
i.value = void 0;
|
|
1792
1792
|
}
|
|
@@ -1794,9 +1794,9 @@ const Do = (o) => {
|
|
|
1794
1794
|
};
|
|
1795
1795
|
return Object.assign(o, {
|
|
1796
1796
|
getDoc: k,
|
|
1797
|
-
setDoc:
|
|
1797
|
+
setDoc: v,
|
|
1798
1798
|
loadDoc: async (d) => {
|
|
1799
|
-
const p = await
|
|
1799
|
+
const p = await v(await l(d));
|
|
1800
1800
|
return s("loadDoc", p, d), p;
|
|
1801
1801
|
},
|
|
1802
1802
|
clearDoc: h
|
|
@@ -1804,7 +1804,7 @@ const Do = (o) => {
|
|
|
1804
1804
|
const {
|
|
1805
1805
|
doc: d
|
|
1806
1806
|
} = e;
|
|
1807
|
-
d ?
|
|
1807
|
+
d ? v(d) : f(t.value);
|
|
1808
1808
|
};
|
|
1809
1809
|
}, Jo = (o) => {
|
|
1810
1810
|
const {
|
|
@@ -1814,29 +1814,29 @@ const Do = (o) => {
|
|
|
1814
1814
|
camera: s,
|
|
1815
1815
|
frameThumbs: a,
|
|
1816
1816
|
log: i,
|
|
1817
|
-
fonts:
|
|
1818
|
-
registerConfig:
|
|
1817
|
+
fonts: r,
|
|
1818
|
+
registerConfig: c
|
|
1819
1819
|
} = o;
|
|
1820
|
-
|
|
1821
|
-
async function
|
|
1820
|
+
c("frameScreenshot", !1);
|
|
1821
|
+
async function u() {
|
|
1822
1822
|
a.value.length = t.value.length;
|
|
1823
1823
|
for (let f = 0; f < t.value.length; f++)
|
|
1824
1824
|
await h(f);
|
|
1825
1825
|
}
|
|
1826
|
-
async function
|
|
1826
|
+
async function l(f) {
|
|
1827
1827
|
await o.waitUntilFontLoad();
|
|
1828
|
-
let
|
|
1829
|
-
return f instanceof G ?
|
|
1830
|
-
width:
|
|
1831
|
-
height:
|
|
1832
|
-
fonts:
|
|
1833
|
-
data:
|
|
1828
|
+
let v;
|
|
1829
|
+
return f instanceof G ? v = f.toJSON() : v = { ...f }, v.style ??= {}, v.style.top = 0, v.style.left = 0, await gt({
|
|
1830
|
+
width: v.style.width,
|
|
1831
|
+
height: v.style.height,
|
|
1832
|
+
fonts: r,
|
|
1833
|
+
data: v
|
|
1834
1834
|
});
|
|
1835
1835
|
}
|
|
1836
1836
|
async function h(f) {
|
|
1837
|
-
const
|
|
1838
|
-
if (
|
|
1839
|
-
const w = await
|
|
1837
|
+
const v = t.value[f];
|
|
1838
|
+
if (v) {
|
|
1839
|
+
const w = await l(v);
|
|
1840
1840
|
a.value[f] = {
|
|
1841
1841
|
width: w.width,
|
|
1842
1842
|
height: w.height,
|
|
@@ -1845,8 +1845,8 @@ const Do = (o) => {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
}
|
|
1847
1847
|
function k(f) {
|
|
1848
|
-
const
|
|
1849
|
-
if (!
|
|
1848
|
+
const v = e.value.view, w = n.value, d = e.value.pixelRatio ?? 1;
|
|
1849
|
+
if (!v)
|
|
1850
1850
|
return;
|
|
1851
1851
|
const p = f.getContext("2d");
|
|
1852
1852
|
if (!p)
|
|
@@ -1856,7 +1856,7 @@ const Do = (o) => {
|
|
|
1856
1856
|
f.width = w.width, f.height = w.height;
|
|
1857
1857
|
const L = w.width * x.x, C = w.height * x.y;
|
|
1858
1858
|
p.drawImage(
|
|
1859
|
-
|
|
1859
|
+
v,
|
|
1860
1860
|
(w.left * x.x + O.x) * d,
|
|
1861
1861
|
(w.top * x.x + O.y) * d,
|
|
1862
1862
|
L * d,
|
|
@@ -1868,19 +1868,19 @@ const Do = (o) => {
|
|
|
1868
1868
|
);
|
|
1869
1869
|
}
|
|
1870
1870
|
return Object.assign(o, {
|
|
1871
|
-
snapshot:
|
|
1872
|
-
captureElementScreenshot:
|
|
1871
|
+
snapshot: u,
|
|
1872
|
+
captureElementScreenshot: l,
|
|
1873
1873
|
captureFrameScreenshot: h,
|
|
1874
1874
|
renderFrameThumb: k
|
|
1875
1875
|
}), () => {
|
|
1876
1876
|
const {
|
|
1877
1877
|
on: f,
|
|
1878
|
-
config:
|
|
1878
|
+
config: v
|
|
1879
1879
|
} = o;
|
|
1880
1880
|
f("setDoc", (w) => {
|
|
1881
|
-
|
|
1881
|
+
v.value.frameScreenshot && u();
|
|
1882
1882
|
function d(p) {
|
|
1883
|
-
if (
|
|
1883
|
+
if (v.value.frameScreenshot) {
|
|
1884
1884
|
const x = p.getIndex();
|
|
1885
1885
|
a.value.splice(x, 0, {
|
|
1886
1886
|
width: 0,
|
|
@@ -1891,7 +1891,7 @@ const Do = (o) => {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
w.root.on("appendChild", d);
|
|
1893
1893
|
}), f("setCurrentFrame", (w, d) => {
|
|
1894
|
-
|
|
1894
|
+
v.value.frameScreenshot && h(d);
|
|
1895
1895
|
});
|
|
1896
1896
|
};
|
|
1897
1897
|
}, Zo = [
|
|
@@ -2662,26 +2662,26 @@ const ns = (o) => {
|
|
|
2662
2662
|
if (!C)
|
|
2663
2663
|
return;
|
|
2664
2664
|
const A = {};
|
|
2665
|
-
let m, y, _,
|
|
2666
|
-
return C.instanceId ? (A.id = C.instanceId, { top: m, left: y, height: _, width:
|
|
2665
|
+
let m, y, _, g;
|
|
2666
|
+
return C.instanceId ? (A.id = C.instanceId, { top: m, left: y, height: _, width: g } = s(C)) : (A.id = Math.random(), { top: m, left: y, height: _, width: g } = C), A.vt = Ne(m, "vt", A), A.vm = Ne(m + _ / 2, "vm", A), A.vb = Ne(m + _, "vb", A), A.hl = Ne(y, "hl", A), A.hm = Ne(y + g / 2, "hm", A), A.hr = Ne(y + g, "hr", A), A;
|
|
2667
2667
|
}
|
|
2668
|
-
const
|
|
2668
|
+
const r = z(() => 4), c = z(() => new Set(
|
|
2669
2669
|
[
|
|
2670
2670
|
t.value[0]?.instanceId
|
|
2671
2671
|
].filter(Boolean)
|
|
2672
|
-
)),
|
|
2672
|
+
)), u = z(() => {
|
|
2673
2673
|
if (t.value[0])
|
|
2674
2674
|
return i(t.value[0]);
|
|
2675
|
-
}),
|
|
2675
|
+
}), l = z(() => {
|
|
2676
2676
|
const C = t.value[0].parent;
|
|
2677
2677
|
return C instanceof G ? C : void 0;
|
|
2678
2678
|
}), h = z(() => i(
|
|
2679
|
-
|
|
2679
|
+
l.value ?? { left: 0, top: 0, width: 0, height: 0 }
|
|
2680
2680
|
)), k = z(() => {
|
|
2681
2681
|
const C = [
|
|
2682
|
-
...
|
|
2682
|
+
...l.value?.children ?? a.value.children
|
|
2683
2683
|
];
|
|
2684
|
-
return e.value &&
|
|
2684
|
+
return e.value && l.value?.equal(e.value) && C.push(l.value), C.filter((A) => !c.value.has(A.instanceId)).map((A) => i(A)).filter(Boolean);
|
|
2685
2685
|
}), f = z(() => k.value.reduce(
|
|
2686
2686
|
(C, A) => ([A.vt, A.vm, A.vb].forEach((m) => C.vLines.add(m)), [A.hl, A.hm, A.hr].forEach((m) => C.hLines.add(m)), C),
|
|
2687
2687
|
{
|
|
@@ -2689,20 +2689,20 @@ const ns = (o) => {
|
|
|
2689
2689
|
hLines: new Tt((C, A) => C.pos - A.pos)
|
|
2690
2690
|
}
|
|
2691
2691
|
));
|
|
2692
|
-
function
|
|
2692
|
+
function v(C) {
|
|
2693
2693
|
return C.box?.id === -1;
|
|
2694
2694
|
}
|
|
2695
2695
|
function w(C, A) {
|
|
2696
2696
|
const m = ["vt", "vb"].includes(A.type) ? "vertical" : "horizontal", y = m === "vertical" ? "horizontal" : "vertical", _ = at(A);
|
|
2697
|
-
let
|
|
2697
|
+
let g = Et(A.type);
|
|
2698
2698
|
if (_) {
|
|
2699
|
-
if (A.pos > h.value[
|
|
2699
|
+
if (A.pos > h.value[g].pos)
|
|
2700
2700
|
return [];
|
|
2701
|
-
} else if (A.pos < h.value[
|
|
2701
|
+
} else if (A.pos < h.value[g].pos)
|
|
2702
2702
|
return [];
|
|
2703
2703
|
const b = [];
|
|
2704
2704
|
let T;
|
|
2705
|
-
const
|
|
2705
|
+
const S = (F) => {
|
|
2706
2706
|
if (["vm", "hm"].includes(F.type))
|
|
2707
2707
|
return;
|
|
2708
2708
|
if (_) {
|
|
@@ -2710,73 +2710,73 @@ const ns = (o) => {
|
|
|
2710
2710
|
return;
|
|
2711
2711
|
} else if (A.pos > F.pos)
|
|
2712
2712
|
return;
|
|
2713
|
-
const R =
|
|
2714
|
-
|
|
2713
|
+
const R = v(F);
|
|
2714
|
+
g !== F.type && !R || Re(Ge(A), Ge(F), y) && (!R && T && T.box.id !== F.box.id && Re(Ge(T), Ge(F), m) || (T = F, b.push(F), g = Et(g)));
|
|
2715
2715
|
};
|
|
2716
|
-
return _ ? C.outorderTraversal(
|
|
2716
|
+
return _ ? C.outorderTraversal(S) : C.inorderTraversal(S), b;
|
|
2717
2717
|
}
|
|
2718
2718
|
function d(C, A) {
|
|
2719
2719
|
if (!C.length)
|
|
2720
2720
|
return [];
|
|
2721
2721
|
const m = at(A), y = C[0].pos;
|
|
2722
2722
|
let _ = Math.abs(A.pos - y);
|
|
2723
|
-
const
|
|
2723
|
+
const g = [];
|
|
2724
2724
|
C = [A].concat(C);
|
|
2725
2725
|
for (let b = 0; b < C.length; b += 2) {
|
|
2726
|
-
const T = C[b],
|
|
2727
|
-
if (!
|
|
2726
|
+
const T = C[b], S = C[b + 1];
|
|
2727
|
+
if (!S)
|
|
2728
2728
|
break;
|
|
2729
|
-
const F = Math.abs(
|
|
2729
|
+
const F = Math.abs(S.pos - T.pos);
|
|
2730
2730
|
if (b === 2) {
|
|
2731
|
-
if (Math.abs(_ - F) >
|
|
2731
|
+
if (Math.abs(_ - F) > r.value)
|
|
2732
2732
|
break;
|
|
2733
2733
|
_ = F;
|
|
2734
2734
|
} else if (Math.abs(_ - F) > 1)
|
|
2735
2735
|
break;
|
|
2736
|
-
|
|
2736
|
+
g.push({ target: S, source: T, type: "area", distance: F });
|
|
2737
2737
|
}
|
|
2738
|
-
return
|
|
2738
|
+
return g.length < 2 ? [] : (g[0]._ctx = {
|
|
2739
2739
|
type: A.type,
|
|
2740
2740
|
pos: m ? y + _ : y - _
|
|
2741
|
-
},
|
|
2741
|
+
}, g);
|
|
2742
2742
|
}
|
|
2743
2743
|
const p = z(() => {
|
|
2744
|
-
if (!
|
|
2744
|
+
if (!u.value)
|
|
2745
2745
|
return [];
|
|
2746
|
-
const { vLines: C, hLines: A } = f.value, m =
|
|
2746
|
+
const { vLines: C, hLines: A } = f.value, m = u.value, y = { vt: [], vb: [], hl: [], hr: [] }, _ = [];
|
|
2747
2747
|
return [
|
|
2748
2748
|
{ sources: [m.vt, m.vm, m.vb], targets: C },
|
|
2749
2749
|
{ sources: [m.hl, m.hm, m.hr], targets: A }
|
|
2750
|
-
].forEach(({ targets:
|
|
2750
|
+
].forEach(({ targets: g, sources: b }) => {
|
|
2751
2751
|
for (const T of b) {
|
|
2752
|
-
const
|
|
2753
|
-
if (!
|
|
2752
|
+
const S = g.searchClosest(T, (R, E, N) => !N || Math.abs(R.pos - E.pos) < Math.abs(R.pos - N.pos));
|
|
2753
|
+
if (!S)
|
|
2754
2754
|
continue;
|
|
2755
|
-
const F = Math.abs(
|
|
2756
|
-
F >=
|
|
2755
|
+
const F = Math.abs(S.pos - T.pos);
|
|
2756
|
+
F >= r.value || _.push({ source: T, target: S, type: "alignment", distance: F });
|
|
2757
2757
|
}
|
|
2758
2758
|
}), [
|
|
2759
2759
|
{ sources: [m.vt, m.vb], targets: C },
|
|
2760
2760
|
{ sources: [m.hl, m.hr], targets: A }
|
|
2761
|
-
].forEach(({ sources:
|
|
2762
|
-
for (const T of
|
|
2761
|
+
].forEach(({ sources: g, targets: b }) => {
|
|
2762
|
+
for (const T of g)
|
|
2763
2763
|
y[T.type] = w(b, T);
|
|
2764
|
-
}), y.vt = y.vt.sort((
|
|
2764
|
+
}), y.vt = y.vt.sort((g, b) => b.pos - g.pos), y.hl = y.hl.sort((g, b) => b.pos - g.pos), [
|
|
2765
2765
|
{ targets: [y.vt, y.vb], sources: [m.vt, m.vb] },
|
|
2766
2766
|
{ targets: [y.hl, y.hr], sources: [m.hl, m.hr] }
|
|
2767
|
-
].forEach(({ sources:
|
|
2768
|
-
const T = b[0][0],
|
|
2769
|
-
if (T && F && (!
|
|
2770
|
-
const E = Math.abs(
|
|
2771
|
-
if (Math.abs(E - N) <
|
|
2772
|
-
const B = at(
|
|
2767
|
+
].forEach(({ sources: g, targets: b }) => {
|
|
2768
|
+
const T = b[0][0], S = g[0], F = b[1][0], R = g[1];
|
|
2769
|
+
if (T && F && (!v(T) || !v(F))) {
|
|
2770
|
+
const E = Math.abs(S.pos - T.pos), N = Math.abs(R.pos - F.pos);
|
|
2771
|
+
if (Math.abs(E - N) < r.value) {
|
|
2772
|
+
const B = at(S);
|
|
2773
2773
|
_.push({
|
|
2774
2774
|
target: T,
|
|
2775
|
-
source:
|
|
2775
|
+
source: S,
|
|
2776
2776
|
type: "area",
|
|
2777
2777
|
distance: E,
|
|
2778
2778
|
_ctx: {
|
|
2779
|
-
type:
|
|
2779
|
+
type: S.type,
|
|
2780
2780
|
pos: B ? T.pos + (E + N) / 2 : T.pos - (E + N) / 2
|
|
2781
2781
|
}
|
|
2782
2782
|
}), _.push({
|
|
@@ -2788,8 +2788,8 @@ const ns = (o) => {
|
|
|
2788
2788
|
return;
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
|
-
for (const E in
|
|
2792
|
-
const N = d(b[E],
|
|
2791
|
+
for (const E in g) {
|
|
2792
|
+
const N = d(b[E], g[E]);
|
|
2793
2793
|
if (N.length) {
|
|
2794
2794
|
_.push(...N);
|
|
2795
2795
|
break;
|
|
@@ -2801,42 +2801,42 @@ const ns = (o) => {
|
|
|
2801
2801
|
return [];
|
|
2802
2802
|
const C = { left: 0, top: 0 };
|
|
2803
2803
|
return p.value.map((A) => {
|
|
2804
|
-
const { target: m, source: y, type: _ } = A,
|
|
2804
|
+
const { target: m, source: y, type: _ } = A, g = y.box, b = m.box, T = ["vt", "vm", "vb"].includes(m.type), S = {};
|
|
2805
2805
|
if (_ === "alignment")
|
|
2806
|
-
if (
|
|
2807
|
-
const F = Math.min(
|
|
2808
|
-
|
|
2806
|
+
if (S.class = "mce-auxiliary__alignment", T) {
|
|
2807
|
+
const F = Math.min(g.hl.pos, b.hl.pos), R = Math.max(g.hr.pos, b.hr.pos);
|
|
2808
|
+
S.style = {
|
|
2809
2809
|
top: C.top + x(m.pos),
|
|
2810
2810
|
left: C.left + x(F),
|
|
2811
2811
|
width: x(R - F)
|
|
2812
2812
|
};
|
|
2813
2813
|
} else {
|
|
2814
|
-
const F = Math.min(b.vt.pos,
|
|
2815
|
-
|
|
2814
|
+
const F = Math.min(b.vt.pos, g.vt.pos), R = Math.max(b.vb.pos, g.vb.pos);
|
|
2815
|
+
S.style = {
|
|
2816
2816
|
top: C.top + x(F),
|
|
2817
2817
|
left: C.left + x(m.pos),
|
|
2818
2818
|
height: x(R - F)
|
|
2819
2819
|
};
|
|
2820
2820
|
}
|
|
2821
2821
|
else if (_ === "area") {
|
|
2822
|
-
|
|
2822
|
+
S.class = [
|
|
2823
2823
|
"mce-auxiliary__area",
|
|
2824
2824
|
{
|
|
2825
2825
|
"mce-auxiliary__area--vertical": T
|
|
2826
2826
|
}
|
|
2827
2827
|
];
|
|
2828
|
-
const F =
|
|
2828
|
+
const F = v(m) || v(y);
|
|
2829
2829
|
if (T) {
|
|
2830
|
-
const R = Math.min(y.pos, m.pos), E = F ? Math.max(
|
|
2831
|
-
|
|
2830
|
+
const R = Math.min(y.pos, m.pos), E = F ? Math.max(g.hl.pos, b.hl.pos) : Math.min(g.hl.pos, b.hl.pos), N = F ? Math.min(g.hr.pos, b.hr.pos) : Math.max(g.hr.pos, b.hr.pos);
|
|
2831
|
+
S.style = {
|
|
2832
2832
|
top: C.top + x(R),
|
|
2833
2833
|
left: C.left + x(E),
|
|
2834
2834
|
width: x(N - E),
|
|
2835
2835
|
height: x(A.distance)
|
|
2836
2836
|
};
|
|
2837
2837
|
} else {
|
|
2838
|
-
const R = Math.min(y.pos, m.pos), E = F ? Math.max(b.vt.pos,
|
|
2839
|
-
|
|
2838
|
+
const R = Math.min(y.pos, m.pos), E = F ? Math.max(b.vt.pos, g.vt.pos) : Math.min(b.vt.pos, g.vt.pos), N = F ? Math.min(b.vb.pos, g.vb.pos) : Math.max(b.vb.pos, g.vb.pos);
|
|
2839
|
+
S.style = {
|
|
2840
2840
|
top: C.top + x(E),
|
|
2841
2841
|
left: C.left + x(R),
|
|
2842
2842
|
height: x(N - E),
|
|
@@ -2844,17 +2844,17 @@ const ns = (o) => {
|
|
|
2844
2844
|
};
|
|
2845
2845
|
}
|
|
2846
2846
|
}
|
|
2847
|
-
return
|
|
2847
|
+
return S;
|
|
2848
2848
|
});
|
|
2849
2849
|
});
|
|
2850
2850
|
function L(C = !1) {
|
|
2851
2851
|
const A = [], m = [];
|
|
2852
2852
|
for (const y of p.value) {
|
|
2853
|
-
const { target: _, source:
|
|
2853
|
+
const { target: _, source: g, type: b } = y, T = _.box, S = g.box;
|
|
2854
2854
|
if (b === "alignment") {
|
|
2855
|
-
const F =
|
|
2855
|
+
const F = S.hr.pos - S.hl.pos, R = S.vb.pos - S.vt.pos;
|
|
2856
2856
|
let E = T[_.type].pos;
|
|
2857
|
-
["vt", "vm", "vb"].includes(_.type) ? (C || (
|
|
2857
|
+
["vt", "vm", "vb"].includes(_.type) ? (C || (g.type === "vm" ? E -= R / 2 : g.type === "vb" && (E -= R)), m.push(E)) : (C || (g.type === "hm" ? E -= F / 2 : g.type === "hr" && (E -= F)), A.push(E));
|
|
2858
2858
|
} else if (b === "area") {
|
|
2859
2859
|
if (!y._ctx)
|
|
2860
2860
|
continue;
|
|
@@ -2878,44 +2878,44 @@ const ns = (o) => {
|
|
|
2878
2878
|
exec: t,
|
|
2879
2879
|
load: n,
|
|
2880
2880
|
addElement: s
|
|
2881
|
-
} = o, a = V(), i = async (
|
|
2882
|
-
if (
|
|
2883
|
-
if (Array.isArray(
|
|
2881
|
+
} = o, a = V(), i = async (l) => {
|
|
2882
|
+
if (l === void 0 && (l = e.value.length === 1 ? [e.value[0].toJSON()] : e.value.map((h) => h.toJSON())), Ct) {
|
|
2883
|
+
if (Array.isArray(l)) {
|
|
2884
2884
|
const h = "text/html";
|
|
2885
2885
|
await navigator.clipboard.write([
|
|
2886
2886
|
new ClipboardItem({
|
|
2887
2887
|
[h]: new Blob([
|
|
2888
|
-
`<mce-clipboard>${JSON.stringify(
|
|
2888
|
+
`<mce-clipboard>${JSON.stringify(l)}</mce-clipboard>`
|
|
2889
2889
|
], { type: h })
|
|
2890
2890
|
})
|
|
2891
2891
|
]);
|
|
2892
|
-
} else if (typeof
|
|
2892
|
+
} else if (typeof l == "string") {
|
|
2893
2893
|
const h = "text/plain";
|
|
2894
2894
|
await navigator.clipboard.write([
|
|
2895
|
-
new ClipboardItem({ [h]: new Blob([
|
|
2895
|
+
new ClipboardItem({ [h]: new Blob([l], { type: h }) })
|
|
2896
2896
|
]);
|
|
2897
2897
|
}
|
|
2898
2898
|
} else
|
|
2899
|
-
Array.isArray(
|
|
2899
|
+
Array.isArray(l) && (a.value = l);
|
|
2900
2900
|
};
|
|
2901
|
-
async function
|
|
2901
|
+
async function r() {
|
|
2902
2902
|
await i(), t("delete");
|
|
2903
2903
|
}
|
|
2904
|
-
async function
|
|
2904
|
+
async function c() {
|
|
2905
2905
|
if (Ct) {
|
|
2906
|
-
const
|
|
2907
|
-
for (const k of
|
|
2906
|
+
const l = await navigator.clipboard.read(), h = [];
|
|
2907
|
+
for (const k of l)
|
|
2908
2908
|
for (const f of k.types) {
|
|
2909
|
-
const
|
|
2910
|
-
if (
|
|
2911
|
-
h.push(await n(
|
|
2909
|
+
const v = await k.getType(f);
|
|
2910
|
+
if (v.type.startsWith("image/"))
|
|
2911
|
+
h.push(await n(v));
|
|
2912
2912
|
else
|
|
2913
|
-
switch (
|
|
2913
|
+
switch (v.type) {
|
|
2914
2914
|
case "text/plain":
|
|
2915
|
-
h.push(ct(await
|
|
2915
|
+
h.push(ct(await v.text()));
|
|
2916
2916
|
break;
|
|
2917
2917
|
case "text/html": {
|
|
2918
|
-
const w = new DOMParser().parseFromString(await
|
|
2918
|
+
const w = new DOMParser().parseFromString(await v.text(), "text/html"), d = w.querySelector("mce-clipboard");
|
|
2919
2919
|
if (d) {
|
|
2920
2920
|
const x = JSON.parse(d.textContent);
|
|
2921
2921
|
Array.isArray(x) && h.push(...x);
|
|
@@ -2938,10 +2938,10 @@ const ns = (o) => {
|
|
|
2938
2938
|
break;
|
|
2939
2939
|
}
|
|
2940
2940
|
case "application/json":
|
|
2941
|
-
h.push(await n(
|
|
2941
|
+
h.push(await n(v));
|
|
2942
2942
|
break;
|
|
2943
2943
|
default:
|
|
2944
|
-
console.warn(`Unhandled clipboard ${
|
|
2944
|
+
console.warn(`Unhandled clipboard ${v.type}`, await v.text());
|
|
2945
2945
|
break;
|
|
2946
2946
|
}
|
|
2947
2947
|
}
|
|
@@ -2950,14 +2950,14 @@ const ns = (o) => {
|
|
|
2950
2950
|
active: !0,
|
|
2951
2951
|
regenId: !0
|
|
2952
2952
|
});
|
|
2953
|
-
} else a.value && Array.isArray(a.value) && s(a.value?.map((
|
|
2953
|
+
} else a.value && Array.isArray(a.value) && s(a.value?.map((l) => Vn(l)) ?? [], {
|
|
2954
2954
|
inPointerPosition: !0,
|
|
2955
2955
|
active: !0,
|
|
2956
2956
|
regenId: !0
|
|
2957
2957
|
});
|
|
2958
2958
|
}
|
|
2959
|
-
async function
|
|
2960
|
-
await i(), await
|
|
2959
|
+
async function u() {
|
|
2960
|
+
await i(), await c();
|
|
2961
2961
|
}
|
|
2962
2962
|
return Object.assign(o, {
|
|
2963
2963
|
copiedData: a
|
|
@@ -2965,9 +2965,9 @@ const ns = (o) => {
|
|
|
2965
2965
|
name: "mce:clipboard",
|
|
2966
2966
|
commands: [
|
|
2967
2967
|
{ command: "copy", handle: i },
|
|
2968
|
-
{ command: "cut", handle:
|
|
2969
|
-
{ command: "paste", handle:
|
|
2970
|
-
{ command: "duplicate", handle:
|
|
2968
|
+
{ command: "cut", handle: r },
|
|
2969
|
+
{ command: "paste", handle: c },
|
|
2970
|
+
{ command: "duplicate", handle: u }
|
|
2971
2971
|
],
|
|
2972
2972
|
hotkeys: [
|
|
2973
2973
|
{ command: "copy", key: "CmdOrCtrl+c", editable: !1 },
|
|
@@ -2986,12 +2986,12 @@ const ns = (o) => {
|
|
|
2986
2986
|
name: "mce:copyAs",
|
|
2987
2987
|
commands: [
|
|
2988
2988
|
{ command: "copyAs", handle: async (a, i = {}) => {
|
|
2989
|
-
let
|
|
2989
|
+
let r = await e(a, {
|
|
2990
2990
|
selected: !0,
|
|
2991
2991
|
...i
|
|
2992
2992
|
});
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2993
|
+
const c = n.value.get(a);
|
|
2994
|
+
c && typeof c.copyAs == "function" && (r = c.copyAs(r)), typeof r != "string" && (r = JSON.stringify(r)), t("copy", r);
|
|
2995
2995
|
} }
|
|
2996
2996
|
]
|
|
2997
2997
|
};
|
|
@@ -3048,17 +3048,17 @@ const ns = (o) => {
|
|
|
3048
3048
|
selection: s,
|
|
3049
3049
|
addElement: a,
|
|
3050
3050
|
isFrame: i,
|
|
3051
|
-
doc:
|
|
3051
|
+
doc: r
|
|
3052
3052
|
} = o;
|
|
3053
|
-
function
|
|
3053
|
+
function c() {
|
|
3054
3054
|
const h = s.value;
|
|
3055
3055
|
if (h.length === 0)
|
|
3056
3056
|
return;
|
|
3057
|
-
const k = t(h, "frame"), f = h.map((
|
|
3058
|
-
const w =
|
|
3057
|
+
const k = t(h, "frame"), f = h.map((v) => {
|
|
3058
|
+
const w = v.toJSON();
|
|
3059
3059
|
return w.style.left = (w.style.left ?? 0) - k.left, w.style.top = (w.style.top ?? 0) - k.top, w;
|
|
3060
3060
|
});
|
|
3061
|
-
|
|
3061
|
+
r.value.transact(() => {
|
|
3062
3062
|
a({
|
|
3063
3063
|
style: { ...k },
|
|
3064
3064
|
children: f,
|
|
@@ -3068,33 +3068,33 @@ const ns = (o) => {
|
|
|
3068
3068
|
}, {
|
|
3069
3069
|
regenId: !0,
|
|
3070
3070
|
active: !0
|
|
3071
|
-
}), h.forEach((
|
|
3071
|
+
}), h.forEach((v) => e(v.id));
|
|
3072
3072
|
});
|
|
3073
3073
|
}
|
|
3074
|
-
function
|
|
3074
|
+
function u() {
|
|
3075
3075
|
const h = s.value[0];
|
|
3076
3076
|
if (!h)
|
|
3077
3077
|
return;
|
|
3078
3078
|
const k = h.children.map((f) => {
|
|
3079
|
-
const
|
|
3080
|
-
return w.style.left =
|
|
3079
|
+
const v = n(f), w = f.toJSON();
|
|
3080
|
+
return w.style.left = v.left, w.style.top = v.top, w;
|
|
3081
3081
|
});
|
|
3082
|
-
|
|
3082
|
+
r.value.transact(() => {
|
|
3083
3083
|
e(h.id), a(k, {
|
|
3084
3084
|
active: !0,
|
|
3085
3085
|
regenId: !0
|
|
3086
3086
|
});
|
|
3087
3087
|
});
|
|
3088
3088
|
}
|
|
3089
|
-
function
|
|
3090
|
-
s.value.length === 1 ? i(s.value[0]) &&
|
|
3089
|
+
function l() {
|
|
3090
|
+
s.value.length === 1 ? i(s.value[0]) && u() : s.value.length > 1 && c();
|
|
3091
3091
|
}
|
|
3092
3092
|
return {
|
|
3093
3093
|
name: "mce:frame",
|
|
3094
3094
|
commands: [
|
|
3095
|
-
{ command: "frame", handle:
|
|
3096
|
-
{ command: "unframe", handle:
|
|
3097
|
-
{ command: "frame/unframe", handle:
|
|
3095
|
+
{ command: "frame", handle: c },
|
|
3096
|
+
{ command: "unframe", handle: u },
|
|
3097
|
+
{ command: "frame/unframe", handle: l }
|
|
3098
3098
|
],
|
|
3099
3099
|
hotkeys: [
|
|
3100
3100
|
{ command: "frame/unframe", key: "Alt+CmdOrCtrl+g" }
|
|
@@ -3112,17 +3112,17 @@ const ns = (o) => {
|
|
|
3112
3112
|
name: "gif",
|
|
3113
3113
|
saveAs: !0,
|
|
3114
3114
|
handle: async (a) => {
|
|
3115
|
-
const { Encoder: i } = await import("modern-gif"), { onProgress:
|
|
3115
|
+
const { Encoder: i } = await import("modern-gif"), { onProgress: r, ...c } = a, u = n("json", c), { startTime: l, endTime: h } = u.meta, k = Math.floor(u.style.width), f = Math.floor(u.style.height), v = new i({ width: k, height: f, workerUrl: s });
|
|
3116
3116
|
return await gt({
|
|
3117
|
-
data:
|
|
3117
|
+
data: u,
|
|
3118
3118
|
width: k,
|
|
3119
3119
|
height: f,
|
|
3120
3120
|
fonts: t,
|
|
3121
|
-
keyframes: Array.from({ length: ~~((h -
|
|
3121
|
+
keyframes: Array.from({ length: ~~((h - l) / 100) }, (w, d) => l + d * 100),
|
|
3122
3122
|
onFrame: async (w, { duration: d, progress: p }) => {
|
|
3123
|
-
await
|
|
3123
|
+
await v.encode({ data: w, delay: d }), r?.(p);
|
|
3124
3124
|
}
|
|
3125
|
-
}), await
|
|
3125
|
+
}), await v.flush("blob");
|
|
3126
3126
|
}
|
|
3127
3127
|
}
|
|
3128
3128
|
]
|
|
@@ -3136,13 +3136,13 @@ const ns = (o) => {
|
|
|
3136
3136
|
deleteElement: a,
|
|
3137
3137
|
doc: i
|
|
3138
3138
|
} = o;
|
|
3139
|
-
function
|
|
3140
|
-
const
|
|
3141
|
-
if (
|
|
3139
|
+
function r() {
|
|
3140
|
+
const l = n.value;
|
|
3141
|
+
if (l.length === 0)
|
|
3142
3142
|
return;
|
|
3143
|
-
const h = t(
|
|
3144
|
-
const
|
|
3145
|
-
return
|
|
3143
|
+
const h = t(l, "frame"), k = l.map((f) => {
|
|
3144
|
+
const v = f.toJSON();
|
|
3145
|
+
return v.style.left = (v.style.left ?? 0) - h.left, v.style.top = (v.style.top ?? 0) - h.top, v;
|
|
3146
3146
|
});
|
|
3147
3147
|
i.value.transact(() => {
|
|
3148
3148
|
s({
|
|
@@ -3154,33 +3154,33 @@ const ns = (o) => {
|
|
|
3154
3154
|
}, {
|
|
3155
3155
|
active: !0,
|
|
3156
3156
|
regenId: !0
|
|
3157
|
-
}),
|
|
3157
|
+
}), l.forEach((f) => a(f.id));
|
|
3158
3158
|
});
|
|
3159
3159
|
}
|
|
3160
|
-
function
|
|
3161
|
-
const
|
|
3162
|
-
if (!
|
|
3160
|
+
function c() {
|
|
3161
|
+
const l = n.value[0];
|
|
3162
|
+
if (!l)
|
|
3163
3163
|
return;
|
|
3164
|
-
const h =
|
|
3165
|
-
const f = e(k, "frame"),
|
|
3166
|
-
return
|
|
3164
|
+
const h = l.children.map((k) => {
|
|
3165
|
+
const f = e(k, "frame"), v = k.toJSON();
|
|
3166
|
+
return v.style.left = f.left, v.style.top = f.top, v;
|
|
3167
3167
|
});
|
|
3168
3168
|
i.value.transact(() => {
|
|
3169
3169
|
s(h, {
|
|
3170
3170
|
active: !0,
|
|
3171
3171
|
regenId: !0
|
|
3172
|
-
}), a(
|
|
3172
|
+
}), a(l.id);
|
|
3173
3173
|
});
|
|
3174
3174
|
}
|
|
3175
|
-
function
|
|
3176
|
-
n.value.length === 1 ?
|
|
3175
|
+
function u() {
|
|
3176
|
+
n.value.length === 1 ? c() : n.value.length > 1 && r();
|
|
3177
3177
|
}
|
|
3178
3178
|
return {
|
|
3179
3179
|
name: "mce:group",
|
|
3180
3180
|
commands: [
|
|
3181
|
-
{ command: "group", handle:
|
|
3182
|
-
{ command: "ungroup", handle:
|
|
3183
|
-
{ command: "group/ungroup", handle:
|
|
3181
|
+
{ command: "group", handle: r },
|
|
3182
|
+
{ command: "ungroup", handle: c },
|
|
3183
|
+
{ command: "group/ungroup", handle: u }
|
|
3184
3184
|
],
|
|
3185
3185
|
hotkeys: [
|
|
3186
3186
|
{ command: "group/ungroup", key: "CmdOrCtrl+g" }
|
|
@@ -3197,9 +3197,9 @@ const ns = (o) => {
|
|
|
3197
3197
|
function i() {
|
|
3198
3198
|
e.value.undo();
|
|
3199
3199
|
}
|
|
3200
|
-
return t("setDoc", (
|
|
3201
|
-
|
|
3202
|
-
n.value =
|
|
3200
|
+
return t("setDoc", (r) => {
|
|
3201
|
+
r.on("history", (c) => {
|
|
3202
|
+
n.value = c.canUndo(), s.value = c.canRedo();
|
|
3203
3203
|
});
|
|
3204
3204
|
}), Object.assign(o, {
|
|
3205
3205
|
canUndo: n,
|
|
@@ -3225,21 +3225,21 @@ const ns = (o) => {
|
|
|
3225
3225
|
to: s,
|
|
3226
3226
|
fonts: a,
|
|
3227
3227
|
upload: i
|
|
3228
|
-
} = o,
|
|
3228
|
+
} = o, r = async (l, h) => n(await ut(l), {
|
|
3229
3229
|
sizeToFit: !0,
|
|
3230
3230
|
positionToFit: !0,
|
|
3231
3231
|
...h
|
|
3232
|
-
}),
|
|
3232
|
+
}), c = () => {
|
|
3233
3233
|
e("drawing", {
|
|
3234
3234
|
content: "image",
|
|
3235
|
-
callback: (
|
|
3236
|
-
t("import", { position:
|
|
3235
|
+
callback: (l) => {
|
|
3236
|
+
t("import", { position: l });
|
|
3237
3237
|
}
|
|
3238
3238
|
});
|
|
3239
3239
|
};
|
|
3240
|
-
function
|
|
3240
|
+
function u(l) {
|
|
3241
3241
|
return {
|
|
3242
|
-
name:
|
|
3242
|
+
name: l,
|
|
3243
3243
|
saveAs: !0,
|
|
3244
3244
|
handle: async (h) => {
|
|
3245
3245
|
const k = await s("json", h), f = await gt({
|
|
@@ -3248,10 +3248,10 @@ const ns = (o) => {
|
|
|
3248
3248
|
width: k.style.width,
|
|
3249
3249
|
height: k.style.height
|
|
3250
3250
|
});
|
|
3251
|
-
return await new Promise((
|
|
3251
|
+
return await new Promise((v) => {
|
|
3252
3252
|
f.toBlob(
|
|
3253
|
-
(w) =>
|
|
3254
|
-
|
|
3253
|
+
(w) => v(w),
|
|
3254
|
+
l === "jpg" ? "image/jpeg" : `image/${l}`
|
|
3255
3255
|
);
|
|
3256
3256
|
});
|
|
3257
3257
|
}
|
|
@@ -3260,20 +3260,20 @@ const ns = (o) => {
|
|
|
3260
3260
|
return {
|
|
3261
3261
|
name: "mce:image",
|
|
3262
3262
|
commands: [
|
|
3263
|
-
{ command: "insertImage", handle:
|
|
3264
|
-
{ command: "drawImage", handle:
|
|
3263
|
+
{ command: "insertImage", handle: r },
|
|
3264
|
+
{ command: "drawImage", handle: c }
|
|
3265
3265
|
],
|
|
3266
3266
|
exporters: [
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3267
|
+
u("jpeg"),
|
|
3268
|
+
u("png"),
|
|
3269
|
+
u("webp")
|
|
3270
3270
|
],
|
|
3271
3271
|
loaders: [
|
|
3272
3272
|
{
|
|
3273
3273
|
name: "image",
|
|
3274
3274
|
accept: nn.join(","),
|
|
3275
|
-
test: (
|
|
3276
|
-
load: async (
|
|
3275
|
+
test: (l) => !!(l instanceof Blob && l.type.startsWith("image/") || l instanceof File && lt.test(l.name)),
|
|
3276
|
+
load: async (l) => await ut(await i(l))
|
|
3277
3277
|
}
|
|
3278
3278
|
]
|
|
3279
3279
|
};
|
|
@@ -3289,10 +3289,10 @@ const ns = (o) => {
|
|
|
3289
3289
|
{ command: "import", handle: async (a = {}) => {
|
|
3290
3290
|
const i = await t({ multiple: !0 });
|
|
3291
3291
|
return n((await Promise.all(
|
|
3292
|
-
i.map(async (
|
|
3293
|
-
const
|
|
3294
|
-
let
|
|
3295
|
-
return
|
|
3292
|
+
i.map(async (r) => {
|
|
3293
|
+
const c = await e(r);
|
|
3294
|
+
let u;
|
|
3295
|
+
return c.meta?.inEditorIs === "Doc" ? u = c.children ?? [] : u = [c], u;
|
|
3296
3296
|
})
|
|
3297
3297
|
)).flat(), {
|
|
3298
3298
|
...a,
|
|
@@ -3309,14 +3309,14 @@ const ns = (o) => {
|
|
|
3309
3309
|
const {
|
|
3310
3310
|
selection: e
|
|
3311
3311
|
} = o;
|
|
3312
|
-
function t(
|
|
3313
|
-
(Array.isArray(
|
|
3314
|
-
const h =
|
|
3312
|
+
function t(r, c) {
|
|
3313
|
+
(Array.isArray(r) ? r : [r]).forEach((l) => {
|
|
3314
|
+
const h = l.getParent();
|
|
3315
3315
|
if (!h)
|
|
3316
3316
|
return;
|
|
3317
|
-
let k =
|
|
3318
|
-
const f = h.children.length - 1,
|
|
3319
|
-
switch (
|
|
3317
|
+
let k = l.getIndex();
|
|
3318
|
+
const f = h.children.length - 1, v = 0;
|
|
3319
|
+
switch (c) {
|
|
3320
3320
|
case "bringForward":
|
|
3321
3321
|
k = Math.min(h.children.length - 1, k + 1);
|
|
3322
3322
|
break;
|
|
@@ -3324,26 +3324,26 @@ const ns = (o) => {
|
|
|
3324
3324
|
k = f;
|
|
3325
3325
|
break;
|
|
3326
3326
|
case "sendBackward":
|
|
3327
|
-
k = Math.max(
|
|
3327
|
+
k = Math.max(v, k - 1);
|
|
3328
3328
|
break;
|
|
3329
3329
|
case "sendToBack":
|
|
3330
|
-
k =
|
|
3330
|
+
k = v;
|
|
3331
3331
|
break;
|
|
3332
3332
|
}
|
|
3333
|
-
h.moveChild(
|
|
3333
|
+
h.moveChild(l, k);
|
|
3334
3334
|
});
|
|
3335
3335
|
}
|
|
3336
|
-
function n(
|
|
3337
|
-
|
|
3336
|
+
function n(r = e.value) {
|
|
3337
|
+
r && t(r, "bringToFront");
|
|
3338
3338
|
}
|
|
3339
|
-
function s(
|
|
3340
|
-
|
|
3339
|
+
function s(r = e.value[0]) {
|
|
3340
|
+
r && t(r, "bringForward");
|
|
3341
3341
|
}
|
|
3342
|
-
function a(
|
|
3343
|
-
|
|
3342
|
+
function a(r = e.value[0]) {
|
|
3343
|
+
r && t(r, "sendBackward");
|
|
3344
3344
|
}
|
|
3345
|
-
function i(
|
|
3346
|
-
|
|
3345
|
+
function i(r = e.value) {
|
|
3346
|
+
r && t(r, "sendToBack");
|
|
3347
3347
|
}
|
|
3348
3348
|
return {
|
|
3349
3349
|
name: "mce:layerOrder",
|
|
@@ -3368,25 +3368,25 @@ const ns = (o) => {
|
|
|
3368
3368
|
} = o;
|
|
3369
3369
|
function s(a) {
|
|
3370
3370
|
const i = t.value.length === 1 ? e.value : n(t.value);
|
|
3371
|
-
t.value.forEach((
|
|
3371
|
+
t.value.forEach((r) => {
|
|
3372
3372
|
switch (a) {
|
|
3373
3373
|
case "left":
|
|
3374
|
-
|
|
3374
|
+
r.style.left = 0;
|
|
3375
3375
|
break;
|
|
3376
3376
|
case "horizontal-center":
|
|
3377
|
-
|
|
3377
|
+
r.style.left = (i.width - r.style.width) / 2;
|
|
3378
3378
|
break;
|
|
3379
3379
|
case "right":
|
|
3380
|
-
|
|
3380
|
+
r.style.left = i.width - r.style.width;
|
|
3381
3381
|
break;
|
|
3382
3382
|
case "top":
|
|
3383
|
-
|
|
3383
|
+
r.style.top = 0;
|
|
3384
3384
|
break;
|
|
3385
3385
|
case "vertical-center":
|
|
3386
|
-
|
|
3386
|
+
r.style.top = (i.height - r.style.height) / 2;
|
|
3387
3387
|
break;
|
|
3388
3388
|
case "bottom":
|
|
3389
|
-
|
|
3389
|
+
r.style.top = i.height - r.style.height;
|
|
3390
3390
|
break;
|
|
3391
3391
|
}
|
|
3392
3392
|
});
|
|
@@ -3429,153 +3429,158 @@ const ns = (o) => {
|
|
|
3429
3429
|
{ command: "lock/unlock", key: "Shift+CmdOrCtrl+l" }
|
|
3430
3430
|
]
|
|
3431
3431
|
};
|
|
3432
|
-
}, vs = (o) => {
|
|
3432
|
+
}, vs = (o, e) => {
|
|
3433
3433
|
const {
|
|
3434
|
-
canUndo:
|
|
3435
|
-
canRedo:
|
|
3436
|
-
copiedData:
|
|
3437
|
-
selection:
|
|
3438
|
-
textSelection:
|
|
3439
|
-
config:
|
|
3440
|
-
exporters:
|
|
3441
|
-
} = o,
|
|
3434
|
+
canUndo: t,
|
|
3435
|
+
canRedo: n,
|
|
3436
|
+
copiedData: s,
|
|
3437
|
+
selection: a,
|
|
3438
|
+
textSelection: i,
|
|
3439
|
+
config: r,
|
|
3440
|
+
exporters: c
|
|
3441
|
+
} = o, {
|
|
3442
|
+
customContextMenu: u
|
|
3443
|
+
} = e, l = z(() => a.value.length > 0), h = z(() => ({
|
|
3442
3444
|
key: "export",
|
|
3443
|
-
children: [...
|
|
3444
|
-
})),
|
|
3445
|
+
children: [...c.value.values()].filter((S) => !!S.saveAs).map((S) => ({ key: `saveAs:${S.name}` }))
|
|
3446
|
+
})), k = z(() => ({
|
|
3445
3447
|
key: "file",
|
|
3446
3448
|
children: [
|
|
3447
3449
|
{ key: "new" },
|
|
3448
3450
|
{ key: "open" },
|
|
3449
3451
|
{ type: "divider" },
|
|
3450
3452
|
{ key: "import" },
|
|
3451
|
-
|
|
3453
|
+
h.value
|
|
3452
3454
|
]
|
|
3453
|
-
})),
|
|
3454
|
-
{ key: "undo", disabled: !
|
|
3455
|
-
{ key: "redo", disabled: !
|
|
3456
|
-
]),
|
|
3457
|
-
{ key: "copy", disabled: !
|
|
3455
|
+
})), f = z(() => [
|
|
3456
|
+
{ key: "undo", disabled: !t.value },
|
|
3457
|
+
{ key: "redo", disabled: !n.value }
|
|
3458
|
+
]), v = z(() => [
|
|
3459
|
+
{ key: "copy", disabled: !l.value },
|
|
3458
3460
|
{
|
|
3459
3461
|
key: "copyAs",
|
|
3460
|
-
disabled: !
|
|
3461
|
-
children: [...
|
|
3462
|
+
disabled: !l.value,
|
|
3463
|
+
children: [...c.value.values()].filter((S) => !!S.copyAs).map((S) => ({ key: `copyAs:${S.name}` }))
|
|
3462
3464
|
},
|
|
3463
|
-
{ key: "cut", disabled: !
|
|
3464
|
-
{ key: "paste", disabled: !
|
|
3465
|
-
{ key: "duplicate", disabled: !
|
|
3466
|
-
{ key: "delete", disabled: !
|
|
3467
|
-
]),
|
|
3465
|
+
{ key: "cut", disabled: !l.value },
|
|
3466
|
+
{ key: "paste", disabled: !s.value },
|
|
3467
|
+
{ key: "duplicate", disabled: !l.value },
|
|
3468
|
+
{ key: "delete", disabled: !l.value }
|
|
3469
|
+
]), w = z(() => ({
|
|
3468
3470
|
key: "select",
|
|
3469
3471
|
children: [
|
|
3470
3472
|
{ key: "selectAll" },
|
|
3471
|
-
{ key: "deselectAll", disabled: !
|
|
3472
|
-
{ key: "selectParent", disabled: !
|
|
3473
|
-
{ key: "previousSelection", disabled: !
|
|
3474
|
-
{ key: "nextSelection", disabled: !
|
|
3473
|
+
{ key: "deselectAll", disabled: !l.value },
|
|
3474
|
+
{ key: "selectParent", disabled: !l.value },
|
|
3475
|
+
{ key: "previousSelection", disabled: !l.value },
|
|
3476
|
+
{ key: "nextSelection", disabled: !l.value }
|
|
3475
3477
|
]
|
|
3476
|
-
})),
|
|
3478
|
+
})), d = z(() => ({
|
|
3477
3479
|
key: "edit",
|
|
3478
3480
|
children: [
|
|
3479
|
-
...
|
|
3481
|
+
...f.value,
|
|
3480
3482
|
{ type: "divider" },
|
|
3481
|
-
...
|
|
3483
|
+
...v.value,
|
|
3482
3484
|
{ type: "divider" },
|
|
3483
|
-
...
|
|
3485
|
+
...w.value.children
|
|
3484
3486
|
]
|
|
3485
|
-
})),
|
|
3487
|
+
})), p = z(() => ({
|
|
3486
3488
|
key: "zoom",
|
|
3487
3489
|
children: [
|
|
3488
3490
|
{ key: "zoomIn" },
|
|
3489
3491
|
{ key: "zoomOut" },
|
|
3490
3492
|
{ key: "zoomTo100" },
|
|
3491
3493
|
{ key: "zoomToFit" },
|
|
3492
|
-
{ key: "zoomToSelection", disabled: !
|
|
3494
|
+
{ key: "zoomToSelection", disabled: !l.value }
|
|
3493
3495
|
]
|
|
3494
|
-
})),
|
|
3496
|
+
})), x = z(() => ({
|
|
3495
3497
|
key: "view",
|
|
3496
3498
|
children: [
|
|
3497
|
-
{ key: "view:checkerboard", checked:
|
|
3498
|
-
{ key: "view:pixelGrid", checked:
|
|
3499
|
-
{ key: "view:ruler", checked:
|
|
3500
|
-
{ key: "view:scrollbar", checked:
|
|
3501
|
-
{ key: "view:timeline", checked:
|
|
3502
|
-
{ key: "view:statusbar", checked:
|
|
3503
|
-
{ key: "view:frameOutline", checked:
|
|
3499
|
+
{ key: "view:checkerboard", checked: r.value.checkerboard },
|
|
3500
|
+
{ key: "view:pixelGrid", checked: r.value.pixelGrid },
|
|
3501
|
+
{ key: "view:ruler", checked: r.value.ruler },
|
|
3502
|
+
{ key: "view:scrollbar", checked: r.value.scrollbar },
|
|
3503
|
+
{ key: "view:timeline", checked: r.value.timeline },
|
|
3504
|
+
{ key: "view:statusbar", checked: r.value.statusbar },
|
|
3505
|
+
{ key: "view:frameOutline", checked: r.value.frameOutline },
|
|
3504
3506
|
{ type: "divider" },
|
|
3505
|
-
...
|
|
3507
|
+
...p.value.children
|
|
3506
3508
|
]
|
|
3507
|
-
})),
|
|
3508
|
-
{ key: "group/ungroup", disabled: !
|
|
3509
|
-
{ key: "frame/unframe", disabled: !
|
|
3510
|
-
]),
|
|
3509
|
+
})), O = z(() => [
|
|
3510
|
+
{ key: "group/ungroup", disabled: !l.value },
|
|
3511
|
+
{ key: "frame/unframe", disabled: !l.value }
|
|
3512
|
+
]), L = z(() => ({
|
|
3511
3513
|
key: "layerOrder",
|
|
3512
3514
|
children: [
|
|
3513
|
-
{ key: "bringToFront", disabled: !
|
|
3514
|
-
{ key: "bringForward", disabled: !
|
|
3515
|
-
{ key: "sendBackward", disabled: !
|
|
3516
|
-
{ key: "sendToBack", disabled: !
|
|
3515
|
+
{ key: "bringToFront", disabled: !l.value },
|
|
3516
|
+
{ key: "bringForward", disabled: !l.value },
|
|
3517
|
+
{ key: "sendBackward", disabled: !l.value },
|
|
3518
|
+
{ key: "sendToBack", disabled: !l.value }
|
|
3517
3519
|
]
|
|
3518
|
-
})),
|
|
3520
|
+
})), C = z(() => ({
|
|
3519
3521
|
key: "flip",
|
|
3520
3522
|
children: [
|
|
3521
|
-
{ key: "flipHorizontal", disabled: !
|
|
3522
|
-
{ key: "flipVertical", disabled: !
|
|
3523
|
+
{ key: "flipHorizontal", disabled: !l.value },
|
|
3524
|
+
{ key: "flipVertical", disabled: !l.value }
|
|
3523
3525
|
]
|
|
3524
|
-
})),
|
|
3525
|
-
{ key: "hide/show", disabled: !
|
|
3526
|
-
{ key: "lock/unlock", disabled: !
|
|
3527
|
-
]),
|
|
3526
|
+
})), A = z(() => [
|
|
3527
|
+
{ key: "hide/show", disabled: !l.value },
|
|
3528
|
+
{ key: "lock/unlock", disabled: !l.value }
|
|
3529
|
+
]), m = z(() => ({
|
|
3528
3530
|
key: "object",
|
|
3529
3531
|
children: [
|
|
3530
|
-
...
|
|
3532
|
+
...O.value,
|
|
3531
3533
|
{ type: "divider" },
|
|
3532
|
-
...
|
|
3534
|
+
...L.value.children,
|
|
3533
3535
|
{ type: "divider" },
|
|
3534
|
-
...
|
|
3536
|
+
...C.value.children,
|
|
3535
3537
|
{ type: "divider" },
|
|
3536
|
-
...
|
|
3538
|
+
...A.value
|
|
3537
3539
|
]
|
|
3538
|
-
})),
|
|
3539
|
-
{ key: "alignLeft", disabled: !
|
|
3540
|
-
{ key: "alignHorizontalCenter", disabled: !
|
|
3541
|
-
{ key: "alignRight", disabled: !
|
|
3542
|
-
{ key: "alignTop", disabled: !
|
|
3543
|
-
{ key: "alignVerticalCenter", disabled: !
|
|
3544
|
-
{ key: "alignBottom", disabled: !
|
|
3545
|
-
]),
|
|
3540
|
+
})), y = z(() => [
|
|
3541
|
+
{ key: "alignLeft", disabled: !l.value },
|
|
3542
|
+
{ key: "alignHorizontalCenter", disabled: !l.value },
|
|
3543
|
+
{ key: "alignRight", disabled: !l.value },
|
|
3544
|
+
{ key: "alignTop", disabled: !l.value },
|
|
3545
|
+
{ key: "alignVerticalCenter", disabled: !l.value },
|
|
3546
|
+
{ key: "alignBottom", disabled: !l.value }
|
|
3547
|
+
]), _ = z(() => ({
|
|
3546
3548
|
key: "layerPosition",
|
|
3547
3549
|
children: [
|
|
3548
|
-
...
|
|
3550
|
+
...y.value
|
|
3549
3551
|
]
|
|
3550
|
-
})),
|
|
3551
|
-
|
|
3552
|
-
g.value,
|
|
3552
|
+
})), g = z(() => [
|
|
3553
|
+
k.value,
|
|
3553
3554
|
d.value,
|
|
3554
|
-
|
|
3555
|
-
m.value
|
|
3556
|
-
|
|
3557
|
-
|
|
3555
|
+
x.value,
|
|
3556
|
+
m.value,
|
|
3557
|
+
_.value
|
|
3558
|
+
]), b = z(() => a.value.length > 0 ? i.value ? [
|
|
3559
|
+
...v.value
|
|
3558
3560
|
] : [
|
|
3559
|
-
...
|
|
3561
|
+
...v.value,
|
|
3560
3562
|
{ type: "divider" },
|
|
3561
|
-
...
|
|
3562
|
-
...
|
|
3563
|
+
...O.value,
|
|
3564
|
+
...A.value,
|
|
3563
3565
|
{ type: "divider" },
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3566
|
+
L.value,
|
|
3567
|
+
_.value,
|
|
3568
|
+
C.value,
|
|
3567
3569
|
{ type: "divider" },
|
|
3568
|
-
|
|
3570
|
+
h.value
|
|
3569
3571
|
] : [
|
|
3570
|
-
|
|
3572
|
+
v.value[2],
|
|
3571
3573
|
{ type: "divider" },
|
|
3572
|
-
...
|
|
3574
|
+
...g.value,
|
|
3573
3575
|
{ type: "divider" },
|
|
3574
|
-
|
|
3575
|
-
])
|
|
3576
|
+
h.value
|
|
3577
|
+
]), T = z(() => {
|
|
3578
|
+
const S = b.value;
|
|
3579
|
+
return u?.(S, o) ?? S;
|
|
3580
|
+
});
|
|
3576
3581
|
return Object.assign(o, {
|
|
3577
|
-
mainMenu:
|
|
3578
|
-
contextMenu:
|
|
3582
|
+
mainMenu: g,
|
|
3583
|
+
contextMenu: T
|
|
3579
3584
|
}), {
|
|
3580
3585
|
name: "mce:menu"
|
|
3581
3586
|
};
|
|
@@ -3597,8 +3602,8 @@ const ns = (o) => {
|
|
|
3597
3602
|
i = "left";
|
|
3598
3603
|
break;
|
|
3599
3604
|
}
|
|
3600
|
-
e.value.forEach((
|
|
3601
|
-
|
|
3605
|
+
e.value.forEach((r) => {
|
|
3606
|
+
r.style[i] += a;
|
|
3602
3607
|
});
|
|
3603
3608
|
}
|
|
3604
3609
|
function n() {
|
|
@@ -3652,17 +3657,11 @@ const ns = (o) => {
|
|
|
3652
3657
|
const [a] = await e();
|
|
3653
3658
|
if (a) {
|
|
3654
3659
|
const i = await t(a);
|
|
3655
|
-
i && (i.children ? n(i) :
|
|
3656
|
-
name: "doc",
|
|
3657
|
-
style: { width: 1920, height: 1080 },
|
|
3660
|
+
i && (i.children ? n(i) : n({
|
|
3658
3661
|
children: [
|
|
3659
|
-
|
|
3660
|
-
name: "page",
|
|
3661
|
-
style: { width: 1920, height: 1080 },
|
|
3662
|
-
children: [i]
|
|
3663
|
-
}
|
|
3662
|
+
i
|
|
3664
3663
|
]
|
|
3665
|
-
}))
|
|
3664
|
+
}));
|
|
3666
3665
|
}
|
|
3667
3666
|
}
|
|
3668
3667
|
return {
|
|
@@ -3685,15 +3684,15 @@ const ns = (o) => {
|
|
|
3685
3684
|
commands: [
|
|
3686
3685
|
{ command: "saveAs", handle: async (a, i = {}) => {
|
|
3687
3686
|
const {
|
|
3688
|
-
filename:
|
|
3689
|
-
...
|
|
3687
|
+
filename: r = t.value.meta.name ?? "download",
|
|
3688
|
+
...c
|
|
3690
3689
|
} = i;
|
|
3691
|
-
let
|
|
3690
|
+
let u = await e(a, {
|
|
3692
3691
|
selected: !0,
|
|
3693
|
-
...
|
|
3692
|
+
...c
|
|
3694
3693
|
});
|
|
3695
|
-
const
|
|
3696
|
-
|
|
3694
|
+
const l = n.value.get(a);
|
|
3695
|
+
l && typeof l.saveAs == "function" && (u = l.saveAs(u)), u instanceof Blob || (u = new Blob([JSON.stringify(u)], { type: "application/json" })), Yt(u, `${r}.${a}`);
|
|
3697
3696
|
} }
|
|
3698
3697
|
]
|
|
3699
3698
|
};
|
|
@@ -3709,22 +3708,22 @@ const ns = (o) => {
|
|
|
3709
3708
|
e.value = [];
|
|
3710
3709
|
}
|
|
3711
3710
|
function a() {
|
|
3712
|
-
const
|
|
3713
|
-
|
|
3711
|
+
const c = e.value[0]?.parent;
|
|
3712
|
+
c instanceof G && (e.value = [c]);
|
|
3714
3713
|
}
|
|
3715
3714
|
function i() {
|
|
3716
|
-
const
|
|
3717
|
-
if (!
|
|
3715
|
+
const c = e.value[0];
|
|
3716
|
+
if (!c)
|
|
3718
3717
|
return;
|
|
3719
|
-
const
|
|
3720
|
-
|
|
3718
|
+
const u = c.previousSibling;
|
|
3719
|
+
u instanceof G && !c.equal(u) && (e.value = [u]);
|
|
3721
3720
|
}
|
|
3722
|
-
function
|
|
3723
|
-
const
|
|
3724
|
-
if (!
|
|
3721
|
+
function r() {
|
|
3722
|
+
const c = e.value[0];
|
|
3723
|
+
if (!c)
|
|
3725
3724
|
return;
|
|
3726
|
-
const
|
|
3727
|
-
|
|
3725
|
+
const u = c.nextSibling;
|
|
3726
|
+
u instanceof G && !c.equal(u) && (e.value = [u]);
|
|
3728
3727
|
}
|
|
3729
3728
|
return {
|
|
3730
3729
|
name: "mce:select",
|
|
@@ -3733,7 +3732,7 @@ const ns = (o) => {
|
|
|
3733
3732
|
{ command: "deselectAll", handle: s },
|
|
3734
3733
|
{ command: "selectParent", handle: a },
|
|
3735
3734
|
{ command: "previousSelection", handle: i },
|
|
3736
|
-
{ command: "nextSelection", handle:
|
|
3735
|
+
{ command: "nextSelection", handle: r }
|
|
3737
3736
|
],
|
|
3738
3737
|
hotkeys: [
|
|
3739
3738
|
{ command: "selectAll", key: "CmdOrCtrl+a" },
|
|
@@ -3749,21 +3748,21 @@ const ns = (o) => {
|
|
|
3749
3748
|
t,
|
|
3750
3749
|
exec: n,
|
|
3751
3750
|
addElement: s
|
|
3752
|
-
} = o, a = (
|
|
3753
|
-
const { style:
|
|
3754
|
-
return s(ct(
|
|
3751
|
+
} = o, a = (c = t("clickEditText"), u = {}) => {
|
|
3752
|
+
const { style: l, ...h } = u;
|
|
3753
|
+
return s(ct(c, l), {
|
|
3755
3754
|
sizeToFit: !0,
|
|
3756
3755
|
positionToFit: !0,
|
|
3757
3756
|
...h
|
|
3758
3757
|
});
|
|
3759
|
-
}, i = (
|
|
3758
|
+
}, i = (c, u) => {
|
|
3760
3759
|
e("drawing", {
|
|
3761
3760
|
content: "text",
|
|
3762
|
-
callback: (
|
|
3763
|
-
n("insertText",
|
|
3761
|
+
callback: (l) => {
|
|
3762
|
+
n("insertText", c, { ...u, position: l });
|
|
3764
3763
|
}
|
|
3765
3764
|
});
|
|
3766
|
-
},
|
|
3765
|
+
}, r = /\.txt$/i;
|
|
3767
3766
|
return {
|
|
3768
3767
|
name: "mce:text",
|
|
3769
3768
|
commands: [
|
|
@@ -3774,8 +3773,8 @@ const ns = (o) => {
|
|
|
3774
3773
|
{
|
|
3775
3774
|
name: "txt",
|
|
3776
3775
|
accept: ".txt",
|
|
3777
|
-
test: (
|
|
3778
|
-
load: async (
|
|
3776
|
+
test: (c) => !!(c instanceof Blob && c.type.startsWith("text/plain") || c instanceof File && r.test(c.name)),
|
|
3777
|
+
load: async (c) => ct(await c.text())
|
|
3779
3778
|
}
|
|
3780
3779
|
]
|
|
3781
3780
|
};
|
|
@@ -3870,16 +3869,16 @@ const ns = (o) => {
|
|
|
3870
3869
|
config: s,
|
|
3871
3870
|
currentAabb: a,
|
|
3872
3871
|
registerConfig: i,
|
|
3873
|
-
selection:
|
|
3872
|
+
selection: r
|
|
3874
3873
|
} = o;
|
|
3875
3874
|
i("zoomToFitOffset", { ...St });
|
|
3876
|
-
function
|
|
3875
|
+
function c() {
|
|
3877
3876
|
e.value.addZoom(0.25);
|
|
3878
3877
|
}
|
|
3879
|
-
function
|
|
3878
|
+
function u() {
|
|
3880
3879
|
e.value.addZoom(-0.25);
|
|
3881
3880
|
}
|
|
3882
|
-
function
|
|
3881
|
+
function l() {
|
|
3883
3882
|
e.value.setZoom(1);
|
|
3884
3883
|
}
|
|
3885
3884
|
function h(w, d = !1) {
|
|
@@ -3890,15 +3889,15 @@ const ns = (o) => {
|
|
|
3890
3889
|
s.value.scrollbar && (x.right += 8, x.bottom += 8), s.value.ruler && (x.left += 16, x.top += 16);
|
|
3891
3890
|
const O = t.value.width - (x.left + x.right), L = t.value.height - (x.top + x.bottom), C = p.left, A = p.top, m = p.width, y = p.height;
|
|
3892
3891
|
if (m && y) {
|
|
3893
|
-
const _ = O / m,
|
|
3892
|
+
const _ = O / m, g = L / y;
|
|
3894
3893
|
e.value.setZoom(
|
|
3895
|
-
w === "contain" ? Math.min(_,
|
|
3894
|
+
w === "contain" ? Math.min(_, g) : Math.max(_, g)
|
|
3896
3895
|
);
|
|
3897
3896
|
const b = e.value.zoom.x;
|
|
3898
|
-
let T = x.left,
|
|
3899
|
-
_ <
|
|
3897
|
+
let T = x.left, S = x.top;
|
|
3898
|
+
_ < g ? S += (L - y * b) / 2 : T += (O - m * b) / 2, e.value.position.set(
|
|
3900
3899
|
-C * b + T,
|
|
3901
|
-
-A * b +
|
|
3900
|
+
-A * b + S
|
|
3902
3901
|
);
|
|
3903
3902
|
}
|
|
3904
3903
|
}
|
|
@@ -3908,18 +3907,18 @@ const ns = (o) => {
|
|
|
3908
3907
|
function f() {
|
|
3909
3908
|
h("cover");
|
|
3910
3909
|
}
|
|
3911
|
-
function
|
|
3910
|
+
function v() {
|
|
3912
3911
|
h("contain", !0);
|
|
3913
3912
|
}
|
|
3914
3913
|
return {
|
|
3915
3914
|
name: "mce:zoom",
|
|
3916
3915
|
commands: [
|
|
3917
|
-
{ command: "zoomIn", handle:
|
|
3918
|
-
{ command: "zoomOut", handle:
|
|
3919
|
-
{ command: "zoomTo100", handle:
|
|
3916
|
+
{ command: "zoomIn", handle: c },
|
|
3917
|
+
{ command: "zoomOut", handle: u },
|
|
3918
|
+
{ command: "zoomTo100", handle: l },
|
|
3920
3919
|
{ command: "zoomToFit", handle: k },
|
|
3921
3920
|
{ command: "zoomToCover", handle: f },
|
|
3922
|
-
{ command: "zoomToSelection", handle:
|
|
3921
|
+
{ command: "zoomToSelection", handle: v }
|
|
3923
3922
|
],
|
|
3924
3923
|
hotkeys: [
|
|
3925
3924
|
{ command: "zoomIn", key: "CmdOrCtrl+=" },
|
|
@@ -3931,7 +3930,7 @@ const ns = (o) => {
|
|
|
3931
3930
|
events: {
|
|
3932
3931
|
setDoc: k,
|
|
3933
3932
|
setCurrentFrame: () => {
|
|
3934
|
-
|
|
3933
|
+
r.value.length ? v() : k();
|
|
3935
3934
|
}
|
|
3936
3935
|
},
|
|
3937
3936
|
setup: () => {
|
|
@@ -4024,14 +4023,14 @@ class Be extends Xt {
|
|
|
4024
4023
|
typeof s == "function" ? a = s(this, t) : a = s, this.plugins.set(a.name, a);
|
|
4025
4024
|
const {
|
|
4026
4025
|
commands: i = [],
|
|
4027
|
-
hotkeys:
|
|
4028
|
-
loaders:
|
|
4029
|
-
exporters:
|
|
4030
|
-
events:
|
|
4026
|
+
hotkeys: r = [],
|
|
4027
|
+
loaders: c = [],
|
|
4028
|
+
exporters: u = [],
|
|
4029
|
+
events: l
|
|
4031
4030
|
} = a;
|
|
4032
|
-
if (this.registerCommand(i), this.registerHotkey(
|
|
4033
|
-
for (const h in
|
|
4034
|
-
this.on(h,
|
|
4031
|
+
if (this.registerCommand(i), this.registerHotkey(r), this.registerLoader(c), this.registerExporter(u), l)
|
|
4032
|
+
for (const h in l)
|
|
4033
|
+
this.on(h, l[h]);
|
|
4035
4034
|
};
|
|
4036
4035
|
e.forEach((s) => {
|
|
4037
4036
|
try {
|
|
@@ -4146,7 +4145,7 @@ function zs(o) {
|
|
|
4146
4145
|
component: Mt,
|
|
4147
4146
|
icon: s
|
|
4148
4147
|
};
|
|
4149
|
-
const a = Object.keys(e.sets).find((
|
|
4148
|
+
const a = Object.keys(e.sets).find((c) => typeof s == "string" && s.startsWith(`${c}:`)), i = a ? s.slice(a.length + 1) : s;
|
|
4150
4149
|
return {
|
|
4151
4150
|
component: e.sets[a ?? e.defaultSet].component,
|
|
4152
4151
|
icon: i
|
|
@@ -4242,7 +4241,7 @@ const Bs = on({
|
|
|
4242
4241
|
setup(o) {
|
|
4243
4242
|
const { auxiliaryLines: e } = de();
|
|
4244
4243
|
return (t, n) => ($(), P("div", js, [
|
|
4245
|
-
($(!0), P(se, null, _e(
|
|
4244
|
+
($(!0), P(se, null, _e(M(e), (s, a) => ($(), P("div", {
|
|
4246
4245
|
key: a,
|
|
4247
4246
|
class: be(s.class),
|
|
4248
4247
|
style: q({
|
|
@@ -4328,51 +4327,51 @@ function Ws(o, e, t, n) {
|
|
|
4328
4327
|
let s = { top: 0, left: 0, right: 0, bottom: 0 };
|
|
4329
4328
|
const a = [{ id: "", layer: { ...s } }];
|
|
4330
4329
|
for (const i of o) {
|
|
4331
|
-
const
|
|
4332
|
-
if (!
|
|
4330
|
+
const r = e.get(i), c = t.get(i), u = n.get(i);
|
|
4331
|
+
if (!r || !c || !u)
|
|
4333
4332
|
continue;
|
|
4334
|
-
const
|
|
4333
|
+
const l = {
|
|
4335
4334
|
...s,
|
|
4336
|
-
[
|
|
4335
|
+
[r.value]: Number.parseInt(String(s[r.value]), 10) + (u.value ? Number.parseInt(String(c.value), 10) : 0)
|
|
4337
4336
|
};
|
|
4338
4337
|
a.push({
|
|
4339
4338
|
id: i,
|
|
4340
|
-
layer:
|
|
4341
|
-
}), s =
|
|
4339
|
+
layer: l
|
|
4340
|
+
}), s = l;
|
|
4342
4341
|
}
|
|
4343
4342
|
return a;
|
|
4344
4343
|
}
|
|
4345
4344
|
function Ks(o) {
|
|
4346
|
-
const e = Se(Je, null), t = z(() => e ? e.rootZIndex.value - 100 : zt), n = V([]), s = Ae(/* @__PURE__ */ new Map()), a = Ae(/* @__PURE__ */ new Map()), i = Ae(/* @__PURE__ */ new Map()),
|
|
4345
|
+
const e = Se(Je, null), t = z(() => e ? e.rootZIndex.value - 100 : zt), n = V([]), s = Ae(/* @__PURE__ */ new Map()), a = Ae(/* @__PURE__ */ new Map()), i = Ae(/* @__PURE__ */ new Map()), r = Ae(/* @__PURE__ */ new Map()), c = Ae(/* @__PURE__ */ new Map()), { resizeRef: u, contentRect: l } = Xs(), h = z(() => {
|
|
4347
4346
|
const A = /* @__PURE__ */ new Map(), m = o.overlaps ?? [];
|
|
4348
4347
|
for (const y of m.filter((_) => _.includes(":"))) {
|
|
4349
|
-
const [_,
|
|
4350
|
-
if (!n.value.includes(_) || !n.value.includes(
|
|
4348
|
+
const [_, g] = y.split(":");
|
|
4349
|
+
if (!n.value.includes(_) || !n.value.includes(g))
|
|
4351
4350
|
continue;
|
|
4352
|
-
const b = s.get(_), T = s.get(
|
|
4353
|
-
!b || !T || !
|
|
4351
|
+
const b = s.get(_), T = s.get(g), S = a.get(_), F = a.get(g);
|
|
4352
|
+
!b || !T || !S || !F || (A.set(g, { position: b.value, amount: Number.parseInt(String(S.value), 10) }), A.set(_, { position: T.value, amount: -Number.parseInt(String(F.value), 10) }));
|
|
4354
4353
|
}
|
|
4355
4354
|
return A;
|
|
4356
4355
|
}), k = z(() => {
|
|
4357
4356
|
const A = [...new Set([...i.values()].map((y) => y.value))].sort((y, _) => y - _), m = [];
|
|
4358
4357
|
for (const y of A) {
|
|
4359
|
-
const _ = n.value.filter((
|
|
4358
|
+
const _ = n.value.filter((g) => i.get(g)?.value === y);
|
|
4360
4359
|
m.push(..._);
|
|
4361
4360
|
}
|
|
4362
|
-
return Ws(m, s, a,
|
|
4363
|
-
}), f = z(() => !Array.from(
|
|
4364
|
-
"--mce-layout-left": qe(
|
|
4365
|
-
"--mce-layout-right": qe(
|
|
4366
|
-
"--mce-layout-top": qe(
|
|
4367
|
-
"--mce-layout-bottom": qe(
|
|
4361
|
+
return Ws(m, s, a, r);
|
|
4362
|
+
}), f = z(() => !Array.from(c.values()).some((A) => A.value)), v = z(() => k.value[k.value.length - 1].layer), w = Te(() => ({
|
|
4363
|
+
"--mce-layout-left": qe(v.value.left),
|
|
4364
|
+
"--mce-layout-right": qe(v.value.right),
|
|
4365
|
+
"--mce-layout-top": qe(v.value.top),
|
|
4366
|
+
"--mce-layout-bottom": qe(v.value.bottom),
|
|
4368
4367
|
...f.value ? void 0 : { transition: "none" }
|
|
4369
4368
|
})), d = z(() => k.value.slice(1).map(({ id: A }, m) => {
|
|
4370
|
-
const { layer: y } = k.value[m], _ = a.get(A),
|
|
4369
|
+
const { layer: y } = k.value[m], _ = a.get(A), g = s.get(A);
|
|
4371
4370
|
return {
|
|
4372
4371
|
id: A,
|
|
4373
4372
|
...y,
|
|
4374
4373
|
size: Number(_.value),
|
|
4375
|
-
position:
|
|
4374
|
+
position: g.value
|
|
4376
4375
|
};
|
|
4377
4376
|
})), p = (A) => d.value.find((m) => m.id === A), x = Qe(), O = Ze(!1);
|
|
4378
4377
|
He(() => {
|
|
@@ -4382,17 +4381,17 @@ function Ks(o) {
|
|
|
4382
4381
|
id: m,
|
|
4383
4382
|
order: y,
|
|
4384
4383
|
position: _,
|
|
4385
|
-
layoutSize:
|
|
4384
|
+
layoutSize: g,
|
|
4386
4385
|
elementSize: b,
|
|
4387
4386
|
active: T,
|
|
4388
|
-
disableTransitions:
|
|
4387
|
+
disableTransitions: S,
|
|
4389
4388
|
absolute: F
|
|
4390
4389
|
}) => {
|
|
4391
|
-
i.set(m, y), s.set(m, _), a.set(m,
|
|
4390
|
+
i.set(m, y), s.set(m, _), a.set(m, g), r.set(m, T), S && c.set(m, S);
|
|
4392
4391
|
const E = je(ln, x?.vnode).indexOf(A);
|
|
4393
4392
|
E > -1 ? n.value.splice(E, 0, m) : n.value.push(m);
|
|
4394
4393
|
const N = z(() => d.value.findIndex((U) => U.id === m)), B = z(() => t.value + k.value.length * 2 - N.value * 2), j = z(() => {
|
|
4395
|
-
const U = _.value === "left" || _.value === "right", W = _.value === "right", Q = _.value === "bottom", he = b.value ??
|
|
4394
|
+
const U = _.value === "left" || _.value === "right", W = _.value === "right", Q = _.value === "bottom", he = b.value ?? g.value, Y = he === 0 ? "%" : "px", xe = {
|
|
4396
4395
|
[_.value]: 0,
|
|
4397
4396
|
zIndex: B.value,
|
|
4398
4397
|
transform: `translate${U ? "X" : "Y"}(${(T.value ? 0 : -(he === 0 ? 100 : he)) * (W || Q ? -1 : 1)}${Y})`,
|
|
@@ -4419,13 +4418,13 @@ function Ks(o) {
|
|
|
4419
4418
|
return { layoutItemStyles: j, layoutItemScrimStyles: D, zIndex: B };
|
|
4420
4419
|
},
|
|
4421
4420
|
unregister: (A) => {
|
|
4422
|
-
i.delete(A), s.delete(A), a.delete(A),
|
|
4421
|
+
i.delete(A), s.delete(A), a.delete(A), r.delete(A), c.delete(A), n.value = n.value.filter((m) => m !== A);
|
|
4423
4422
|
},
|
|
4424
|
-
mainRect:
|
|
4423
|
+
mainRect: v,
|
|
4425
4424
|
mainStyles: w,
|
|
4426
4425
|
getLayoutItem: p,
|
|
4427
4426
|
items: d,
|
|
4428
|
-
layoutRect:
|
|
4427
|
+
layoutRect: l,
|
|
4429
4428
|
rootZIndex: t
|
|
4430
4429
|
});
|
|
4431
4430
|
const L = Te(() => [
|
|
@@ -4441,8 +4440,8 @@ function Ks(o) {
|
|
|
4441
4440
|
layoutStyles: C,
|
|
4442
4441
|
getLayoutItem: p,
|
|
4443
4442
|
items: d,
|
|
4444
|
-
layoutRect:
|
|
4445
|
-
layoutRef:
|
|
4443
|
+
layoutRect: l,
|
|
4444
|
+
layoutRef: u
|
|
4446
4445
|
};
|
|
4447
4446
|
}
|
|
4448
4447
|
const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
@@ -4453,8 +4452,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4453
4452
|
},
|
|
4454
4453
|
setup(o) {
|
|
4455
4454
|
const e = o, t = Rt(), { iconData: n } = zs(z(() => e.icon)), s = !!(t.onClick || t.onClickOnce);
|
|
4456
|
-
return (a, i) => ($(), oe(Bt(
|
|
4457
|
-
icon:
|
|
4455
|
+
return (a, i) => ($(), oe(Bt(M(n).component), {
|
|
4456
|
+
icon: M(n).icon,
|
|
4458
4457
|
tag: e.tag,
|
|
4459
4458
|
class: be(["mce-icon", {
|
|
4460
4459
|
"mce-icon--disabled": e.disabled
|
|
@@ -4479,7 +4478,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4479
4478
|
const n = o, s = t, a = Rs(), i = z({
|
|
4480
4479
|
get: () => n.modelValue,
|
|
4481
4480
|
set: (p) => s("update:modelValue", p)
|
|
4482
|
-
}),
|
|
4481
|
+
}), r = V(), c = {
|
|
4483
4482
|
getBoundingClientRect() {
|
|
4484
4483
|
const { x: p = 0, y: x = 0 } = n.target;
|
|
4485
4484
|
return {
|
|
@@ -4493,7 +4492,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4493
4492
|
height: 0
|
|
4494
4493
|
};
|
|
4495
4494
|
}
|
|
4496
|
-
},
|
|
4495
|
+
}, u = z(() => typeof n.target == "object" && !(n.target instanceof Element) && "x" in n.target && "y" in n.target ? c : n.target ?? r.value), l = ce("contentElTpl"), h = z(() => n.attach ?? a.attach?.value ?? "body"), { floatingStyles: k, update: f } = Un(u, l, {
|
|
4497
4496
|
placement: z(() => n.location),
|
|
4498
4497
|
whileElementsMounted: qn,
|
|
4499
4498
|
middleware: [
|
|
@@ -4501,16 +4500,16 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4501
4500
|
Hn(),
|
|
4502
4501
|
Yn({ padding: 20 })
|
|
4503
4502
|
]
|
|
4504
|
-
}),
|
|
4503
|
+
}), v = z(() => ({
|
|
4505
4504
|
...k.value,
|
|
4506
4505
|
zIndex: 2e3 + a.index.value
|
|
4507
4506
|
})), w = z(() => ({
|
|
4508
|
-
ref: (p) =>
|
|
4507
|
+
ref: (p) => r.value = p
|
|
4509
4508
|
}));
|
|
4510
4509
|
let d = [];
|
|
4511
4510
|
return He(() => {
|
|
4512
4511
|
const { trigger: p, stop: x } = kn(
|
|
4513
|
-
|
|
4512
|
+
l,
|
|
4514
4513
|
(O) => {
|
|
4515
4514
|
i.value && (i.value = !1, s("click:outside", O));
|
|
4516
4515
|
},
|
|
@@ -4521,9 +4520,9 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4521
4520
|
Dt("pointerdown", p, { passive: !0, capture: !0 })
|
|
4522
4521
|
];
|
|
4523
4522
|
}), we(() => d.forEach((p) => p())), e({
|
|
4524
|
-
activatorEl:
|
|
4525
|
-
target:
|
|
4526
|
-
contentEl:
|
|
4523
|
+
activatorEl: r,
|
|
4524
|
+
target: u,
|
|
4525
|
+
contentEl: l,
|
|
4527
4526
|
updateLocation: f
|
|
4528
4527
|
}), (p, x) => ($(), P(se, null, [
|
|
4529
4528
|
ee(p.$slots, "activator", {
|
|
@@ -4538,7 +4537,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4538
4537
|
key: 0,
|
|
4539
4538
|
ref: "contentElTpl",
|
|
4540
4539
|
class: "mce-overlay",
|
|
4541
|
-
style:
|
|
4540
|
+
style: v.value
|
|
4542
4541
|
}, p.$attrs), [
|
|
4543
4542
|
ee(p.$slots, "default")
|
|
4544
4543
|
], 16)) : Z("", !0)
|
|
@@ -4565,12 +4564,12 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4565
4564
|
}),
|
|
4566
4565
|
emits: /* @__PURE__ */ $e(["click:item"], ["update:modelValue"]),
|
|
4567
4566
|
setup(o, { expose: e, emit: t }) {
|
|
4568
|
-
const n = o, s = t, a = ke(o, "modelValue"), i = V(-1),
|
|
4567
|
+
const n = o, s = t, a = ke(o, "modelValue"), i = V(-1), r = ce("overlayTpl"), c = ce("menuItemTplRefs"), u = z(() => !!n.items?.some((x) => "checked" in x)), l = Pt(), h = Se(Ot, null), k = Ze(/* @__PURE__ */ new Set());
|
|
4569
4568
|
Le(Ot, {
|
|
4570
|
-
register: () => k.value.add(
|
|
4571
|
-
unregister: () => k.value.delete(
|
|
4569
|
+
register: () => k.value.add(l),
|
|
4570
|
+
unregister: () => k.value.delete(l),
|
|
4572
4571
|
closeParents(x) {
|
|
4573
|
-
!k.value.size && !n.persistent && (x == null ||
|
|
4572
|
+
!k.value.size && !n.persistent && (x == null || r.value?.contentEl && !Mo(x, r.value.contentEl)) && (a.value = !1, h?.closeParents());
|
|
4574
4573
|
}
|
|
4575
4574
|
}), we(() => {
|
|
4576
4575
|
h?.unregister();
|
|
@@ -4579,11 +4578,11 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4579
4578
|
const x = {};
|
|
4580
4579
|
return n.openOnHover && (x.onMouseenter = () => a.value = !0), x;
|
|
4581
4580
|
});
|
|
4582
|
-
function
|
|
4581
|
+
function v(x) {
|
|
4583
4582
|
h?.closeParents(x);
|
|
4584
4583
|
}
|
|
4585
4584
|
function w() {
|
|
4586
|
-
|
|
4585
|
+
r.value?.updateLocation();
|
|
4587
4586
|
}
|
|
4588
4587
|
function d(x, O, L) {
|
|
4589
4588
|
x.children?.length ? i.value = O : (a.value = !1, h?.closeParents(L), x.handle?.(L), s("click:item", x, L));
|
|
@@ -4605,7 +4604,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4605
4604
|
target: n.target,
|
|
4606
4605
|
attach: n.attach,
|
|
4607
4606
|
class: "mce-menu",
|
|
4608
|
-
"onClick:outside":
|
|
4607
|
+
"onClick:outside": v
|
|
4609
4608
|
}, {
|
|
4610
4609
|
activator: ne((C) => [
|
|
4611
4610
|
ee(x.$slots, "activator", Oe(C, {
|
|
@@ -4638,7 +4637,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4638
4637
|
]]),
|
|
4639
4638
|
onClick: (m) => d(C, A, m)
|
|
4640
4639
|
}, [
|
|
4641
|
-
|
|
4640
|
+
u.value ? ($(), P("div", Qs, [
|
|
4642
4641
|
C.checked ? ($(), oe(Ee, {
|
|
4643
4642
|
key: 0,
|
|
4644
4643
|
icon: "$check"
|
|
@@ -4661,7 +4660,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4661
4660
|
items: o.items?.[i.value]?.children,
|
|
4662
4661
|
location: "right",
|
|
4663
4662
|
"model-value": i.value > -1,
|
|
4664
|
-
target:
|
|
4663
|
+
target: c.value?.[i.value],
|
|
4665
4664
|
attach: !1,
|
|
4666
4665
|
offset: 16,
|
|
4667
4666
|
"onUpdate:modelValue": O[0] || (O[0] = (C) => i.value = -1),
|
|
@@ -4702,14 +4701,14 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4702
4701
|
contextMenu: s,
|
|
4703
4702
|
exec: a,
|
|
4704
4703
|
getKbd: i,
|
|
4705
|
-
t:
|
|
4706
|
-
hotkeys:
|
|
4707
|
-
} = de(),
|
|
4704
|
+
t: r,
|
|
4705
|
+
hotkeys: c
|
|
4706
|
+
} = de(), u = ke(o, "modelValue"), l = ke(o, "position"), h = ce("menuTplRef");
|
|
4708
4707
|
function k() {
|
|
4709
4708
|
h.value?.updateLocation();
|
|
4710
4709
|
}
|
|
4711
4710
|
function f(w) {
|
|
4712
|
-
w.preventDefault(),
|
|
4711
|
+
w.preventDefault(), u.value = !0, l.value = {
|
|
4713
4712
|
x: w.clientX,
|
|
4714
4713
|
y: w.clientY
|
|
4715
4714
|
}, k();
|
|
@@ -4719,28 +4718,28 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4719
4718
|
}, { immediate: !0 }), we(() => {
|
|
4720
4719
|
t.value?.removeEventListener("contextmenu", f);
|
|
4721
4720
|
});
|
|
4722
|
-
function
|
|
4721
|
+
function v(w) {
|
|
4723
4722
|
a(w.key);
|
|
4724
4723
|
}
|
|
4725
4724
|
return e({
|
|
4726
4725
|
updateLocation: k
|
|
4727
4726
|
}), (w, d) => ($(), oe(na, {
|
|
4728
4727
|
ref: "menuTplRef",
|
|
4729
|
-
modelValue:
|
|
4730
|
-
"onUpdate:modelValue": d[0] || (d[0] = (p) =>
|
|
4728
|
+
modelValue: u.value,
|
|
4729
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => u.value = p),
|
|
4731
4730
|
offset: 10,
|
|
4732
4731
|
class: "mce-context-menu",
|
|
4733
|
-
target:
|
|
4732
|
+
target: l.value,
|
|
4734
4733
|
location: "bottom-start",
|
|
4735
|
-
items:
|
|
4734
|
+
items: M(s),
|
|
4736
4735
|
style: q({
|
|
4737
|
-
maxHeight: `${
|
|
4736
|
+
maxHeight: `${M(n).height * 0.8}px`
|
|
4738
4737
|
}),
|
|
4739
|
-
"onClick:item":
|
|
4738
|
+
"onClick:item": v
|
|
4740
4739
|
}, {
|
|
4741
4740
|
title: ne(({ item: p }) => [
|
|
4742
|
-
I("span", oa, K(
|
|
4743
|
-
|
|
4741
|
+
I("span", oa, K(M(r)(p.key)), 1),
|
|
4742
|
+
M(c).has(p.key) ? ($(), P("span", sa, K(M(i)(p.key)), 1)) : Z("", !0)
|
|
4744
4743
|
]),
|
|
4745
4744
|
_: 1
|
|
4746
4745
|
}, 8, ["modelValue", "target", "items", "style"]));
|
|
@@ -4758,24 +4757,24 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4758
4757
|
camera: s,
|
|
4759
4758
|
drawboardAabb: a,
|
|
4760
4759
|
setCursor: i
|
|
4761
|
-
} = de(), { x:
|
|
4762
|
-
function
|
|
4760
|
+
} = de(), { x: r, y: c } = Cn();
|
|
4761
|
+
function u(l) {
|
|
4763
4762
|
const h = s.value.toGlobal({
|
|
4764
|
-
x:
|
|
4765
|
-
y:
|
|
4763
|
+
x: l.clientX - a.value.left,
|
|
4764
|
+
y: l.clientY - a.value.top
|
|
4766
4765
|
});
|
|
4767
4766
|
t.value?.callback?.(h), i(void 0);
|
|
4768
4767
|
}
|
|
4769
|
-
return (
|
|
4768
|
+
return (l, h) => M(e) === "drawing" ? ($(), P("div", {
|
|
4770
4769
|
key: 0,
|
|
4771
4770
|
class: "mce-drawing",
|
|
4772
4771
|
style: q({
|
|
4773
|
-
left: `${
|
|
4774
|
-
top: `${
|
|
4772
|
+
left: `${M(r)}px`,
|
|
4773
|
+
top: `${M(c)}px`
|
|
4775
4774
|
}),
|
|
4776
|
-
onMousedown:
|
|
4775
|
+
onMousedown: u
|
|
4777
4776
|
}, [
|
|
4778
|
-
|
|
4777
|
+
M(t)?.content ? ($(), P("div", ia, K(M(n)(M(t).content)), 1)) : Z("", !0)
|
|
4779
4778
|
], 36)) : Z("", !0);
|
|
4780
4779
|
}
|
|
4781
4780
|
}), la = /* @__PURE__ */ X({
|
|
@@ -4792,24 +4791,24 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4792
4791
|
selection: s,
|
|
4793
4792
|
isFrame: a
|
|
4794
4793
|
} = de(), i = ce("overlayTpl");
|
|
4795
|
-
function
|
|
4794
|
+
function r() {
|
|
4796
4795
|
i.value?.updateLocation();
|
|
4797
4796
|
}
|
|
4798
|
-
return pe(() => n(s.value),
|
|
4797
|
+
return pe(() => n(s.value), r, {
|
|
4799
4798
|
deep: !0
|
|
4800
4799
|
}), e({
|
|
4801
|
-
updateLocation:
|
|
4802
|
-
}), (
|
|
4800
|
+
updateLocation: r
|
|
4801
|
+
}), (c, u) => ($(), oe(tt, {
|
|
4803
4802
|
ref: "overlayTpl",
|
|
4804
4803
|
class: "mce-floatbar",
|
|
4805
4804
|
location: t.location,
|
|
4806
|
-
offset:
|
|
4805
|
+
offset: M(s)[0] && M(a)(M(s)[0]) ? 32 : 8,
|
|
4807
4806
|
target: t.target,
|
|
4808
4807
|
attach: !1,
|
|
4809
4808
|
"model-value": !0
|
|
4810
4809
|
}, {
|
|
4811
4810
|
default: ne(() => [
|
|
4812
|
-
|
|
4811
|
+
M(s).length > 0 ? ee(c.$slots, "default", { key: 0 }) : Z("", !0)
|
|
4813
4812
|
]),
|
|
4814
4813
|
_: 3
|
|
4815
4814
|
}, 8, ["location", "offset", "target"]));
|
|
@@ -4827,39 +4826,39 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4827
4826
|
hoverElement: s,
|
|
4828
4827
|
selection: a,
|
|
4829
4828
|
state: i,
|
|
4830
|
-
config:
|
|
4831
|
-
exec:
|
|
4832
|
-
} = de(),
|
|
4833
|
-
async function
|
|
4834
|
-
|
|
4829
|
+
config: r,
|
|
4830
|
+
exec: c
|
|
4831
|
+
} = de(), u = V(!1);
|
|
4832
|
+
async function l() {
|
|
4833
|
+
u.value = !0, await Xe(), t.value && (t.value.focus(), t.value.select());
|
|
4835
4834
|
}
|
|
4836
4835
|
async function h(k) {
|
|
4837
|
-
|
|
4836
|
+
u.value || (a.value = [e.value], await Xe(), c("startTransform", k));
|
|
4838
4837
|
}
|
|
4839
4838
|
return (k, f) => ze(($(), P("div", {
|
|
4840
|
-
style: q(
|
|
4839
|
+
style: q(M(Me)(M(n)(e.value))),
|
|
4841
4840
|
class: be(["mce-frame", [
|
|
4842
|
-
|
|
4841
|
+
M(r).frameOutline && "mce-frame--outline"
|
|
4843
4842
|
]])
|
|
4844
4843
|
}, [
|
|
4845
4844
|
ze(I("div", {
|
|
4846
4845
|
class: "mce-frame__name",
|
|
4847
|
-
onDblclick:
|
|
4846
|
+
onDblclick: l,
|
|
4848
4847
|
onPointerdown: h,
|
|
4849
|
-
onPointerenter: f[2] || (f[2] = (
|
|
4850
|
-
onPointerleave: f[3] || (f[3] = (
|
|
4848
|
+
onPointerenter: f[2] || (f[2] = (v) => !M(i) && (s.value = e.value)),
|
|
4849
|
+
onPointerleave: f[3] || (f[3] = (v) => !M(i) && (s.value = void 0))
|
|
4851
4850
|
}, [
|
|
4852
4851
|
I("div", null, K(e.value.name), 1),
|
|
4853
4852
|
ze(I("input", {
|
|
4854
4853
|
ref: "inputTpl",
|
|
4855
|
-
"onUpdate:modelValue": f[0] || (f[0] = (
|
|
4856
|
-
onBlur: f[1] || (f[1] = (
|
|
4854
|
+
"onUpdate:modelValue": f[0] || (f[0] = (v) => e.value.name = v),
|
|
4855
|
+
onBlur: f[1] || (f[1] = (v) => u.value = !1)
|
|
4857
4856
|
}, null, 544), [
|
|
4858
|
-
[Ue,
|
|
4857
|
+
[Ue, u.value],
|
|
4859
4858
|
[bn, e.value.name]
|
|
4860
4859
|
])
|
|
4861
4860
|
], 544), [
|
|
4862
|
-
[Ue,
|
|
4861
|
+
[Ue, M(r).viewMode === "edgeless"]
|
|
4863
4862
|
])
|
|
4864
4863
|
], 6)), [
|
|
4865
4864
|
[Ue, e.value.visible]
|
|
@@ -4871,7 +4870,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4871
4870
|
const {
|
|
4872
4871
|
frames: e
|
|
4873
4872
|
} = de();
|
|
4874
|
-
return (t, n) => ($(!0), P(se, null, _e(
|
|
4873
|
+
return (t, n) => ($(!0), P(se, null, _e(M(e), (s, a) => ($(), oe(ca, {
|
|
4875
4874
|
key: a,
|
|
4876
4875
|
"model-value": s
|
|
4877
4876
|
}, null, 8, ["model-value"]))), 128));
|
|
@@ -4889,13 +4888,13 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4889
4888
|
t.value,
|
|
4890
4889
|
n(e.value)
|
|
4891
4890
|
));
|
|
4892
|
-
return (
|
|
4891
|
+
return (r, c) => i.value ? ($(), P("div", {
|
|
4893
4892
|
key: 0,
|
|
4894
4893
|
class: "mce-back-selected-aera",
|
|
4895
|
-
onClick:
|
|
4894
|
+
onClick: c[0] || (c[0] = We((u) => M(s)("zoomToSelection"), ["prevent"]))
|
|
4896
4895
|
}, [
|
|
4897
4896
|
H(Ee, { icon: "$gps" }),
|
|
4898
|
-
I("span", null, K(
|
|
4897
|
+
I("span", null, K(M(a)("goBackSelectedArea")), 1)
|
|
4899
4898
|
])) : Z("", !0);
|
|
4900
4899
|
}
|
|
4901
4900
|
}), ma = ["data-name"], ha = /* @__PURE__ */ X({
|
|
@@ -4906,13 +4905,13 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4906
4905
|
hoverElement: t,
|
|
4907
4906
|
getObbInDrawboard: n
|
|
4908
4907
|
} = de(), s = z(() => n(t.value));
|
|
4909
|
-
return (a, i) =>
|
|
4908
|
+
return (a, i) => M(t) && !M(t).equal(M(e)[0]) ? ($(), P("div", {
|
|
4910
4909
|
key: 0,
|
|
4911
4910
|
class: "mce-hover",
|
|
4912
|
-
"data-name":
|
|
4911
|
+
"data-name": M(t).name,
|
|
4913
4912
|
style: q({
|
|
4914
4913
|
borderColor: "currentcolor",
|
|
4915
|
-
...
|
|
4914
|
+
...M(Me)(s.value)
|
|
4916
4915
|
})
|
|
4917
4916
|
}, null, 12, ma)) : Z("", !0);
|
|
4918
4917
|
}
|
|
@@ -4935,10 +4934,10 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4935
4934
|
}
|
|
4936
4935
|
return e({
|
|
4937
4936
|
updateLocation: a
|
|
4938
|
-
}), (i,
|
|
4937
|
+
}), (i, r) => ($(), oe(tt, {
|
|
4939
4938
|
ref: "overlayTpl",
|
|
4940
4939
|
modelValue: n.value,
|
|
4941
|
-
"onUpdate:modelValue":
|
|
4940
|
+
"onUpdate:modelValue": r[0] || (r[0] = (c) => n.value = c),
|
|
4942
4941
|
class: "mce-tooltip",
|
|
4943
4942
|
location: t.location,
|
|
4944
4943
|
offset: t.offset,
|
|
@@ -4952,8 +4951,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4952
4951
|
}, [
|
|
4953
4952
|
i.$slots.activator ? {
|
|
4954
4953
|
name: "activator",
|
|
4955
|
-
fn: ne((
|
|
4956
|
-
ee(i.$slots, "activator", ft(pt(
|
|
4954
|
+
fn: ne((c) => [
|
|
4955
|
+
ee(i.$slots, "activator", ft(pt(c)))
|
|
4957
4956
|
]),
|
|
4958
4957
|
key: "0"
|
|
4959
4958
|
} : void 0
|
|
@@ -4976,28 +4975,28 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
4976
4975
|
labelFormat: { type: Function, default: (o) => String(o) }
|
|
4977
4976
|
},
|
|
4978
4977
|
setup(o, { expose: e }) {
|
|
4979
|
-
const t = o, n = Rt(), s = z(() => t.pixelRatio), a = V(), i = V({ x: 0, y: 0 }),
|
|
4978
|
+
const t = o, n = Rt(), s = z(() => t.pixelRatio), a = V(), i = V({ x: 0, y: 0 }), r = ce("canvasTpl"), c = "OffscreenCanvas" in window ? new OffscreenCanvas(t.size, t.size) : document.createElement("canvas"), u = c.getContext("2d"), l = V(), h = Ae({
|
|
4980
4979
|
text: "#000",
|
|
4981
4980
|
border: "#000"
|
|
4982
4981
|
});
|
|
4983
4982
|
function k() {
|
|
4984
4983
|
if (!t.selected?.width || !t.selected?.height)
|
|
4985
4984
|
return;
|
|
4986
|
-
|
|
4985
|
+
u.fillStyle = "#6165FD20";
|
|
4987
4986
|
const E = t.vertical ? t.selected.top : t.selected.left, N = t.vertical ? t.selected.height : t.selected.width;
|
|
4988
|
-
|
|
4987
|
+
u.fillRect(E, 0, N, t.size);
|
|
4989
4988
|
}
|
|
4990
4989
|
function f(E, N, B, j) {
|
|
4991
|
-
|
|
4990
|
+
u.lineWidth = B, u.strokeStyle = j, u.beginPath(), u.moveTo(E[0], E[1]), u.lineTo(N[0], N[1]), u.stroke();
|
|
4992
4991
|
}
|
|
4993
|
-
function
|
|
4992
|
+
function v(E, N, B = 1) {
|
|
4994
4993
|
const j = E, D = t.size, U = E, W = t.size - N * B;
|
|
4995
|
-
|
|
4994
|
+
u.moveTo(j, D), u.lineTo(U, W);
|
|
4996
4995
|
}
|
|
4997
4996
|
function w(E, N, B, j) {
|
|
4998
|
-
|
|
4997
|
+
u.font = `${j}px sans-serif`, u.textAlign = "left", u.textBaseline = "bottom";
|
|
4999
4998
|
const D = N, U = t.size - B;
|
|
5000
|
-
|
|
4999
|
+
u.save(), t.vertical && (u.translate(0, t.size), u.scale(1, -1)), u.fillText(E, D, U), u.restore();
|
|
5001
5000
|
}
|
|
5002
5001
|
const d = z(() => {
|
|
5003
5002
|
const E = Math.max(t.unit / t.zoom, 1), N = t.unitFractions, B = Math.floor(Math.log10(E)), j = E / 10 ** B;
|
|
@@ -5012,7 +5011,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5012
5011
|
const E = -t.position / t.zoom;
|
|
5013
5012
|
return Math.floor(E / d.value) * d.value;
|
|
5014
5013
|
}), x = z(() => {
|
|
5015
|
-
const N = ((t.vertical ?
|
|
5014
|
+
const N = ((t.vertical ? l.value?.height : l.value?.width) ?? 0) / t.zoom;
|
|
5016
5015
|
return p.value + Math.ceil(N / d.value) * d.value;
|
|
5017
5016
|
});
|
|
5018
5017
|
function O(E) {
|
|
@@ -5022,73 +5021,73 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5022
5021
|
return Math.round((E - t.position) / t.zoom);
|
|
5023
5022
|
}
|
|
5024
5023
|
function C() {
|
|
5025
|
-
const E =
|
|
5026
|
-
if (!E || !
|
|
5024
|
+
const E = r.value;
|
|
5025
|
+
if (!E || !c.width || !c.height)
|
|
5027
5026
|
return;
|
|
5028
|
-
|
|
5027
|
+
u.clearRect(0, 0, c.width, c.height), u.save(), u.scale(s.value, s.value), t.vertical && (u.scale(1, -1), u.translate(0, 0), u.rotate(-Math.PI / 2)), k(), t.axis && f(
|
|
5029
5028
|
[0, t.size],
|
|
5030
5029
|
[t.vertical ? E.height : E.width, t.size],
|
|
5031
5030
|
2,
|
|
5032
5031
|
h.border
|
|
5033
5032
|
);
|
|
5034
5033
|
const N = (D, U) => {
|
|
5035
|
-
|
|
5036
|
-
}, B = (D) =>
|
|
5034
|
+
v(D, 10), w(U, D + 2, 4, 8);
|
|
5035
|
+
}, B = (D) => v(D, 4);
|
|
5037
5036
|
let j = d.value / 10;
|
|
5038
|
-
j = (j > 0 ? 1 : -1) * Math.max(1, Math.abs(j)),
|
|
5037
|
+
j = (j > 0 ? 1 : -1) * Math.max(1, Math.abs(j)), u.beginPath(), u.lineWidth = 1, u.strokeStyle = h.text, u.fillStyle = h.text;
|
|
5039
5038
|
for (let D = p.value; D <= x.value; D += j)
|
|
5040
5039
|
D % d.value === 0 && N(O(D), t.labelFormat(D));
|
|
5041
|
-
|
|
5040
|
+
u.stroke(), u.beginPath(), u.lineWidth = 1, u.strokeStyle = h.border;
|
|
5042
5041
|
for (let D = p.value; D <= x.value; D += j)
|
|
5043
5042
|
D % d.value === 0 || D % j === 0 && B(O(D));
|
|
5044
|
-
if (
|
|
5045
|
-
E.getContext("bitmaprenderer").transferFromImageBitmap(
|
|
5043
|
+
if (u.stroke(), u.restore(), "transferToImageBitmap" in c)
|
|
5044
|
+
E.getContext("bitmaprenderer").transferFromImageBitmap(c.transferToImageBitmap());
|
|
5046
5045
|
else {
|
|
5047
5046
|
const D = E.getContext("2d");
|
|
5048
|
-
D && (D.clearRect(0, 0, E.width, E.height), D.drawImage(
|
|
5047
|
+
D && (D.clearRect(0, 0, E.width, E.height), D.drawImage(c, 0, 0));
|
|
5049
5048
|
}
|
|
5050
5049
|
}
|
|
5051
5050
|
pe(
|
|
5052
|
-
[
|
|
5051
|
+
[r, () => t.zoom, () => t.position, () => t.selected],
|
|
5053
5052
|
() => {
|
|
5054
5053
|
C();
|
|
5055
5054
|
},
|
|
5056
5055
|
{ immediate: !0, deep: !0 }
|
|
5057
5056
|
);
|
|
5058
5057
|
const A = jt(() => {
|
|
5059
|
-
if (!
|
|
5058
|
+
if (!r.value)
|
|
5060
5059
|
return;
|
|
5061
|
-
const E =
|
|
5062
|
-
|
|
5060
|
+
const E = r.value.parentElement.getBoundingClientRect();
|
|
5061
|
+
c.width = r.value.width = E.width * s.value, c.height = r.value.height = E.height * s.value, r.value.style.width = `${E.width}px`, r.value.style.height = `${E.height}px`, l.value = E, C();
|
|
5063
5062
|
}, 50);
|
|
5064
5063
|
He(() => {
|
|
5065
5064
|
A();
|
|
5066
|
-
const E =
|
|
5065
|
+
const E = r.value;
|
|
5067
5066
|
if (E) {
|
|
5068
5067
|
const N = window.getComputedStyle(E);
|
|
5069
5068
|
h.text = N.getPropertyValue("--text-color").trim(), h.border = N.getPropertyValue("--border-color").trim();
|
|
5070
5069
|
}
|
|
5071
5070
|
}), we(() => {
|
|
5072
|
-
|
|
5071
|
+
c.width = 0, c.height = 0;
|
|
5073
5072
|
});
|
|
5074
5073
|
const m = V([]), y = V(), _ = z(() => {
|
|
5075
5074
|
const E = [...m.value];
|
|
5076
5075
|
return typeof y.value == "number" && E.unshift(y.value), E;
|
|
5077
5076
|
});
|
|
5078
|
-
function
|
|
5077
|
+
function g(E) {
|
|
5079
5078
|
return L(
|
|
5080
|
-
t.vertical ? E.clientY -
|
|
5079
|
+
t.vertical ? E.clientY - l.value.top : E.clientX - l.value.left
|
|
5081
5080
|
);
|
|
5082
5081
|
}
|
|
5083
5082
|
function b(E) {
|
|
5084
|
-
const N =
|
|
5083
|
+
const N = g(E);
|
|
5085
5084
|
t.refline && m.value.push(N);
|
|
5086
5085
|
}
|
|
5087
5086
|
function T(E, N = !1) {
|
|
5088
|
-
const B =
|
|
5087
|
+
const B = g(E);
|
|
5089
5088
|
t.refline && N && (y.value = B), a.value = t.labelFormat(B), i.value = { x: E.clientX, y: E.clientY };
|
|
5090
5089
|
}
|
|
5091
|
-
function
|
|
5090
|
+
function S() {
|
|
5092
5091
|
y.value = void 0, a.value = void 0;
|
|
5093
5092
|
}
|
|
5094
5093
|
function F(E) {
|
|
@@ -5097,24 +5096,24 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5097
5096
|
function R(E, N) {
|
|
5098
5097
|
E.stopPropagation(), E.preventDefault();
|
|
5099
5098
|
const B = (D) => {
|
|
5100
|
-
m.value[N] =
|
|
5099
|
+
m.value[N] = g(D);
|
|
5101
5100
|
}, j = () => {
|
|
5102
5101
|
window.removeEventListener("mousemove", B), window.removeEventListener("mouseup", j);
|
|
5103
5102
|
};
|
|
5104
5103
|
window.addEventListener("mousemove", B), window.addEventListener("mouseup", j);
|
|
5105
5104
|
}
|
|
5106
5105
|
return e({
|
|
5107
|
-
box:
|
|
5106
|
+
box: l
|
|
5108
5107
|
}), (E, N) => ($(), P(se, null, [
|
|
5109
5108
|
ze(($(), P("div", Oe({
|
|
5110
5109
|
class: ["mce-ruler", [
|
|
5111
5110
|
`mce-ruler--${t.vertical ? "vertical" : "horizontal"}`
|
|
5112
5111
|
]],
|
|
5113
5112
|
style: { "--size": `${t.size}px` }
|
|
5114
|
-
},
|
|
5113
|
+
}, M(n), {
|
|
5115
5114
|
onMousedown: b,
|
|
5116
5115
|
onMousemove: N[0] || (N[0] = (B) => T(B, !0)),
|
|
5117
|
-
onMouseleave:
|
|
5116
|
+
onMouseleave: S
|
|
5118
5117
|
}), [
|
|
5119
5118
|
I("canvas", {
|
|
5120
5119
|
ref: "canvasTpl",
|
|
@@ -5123,7 +5122,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5123
5122
|
height: t.size
|
|
5124
5123
|
}, null, 8, pa)
|
|
5125
5124
|
], 16)), [
|
|
5126
|
-
[
|
|
5125
|
+
[M(Gt), M(A)]
|
|
5127
5126
|
]),
|
|
5128
5127
|
($(!0), P(se, null, _e(_.value, (B, j) => ($(), P("div", {
|
|
5129
5128
|
key: j,
|
|
@@ -5141,7 +5140,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5141
5140
|
onDblclick: (D) => F(j),
|
|
5142
5141
|
onMousedown: (D) => R(D, j),
|
|
5143
5142
|
onMousemove: () => a.value = `${B}`,
|
|
5144
|
-
onMouseleave:
|
|
5143
|
+
onMouseleave: S
|
|
5145
5144
|
}, null, 46, va))), 128)),
|
|
5146
5145
|
H(fa, {
|
|
5147
5146
|
"model-value": !!a.value,
|
|
@@ -5167,16 +5166,16 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5167
5166
|
return (a, i) => ($(), P("div", ga, [
|
|
5168
5167
|
H(mt, {
|
|
5169
5168
|
refline: "",
|
|
5170
|
-
zoom:
|
|
5171
|
-
position:
|
|
5169
|
+
zoom: M(e).zoom.x,
|
|
5170
|
+
position: M(e).position.x,
|
|
5172
5171
|
selected: s.value,
|
|
5173
5172
|
axis: "",
|
|
5174
5173
|
size: 16
|
|
5175
5174
|
}, null, 8, ["zoom", "position", "selected"]),
|
|
5176
5175
|
H(mt, {
|
|
5177
5176
|
refline: "",
|
|
5178
|
-
zoom:
|
|
5179
|
-
position:
|
|
5177
|
+
zoom: M(e).zoom.y,
|
|
5178
|
+
position: M(e).position.y,
|
|
5180
5179
|
selected: s.value,
|
|
5181
5180
|
axis: "",
|
|
5182
5181
|
vertical: "",
|
|
@@ -5203,13 +5202,13 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5203
5202
|
}),
|
|
5204
5203
|
emits: /* @__PURE__ */ $e(["scroll"], ["update:modelValue"]),
|
|
5205
5204
|
setup(o, { emit: e }) {
|
|
5206
|
-
const t = o, n = e, s = (b, T,
|
|
5207
|
-
() => t.infinite ? t.length * t.zoom +
|
|
5205
|
+
const t = o, n = e, s = (b, T, S) => b * (1 - S) + T * S, a = (b, T) => s(b / 2, 1 - b / 2, T), i = ke(o, "modelValue"), r = ce("trackTplRef"), c = ce("thumbTplRef"), u = V(0), l = z(
|
|
5206
|
+
() => t.infinite ? t.length * t.zoom + u.value + Math.abs(i.value) * 2 : i.value > 0 ? i.value + t.length * t.zoom : Math.max(u.value - i.value, t.length * t.zoom)
|
|
5208
5207
|
), h = z(
|
|
5209
5208
|
() => t.infinite ? Math.abs(i.value) - i.value : i.value > 0 ? 0 : -i.value
|
|
5210
|
-
), k = z(() => Math.max(0.05, Math.min(1,
|
|
5211
|
-
const b =
|
|
5212
|
-
|
|
5209
|
+
), k = z(() => Math.max(0.05, Math.min(1, u.value / l.value))), f = z(() => h.value / (l.value - u.value) * (1 - k.value)), v = jt(() => {
|
|
5210
|
+
const b = r.value?.getBoundingClientRect() ?? { width: 0, height: 0 };
|
|
5211
|
+
u.value = t.vertical ? b.height : b.width;
|
|
5213
5212
|
}, 50), w = z(() => t.infinite ? a(k.value, f.value) : f.value), d = z(() => 1 - w.value - k.value), p = z(() => t.vertical ? `${w.value * 100}%` : "0%"), x = z(() => t.vertical ? `${d.value * 100}%` : "50%"), O = z(() => t.vertical ? "0%" : `${w.value * 100}%`), L = z(() => t.vertical ? "50%" : `${d.value * 100}%`);
|
|
5214
5213
|
function C(b) {
|
|
5215
5214
|
n("scroll", b - i.value), i.value = b;
|
|
@@ -5221,28 +5220,28 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5221
5220
|
let y;
|
|
5222
5221
|
function _(b) {
|
|
5223
5222
|
const T = b.target;
|
|
5224
|
-
let
|
|
5225
|
-
if (
|
|
5226
|
-
|
|
5223
|
+
let S = 0;
|
|
5224
|
+
if (c.value?.contains(T)) {
|
|
5225
|
+
g();
|
|
5227
5226
|
return;
|
|
5228
|
-
} else if (
|
|
5229
|
-
const F = (t.vertical ? b.offsetY : b.offsetX) /
|
|
5227
|
+
} else if (r.value?.contains(T)) {
|
|
5228
|
+
const F = (t.vertical ? b.offsetY : b.offsetX) / u.value;
|
|
5230
5229
|
if (F < w.value)
|
|
5231
|
-
|
|
5230
|
+
S = 1;
|
|
5232
5231
|
else if (F > 1 - d.value)
|
|
5233
|
-
|
|
5232
|
+
S = -1;
|
|
5234
5233
|
else {
|
|
5235
|
-
|
|
5234
|
+
g();
|
|
5236
5235
|
return;
|
|
5237
5236
|
}
|
|
5238
5237
|
}
|
|
5239
|
-
A(xa *
|
|
5238
|
+
A(xa * S), y = setTimeout(() => _(b), $t);
|
|
5240
5239
|
}
|
|
5241
|
-
function
|
|
5240
|
+
function g() {
|
|
5242
5241
|
clearTimeout(y);
|
|
5243
5242
|
}
|
|
5244
5243
|
return we(() => {
|
|
5245
|
-
|
|
5244
|
+
g();
|
|
5246
5245
|
}), (b, T) => ze(($(), P("div", {
|
|
5247
5246
|
class: be(["mce-scrollbar", {
|
|
5248
5247
|
"mce-scrollbar--vertical": t.vertical,
|
|
@@ -5271,8 +5270,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5271
5270
|
])
|
|
5272
5271
|
], 512)
|
|
5273
5272
|
], 6)), [
|
|
5274
|
-
[
|
|
5275
|
-
[
|
|
5273
|
+
[M(Gt), M(v)],
|
|
5274
|
+
[M(Gn), [_, { delay: $t, onMouseUp: g }]]
|
|
5276
5275
|
]);
|
|
5277
5276
|
}
|
|
5278
5277
|
}), _a = /* @__PURE__ */ X({
|
|
@@ -5290,17 +5289,17 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5290
5289
|
} = de();
|
|
5291
5290
|
return (s, a) => ($(), P(se, null, [
|
|
5292
5291
|
H(It, Oe(e, {
|
|
5293
|
-
modelValue:
|
|
5294
|
-
"onUpdate:modelValue": a[0] || (a[0] = (i) =>
|
|
5295
|
-
zoom:
|
|
5292
|
+
modelValue: M(t).position.y,
|
|
5293
|
+
"onUpdate:modelValue": a[0] || (a[0] = (i) => M(t).position.y = i),
|
|
5294
|
+
zoom: M(t).zoom.y,
|
|
5296
5295
|
vertical: "",
|
|
5297
|
-
length:
|
|
5296
|
+
length: M(n).height
|
|
5298
5297
|
}), null, 16, ["modelValue", "zoom", "length"]),
|
|
5299
5298
|
H(It, Oe(e, {
|
|
5300
|
-
modelValue:
|
|
5301
|
-
"onUpdate:modelValue": a[1] || (a[1] = (i) =>
|
|
5302
|
-
zoom:
|
|
5303
|
-
length:
|
|
5299
|
+
modelValue: M(t).position.x,
|
|
5300
|
+
"onUpdate:modelValue": a[1] || (a[1] = (i) => M(t).position.x = i),
|
|
5301
|
+
zoom: M(t).zoom.x,
|
|
5302
|
+
length: M(n).width
|
|
5304
5303
|
}), null, 16, ["modelValue", "zoom", "length"])
|
|
5305
5304
|
], 64));
|
|
5306
5305
|
}
|
|
@@ -5356,22 +5355,22 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5356
5355
|
"resize-top-right": (m) => x("resizeBevel", 180 + m),
|
|
5357
5356
|
"resize-bottom-right": (m) => x("resizeBevel", 90 + m),
|
|
5358
5357
|
"resize-bottom-left": (m) => x("resizeBevel", 180 + m)
|
|
5359
|
-
}, i = ke(n, "modelValue"),
|
|
5358
|
+
}, i = ke(n, "modelValue"), r = z({
|
|
5360
5359
|
get: () => {
|
|
5361
|
-
let { left: m = 0, top: y = 0, width: _ = 0, height:
|
|
5362
|
-
return Number.isNaN(Number(_)) && (_ = 0), Number.isNaN(Number(
|
|
5360
|
+
let { left: m = 0, top: y = 0, width: _ = 0, height: g = 0, rotate: b = 0 } = i.value ?? {};
|
|
5361
|
+
return Number.isNaN(Number(_)) && (_ = 0), Number.isNaN(Number(g)) && (g = 0), { left: m, top: y, width: _, height: g, rotate: b };
|
|
5363
5362
|
},
|
|
5364
5363
|
set: (m) => i.value = m
|
|
5365
|
-
}),
|
|
5366
|
-
const { width: m = 0, height: y = 0 } =
|
|
5364
|
+
}), c = V(!1), u = V(), l = z(() => {
|
|
5365
|
+
const { width: m = 0, height: y = 0 } = r.value, _ = 6, g = _ / 2, b = 8, T = b / 2, S = 12;
|
|
5367
5366
|
let F;
|
|
5368
5367
|
return n.handleStrategy === "point" ? F = [
|
|
5369
5368
|
// move
|
|
5370
|
-
{ type: "move", x: -
|
|
5371
|
-
{ type: "move", x: T, y: -
|
|
5372
|
-
{ type: "move", x: m -
|
|
5373
|
-
{ type: "move", x: T, y: y -
|
|
5374
|
-
{ type: "move", x: -
|
|
5369
|
+
{ type: "move", x: -g, y: T, width: _, height: y - b },
|
|
5370
|
+
{ type: "move", x: T, y: -g, width: m - b, height: _ },
|
|
5371
|
+
{ type: "move", x: m - g, y: T, width: _, height: y - b },
|
|
5372
|
+
{ type: "move", x: T, y: y - g, width: m - b, height: _ },
|
|
5373
|
+
{ type: "move", x: -g, y: T, width: _, height: y - b },
|
|
5375
5374
|
// resize
|
|
5376
5375
|
{ type: "resize-top", x: m / 2 - T, y: -T, width: b, height: b },
|
|
5377
5376
|
{ type: "resize-right", x: m - T, y: y / 2 - T, width: b, height: b },
|
|
@@ -5382,57 +5381,57 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5382
5381
|
{ type: "resize-bottom-left", x: -T, y: y - T, width: b, height: b },
|
|
5383
5382
|
{ type: "resize-bottom-right", x: m - T, y: y - T, width: b, height: b },
|
|
5384
5383
|
// rotate
|
|
5385
|
-
{ type: "rotate-top-left", x: -
|
|
5386
|
-
{ type: "rotate-top-right", x: m + T, y: -
|
|
5387
|
-
{ type: "rotate-bottom-left", x: -
|
|
5388
|
-
{ type: "rotate-bottom-right", x: m + T, y: y + T, width:
|
|
5384
|
+
{ type: "rotate-top-left", x: -S - T, y: -S - T, width: S, height: S },
|
|
5385
|
+
{ type: "rotate-top-right", x: m + T, y: -S - T, width: S, height: S },
|
|
5386
|
+
{ type: "rotate-bottom-left", x: -S - T, y: y + T, width: S, height: S },
|
|
5387
|
+
{ type: "rotate-bottom-right", x: m + T, y: y + T, width: S, height: S }
|
|
5389
5388
|
] : F = [
|
|
5390
5389
|
// resize
|
|
5391
|
-
{ type: "resize-top", x: T, y: -
|
|
5392
|
-
{ type: "resize-right", x: m -
|
|
5393
|
-
{ type: "resize-bottom", x: T, y: y -
|
|
5394
|
-
{ type: "resize-left", x: -
|
|
5390
|
+
{ type: "resize-top", x: T, y: -g, width: m - b, height: _ },
|
|
5391
|
+
{ type: "resize-right", x: m - g, y: T, width: _, height: y - b },
|
|
5392
|
+
{ type: "resize-bottom", x: T, y: y - g, width: m - b, height: _ },
|
|
5393
|
+
{ type: "resize-left", x: -g, y: T, width: _, height: y - b },
|
|
5395
5394
|
{ type: "resize-top-left", x: -T, y: -T, width: b, height: b },
|
|
5396
5395
|
{ type: "resize-top-right", x: m - T, y: -T, width: b, height: b },
|
|
5397
5396
|
{ type: "resize-bottom-left", x: -T, y: y - T, width: b, height: b },
|
|
5398
5397
|
{ type: "resize-bottom-right", x: m - T, y: y - T, width: b, height: b },
|
|
5399
5398
|
// rotate
|
|
5400
|
-
{ type: "rotate-top-left", x: -
|
|
5401
|
-
{ type: "rotate-top-right", x: m + T, y: -
|
|
5402
|
-
{ type: "rotate-bottom-left", x: -
|
|
5403
|
-
{ type: "rotate-bottom-right", x: m + T, y: y + T, width:
|
|
5399
|
+
{ type: "rotate-top-left", x: -S - T, y: -S - T, width: S, height: S },
|
|
5400
|
+
{ type: "rotate-top-right", x: m + T, y: -S - T, width: S, height: S },
|
|
5401
|
+
{ type: "rotate-bottom-left", x: -S - T, y: y + T, width: S, height: S },
|
|
5402
|
+
{ type: "rotate-bottom-right", x: m + T, y: y + T, width: S, height: S }
|
|
5404
5403
|
], F.filter((R) => n.handles.includes(R.type)).map((R) => (R.width = Math.max(R.width, 0), R.height = Math.max(R.height, 0), R));
|
|
5405
5404
|
}), h = V(), k = z(() => {
|
|
5406
|
-
const { width: m = 0, height: y = 0 } =
|
|
5405
|
+
const { width: m = 0, height: y = 0 } = r.value;
|
|
5407
5406
|
return {
|
|
5408
5407
|
width: n.initialSize && !m ? void 0 : `${m}px`,
|
|
5409
5408
|
height: n.initialSize && !y ? void 0 : `${y}px`
|
|
5410
5409
|
};
|
|
5411
5410
|
}), f = z(() => {
|
|
5412
|
-
const { left: m = 0, top: y = 0, rotate: _ = 0 } =
|
|
5411
|
+
const { left: m = 0, top: y = 0, rotate: _ = 0 } = r.value, g = _ * Math.PI / 180, b = Math.cos(g), T = Math.sin(g);
|
|
5413
5412
|
return {
|
|
5414
5413
|
...k.value,
|
|
5415
5414
|
transform: `matrix(${b}, ${T}, ${-T}, ${b}, ${m}, ${y})`
|
|
5416
5415
|
};
|
|
5417
|
-
}),
|
|
5416
|
+
}), v = z(() => n.visibility === "auto" && c.value), w = z(() => n.tipFormat?.("size"));
|
|
5418
5417
|
function d(m, y) {
|
|
5419
5418
|
if (m && m.button !== void 0 && m.button !== 0)
|
|
5420
5419
|
return !1;
|
|
5421
5420
|
m?.preventDefault(), m?.stopPropagation();
|
|
5422
|
-
const { left: _ = 0, top:
|
|
5423
|
-
|
|
5421
|
+
const { left: _ = 0, top: g = 0, width: b = 0, height: T = 0, rotate: S = 0 } = r.value, F = b && T ? b / T : 0, R = y === void 0 ? { type: "move", x: 0, y: 0, width: 0, height: 0 } : l.value[y];
|
|
5422
|
+
u.value = R.type;
|
|
5424
5423
|
const E = R.type === "move", N = R.type.startsWith("rotate"), B = R.type === "resize-left" || R.type === "resize-right", j = R.type.split("-").length === 2, D = {
|
|
5425
5424
|
x: _ + b / 2,
|
|
5426
|
-
y:
|
|
5425
|
+
y: g + T / 2
|
|
5427
5426
|
}, U = {
|
|
5428
5427
|
x: _,
|
|
5429
|
-
y:
|
|
5428
|
+
y: g
|
|
5430
5429
|
};
|
|
5431
5430
|
E || (U.x += R.x + R.width / 2, U.y += R.y + R.height / 2);
|
|
5432
5431
|
const W = L(
|
|
5433
5432
|
U,
|
|
5434
5433
|
D,
|
|
5435
|
-
E ? 0 :
|
|
5434
|
+
E ? 0 : S
|
|
5436
5435
|
), Q = {
|
|
5437
5436
|
x: D.x * 2 - W.x,
|
|
5438
5437
|
y: D.y * 2 - W.y
|
|
@@ -5442,9 +5441,9 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5442
5441
|
) / (Math.PI / 180);
|
|
5443
5442
|
let Y = m ? { x: m.clientX, y: m.clientY } : void 0;
|
|
5444
5443
|
function xe() {
|
|
5445
|
-
|
|
5444
|
+
c.value = !0, s("start", r.value);
|
|
5446
5445
|
}
|
|
5447
|
-
!n.threshold && !
|
|
5446
|
+
!n.threshold && !c.value && xe();
|
|
5448
5447
|
function ae(ye) {
|
|
5449
5448
|
const J = {};
|
|
5450
5449
|
Y || (Y = { x: ye.clientX, y: ye.clientY });
|
|
@@ -5452,7 +5451,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5452
5451
|
x: ye.clientX - Y.x,
|
|
5453
5452
|
y: ye.clientY - Y.y
|
|
5454
5453
|
};
|
|
5455
|
-
if (!
|
|
5454
|
+
if (!c.value) {
|
|
5456
5455
|
if (Math.abs(me.x) < n.threshold && Math.abs(me.y) < n.threshold)
|
|
5457
5456
|
return;
|
|
5458
5457
|
xe();
|
|
@@ -5470,12 +5469,12 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5470
5469
|
ue.y - D.y,
|
|
5471
5470
|
ue.x - D.x
|
|
5472
5471
|
) / (Math.PI / 180);
|
|
5473
|
-
J.rotate = (
|
|
5472
|
+
J.rotate = (S + ge - he + 360) % 360;
|
|
5474
5473
|
} else if (j) {
|
|
5475
|
-
const ge = L(ue, W, -
|
|
5474
|
+
const ge = L(ue, W, -S), re = L(
|
|
5476
5475
|
B ? { x: ge.x, y: W.y } : { x: W.x, y: ge.y },
|
|
5477
5476
|
W,
|
|
5478
|
-
|
|
5477
|
+
S
|
|
5479
5478
|
), De = {
|
|
5480
5479
|
x: re.x - (re.x - Q.x) / 2,
|
|
5481
5480
|
y: re.y + (Q.y - re.y) / 2
|
|
@@ -5493,18 +5492,18 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5493
5492
|
me.x > me.y ? (ue.x = W.x + me.x, ue.y = W.y + nt * me.x / F) : (ue.x = W.x + nt * me.y * F, ue.y = W.y + me.y);
|
|
5494
5493
|
}
|
|
5495
5494
|
const ge = C(ue, Q), re = [
|
|
5496
|
-
L(ue, ge, -
|
|
5497
|
-
L(Q, ge, -
|
|
5495
|
+
L(ue, ge, -S),
|
|
5496
|
+
L(Q, ge, -S)
|
|
5498
5497
|
], [De, Ce] = re[0].x > re[1].x ? [re[1].x, re[0].x] : [re[0].x, re[1].x], [xt, un] = re[0].y > re[1].y ? [re[1].y, re[0].y] : [re[0].y, re[1].y];
|
|
5499
5498
|
J.width = Ce - De, J.height = un - xt, J.left = De, J.top = xt;
|
|
5500
5499
|
}
|
|
5501
5500
|
if ("width" in J && J.width <= 0 || "height" in J && J.height <= 0)
|
|
5502
5501
|
return;
|
|
5503
|
-
const te = { ...
|
|
5504
|
-
|
|
5502
|
+
const te = { ...r.value }, ie = { ...r.value, ...J };
|
|
5503
|
+
r.value = ie, s("move", ie, te);
|
|
5505
5504
|
}
|
|
5506
5505
|
function ve() {
|
|
5507
|
-
window.removeEventListener("pointermove", ae), window.removeEventListener("pointerup", ve, !0),
|
|
5506
|
+
window.removeEventListener("pointermove", ae), window.removeEventListener("pointerup", ve, !0), c.value = !1, s("end", r.value);
|
|
5508
5507
|
}
|
|
5509
5508
|
return window.addEventListener("pointermove", ae), window.addEventListener("pointerup", ve, !0), !0;
|
|
5510
5509
|
}
|
|
@@ -5518,10 +5517,10 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5518
5517
|
return `<svg height="32" width="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><filter id="shadow" color-interpolation-filters="sRGB"><feDropShadow dx="1" dy="1" stdDeviation="1.2" flood-opacity=".5"/></filter></defs><g fill="none" transform="rotate(${y} 16 16)" filter="url(%23shadow)">${_}</g></svg>`.replace(/"/g, "'");
|
|
5519
5518
|
}
|
|
5520
5519
|
function O(m) {
|
|
5521
|
-
return m === "move" ? "move" : `url("data:image/svg+xml,${a[m](
|
|
5520
|
+
return m === "move" ? "move" : `url("data:image/svg+xml,${a[m](r.value.rotate ?? 0)}") 16 16, pointer`;
|
|
5522
5521
|
}
|
|
5523
5522
|
function L(m, y, _) {
|
|
5524
|
-
const
|
|
5523
|
+
const g = _ * Math.PI / 180, b = Math.cos(g), T = Math.sin(g);
|
|
5525
5524
|
return {
|
|
5526
5525
|
x: (m.x - y.x) * b - (m.y - y.y) * T + y.x,
|
|
5527
5526
|
y: (m.x - y.x) * T + (m.y - y.y) * b + y.y
|
|
@@ -5540,16 +5539,16 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5540
5539
|
const y = Qe()?.proxy?.$el;
|
|
5541
5540
|
if (y && n.initialSize) {
|
|
5542
5541
|
await Xe();
|
|
5543
|
-
let _,
|
|
5542
|
+
let _, g;
|
|
5544
5543
|
const b = getComputedStyle(y);
|
|
5545
|
-
if (b.width.endsWith("px") && b.height.endsWith("px") ? (_ = Number(b.width.replace("px", "")),
|
|
5546
|
-
|
|
5544
|
+
if (b.width.endsWith("px") && b.height.endsWith("px") ? (_ = Number(b.width.replace("px", "")), g = Number(b.height.replace("px", ""))) : { width: _, height: g } = y.getBoundingClientRect(), _ && g)
|
|
5545
|
+
r.value = { ...r.value, width: _, height: g };
|
|
5547
5546
|
else if ("ResizeObserver" in globalThis) {
|
|
5548
|
-
const T = new ResizeObserver(([
|
|
5549
|
-
|
|
5550
|
-
...
|
|
5551
|
-
width:
|
|
5552
|
-
height:
|
|
5547
|
+
const T = new ResizeObserver(([S]) => {
|
|
5548
|
+
S.contentRect.width && S.contentRect.height && (r.value = {
|
|
5549
|
+
...r.value,
|
|
5550
|
+
width: S.contentRect.width,
|
|
5551
|
+
height: S.contentRect.height
|
|
5553
5552
|
}, T.unobserve(y));
|
|
5554
5553
|
});
|
|
5555
5554
|
T.observe(y);
|
|
@@ -5557,15 +5556,15 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5557
5556
|
}
|
|
5558
5557
|
}), e({
|
|
5559
5558
|
start: d,
|
|
5560
|
-
activeHandle:
|
|
5561
|
-
transforming:
|
|
5559
|
+
activeHandle: u,
|
|
5560
|
+
transforming: c
|
|
5562
5561
|
}), (m, y) => ($(), oe(Bt(o.tag), {
|
|
5563
5562
|
class: "mce-transformable",
|
|
5564
5563
|
style: q(f.value)
|
|
5565
5564
|
}, {
|
|
5566
5565
|
default: ne(() => [
|
|
5567
5566
|
ee(m.$slots, "default", {
|
|
5568
|
-
value:
|
|
5567
|
+
value: M(i),
|
|
5569
5568
|
moveProps: {
|
|
5570
5569
|
onPointerdown: d,
|
|
5571
5570
|
style: { cursor: "move" }
|
|
@@ -5580,12 +5579,12 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5580
5579
|
class: "mce-transformable__box",
|
|
5581
5580
|
style: q({
|
|
5582
5581
|
strokeDasharray: n.borderStyle === "dashed" ? "4px" : void 0,
|
|
5583
|
-
opacity: o.visibility === "none" ? 0 :
|
|
5584
|
-
strokeWidth:
|
|
5582
|
+
opacity: o.visibility === "none" ? 0 : v.value ? ".4" : void 0,
|
|
5583
|
+
strokeWidth: v.value ? "0.5px" : void 0
|
|
5585
5584
|
})
|
|
5586
5585
|
}, null, 4),
|
|
5587
5586
|
I("g", Ca, [
|
|
5588
|
-
($(!0), P(se, null, _e(
|
|
5587
|
+
($(!0), P(se, null, _e(l.value.filter((_) => !(!o.resizable && _.type.startsWith("resize") || !o.rotatable && _.type.startsWith("rotate") || !o.moveable && _.type === "move")), (_, g) => ($(), P(se, { key: g }, [
|
|
5589
5588
|
(o.handleStrategy === "point" ? _.type.startsWith("resize") : _.type === "resize-top-left" || _.type === "resize-top-right" || _.type === "resize-bottom-left" || _.type === "resize-bottom-right") ? ($(), P(se, { key: 0 }, [
|
|
5590
5589
|
n.handleShape === "rect" ? ($(), P("rect", {
|
|
5591
5590
|
key: 0,
|
|
@@ -5597,7 +5596,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5597
5596
|
fill: o.handleColor,
|
|
5598
5597
|
class: "mce-transformable__handle",
|
|
5599
5598
|
style: q({
|
|
5600
|
-
opacity: o.visibility === "none" ||
|
|
5599
|
+
opacity: o.visibility === "none" || c.value && o.visibility !== "visible" ? 0 : void 0
|
|
5601
5600
|
})
|
|
5602
5601
|
}, null, 12, Aa)) : ($(), P("circle", {
|
|
5603
5602
|
key: 1,
|
|
@@ -5608,7 +5607,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5608
5607
|
fill: o.handleColor,
|
|
5609
5608
|
class: "mce-transformable__handle",
|
|
5610
5609
|
style: q({
|
|
5611
|
-
opacity: o.visibility === "none" ||
|
|
5610
|
+
opacity: o.visibility === "none" || c.value && o.visibility !== "visible" ? 0 : void 0
|
|
5612
5611
|
})
|
|
5613
5612
|
}, null, 12, Ta))
|
|
5614
5613
|
], 64)) : Z("", !0),
|
|
@@ -5623,18 +5622,18 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5623
5622
|
"aria-label": _.type,
|
|
5624
5623
|
class: "mce-transformable__handle-box",
|
|
5625
5624
|
style: q({
|
|
5626
|
-
opacity: o.visibility === "none" ||
|
|
5625
|
+
opacity: o.visibility === "none" || c.value && o.visibility !== "visible" ? 0 : void 0
|
|
5627
5626
|
}),
|
|
5628
|
-
cursor:
|
|
5629
|
-
onPointerdown: (b) => d(b,
|
|
5627
|
+
cursor: c.value ? "auto" : O(_.type),
|
|
5628
|
+
onPointerdown: (b) => d(b, g)
|
|
5630
5629
|
}, null, 44, Ea)
|
|
5631
5630
|
], 64))), 128))
|
|
5632
5631
|
]),
|
|
5633
5632
|
I("g", {
|
|
5634
5633
|
"pointer-events": "all",
|
|
5635
|
-
style: q(
|
|
5634
|
+
style: q(v.value ? { opacity: ".4", strokeWidth: "0.5px" } : void 0)
|
|
5636
5635
|
}, [
|
|
5637
|
-
ee(m.$slots, "svg", { box:
|
|
5636
|
+
ee(m.$slots, "svg", { box: r.value })
|
|
5638
5637
|
], 4)
|
|
5639
5638
|
])),
|
|
5640
5639
|
w.value ? ($(), P("div", Sa, K(w.value), 1)) : Z("", !0)
|
|
@@ -5655,17 +5654,17 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5655
5654
|
resizeElement: s,
|
|
5656
5655
|
selection: a,
|
|
5657
5656
|
camera: i,
|
|
5658
|
-
obbToFit:
|
|
5659
|
-
getObbInDrawboard:
|
|
5660
|
-
getObb:
|
|
5661
|
-
registerCommand:
|
|
5657
|
+
obbToFit: r,
|
|
5658
|
+
getObbInDrawboard: c,
|
|
5659
|
+
getObb: u,
|
|
5660
|
+
registerCommand: l,
|
|
5662
5661
|
unregisterCommand: h,
|
|
5663
5662
|
isFrame: k,
|
|
5664
5663
|
isLock: f,
|
|
5665
|
-
config:
|
|
5664
|
+
config: v
|
|
5666
5665
|
} = de(), w = ce("transformableRef");
|
|
5667
5666
|
vt(() => {
|
|
5668
|
-
|
|
5667
|
+
l({ command: "startTransform", handle: (C) => !!w.value?.start(C) });
|
|
5669
5668
|
}), we(() => {
|
|
5670
5669
|
h("startTransform");
|
|
5671
5670
|
});
|
|
@@ -5673,11 +5672,11 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5673
5672
|
if (a.value.length !== 1)
|
|
5674
5673
|
return [];
|
|
5675
5674
|
const C = [];
|
|
5676
|
-
return a.value[0]?.findAncestor((A) => (A instanceof G && C.push(
|
|
5675
|
+
return a.value[0]?.findAncestor((A) => (A instanceof G && C.push(c(A)), !1)), C;
|
|
5677
5676
|
}), p = z(() => n.value !== "selecting" && a.value.length === 1 ? [] : a.value.map((C) => ({
|
|
5678
5677
|
name: C.name,
|
|
5679
|
-
box:
|
|
5680
|
-
}))), x = z(() =>
|
|
5678
|
+
box: c(C)
|
|
5679
|
+
}))), x = z(() => c(a.value)), O = z({
|
|
5681
5680
|
get: () => x.value,
|
|
5682
5681
|
set: (C) => {
|
|
5683
5682
|
const A = i.value.zoom, m = x.value, y = {
|
|
@@ -5687,8 +5686,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5687
5686
|
height: Math.round((C.height - m.height) / A.y),
|
|
5688
5687
|
rotate: Math.round((C.rotate ?? 0) - (m.rotate ?? 0))
|
|
5689
5688
|
}, _ = w.value?.activeHandle ?? "move";
|
|
5690
|
-
a.value.forEach((
|
|
5691
|
-
const b =
|
|
5689
|
+
a.value.forEach((g) => {
|
|
5690
|
+
const b = g.style, T = {
|
|
5692
5691
|
left: b.left + y.left,
|
|
5693
5692
|
top: b.top + y.top,
|
|
5694
5693
|
width: b.width + y.width,
|
|
@@ -5696,16 +5695,16 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5696
5695
|
rotate: b.rotate + y.rotate
|
|
5697
5696
|
};
|
|
5698
5697
|
_.startsWith("rotate") || _.startsWith("resize") && (s(
|
|
5699
|
-
|
|
5700
|
-
T.width /
|
|
5701
|
-
T.height /
|
|
5702
|
-
k(
|
|
5703
|
-
), T.width =
|
|
5698
|
+
g,
|
|
5699
|
+
T.width / g.style.width,
|
|
5700
|
+
T.height / g.style.height,
|
|
5701
|
+
k(g) ? void 0 : _.split("-").length > 2 ? { deep: !0, textFontSizeToFit: !0 } : { deep: !0, textToFit: !0 }
|
|
5702
|
+
), T.width = g.style.width, T.height = g.style.height), Object.assign(b, T), g.updateGlobalTransform(), g.findAncestor((S) => (S instanceof G && !k(S) && r(S), !1));
|
|
5704
5703
|
});
|
|
5705
5704
|
}
|
|
5706
5705
|
});
|
|
5707
5706
|
function L() {
|
|
5708
|
-
const C = a.value.length === 1 ? a.value[0].style :
|
|
5707
|
+
const C = a.value.length === 1 ? a.value[0].style : u(a.value);
|
|
5709
5708
|
return `${Number(C.width.toFixed(2))} × ${Number(C.height.toFixed(2))}`;
|
|
5710
5709
|
}
|
|
5711
5710
|
return e({
|
|
@@ -5716,15 +5715,15 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5716
5715
|
class: "mce-parent-element-obb",
|
|
5717
5716
|
style: q({
|
|
5718
5717
|
borderColor: "currentColor",
|
|
5719
|
-
...
|
|
5718
|
+
...M(Me)(m)
|
|
5720
5719
|
})
|
|
5721
5720
|
}, null, 4))), 128)),
|
|
5722
|
-
|
|
5721
|
+
M(n) === "selecting" ? ($(), P("div", {
|
|
5723
5722
|
key: 0,
|
|
5724
5723
|
class: "mce-selected-area",
|
|
5725
5724
|
style: q({
|
|
5726
5725
|
borderColor: "currentcolor",
|
|
5727
|
-
...
|
|
5726
|
+
...M(Me)(t.selectedArea)
|
|
5728
5727
|
})
|
|
5729
5728
|
}, null, 4)) : Z("", !0),
|
|
5730
5729
|
($(!0), P(se, null, _e(p.value, (m, y) => ($(), P("div", {
|
|
@@ -5732,7 +5731,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5732
5731
|
class: "mce-element-obb",
|
|
5733
5732
|
style: q({
|
|
5734
5733
|
borderColor: "currentcolor",
|
|
5735
|
-
...
|
|
5734
|
+
...M(Me)(m.box)
|
|
5736
5735
|
})
|
|
5737
5736
|
}, null, 4))), 128)),
|
|
5738
5737
|
O.value.width && O.value.height ? ($(), oe(Ma, {
|
|
@@ -5740,15 +5739,15 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5740
5739
|
ref: "transformableRef",
|
|
5741
5740
|
modelValue: O.value,
|
|
5742
5741
|
"onUpdate:modelValue": A[0] || (A[0] = (m) => O.value = m),
|
|
5743
|
-
visibility:
|
|
5744
|
-
moveable:
|
|
5742
|
+
visibility: M(n) !== "selecting" ? "auto" : "none",
|
|
5743
|
+
moveable: M(a)[0] && !M(f)(M(a)[0]),
|
|
5745
5744
|
"resize-strategy": t.resizeStrategy,
|
|
5746
|
-
"handle-shape":
|
|
5745
|
+
"handle-shape": M(v).handleShape,
|
|
5747
5746
|
class: "mce-selection-obb",
|
|
5748
|
-
"border-style":
|
|
5747
|
+
"border-style": M(a).length > 1 ? "dashed" : "solid",
|
|
5749
5748
|
"tip-format": L,
|
|
5750
|
-
onMove: A[1] || (A[1] = () => !
|
|
5751
|
-
onEnd: A[2] || (A[2] = () =>
|
|
5749
|
+
onMove: A[1] || (A[1] = () => !M(n) && (n.value = "transforming")),
|
|
5750
|
+
onEnd: A[2] || (A[2] = () => M(n) === "transforming" && (n.value = void 0))
|
|
5752
5751
|
}, ht({ _: 2 }, [
|
|
5753
5752
|
C.$slots.transformable ? {
|
|
5754
5753
|
name: "svg",
|
|
@@ -5760,7 +5759,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5760
5759
|
]), 1032, ["modelValue", "visibility", "moveable", "resize-strategy", "handle-shape", "border-style"])) : Z("", !0),
|
|
5761
5760
|
O.value.width && O.value.height && C.$slots.default ? ($(), P("div", {
|
|
5762
5761
|
key: 2,
|
|
5763
|
-
style: q([{ position: "absolute" },
|
|
5762
|
+
style: q([{ position: "absolute" }, M(Me)(O.value)])
|
|
5764
5763
|
}, [
|
|
5765
5764
|
ee(C.$slots, "default", { box: O.value })
|
|
5766
5765
|
], 4)) : Z("", !0)
|
|
@@ -5782,17 +5781,17 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5782
5781
|
layoutStyles: s,
|
|
5783
5782
|
items: a,
|
|
5784
5783
|
getLayoutItem: i,
|
|
5785
|
-
layoutRef:
|
|
5784
|
+
layoutRef: r
|
|
5786
5785
|
} = Ks(t);
|
|
5787
5786
|
return e({
|
|
5788
5787
|
items: a,
|
|
5789
5788
|
getLayoutItem: i
|
|
5790
|
-
}), (
|
|
5791
|
-
ref:
|
|
5792
|
-
class: be([
|
|
5793
|
-
style: q([
|
|
5789
|
+
}), (c, u) => ($(), P("div", {
|
|
5790
|
+
ref: M(r),
|
|
5791
|
+
class: be([M(n)]),
|
|
5792
|
+
style: q([M(s)])
|
|
5794
5793
|
}, [
|
|
5795
|
-
ee(
|
|
5794
|
+
ee(c.$slots, "default")
|
|
5796
5795
|
], 6));
|
|
5797
5796
|
}
|
|
5798
5797
|
}), Ft = /* @__PURE__ */ X({
|
|
@@ -5823,7 +5822,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5823
5822
|
class: be(["mce-layout-item", [
|
|
5824
5823
|
`mce-layout-item--${e.position}`
|
|
5825
5824
|
]]),
|
|
5826
|
-
style: q([
|
|
5825
|
+
style: q([M(t)])
|
|
5827
5826
|
}, [
|
|
5828
5827
|
ee(n.$slots, "default")
|
|
5829
5828
|
], 6));
|
|
@@ -5842,7 +5841,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5842
5841
|
class: be(["mce-main", [
|
|
5843
5842
|
{ "mce-main--scrollable": e.scrollable }
|
|
5844
5843
|
]]),
|
|
5845
|
-
style: q([
|
|
5844
|
+
style: q([M(t)])
|
|
5846
5845
|
}, [
|
|
5847
5846
|
e.scrollable ? ($(), P("div", Ia, [
|
|
5848
5847
|
ee(n.$slots, "default")
|
|
@@ -5893,65 +5892,65 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5893
5892
|
exporting: s,
|
|
5894
5893
|
exportProgress: a
|
|
5895
5894
|
} = de();
|
|
5896
|
-
return (i,
|
|
5895
|
+
return (i, r) => ($(), P("div", Va, [
|
|
5897
5896
|
I("div", ja, [
|
|
5898
|
-
|
|
5897
|
+
M(e) === "typing" ? ($(), P(se, { key: 0 }, [
|
|
5899
5898
|
I("div", Ua, [
|
|
5900
|
-
I("span", Xa, K(
|
|
5901
|
-
I("span", Ha, K(
|
|
5899
|
+
I("span", Xa, K(M(n)("Command")), 1),
|
|
5900
|
+
I("span", Ha, K(M(n)("Enter")), 1)
|
|
5902
5901
|
]),
|
|
5903
|
-
|
|
5902
|
+
r[1] || (r[1] = I("span", null, "/", -1)),
|
|
5904
5903
|
I("div", Ya, [
|
|
5905
|
-
I("span", qa, K(
|
|
5906
|
-
I("span", null, K(
|
|
5904
|
+
I("span", qa, K(M(n)("Escape")), 1),
|
|
5905
|
+
I("span", null, K(M(t)("commitChanges")), 1)
|
|
5907
5906
|
])
|
|
5908
|
-
], 64)) :
|
|
5907
|
+
], 64)) : M(e) === "transforming" ? ($(), P(se, { key: 1 }, [
|
|
5909
5908
|
I("div", Ga, [
|
|
5910
5909
|
H(Ee, { icon: "$mouseRightClick" })
|
|
5911
5910
|
]),
|
|
5912
|
-
|
|
5911
|
+
r[2] || (r[2] = I("span", null, " / ", -1)),
|
|
5913
5912
|
I("div", Wa, [
|
|
5914
|
-
I("span", Ka, K(
|
|
5915
|
-
I("span", null, K(
|
|
5913
|
+
I("span", Ka, K(M(n)("Escape")), 1),
|
|
5914
|
+
I("span", null, K(M(t)("cancel")), 1)
|
|
5916
5915
|
]),
|
|
5917
|
-
|
|
5916
|
+
r[3] || (r[3] = I("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
5918
5917
|
I("div", Ja, [
|
|
5919
|
-
I("span", Za, K(
|
|
5920
|
-
I("span", null, K(
|
|
5918
|
+
I("span", Za, K(M(n)("Shift")), 1),
|
|
5919
|
+
I("span", null, K(M(t)("constrainToAxis")), 1)
|
|
5921
5920
|
])
|
|
5922
|
-
], 64)) :
|
|
5921
|
+
], 64)) : M(e) ? ($(), P("span", Qa, K(M(t)(M(e))), 1)) : ($(), P(se, { key: 3 }, [
|
|
5923
5922
|
I("div", ei, [
|
|
5924
5923
|
H(Ee, { icon: "$mouseLeftClick" }),
|
|
5925
|
-
I("span", null, K(
|
|
5924
|
+
I("span", null, K(M(t)("selectObject")), 1)
|
|
5926
5925
|
]),
|
|
5927
|
-
|
|
5926
|
+
r[4] || (r[4] = I("span", null, " + ", -1)),
|
|
5928
5927
|
I("div", ti, [
|
|
5929
|
-
I("span", ni, K(
|
|
5930
|
-
I("span", null, K(
|
|
5928
|
+
I("span", ni, K(M(n)("Shift")), 1),
|
|
5929
|
+
I("span", null, K(M(t)("extend")), 1)
|
|
5931
5930
|
]),
|
|
5932
|
-
|
|
5931
|
+
r[5] || (r[5] = I("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
5933
5932
|
I("div", oi, [
|
|
5934
5933
|
H(Ee, { icon: "$mouseLeftClick" }),
|
|
5935
|
-
I("span", null, K(
|
|
5934
|
+
I("span", null, K(M(t)("selectArea")), 1)
|
|
5936
5935
|
]),
|
|
5937
|
-
|
|
5936
|
+
r[6] || (r[6] = I("span", null, " + ", -1)),
|
|
5938
5937
|
I("div", si, [
|
|
5939
|
-
I("span", ai, K(
|
|
5940
|
-
I("span", null, K(
|
|
5938
|
+
I("span", ai, K(M(n)("Shift")), 1),
|
|
5939
|
+
I("span", null, K(M(t)("extend")), 1)
|
|
5941
5940
|
]),
|
|
5942
|
-
|
|
5941
|
+
r[7] || (r[7] = I("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
5943
5942
|
I("div", ii, [
|
|
5944
5943
|
H(Ee, { icon: "$mouseLeftClick" }),
|
|
5945
|
-
I("span", null, K(
|
|
5944
|
+
I("span", null, K(M(t)("dragSelected")), 1)
|
|
5946
5945
|
])
|
|
5947
5946
|
], 64))
|
|
5948
5947
|
]),
|
|
5949
5948
|
I("div", ri, [
|
|
5950
|
-
|
|
5949
|
+
M(s) ? ($(), oe(Da, {
|
|
5951
5950
|
key: 0,
|
|
5952
|
-
modelValue:
|
|
5953
|
-
"onUpdate:modelValue":
|
|
5954
|
-
label:
|
|
5951
|
+
modelValue: M(a),
|
|
5952
|
+
"onUpdate:modelValue": r[0] || (r[0] = (c) => wn(a) ? a.value = c : null),
|
|
5953
|
+
label: M(t)("exporting")
|
|
5955
5954
|
}, null, 8, ["modelValue", "label"])) : Z("", !0)
|
|
5956
5955
|
])
|
|
5957
5956
|
]));
|
|
@@ -5965,11 +5964,11 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5965
5964
|
textSelection: s,
|
|
5966
5965
|
textToFit: a,
|
|
5967
5966
|
getObb: i,
|
|
5968
|
-
registerCommand:
|
|
5969
|
-
unregisterCommand:
|
|
5970
|
-
camera:
|
|
5971
|
-
} = de(),
|
|
5972
|
-
const { zoom: d, position: p } =
|
|
5967
|
+
registerCommand: r,
|
|
5968
|
+
unregisterCommand: c,
|
|
5969
|
+
camera: u
|
|
5970
|
+
} = de(), l = V(), h = z(() => {
|
|
5971
|
+
const { zoom: d, position: p } = u.value;
|
|
5973
5972
|
return {
|
|
5974
5973
|
transformOrigin: "left top",
|
|
5975
5974
|
transform: `translate(${p.x}px, ${p.y}px) scale(${d.x}, ${d.y})`
|
|
@@ -5983,7 +5982,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5983
5982
|
function f(d) {
|
|
5984
5983
|
s.value = d.detail;
|
|
5985
5984
|
}
|
|
5986
|
-
function
|
|
5985
|
+
function v() {
|
|
5987
5986
|
const d = t.value[0], p = d.shape;
|
|
5988
5987
|
(!p.enabled || !p._path2DSet.paths.length) && a(d);
|
|
5989
5988
|
}
|
|
@@ -5992,11 +5991,11 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
5992
5991
|
if (!p)
|
|
5993
5992
|
return !1;
|
|
5994
5993
|
p.text.isValid() || p.text.setContent(" "), p.text.update(), n.value = "typing";
|
|
5995
|
-
const x =
|
|
5994
|
+
const x = l.value;
|
|
5996
5995
|
return x.set(p.text.base), await Xe(), x.pointerdown(d);
|
|
5997
5996
|
}
|
|
5998
|
-
return vt(() =>
|
|
5999
|
-
textEditor:
|
|
5997
|
+
return vt(() => r({ command: "startTyping", handle: w })), we(() => c("startTyping")), e({
|
|
5998
|
+
textEditor: l
|
|
6000
5999
|
}), (d, p) => ze(($(), P("div", {
|
|
6001
6000
|
class: "mce-text-editor",
|
|
6002
6001
|
style: q({
|
|
@@ -6011,18 +6010,18 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6011
6010
|
}, [
|
|
6012
6011
|
I("text-editor", {
|
|
6013
6012
|
ref_key: "textEditor",
|
|
6014
|
-
ref:
|
|
6013
|
+
ref: l,
|
|
6015
6014
|
class: "mce-text-editor__editor",
|
|
6016
6015
|
style: {
|
|
6017
6016
|
"--color": "var(--mce-theme-primary)"
|
|
6018
6017
|
},
|
|
6019
6018
|
"data-pointerdown_to_drawboard": "",
|
|
6020
6019
|
onSelected: f,
|
|
6021
|
-
onUpdate:
|
|
6020
|
+
onUpdate: v
|
|
6022
6021
|
}, null, 544)
|
|
6023
6022
|
], 4)
|
|
6024
6023
|
], 4)), [
|
|
6025
|
-
[Ue,
|
|
6024
|
+
[Ue, M(t)[0] && M(n) === "typing"]
|
|
6026
6025
|
]);
|
|
6027
6026
|
}
|
|
6028
6027
|
}), di = { class: "mce-payhead" }, mi = /* @__PURE__ */ X({
|
|
@@ -6099,7 +6098,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6099
6098
|
timeline: s,
|
|
6100
6099
|
endTime: a,
|
|
6101
6100
|
selection: i
|
|
6102
|
-
} = de(),
|
|
6101
|
+
} = de(), r = V(1e3 / 30), c = ce("rulerTpl"), u = V(!0), l = V([0, 0]), h = z(() => e.value.findAll((O) => !!(O instanceof G && O.children.some((L) => L instanceof In))));
|
|
6103
6102
|
function k(O) {
|
|
6104
6103
|
if (O.ctrlKey) {
|
|
6105
6104
|
if (!(O.wheelDeltaY ? Math.abs(Math.abs(O.wheelDeltaY) - Math.abs(3 * O.deltaY)) < 3 : O.deltaMode === 0)) {
|
|
@@ -6108,24 +6107,24 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6108
6107
|
t.value = Math.exp(y);
|
|
6109
6108
|
}
|
|
6110
6109
|
} else
|
|
6111
|
-
O.preventDefault(),
|
|
6112
|
-
Math.min(0,
|
|
6113
|
-
Math.min(0,
|
|
6110
|
+
O.preventDefault(), l.value = [
|
|
6111
|
+
Math.min(0, l.value[0] - O.deltaX),
|
|
6112
|
+
Math.min(0, l.value[1] - O.deltaY)
|
|
6114
6113
|
];
|
|
6115
6114
|
}
|
|
6116
6115
|
function f(O) {
|
|
6117
|
-
const L =
|
|
6116
|
+
const L = c.value?.box;
|
|
6118
6117
|
if (L) {
|
|
6119
|
-
n.value = (O.clientX - L.left +
|
|
6118
|
+
n.value = (O.clientX - L.left + l.value[0]) * t.value;
|
|
6120
6119
|
const C = (m) => {
|
|
6121
|
-
n.value = (m.clientX - L.left +
|
|
6120
|
+
n.value = (m.clientX - L.left + l.value[0]) * t.value;
|
|
6122
6121
|
}, A = () => {
|
|
6123
6122
|
window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", A);
|
|
6124
6123
|
};
|
|
6125
6124
|
window.addEventListener("mousemove", C), window.addEventListener("mouseup", A);
|
|
6126
6125
|
}
|
|
6127
6126
|
}
|
|
6128
|
-
function
|
|
6127
|
+
function v(O) {
|
|
6129
6128
|
if (O % 30 === 0) {
|
|
6130
6129
|
const L = Math.floor(O / 30 / 60), C = Math.floor(O / 30) % 60, A = String(L).padStart(2, "0"), m = String(C).padStart(2, "0");
|
|
6131
6130
|
return `${A}:${m}`;
|
|
@@ -6134,7 +6133,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6134
6133
|
}
|
|
6135
6134
|
let w;
|
|
6136
6135
|
function d() {
|
|
6137
|
-
|
|
6136
|
+
u.value = !1;
|
|
6138
6137
|
let O;
|
|
6139
6138
|
function L(C) {
|
|
6140
6139
|
O !== void 0 && C !== void 0 && s.value.addTime(C - O), O = C, w = requestAnimationFrame(L);
|
|
@@ -6142,10 +6141,10 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6142
6141
|
L();
|
|
6143
6142
|
}
|
|
6144
6143
|
function p() {
|
|
6145
|
-
|
|
6144
|
+
u.value = !0, w !== void 0 && (cancelAnimationFrame(w), w = void 0);
|
|
6146
6145
|
}
|
|
6147
6146
|
function x() {
|
|
6148
|
-
|
|
6147
|
+
u.value ? d() : p();
|
|
6149
6148
|
}
|
|
6150
6149
|
return we(p), (O, L) => ($(), P("div", {
|
|
6151
6150
|
class: "mce-timeline",
|
|
@@ -6158,7 +6157,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6158
6157
|
onClick: x
|
|
6159
6158
|
}, [
|
|
6160
6159
|
H(Ee, {
|
|
6161
|
-
icon:
|
|
6160
|
+
icon: u.value ? "$play" : "$pause"
|
|
6162
6161
|
}, null, 8, ["icon"])
|
|
6163
6162
|
])
|
|
6164
6163
|
]),
|
|
@@ -6167,7 +6166,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6167
6166
|
I("div", ki, [
|
|
6168
6167
|
I("div", {
|
|
6169
6168
|
style: q({
|
|
6170
|
-
transform: `translateY(${
|
|
6169
|
+
transform: `translateY(${l.value[1]}px)`
|
|
6171
6170
|
})
|
|
6172
6171
|
}, [
|
|
6173
6172
|
($(!0), P(se, null, _e(h.value, (C, A) => ($(), oe(bi, {
|
|
@@ -6186,27 +6185,27 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6186
6185
|
I("div", Ai, [
|
|
6187
6186
|
H(mt, {
|
|
6188
6187
|
ref: "rulerTpl",
|
|
6189
|
-
zoom: 1 /
|
|
6188
|
+
zoom: 1 / M(t) * r.value,
|
|
6190
6189
|
unit: 100,
|
|
6191
6190
|
"unit-fractions": [1, 3],
|
|
6192
6191
|
style: { position: "relative" },
|
|
6193
|
-
position:
|
|
6194
|
-
"label-format":
|
|
6192
|
+
position: l.value[0],
|
|
6193
|
+
"label-format": v
|
|
6195
6194
|
}, null, 8, ["zoom", "position"])
|
|
6196
6195
|
]),
|
|
6197
6196
|
I("div", Ti, [
|
|
6198
6197
|
I("div", {
|
|
6199
6198
|
style: q({
|
|
6200
|
-
width: `${
|
|
6201
|
-
transform: `translate(${
|
|
6199
|
+
width: `${M(a) / M(t)}px`,
|
|
6200
|
+
transform: `translate(${l.value[0]}px, ${l.value[1]}px)`
|
|
6202
6201
|
})
|
|
6203
6202
|
}, [
|
|
6204
6203
|
($(!0), P(se, null, _e(h.value, (C, A) => ($(), oe(gi, { key: A }, {
|
|
6205
6204
|
default: ne(() => [
|
|
6206
6205
|
H(vi, {
|
|
6207
6206
|
node: C,
|
|
6208
|
-
"ms-per-px":
|
|
6209
|
-
active:
|
|
6207
|
+
"ms-per-px": M(t),
|
|
6208
|
+
active: M(i).some((m) => m.equal(C)),
|
|
6210
6209
|
onMousedown: We((m) => i.value = [C], ["stop"])
|
|
6211
6210
|
}, null, 8, ["node", "ms-per-px", "active", "onMousedown"])
|
|
6212
6211
|
]),
|
|
@@ -6216,7 +6215,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6216
6215
|
]),
|
|
6217
6216
|
H(mi, {
|
|
6218
6217
|
style: q({
|
|
6219
|
-
transform: `translate(${
|
|
6218
|
+
transform: `translate(${l.value[0] + Math.ceil(M(n) / M(t))}px, 0px)`
|
|
6220
6219
|
})
|
|
6221
6220
|
}, null, 8, ["style"])
|
|
6222
6221
|
])
|
|
@@ -6248,14 +6247,14 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6248
6247
|
const {
|
|
6249
6248
|
config: a,
|
|
6250
6249
|
drawboardDom: i,
|
|
6251
|
-
renderEngine:
|
|
6252
|
-
camera:
|
|
6253
|
-
bindRenderCanvas:
|
|
6254
|
-
hoverElement:
|
|
6250
|
+
renderEngine: r,
|
|
6251
|
+
camera: c,
|
|
6252
|
+
bindRenderCanvas: u,
|
|
6253
|
+
hoverElement: l,
|
|
6255
6254
|
state: h,
|
|
6256
6255
|
setCursor: k,
|
|
6257
6256
|
isFrame: f,
|
|
6258
|
-
selectArea:
|
|
6257
|
+
selectArea: v,
|
|
6259
6258
|
exec: w,
|
|
6260
6259
|
isLock: d,
|
|
6261
6260
|
selection: p,
|
|
@@ -6267,15 +6266,15 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6267
6266
|
attach: z(() => C.value)
|
|
6268
6267
|
}), Vt(A, (E) => {
|
|
6269
6268
|
const { width: N, height: B } = E[0].contentRect;
|
|
6270
|
-
|
|
6269
|
+
r.value.resize(N, B);
|
|
6271
6270
|
}), vt(() => {
|
|
6272
|
-
|
|
6271
|
+
r.value.on("pointerdown", T), r.value.on("pointermove", S), r.value.on("pointerover", F);
|
|
6273
6272
|
}), He(() => {
|
|
6274
|
-
|
|
6273
|
+
u(A.value, i.value);
|
|
6275
6274
|
}), we(() => {
|
|
6276
|
-
|
|
6275
|
+
r.value.off("pointerdown", T), r.value.off("pointermove", S), r.value.off("pointerover", F);
|
|
6277
6276
|
});
|
|
6278
|
-
function
|
|
6277
|
+
function g(E) {
|
|
6279
6278
|
return f(E);
|
|
6280
6279
|
}
|
|
6281
6280
|
function b(E) {
|
|
@@ -6290,14 +6289,14 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6290
6289
|
element: j,
|
|
6291
6290
|
oldElement: D,
|
|
6292
6291
|
event: E,
|
|
6293
|
-
isExcluded:
|
|
6292
|
+
isExcluded: g
|
|
6294
6293
|
});
|
|
6295
6294
|
U && !(U instanceof G) ? (B = U.element, N = U.cursor) : B = U;
|
|
6296
6295
|
}
|
|
6297
|
-
|
|
6296
|
+
l.value = B, k(N);
|
|
6298
6297
|
}
|
|
6299
6298
|
function T(E) {
|
|
6300
|
-
if (E.srcElement !== i.value && E.srcElement.dataset?.pointerdown_to_drawboard === void 0 ||
|
|
6299
|
+
if (E.srcElement !== i.value && E.srcElement.dataset?.pointerdown_to_drawboard === void 0 || c.value.spaceKey || ![0, 2].includes(E.button))
|
|
6301
6300
|
return;
|
|
6302
6301
|
const N = p.value[0], B = E.target, j = { x: E.clientX, y: E.clientY };
|
|
6303
6302
|
let D = { ...j }, U = !1, W = !1, Q = [], he;
|
|
@@ -6311,7 +6310,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6311
6310
|
element: B,
|
|
6312
6311
|
oldElement: N,
|
|
6313
6312
|
event: E,
|
|
6314
|
-
isExcluded:
|
|
6313
|
+
isExcluded: g
|
|
6315
6314
|
});
|
|
6316
6315
|
te && !(te instanceof G) ? Q = te.element ? [te.element] : [] : Q = te ? [te] : [], p.value = Q;
|
|
6317
6316
|
}
|
|
@@ -6322,7 +6321,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6322
6321
|
element: B,
|
|
6323
6322
|
oldElement: N,
|
|
6324
6323
|
event: te,
|
|
6325
|
-
isExcluded:
|
|
6324
|
+
isExcluded: g
|
|
6326
6325
|
});
|
|
6327
6326
|
ie && !(ie instanceof G) ? Q = ie.element ? [ie.element] : [] : Q = ie ? [ie] : [], p.value = Q;
|
|
6328
6327
|
}
|
|
@@ -6332,7 +6331,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6332
6331
|
top: Math.min(j.y, D.y) - O.value.top,
|
|
6333
6332
|
width: Math.abs(j.x - D.x),
|
|
6334
6333
|
height: Math.abs(j.y - D.y)
|
|
6335
|
-
}, Q =
|
|
6334
|
+
}, Q = v(_.value);
|
|
6336
6335
|
}
|
|
6337
6336
|
function ve() {
|
|
6338
6337
|
const te = t.activeStrategy({
|
|
@@ -6366,15 +6365,15 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6366
6365
|
}
|
|
6367
6366
|
b(E);
|
|
6368
6367
|
}
|
|
6369
|
-
|
|
6368
|
+
r.value.off("pointermove", J), document.removeEventListener("pointermove", me), document.removeEventListener("pointerup", ue), W = !0;
|
|
6370
6369
|
}
|
|
6371
|
-
|
|
6370
|
+
r.value.on("pointermove", J), document.addEventListener("pointermove", me), document.addEventListener("pointerup", ue);
|
|
6372
6371
|
}
|
|
6373
|
-
function
|
|
6374
|
-
E.srcElement === i.value && (L.value = { x: E.clientX, y: E.clientY }, !(
|
|
6372
|
+
function S(E) {
|
|
6373
|
+
E.srcElement === i.value && (L.value = { x: E.clientX, y: E.clientY }, !(c.value.grabbing || E.button === 1 || h.value && h.value !== "typing") && b(E));
|
|
6375
6374
|
}
|
|
6376
6375
|
function F() {
|
|
6377
|
-
L.value = void 0,
|
|
6376
|
+
L.value = void 0, l.value = void 0, k(void 0);
|
|
6378
6377
|
}
|
|
6379
6378
|
function R() {
|
|
6380
6379
|
i.value && (i.value.scrollLeft && (i.value.scrollLeft = 0), i.value.scrollTop && (i.value.scrollTop = 0));
|
|
@@ -6388,7 +6387,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6388
6387
|
ref_key: "drawboardDom",
|
|
6389
6388
|
ref: i,
|
|
6390
6389
|
class: "mce-editor__drawboard",
|
|
6391
|
-
"data-pixel-ratio":
|
|
6390
|
+
"data-pixel-ratio": M(r).pixelRatio,
|
|
6392
6391
|
onDblclick: N[0] || (N[0] = (B) => n("dblclick:drawboard", B)),
|
|
6393
6392
|
onScroll: R,
|
|
6394
6393
|
onWheel: N[1] || (N[1] = We(() => {
|
|
@@ -6403,7 +6402,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6403
6402
|
H(za, {
|
|
6404
6403
|
ref: "selectorTpl",
|
|
6405
6404
|
"selected-area": _.value,
|
|
6406
|
-
"resize-strategy":
|
|
6405
|
+
"resize-strategy": M(p)[0] ? t.resizeStrategy(M(p)[0]) : void 0
|
|
6407
6406
|
}, {
|
|
6408
6407
|
transformable: ne(({ box: B }) => [
|
|
6409
6408
|
ee(E.$slots, "transformer", { box: B })
|
|
@@ -6413,10 +6412,10 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6413
6412
|
]),
|
|
6414
6413
|
_: 3
|
|
6415
6414
|
}, 8, ["selected-area", "resize-strategy"]),
|
|
6416
|
-
|
|
6415
|
+
M(a).scrollbar ? ($(), oe(_a, { key: 0 })) : Z("", !0),
|
|
6417
6416
|
E.$slots.floatbar ? ($(), oe(la, {
|
|
6418
6417
|
key: 1,
|
|
6419
|
-
target:
|
|
6418
|
+
target: M(h) === "typing" ? y.value?.textEditor : m.value?.transformable?.$el
|
|
6420
6419
|
}, {
|
|
6421
6420
|
default: ne(() => [
|
|
6422
6421
|
ee(E.$slots, "floatbar")
|
|
@@ -6425,7 +6424,7 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6425
6424
|
}, 8, ["target"])) : Z("", !0),
|
|
6426
6425
|
H(aa),
|
|
6427
6426
|
H(da),
|
|
6428
|
-
|
|
6427
|
+
M(a).ruler ? ($(), oe(ba, { key: 2 })) : Z("", !0),
|
|
6429
6428
|
ee(E.$slots, "drawboard")
|
|
6430
6429
|
], 40, Mi)
|
|
6431
6430
|
]),
|
|
@@ -6433,8 +6432,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6433
6432
|
}),
|
|
6434
6433
|
ee(E.$slots, "default"),
|
|
6435
6434
|
H(Ft, {
|
|
6436
|
-
modelValue:
|
|
6437
|
-
"onUpdate:modelValue": N[2] || (N[2] = (B) =>
|
|
6435
|
+
modelValue: M(a).statusbar,
|
|
6436
|
+
"onUpdate:modelValue": N[2] || (N[2] = (B) => M(a).statusbar = B),
|
|
6438
6437
|
position: "bottom",
|
|
6439
6438
|
size: 24
|
|
6440
6439
|
}, {
|
|
@@ -6444,8 +6443,8 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6444
6443
|
_: 1
|
|
6445
6444
|
}, 8, ["modelValue"]),
|
|
6446
6445
|
H(Ft, {
|
|
6447
|
-
modelValue:
|
|
6448
|
-
"onUpdate:modelValue": N[3] || (N[3] = (B) =>
|
|
6446
|
+
modelValue: M(a).timeline,
|
|
6447
|
+
"onUpdate:modelValue": N[3] || (N[3] = (B) => M(a).timeline = B),
|
|
6449
6448
|
position: "bottom",
|
|
6450
6449
|
size: 160
|
|
6451
6450
|
}, {
|
|
@@ -6478,23 +6477,23 @@ const Ot = Symbol.for("MceMenuSymbol"), Ee = /* @__PURE__ */ X({
|
|
|
6478
6477
|
return e({
|
|
6479
6478
|
isActive: n,
|
|
6480
6479
|
updateLocation: i
|
|
6481
|
-
}), (
|
|
6480
|
+
}), (r, c) => ($(), oe(tt, {
|
|
6482
6481
|
ref: "overlayTpl",
|
|
6483
6482
|
modelValue: n.value,
|
|
6484
|
-
"onUpdate:modelValue":
|
|
6483
|
+
"onUpdate:modelValue": c[0] || (c[0] = (u) => n.value = u),
|
|
6485
6484
|
location: t.location,
|
|
6486
6485
|
offset: t.offset,
|
|
6487
6486
|
target: t.target,
|
|
6488
6487
|
attach: t.attach,
|
|
6489
6488
|
class: "mce-dialog"
|
|
6490
6489
|
}, {
|
|
6491
|
-
activator: ne((
|
|
6492
|
-
ee(
|
|
6493
|
-
props: { ...
|
|
6490
|
+
activator: ne((u) => [
|
|
6491
|
+
ee(r.$slots, "activator", Oe(u, {
|
|
6492
|
+
props: { ...u.props, ...a.value }
|
|
6494
6493
|
}))
|
|
6495
6494
|
]),
|
|
6496
6495
|
default: ne(() => [
|
|
6497
|
-
ee(
|
|
6496
|
+
ee(r.$slots, "default")
|
|
6498
6497
|
]),
|
|
6499
6498
|
_: 3
|
|
6500
6499
|
}, 8, ["modelValue", "location", "offset", "target", "attach"]));
|