mce 0.15.24 → 0.15.26
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/components/Floatbar.vue.d.ts +7 -9
- package/dist/components/Selector.vue.d.ts +33 -31
- package/dist/components/shared/Dialog.vue.d.ts +4 -0
- package/dist/components/shared/Menu.vue.d.ts +6 -0
- package/dist/components/shared/Overlay.vue.d.ts +4 -0
- package/dist/components/shared/Tooltip.vue.d.ts +4 -0
- package/dist/components/shared/{Transformable.vue.d.ts → TransformControls.vue.d.ts} +4 -4
- package/dist/composables/icons.d.ts +20 -0
- package/dist/composables/layer.d.ts +2 -0
- package/dist/composables/overlay.d.ts +11 -1
- package/dist/index.css +64 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.js +701 -403
- package/dist/mixins/0.config/base.d.ts +8 -4
- package/dist/mixins/1.screen.d.ts +2 -1
- package/dist/mixins/scroll.d.ts +4 -0
- package/dist/mixins/zoom.d.ts +1 -1
- package/dist/plugins/transform.d.ts +6 -0
- package/dist/plugins/ui.d.ts +13 -7
- package/dist/plugins/zoom.d.ts +0 -4
- package/dist/typed-plugins.d.ts +0 -1
- package/dist/utils/helper.d.ts +1 -0
- package/package.json +1 -1
- package/dist/plugins/enter.d.ts +0 -12
package/dist/index.js
CHANGED
|
@@ -123,7 +123,7 @@ const _0_config_base = defineMixin((editor, options) => {
|
|
|
123
123
|
registerConfig("frameOutline", false);
|
|
124
124
|
registerConfig("frameGap", 48);
|
|
125
125
|
registerConfig("typographyStrategy", "autoHeight");
|
|
126
|
-
registerConfig("
|
|
126
|
+
registerConfig("transformControls", {});
|
|
127
127
|
registerConfig("screenCenterOffset", { left: 0, top: 0, bottom: 0, right: 0 });
|
|
128
128
|
registerConfig("localDb", false);
|
|
129
129
|
return () => {
|
|
@@ -1515,6 +1515,14 @@ function findChildrenWithProvide(key, vnode) {
|
|
|
1515
1515
|
}
|
|
1516
1516
|
return [];
|
|
1517
1517
|
}
|
|
1518
|
+
function isInputElement(target) {
|
|
1519
|
+
const { tagName } = target;
|
|
1520
|
+
const isInput = tagName === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(target.type);
|
|
1521
|
+
if (target.isContentEditable || (isInput || tagName === "TEXTAREA" || tagName === "SELECT") && !target.readOnly) {
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
1524
|
+
return false;
|
|
1525
|
+
}
|
|
1518
1526
|
function isInputEvent(event) {
|
|
1519
1527
|
if (!event)
|
|
1520
1528
|
return false;
|
|
@@ -1522,10 +1530,8 @@ function isInputEvent(event) {
|
|
|
1522
1530
|
if (!path && event.composedPath)
|
|
1523
1531
|
path = event.composedPath();
|
|
1524
1532
|
if (!path)
|
|
1525
|
-
return
|
|
1526
|
-
return path?.some(
|
|
1527
|
-
(el) => ["INPUT", "TEXTAREA", "SELECT"].includes(el?.tagName) || el?.contentEditable === "true"
|
|
1528
|
-
);
|
|
1533
|
+
return isInputElement(event.target || event.srcElement);
|
|
1534
|
+
return path?.some((el) => isInputElement(el));
|
|
1529
1535
|
}
|
|
1530
1536
|
function toKebabCase$1(str = "") {
|
|
1531
1537
|
if (toKebabCase$1.cache.has(str))
|
|
@@ -1561,6 +1567,146 @@ const uuidv4Template = "10000000-1000-4000-8000" + -1e11;
|
|
|
1561
1567
|
function uuidv4() {
|
|
1562
1568
|
return uuidv4Template.replace(/[018]/g, (c) => (c ^ uint32() & 15 >> c / 4).toString(16));
|
|
1563
1569
|
}
|
|
1570
|
+
const isff = typeof navigator !== "undefined" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : false;
|
|
1571
|
+
const _keyMap = {
|
|
1572
|
+
"backspace": 8,
|
|
1573
|
+
"⌫": 8,
|
|
1574
|
+
"tab": 9,
|
|
1575
|
+
"clear": 12,
|
|
1576
|
+
"enter": 13,
|
|
1577
|
+
"↩": 13,
|
|
1578
|
+
"return": 13,
|
|
1579
|
+
"esc": 27,
|
|
1580
|
+
"escape": 27,
|
|
1581
|
+
"space": 32,
|
|
1582
|
+
"left": 37,
|
|
1583
|
+
"up": 38,
|
|
1584
|
+
"right": 39,
|
|
1585
|
+
"down": 40,
|
|
1586
|
+
/// https://w3c.github.io/uievents/#events-keyboard-key-location
|
|
1587
|
+
"arrowup": 38,
|
|
1588
|
+
"arrowdown": 40,
|
|
1589
|
+
"arrowleft": 37,
|
|
1590
|
+
"arrowright": 39,
|
|
1591
|
+
"del": 46,
|
|
1592
|
+
"delete": 46,
|
|
1593
|
+
"ins": 45,
|
|
1594
|
+
"insert": 45,
|
|
1595
|
+
"home": 36,
|
|
1596
|
+
"end": 35,
|
|
1597
|
+
"pageup": 33,
|
|
1598
|
+
"pagedown": 34,
|
|
1599
|
+
"capslock": 20,
|
|
1600
|
+
"num_0": 96,
|
|
1601
|
+
"num_1": 97,
|
|
1602
|
+
"num_2": 98,
|
|
1603
|
+
"num_3": 99,
|
|
1604
|
+
"num_4": 100,
|
|
1605
|
+
"num_5": 101,
|
|
1606
|
+
"num_6": 102,
|
|
1607
|
+
"num_7": 103,
|
|
1608
|
+
"num_8": 104,
|
|
1609
|
+
"num_9": 105,
|
|
1610
|
+
"num_multiply": 106,
|
|
1611
|
+
"num_add": 107,
|
|
1612
|
+
"num_enter": 108,
|
|
1613
|
+
"num_subtract": 109,
|
|
1614
|
+
"num_decimal": 110,
|
|
1615
|
+
"num_divide": 111,
|
|
1616
|
+
"⇪": 20,
|
|
1617
|
+
",": 188,
|
|
1618
|
+
".": 190,
|
|
1619
|
+
"/": 191,
|
|
1620
|
+
"`": 192,
|
|
1621
|
+
"-": isff ? 173 : 189,
|
|
1622
|
+
"=": isff ? 61 : 187,
|
|
1623
|
+
";": isff ? 59 : 186,
|
|
1624
|
+
"'": 222,
|
|
1625
|
+
"{": 219,
|
|
1626
|
+
"}": 221,
|
|
1627
|
+
"[": 219,
|
|
1628
|
+
"]": 221,
|
|
1629
|
+
"\\": 220
|
|
1630
|
+
};
|
|
1631
|
+
const _modifier = {
|
|
1632
|
+
// shiftKey
|
|
1633
|
+
"⇧": 16,
|
|
1634
|
+
"shift": 16,
|
|
1635
|
+
// altKey
|
|
1636
|
+
"⌥": 18,
|
|
1637
|
+
"alt": 18,
|
|
1638
|
+
"option": 18,
|
|
1639
|
+
// ctrlKey
|
|
1640
|
+
"⌃": 17,
|
|
1641
|
+
"ctrl": 17,
|
|
1642
|
+
"control": 17,
|
|
1643
|
+
// metaKey
|
|
1644
|
+
"⌘": 91,
|
|
1645
|
+
"cmd": 91,
|
|
1646
|
+
"meta": 91,
|
|
1647
|
+
"command": 91
|
|
1648
|
+
};
|
|
1649
|
+
const kbdMap = {
|
|
1650
|
+
ArrowUp: "↑",
|
|
1651
|
+
ArrowDown: "↓",
|
|
1652
|
+
ArrowLeft: "←",
|
|
1653
|
+
ArrowRight: "→",
|
|
1654
|
+
Slash: "/",
|
|
1655
|
+
Semicolon: ";",
|
|
1656
|
+
BracketLeft: "[",
|
|
1657
|
+
BracketRight: "]",
|
|
1658
|
+
Backslash: "\\",
|
|
1659
|
+
Quote: "'",
|
|
1660
|
+
Comma: ",",
|
|
1661
|
+
Minus: "-",
|
|
1662
|
+
Equal: "=",
|
|
1663
|
+
Backspace: "⌫",
|
|
1664
|
+
Enter: "⏎",
|
|
1665
|
+
Escape: "Esc",
|
|
1666
|
+
Dead: "N"
|
|
1667
|
+
};
|
|
1668
|
+
function getCharCode(x) {
|
|
1669
|
+
let code = _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
|
|
1670
|
+
if (code === 93 || code === 224) {
|
|
1671
|
+
code = 91;
|
|
1672
|
+
}
|
|
1673
|
+
if (code === 229) {
|
|
1674
|
+
return 0;
|
|
1675
|
+
}
|
|
1676
|
+
return code;
|
|
1677
|
+
}
|
|
1678
|
+
function parseKey(key) {
|
|
1679
|
+
return key.split("+").map((v) => {
|
|
1680
|
+
switch (v) {
|
|
1681
|
+
case "Meta":
|
|
1682
|
+
case "Control":
|
|
1683
|
+
case "CommandOrControl":
|
|
1684
|
+
return "CmdOrCtrl";
|
|
1685
|
+
case "Alt":
|
|
1686
|
+
case "Shift":
|
|
1687
|
+
case "CmdOrCtrl":
|
|
1688
|
+
return v;
|
|
1689
|
+
default:
|
|
1690
|
+
return String.fromCharCode(getCharCode(v));
|
|
1691
|
+
}
|
|
1692
|
+
}).filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
|
|
1693
|
+
}
|
|
1694
|
+
function parseKeyboardEvent(event) {
|
|
1695
|
+
if (event.key.toLowerCase() === "capslock") {
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
const { code } = event;
|
|
1699
|
+
let key = event.keyCode || event.which || event.charCode;
|
|
1700
|
+
if (code && /^Key[A-Z]$/.test(code)) {
|
|
1701
|
+
key = code.charCodeAt(3);
|
|
1702
|
+
}
|
|
1703
|
+
return [
|
|
1704
|
+
(event.metaKey || event.ctrlKey) && "CmdOrCtrl",
|
|
1705
|
+
event.altKey && "Alt",
|
|
1706
|
+
event.shiftKey && "Shift",
|
|
1707
|
+
!["Meta", "Control", "Alt", "Shift"].includes(event.key) && String.fromCharCode(key)
|
|
1708
|
+
].filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
|
|
1709
|
+
}
|
|
1564
1710
|
const _1_hotkey = defineMixin((editor) => {
|
|
1565
1711
|
const {
|
|
1566
1712
|
registerConfig
|
|
@@ -1589,29 +1735,6 @@ const _1_hotkey = defineMixin((editor) => {
|
|
|
1589
1735
|
function unregisterHotkey(command) {
|
|
1590
1736
|
hotkeysData.value = hotkeysData.value.filter((v) => v.command !== command);
|
|
1591
1737
|
}
|
|
1592
|
-
const kbdMap = {
|
|
1593
|
-
"ArrowUp": "↑",
|
|
1594
|
-
"ArrowDown": "↓",
|
|
1595
|
-
"ArrowLeft": "←",
|
|
1596
|
-
"ArrowRight": "→",
|
|
1597
|
-
"Slash": "/",
|
|
1598
|
-
"Semicolon": ";",
|
|
1599
|
-
"BracketLeft": "[",
|
|
1600
|
-
"BracketRight": "]",
|
|
1601
|
-
"Backslash": "\\",
|
|
1602
|
-
"Quote": "'",
|
|
1603
|
-
"Comma": ",",
|
|
1604
|
-
"Minus": "-",
|
|
1605
|
-
"Equal": "=",
|
|
1606
|
-
"Backspace": "⌫",
|
|
1607
|
-
"Enter": "⏎",
|
|
1608
|
-
"Escape": "Esc",
|
|
1609
|
-
"=": "+",
|
|
1610
|
-
"º": "0",
|
|
1611
|
-
"¡": "1",
|
|
1612
|
-
"™": "2",
|
|
1613
|
-
"Dead": "N"
|
|
1614
|
-
};
|
|
1615
1738
|
function getKbd(command) {
|
|
1616
1739
|
if (!command) {
|
|
1617
1740
|
return "";
|
|
@@ -1661,30 +1784,17 @@ const _1_hotkey = defineMixin((editor) => {
|
|
|
1661
1784
|
if (isInputEvent(e)) {
|
|
1662
1785
|
return;
|
|
1663
1786
|
}
|
|
1664
|
-
const eKey =
|
|
1665
|
-
(e.metaKey || e.ctrlKey) && "CmdOrCtrl",
|
|
1666
|
-
e.altKey && "Alt",
|
|
1667
|
-
e.shiftKey && "Shift",
|
|
1668
|
-
!["Meta", "Control", "Alt", "Shift"].includes(e.key) && e.key
|
|
1669
|
-
].filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
|
|
1787
|
+
const eKey = parseKeyboardEvent(e);
|
|
1670
1788
|
hotkeysData.value.forEach((hotkeyData) => {
|
|
1671
1789
|
const command = hotkeyData.command;
|
|
1672
1790
|
const hotkey = hotkeys.get(command);
|
|
1673
1791
|
const keys = Array.isArray(hotkeyData.key) ? hotkeyData.key : [hotkeyData.key];
|
|
1674
1792
|
keys.forEach((key) => {
|
|
1675
|
-
const tKey = key
|
|
1676
|
-
switch (v) {
|
|
1677
|
-
case "Meta":
|
|
1678
|
-
case "Control":
|
|
1679
|
-
case "CommandOrControl":
|
|
1680
|
-
return "CmdOrCtrl";
|
|
1681
|
-
default:
|
|
1682
|
-
return v;
|
|
1683
|
-
}
|
|
1684
|
-
}).filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
|
|
1793
|
+
const tKey = parseKey(key);
|
|
1685
1794
|
if (eKey === tKey && (!hotkey?.when || hotkey.when(e))) {
|
|
1686
1795
|
if (hotkey?.preventDefault !== false) {
|
|
1687
1796
|
e.preventDefault();
|
|
1797
|
+
e.stopPropagation();
|
|
1688
1798
|
}
|
|
1689
1799
|
if (hotkey?.handle) {
|
|
1690
1800
|
hotkey.handle(e);
|
|
@@ -1705,22 +1815,36 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1705
1815
|
config,
|
|
1706
1816
|
drawboardAabb
|
|
1707
1817
|
} = editor;
|
|
1708
|
-
const
|
|
1818
|
+
const screenControlsOffset = computed(() => {
|
|
1709
1819
|
const offset2 = {
|
|
1710
1820
|
left: 0,
|
|
1711
1821
|
top: 0,
|
|
1712
1822
|
bottom: 0,
|
|
1713
|
-
right: 0
|
|
1714
|
-
...config.value.screenCenterOffset
|
|
1823
|
+
right: 0
|
|
1715
1824
|
};
|
|
1716
|
-
if (config.value.scrollbar) {
|
|
1717
|
-
offset2.right += 8;
|
|
1718
|
-
offset2.bottom += 8;
|
|
1719
|
-
}
|
|
1720
1825
|
if (config.value.ruler) {
|
|
1721
1826
|
offset2.left += 16;
|
|
1722
1827
|
offset2.top += 16;
|
|
1723
1828
|
}
|
|
1829
|
+
if (config.value.scrollbar) {
|
|
1830
|
+
offset2.right += 8;
|
|
1831
|
+
offset2.bottom += 8;
|
|
1832
|
+
}
|
|
1833
|
+
return offset2;
|
|
1834
|
+
});
|
|
1835
|
+
const screenCenterOffset = computed(() => {
|
|
1836
|
+
const _screenControlsOffset = screenControlsOffset.value;
|
|
1837
|
+
const offset2 = {
|
|
1838
|
+
left: 0,
|
|
1839
|
+
top: 0,
|
|
1840
|
+
bottom: 0,
|
|
1841
|
+
right: 0,
|
|
1842
|
+
...config.value.screenCenterOffset
|
|
1843
|
+
};
|
|
1844
|
+
offset2.left += _screenControlsOffset.left;
|
|
1845
|
+
offset2.top += _screenControlsOffset.top;
|
|
1846
|
+
offset2.right += _screenControlsOffset.right;
|
|
1847
|
+
offset2.bottom += _screenControlsOffset.bottom;
|
|
1724
1848
|
return offset2;
|
|
1725
1849
|
});
|
|
1726
1850
|
const screenCenter = computed(() => {
|
|
@@ -1731,6 +1855,7 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1731
1855
|
};
|
|
1732
1856
|
});
|
|
1733
1857
|
Object.assign(editor, {
|
|
1858
|
+
screenControlsOffset,
|
|
1734
1859
|
screenCenterOffset,
|
|
1735
1860
|
screenCenter
|
|
1736
1861
|
});
|
|
@@ -1827,7 +1952,8 @@ const _2_box = defineMixin((editor) => {
|
|
|
1827
1952
|
root,
|
|
1828
1953
|
selection,
|
|
1829
1954
|
getAncestorFrame,
|
|
1830
|
-
drawboardAabb
|
|
1955
|
+
drawboardAabb,
|
|
1956
|
+
screenControlsOffset
|
|
1831
1957
|
} = editor;
|
|
1832
1958
|
function obbToFit(element) {
|
|
1833
1959
|
const min = {
|
|
@@ -2010,15 +2136,18 @@ const _2_box = defineMixin((editor) => {
|
|
|
2010
2136
|
return _aabb;
|
|
2011
2137
|
}
|
|
2012
2138
|
const viewportAabb = computed(() => {
|
|
2139
|
+
const _camera = camera.value;
|
|
2140
|
+
const { position, zoom } = _camera;
|
|
2013
2141
|
noop(
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2142
|
+
position.x,
|
|
2143
|
+
position.y,
|
|
2144
|
+
zoom.x,
|
|
2145
|
+
zoom.y
|
|
2018
2146
|
);
|
|
2147
|
+
const { left, top, right, bottom } = screenControlsOffset.value;
|
|
2019
2148
|
const { width, height } = drawboardAabb.value;
|
|
2020
|
-
const p1 =
|
|
2021
|
-
const p2 =
|
|
2149
|
+
const p1 = _camera.toGlobal({ x: left, y: top });
|
|
2150
|
+
const p2 = _camera.toGlobal({ x: width - (right + left), y: height - (bottom + top) });
|
|
2022
2151
|
return new Aabb2D({
|
|
2023
2152
|
x: p1.x,
|
|
2024
2153
|
y: p1.y,
|
|
@@ -3391,6 +3520,49 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3391
3520
|
findFrame,
|
|
3392
3521
|
handleDragOutReparent
|
|
3393
3522
|
});
|
|
3523
|
+
return () => {
|
|
3524
|
+
const {
|
|
3525
|
+
on,
|
|
3526
|
+
getGlobalPointer
|
|
3527
|
+
} = editor;
|
|
3528
|
+
const startContext = ref({});
|
|
3529
|
+
on("selectionTransformStart", ({ elements }) => {
|
|
3530
|
+
const ctx = {};
|
|
3531
|
+
elements.forEach((el) => {
|
|
3532
|
+
ctx[el.instanceId] = {
|
|
3533
|
+
parent: el.getParent(),
|
|
3534
|
+
index: el.getIndex()
|
|
3535
|
+
};
|
|
3536
|
+
});
|
|
3537
|
+
startContext.value = ctx;
|
|
3538
|
+
});
|
|
3539
|
+
on("selectionTransforming", ({ handle, startEvent, elements }) => {
|
|
3540
|
+
if (handle === "move" && !startEvent?.__FROM__) {
|
|
3541
|
+
const idSet = /* @__PURE__ */ new Set();
|
|
3542
|
+
elements.forEach((el) => {
|
|
3543
|
+
if (isTopFrame(el)) {
|
|
3544
|
+
idSet.add(el.instanceId);
|
|
3545
|
+
} else {
|
|
3546
|
+
idSet.add(el.findAncestor(isTopFrame)?.instanceId ?? 0);
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3549
|
+
if (idSet.size === 1) {
|
|
3550
|
+
elements.forEach((element) => {
|
|
3551
|
+
handleDragOutReparent(
|
|
3552
|
+
element,
|
|
3553
|
+
{
|
|
3554
|
+
...startContext.value[element.instanceId],
|
|
3555
|
+
pointer: getGlobalPointer()
|
|
3556
|
+
}
|
|
3557
|
+
);
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
});
|
|
3562
|
+
on("selectionTransformEnd", () => {
|
|
3563
|
+
startContext.value = {};
|
|
3564
|
+
});
|
|
3565
|
+
};
|
|
3394
3566
|
});
|
|
3395
3567
|
const _4_3_element = defineMixin((editor) => {
|
|
3396
3568
|
const {
|
|
@@ -3771,7 +3943,8 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3771
3943
|
selectionAabb,
|
|
3772
3944
|
rootAabb,
|
|
3773
3945
|
viewportAabb,
|
|
3774
|
-
screenCenter
|
|
3946
|
+
screenCenter,
|
|
3947
|
+
screenCenterOffset
|
|
3775
3948
|
} = editor;
|
|
3776
3949
|
const scrollTo = async (target, options = {}) => {
|
|
3777
3950
|
const {
|
|
@@ -3780,12 +3953,20 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3780
3953
|
duration = 500
|
|
3781
3954
|
} = options;
|
|
3782
3955
|
const _camera = camera.value;
|
|
3956
|
+
const { position: _position, zoom } = _camera;
|
|
3957
|
+
const oldPosition = { x: _position.x, y: _position.y };
|
|
3783
3958
|
const _screenCenter = screenCenter.value;
|
|
3784
3959
|
const offset2 = { x: 0, y: 0 };
|
|
3785
|
-
let
|
|
3786
|
-
if (typeof target === "object"
|
|
3787
|
-
|
|
3788
|
-
|
|
3960
|
+
let targetPosition = {};
|
|
3961
|
+
if (typeof target === "object") {
|
|
3962
|
+
if ("x" in target) {
|
|
3963
|
+
targetPosition.x = target.x;
|
|
3964
|
+
offset2.x = -screenCenterOffset.value.left;
|
|
3965
|
+
}
|
|
3966
|
+
if ("y" in target) {
|
|
3967
|
+
targetPosition.y = target.y;
|
|
3968
|
+
offset2.y = -screenCenterOffset.value.top;
|
|
3969
|
+
}
|
|
3789
3970
|
} else {
|
|
3790
3971
|
let aabb;
|
|
3791
3972
|
if (Array.isArray(target)) {
|
|
@@ -3804,15 +3985,22 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3804
3985
|
if (intoView && viewportAabb.value.contains(aabb)) {
|
|
3805
3986
|
return;
|
|
3806
3987
|
}
|
|
3807
|
-
|
|
3988
|
+
targetPosition = { x: aabb.left + aabb.width / 2, y: aabb.top + aabb.height / 2 };
|
|
3808
3989
|
offset2.x += -_screenCenter.x;
|
|
3809
3990
|
offset2.y = -_screenCenter.y;
|
|
3810
3991
|
}
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3992
|
+
if (targetPosition.x !== void 0) {
|
|
3993
|
+
targetPosition.x *= zoom.x;
|
|
3994
|
+
targetPosition.x += offset2.x;
|
|
3995
|
+
}
|
|
3996
|
+
if (targetPosition.y !== void 0) {
|
|
3997
|
+
targetPosition.y *= zoom.y;
|
|
3998
|
+
targetPosition.y += offset2.y;
|
|
3999
|
+
}
|
|
4000
|
+
const position = {
|
|
4001
|
+
...oldPosition,
|
|
4002
|
+
...targetPosition
|
|
4003
|
+
};
|
|
3816
4004
|
switch (behavior) {
|
|
3817
4005
|
case "smooth":
|
|
3818
4006
|
await new Promise((resolve) => {
|
|
@@ -3825,7 +4013,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3825
4013
|
const elapsed = now - startTime;
|
|
3826
4014
|
const progress = Math.min(elapsed / duration, 1);
|
|
3827
4015
|
const ease = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
|
|
3828
|
-
|
|
4016
|
+
_position.set(
|
|
3829
4017
|
oldPosition.x + positionDistance.x * ease,
|
|
3830
4018
|
oldPosition.y + positionDistance.y * ease
|
|
3831
4019
|
);
|
|
@@ -3840,7 +4028,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3840
4028
|
break;
|
|
3841
4029
|
case "instant":
|
|
3842
4030
|
default:
|
|
3843
|
-
|
|
4031
|
+
_position.set(position.x, position.y);
|
|
3844
4032
|
break;
|
|
3845
4033
|
}
|
|
3846
4034
|
};
|
|
@@ -3978,10 +4166,7 @@ const _zoom$1 = defineMixin((editor) => {
|
|
|
3978
4166
|
const { width, height } = drawboardAabb.value;
|
|
3979
4167
|
const tw = width - (offset2.left + offset2.right);
|
|
3980
4168
|
const th = height - (offset2.top + offset2.bottom);
|
|
3981
|
-
const sx = aabb.
|
|
3982
|
-
const sy = aabb.top;
|
|
3983
|
-
const sw = aabb.width;
|
|
3984
|
-
const sh = aabb.height;
|
|
4169
|
+
const [sx, sy, sw, sh] = aabb.toArray();
|
|
3985
4170
|
if (!sw || !sh)
|
|
3986
4171
|
return;
|
|
3987
4172
|
const zw = tw / sw;
|
|
@@ -3990,10 +4175,22 @@ const _zoom$1 = defineMixin((editor) => {
|
|
|
3990
4175
|
let targetZoom;
|
|
3991
4176
|
if (typeof target === "number") {
|
|
3992
4177
|
targetZoom = target;
|
|
3993
|
-
} else if (mode === "cover") {
|
|
3994
|
-
targetZoom = Math.max(zw, zh);
|
|
3995
4178
|
} else {
|
|
3996
|
-
|
|
4179
|
+
switch (mode) {
|
|
4180
|
+
case "width":
|
|
4181
|
+
targetZoom = zw;
|
|
4182
|
+
break;
|
|
4183
|
+
case "height":
|
|
4184
|
+
targetZoom = zh;
|
|
4185
|
+
break;
|
|
4186
|
+
case "cover":
|
|
4187
|
+
targetZoom = Math.max(zw, zh);
|
|
4188
|
+
break;
|
|
4189
|
+
case "contain":
|
|
4190
|
+
default:
|
|
4191
|
+
targetZoom = Math.min(zw, zh);
|
|
4192
|
+
break;
|
|
4193
|
+
}
|
|
3997
4194
|
}
|
|
3998
4195
|
const oldZoom = Math.min(_camera.zoom.x, _camera.zoom.y);
|
|
3999
4196
|
const newZoom = Math.min(
|
|
@@ -4196,12 +4393,12 @@ const _arrange = definePlugin((editor) => {
|
|
|
4196
4393
|
{ command: "sendBackward", key: "CmdOrCtrl+[" },
|
|
4197
4394
|
{ command: "bringToFront", key: "]" },
|
|
4198
4395
|
{ command: "sendToBack", key: "[" },
|
|
4199
|
-
{ command: "alignLeft", key: "Alt+
|
|
4200
|
-
{ command: "alignRight", key: "Alt+
|
|
4201
|
-
{ command: "alignTop", key: "Alt+
|
|
4202
|
-
{ command: "alignBottom", key: "Alt+
|
|
4203
|
-
{ command: "alignHorizontalCenter", key: "Alt+
|
|
4204
|
-
{ command: "alignVerticalCenter", key: "Alt+
|
|
4396
|
+
{ command: "alignLeft", key: "Alt+A" },
|
|
4397
|
+
{ command: "alignRight", key: "Alt+D" },
|
|
4398
|
+
{ command: "alignTop", key: "Alt+W" },
|
|
4399
|
+
{ command: "alignBottom", key: "Alt+S" },
|
|
4400
|
+
{ command: "alignHorizontalCenter", key: "Alt+H" },
|
|
4401
|
+
{ command: "alignVerticalCenter", key: "Alt+V" }
|
|
4205
4402
|
]
|
|
4206
4403
|
};
|
|
4207
4404
|
});
|
|
@@ -4539,10 +4736,10 @@ const _edit = definePlugin((editor, options) => {
|
|
|
4539
4736
|
{ command: "duplicate", handle: duplicate }
|
|
4540
4737
|
],
|
|
4541
4738
|
hotkeys: [
|
|
4542
|
-
{ command: "copy", key: "CmdOrCtrl+
|
|
4543
|
-
{ command: "cut", key: "CmdOrCtrl+
|
|
4544
|
-
{ command: "paste", key: "CmdOrCtrl+
|
|
4545
|
-
{ command: "duplicate", key: "CmdOrCtrl+
|
|
4739
|
+
{ command: "copy", key: "CmdOrCtrl+C", editable: false },
|
|
4740
|
+
{ command: "cut", key: "CmdOrCtrl+X", editable: false },
|
|
4741
|
+
{ command: "paste", key: "CmdOrCtrl+V", editable: false, preventDefault: false },
|
|
4742
|
+
{ command: "duplicate", key: "CmdOrCtrl+D", editable: false }
|
|
4546
4743
|
],
|
|
4547
4744
|
setup: () => {
|
|
4548
4745
|
if (useClipboard) {
|
|
@@ -4560,33 +4757,6 @@ const _edit = definePlugin((editor, options) => {
|
|
|
4560
4757
|
}
|
|
4561
4758
|
};
|
|
4562
4759
|
});
|
|
4563
|
-
const _enter = definePlugin((editor) => {
|
|
4564
|
-
const {
|
|
4565
|
-
selection,
|
|
4566
|
-
isElement,
|
|
4567
|
-
exec
|
|
4568
|
-
} = editor;
|
|
4569
|
-
async function _enter2() {
|
|
4570
|
-
if (selection.value.length === 1) {
|
|
4571
|
-
const node = selection.value[0];
|
|
4572
|
-
if (isElement(node)) {
|
|
4573
|
-
if (node.text.isValid()) {
|
|
4574
|
-
await exec("startTyping");
|
|
4575
|
-
}
|
|
4576
|
-
}
|
|
4577
|
-
}
|
|
4578
|
-
}
|
|
4579
|
-
const when = () => Boolean(selection.value.length > 0);
|
|
4580
|
-
return {
|
|
4581
|
-
name: "mce:enter",
|
|
4582
|
-
commands: [
|
|
4583
|
-
{ command: "enter", handle: _enter2 }
|
|
4584
|
-
],
|
|
4585
|
-
hotkeys: [
|
|
4586
|
-
{ command: "enter", key: ["Enter"], when }
|
|
4587
|
-
]
|
|
4588
|
-
};
|
|
4589
|
-
});
|
|
4590
4760
|
function makeIconProps() {
|
|
4591
4761
|
return {
|
|
4592
4762
|
icon: {
|
|
@@ -4675,6 +4845,7 @@ const aliases = {
|
|
|
4675
4845
|
mouseLeftClick: "M13 9V1.07A8.01 8.01 0 0 1 19.75 7c.16.64.25 1.31.25 2zm4.66-2c-.48-1.35-1.43-2.5-2.66-3.19V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4zm7-6V1.07C7.06 1.56 4 4.92 4 9z",
|
|
4676
4846
|
mouseRightClick: "M13 9V1.07c3.94.49 7 3.85 7 7.93zm-2 0V1.07A8.01 8.01 0 0 0 4.25 7C4.09 7.64 4 8.31 4 9zM6.34 7C6.82 5.65 7.78 4.5 9 3.81V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4z",
|
|
4677
4847
|
check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
|
|
4848
|
+
collapse: "m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z",
|
|
4678
4849
|
frame: "M17 9v6H7V9zm2-6h-2v3h2zM7 3H5v3h2zm16 4h-3v2h3zm-4 0H5v10h14zM4 7H1v2h3zm19 8h-3v2h3zM4 15H1v2h3zm15 3h-2v3h2zM7 18H5v3h2z",
|
|
4679
4850
|
group: "M10 22q-.825 0-1.412-.587T8 20v-4H4q-.825 0-1.412-.587T2 14V4q0-.825.588-1.412T4 2h10q.825 0 1.413.588T16 4v4h4q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22zm0-2h10V10h-6V4H4v10h6zm2-8",
|
|
4680
4851
|
shape: "M8 17.95q.25.025.488.038T9 18t.513-.012t.487-.038V20h10V10h-2.05q.025-.25.038-.488T18 9t-.012-.513T17.95 8H20q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22H10q-.825 0-1.412-.587T8 20zM9 16q-2.925 0-4.962-2.037T2 9t2.038-4.962T9 2t4.963 2.038T16 9t-2.037 4.963T9 16m0-2q2.075 0 3.538-1.463T14 9t-1.463-3.537T9 4T5.463 5.463T4 9t1.463 3.538T9 14m0-5",
|
|
@@ -4775,6 +4946,7 @@ function createLayer() {
|
|
|
4775
4946
|
}
|
|
4776
4947
|
provide(MceLayerKey, {
|
|
4777
4948
|
selecting,
|
|
4949
|
+
openedItems,
|
|
4778
4950
|
dragging,
|
|
4779
4951
|
droppingItemId,
|
|
4780
4952
|
register: (vm, item) => {
|
|
@@ -5156,7 +5328,9 @@ const makeMceOverlayProps = propsFactory({
|
|
|
5156
5328
|
attach: {
|
|
5157
5329
|
type: [String, Boolean, Object],
|
|
5158
5330
|
default: void 0
|
|
5159
|
-
}
|
|
5331
|
+
},
|
|
5332
|
+
contentClass: Object,
|
|
5333
|
+
contentStyle: Object
|
|
5160
5334
|
}, "makeMceOverlayProps");
|
|
5161
5335
|
let globalOverlayRoot;
|
|
5162
5336
|
function getGlobalOverlayRoot() {
|
|
@@ -5287,8 +5461,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5287
5461
|
const cloend = renderEngine.value.input._clonePointerEvent(event);
|
|
5288
5462
|
cloend.srcElement = drawboardDom.value;
|
|
5289
5463
|
cloend.target = frame.value;
|
|
5290
|
-
cloend.
|
|
5291
|
-
exec("
|
|
5464
|
+
cloend.__FROM__ = event.target;
|
|
5465
|
+
exec("pointerDown", cloend, {
|
|
5292
5466
|
allowTopFrame: true
|
|
5293
5467
|
});
|
|
5294
5468
|
}
|
|
@@ -5392,7 +5566,7 @@ const _frame = definePlugin((editor) => {
|
|
|
5392
5566
|
}
|
|
5393
5567
|
],
|
|
5394
5568
|
hotkeys: [
|
|
5395
|
-
{ command: "setActiveDrawingTool:frame", key: "
|
|
5569
|
+
{ command: "setActiveDrawingTool:frame", key: "F" }
|
|
5396
5570
|
]
|
|
5397
5571
|
};
|
|
5398
5572
|
});
|
|
@@ -5510,8 +5684,8 @@ const _group = definePlugin((editor) => {
|
|
|
5510
5684
|
{ command: "ungroup", handle: ungroup }
|
|
5511
5685
|
],
|
|
5512
5686
|
hotkeys: [
|
|
5513
|
-
{ command: "groupSelection", key: "CmdOrCtrl+
|
|
5514
|
-
{ command: "frameSelection", key: "Alt+CmdOrCtrl+
|
|
5687
|
+
{ command: "groupSelection", key: "CmdOrCtrl+G" },
|
|
5688
|
+
{ command: "frameSelection", key: "Alt+CmdOrCtrl+G" },
|
|
5515
5689
|
{ command: "ungroup", key: "CmdOrCtrl+Backspace" }
|
|
5516
5690
|
]
|
|
5517
5691
|
};
|
|
@@ -5548,8 +5722,8 @@ const _history = definePlugin((editor) => {
|
|
|
5548
5722
|
{ command: "redo", handle: redo }
|
|
5549
5723
|
],
|
|
5550
5724
|
hotkeys: [
|
|
5551
|
-
{ command: "undo", key: "CmdOrCtrl+
|
|
5552
|
-
{ command: "redo", key: "Shift+CmdOrCtrl+
|
|
5725
|
+
{ command: "undo", key: "CmdOrCtrl+Z" },
|
|
5726
|
+
{ command: "redo", key: "Shift+CmdOrCtrl+Z" }
|
|
5553
5727
|
]
|
|
5554
5728
|
};
|
|
5555
5729
|
});
|
|
@@ -5703,8 +5877,8 @@ const _image = definePlugin((editor) => {
|
|
|
5703
5877
|
{ name: "image", handle: (position) => exec("import", { position }) }
|
|
5704
5878
|
],
|
|
5705
5879
|
hotkeys: [
|
|
5706
|
-
{ command: "copyAs:png", key: "Shift+CmdOrCtrl+
|
|
5707
|
-
{ command: "setActiveDrawingTool:image", key: "Shift+CmdOrCtrl+
|
|
5880
|
+
{ command: "copyAs:png", key: "Shift+CmdOrCtrl+C" },
|
|
5881
|
+
{ command: "setActiveDrawingTool:image", key: "Shift+CmdOrCtrl+K" }
|
|
5708
5882
|
]
|
|
5709
5883
|
};
|
|
5710
5884
|
});
|
|
@@ -5735,7 +5909,7 @@ const _import = definePlugin((editor) => {
|
|
|
5735
5909
|
{ command: "import", handle: _import2 }
|
|
5736
5910
|
],
|
|
5737
5911
|
hotkeys: [
|
|
5738
|
-
{ command: "import", key: "CmdOrCtrl+
|
|
5912
|
+
{ command: "import", key: "CmdOrCtrl+I" }
|
|
5739
5913
|
],
|
|
5740
5914
|
setup: () => {
|
|
5741
5915
|
const {
|
|
@@ -5929,13 +6103,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5929
6103
|
dragging,
|
|
5930
6104
|
dropping,
|
|
5931
6105
|
onMousedown,
|
|
5932
|
-
id
|
|
6106
|
+
id,
|
|
6107
|
+
openedItems
|
|
5933
6108
|
} = useLayerItem({
|
|
5934
6109
|
opened,
|
|
5935
6110
|
node: computed(() => props.node),
|
|
5936
6111
|
dom: computed(() => dom.value)
|
|
5937
6112
|
});
|
|
5938
|
-
const
|
|
6113
|
+
const selected = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
5939
6114
|
const children = computed(() => props.node.children);
|
|
5940
6115
|
const childrenLength = computed(() => children.value.length);
|
|
5941
6116
|
const inputDom = ref();
|
|
@@ -6088,7 +6263,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6088
6263
|
ref: dom,
|
|
6089
6264
|
class: normalizeClass(["mce-layer", [
|
|
6090
6265
|
props.root && "mce-layer--root",
|
|
6091
|
-
(__props.active ||
|
|
6266
|
+
(__props.active || selected.value) && "mce-layer--active",
|
|
6267
|
+
selected.value && "mce-layer--selected",
|
|
6092
6268
|
opened.value && "mce-layer--open",
|
|
6093
6269
|
isHoverElement.value && "mce-layer--hover",
|
|
6094
6270
|
unref(dropping) && "mce-layer--dropping"
|
|
@@ -6102,12 +6278,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6102
6278
|
onMouseleave,
|
|
6103
6279
|
onContextmenu
|
|
6104
6280
|
}, [
|
|
6105
|
-
_cache[
|
|
6106
|
-
_cache[
|
|
6281
|
+
_cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
|
|
6282
|
+
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
6107
6283
|
createElementVNode("div", _hoisted_2$c, [
|
|
6108
6284
|
createElementVNode("div", _hoisted_3$b, [
|
|
6109
6285
|
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
|
|
6110
6286
|
key: 0,
|
|
6287
|
+
class: "mce-layer__arrow",
|
|
6111
6288
|
icon: "$arrowRight",
|
|
6112
6289
|
onClick: onClickExpand,
|
|
6113
6290
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
@@ -6150,13 +6327,29 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6150
6327
|
"mce-layer__action--show": hovering.value || unref(isLock)(props.node) || !unref(isVisible)(props.node)
|
|
6151
6328
|
}])
|
|
6152
6329
|
}, [
|
|
6153
|
-
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6330
|
+
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6331
|
+
Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$y, {
|
|
6332
|
+
key: 0,
|
|
6333
|
+
icon: "",
|
|
6334
|
+
class: "mce-layer__btn mce-layer__btn--show",
|
|
6335
|
+
onMousedown: _cache[2] || (_cache[2] = withModifiers(($event) => unref(openedItems).forEach((item, _id) => {
|
|
6336
|
+
if (_id !== unref(id)) {
|
|
6337
|
+
item.value = false;
|
|
6338
|
+
}
|
|
6339
|
+
}), ["prevent", "stop"]))
|
|
6340
|
+
}, {
|
|
6341
|
+
default: withCtx(() => [
|
|
6342
|
+
createVNode(unref(_sfc_main$C), { icon: "$collapse" })
|
|
6343
|
+
]),
|
|
6344
|
+
_: 1
|
|
6345
|
+
})) : createCommentVNode("", true)
|
|
6346
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6154
6347
|
createVNode(_sfc_main$y, {
|
|
6155
6348
|
icon: "",
|
|
6156
6349
|
class: normalizeClass(["mce-layer__btn", {
|
|
6157
6350
|
"mce-layer__btn--show": unref(isLock)(props.node)
|
|
6158
6351
|
}]),
|
|
6159
|
-
onClick: _cache[
|
|
6352
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
6160
6353
|
}, {
|
|
6161
6354
|
default: withCtx(() => [
|
|
6162
6355
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6170,7 +6363,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6170
6363
|
class: normalizeClass(["mce-layer__btn", {
|
|
6171
6364
|
"mce-layer__btn--show": !unref(isVisible)(props.node)
|
|
6172
6365
|
}]),
|
|
6173
|
-
onClick: _cache[
|
|
6366
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
6174
6367
|
}, {
|
|
6175
6368
|
default: withCtx(() => [
|
|
6176
6369
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6188,7 +6381,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6188
6381
|
key: i,
|
|
6189
6382
|
node: children.value[childrenLength.value - i],
|
|
6190
6383
|
indent: __props.root ? props.indent : props.indent + 1,
|
|
6191
|
-
active: __props.active ||
|
|
6384
|
+
active: __props.active || selected.value
|
|
6192
6385
|
}, null, 8, ["node", "indent", "active"]);
|
|
6193
6386
|
}), 128)) : createCommentVNode("", true)
|
|
6194
6387
|
], 64);
|
|
@@ -6275,7 +6468,7 @@ const _lock = definePlugin((editor) => {
|
|
|
6275
6468
|
{ command: "lock/unlock", handle: () => selection.value.forEach((el) => setLock(el, !isLock(el))) }
|
|
6276
6469
|
],
|
|
6277
6470
|
hotkeys: [
|
|
6278
|
-
{ command: "lock/unlock", key: "Shift+CmdOrCtrl+
|
|
6471
|
+
{ command: "lock/unlock", key: "Shift+CmdOrCtrl+L" }
|
|
6279
6472
|
]
|
|
6280
6473
|
};
|
|
6281
6474
|
});
|
|
@@ -6351,7 +6544,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6351
6544
|
}
|
|
6352
6545
|
};
|
|
6353
6546
|
const target = computed(() => {
|
|
6354
|
-
if (typeof props.target === "object" && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6547
|
+
if (typeof props.target === "object" && !("getBoundingClientRect" in props.target) && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6355
6548
|
return virtualElement;
|
|
6356
6549
|
}
|
|
6357
6550
|
return props.target ?? activatorEl.value;
|
|
@@ -6365,15 +6558,20 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6365
6558
|
middleware: [
|
|
6366
6559
|
middlewares.has("offset") && offset(() => props.offset ?? 0),
|
|
6367
6560
|
middlewares.has("flip") && flip(),
|
|
6368
|
-
middlewares.has("shift") && shift({ padding: 20 })
|
|
6561
|
+
middlewares.has("shift") && shift({ crossAxis: true, padding: 20 })
|
|
6369
6562
|
].filter(Boolean)
|
|
6370
6563
|
});
|
|
6371
6564
|
const style = computed(() => {
|
|
6372
6565
|
return {
|
|
6373
|
-
...floatingStyles.value,
|
|
6374
6566
|
zIndex: 1500 + overlayItem.index.value
|
|
6375
6567
|
};
|
|
6376
6568
|
});
|
|
6569
|
+
const contentStyle = computed(() => {
|
|
6570
|
+
return {
|
|
6571
|
+
...floatingStyles.value,
|
|
6572
|
+
...props.contentStyle
|
|
6573
|
+
};
|
|
6574
|
+
});
|
|
6377
6575
|
const activatorProps = computed(() => {
|
|
6378
6576
|
return {
|
|
6379
6577
|
ref: (el) => activatorEl.value = el
|
|
@@ -6421,11 +6619,16 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6421
6619
|
}, [
|
|
6422
6620
|
isActive.value ? (openBlock(), createElementBlock("div", mergeProps({
|
|
6423
6621
|
key: 0,
|
|
6424
|
-
ref: "contentElTpl",
|
|
6425
6622
|
class: "mce-overlay",
|
|
6426
6623
|
style: style.value
|
|
6427
6624
|
}, _ctx.$attrs), [
|
|
6428
|
-
|
|
6625
|
+
createElementVNode("div", {
|
|
6626
|
+
ref: "contentElTpl",
|
|
6627
|
+
style: normalizeStyle$1(contentStyle.value),
|
|
6628
|
+
class: normalizeClass(["mce-overlay-content", props.contentClass])
|
|
6629
|
+
}, [
|
|
6630
|
+
renderSlot(_ctx.$slots, "default")
|
|
6631
|
+
], 6)
|
|
6429
6632
|
], 16)) : createCommentVNode("", true)
|
|
6430
6633
|
], 8, ["disabled", "to"]))
|
|
6431
6634
|
], 64);
|
|
@@ -6528,6 +6731,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6528
6731
|
}
|
|
6529
6732
|
__expose({
|
|
6530
6733
|
isActive,
|
|
6734
|
+
activatorEl: computed(() => overlay.value?.activatorEl),
|
|
6735
|
+
contentEl: computed(() => overlay.value?.contentEl),
|
|
6531
6736
|
updateLocation
|
|
6532
6737
|
});
|
|
6533
6738
|
return (_ctx, _cache) => {
|
|
@@ -6681,6 +6886,24 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6681
6886
|
const isActive = useModel(__props, "modelValue");
|
|
6682
6887
|
const position = useModel(__props, "position");
|
|
6683
6888
|
const menuRef = useTemplateRef("menuTplRef");
|
|
6889
|
+
const target = {
|
|
6890
|
+
getBoundingClientRect() {
|
|
6891
|
+
const box = menuRef.value?.contentEl?.getBoundingClientRect();
|
|
6892
|
+
const { x, y } = position.value;
|
|
6893
|
+
const width = 0;
|
|
6894
|
+
const height = box?.height ?? 0;
|
|
6895
|
+
return {
|
|
6896
|
+
x,
|
|
6897
|
+
y,
|
|
6898
|
+
left: x,
|
|
6899
|
+
top: y,
|
|
6900
|
+
bottom: x + height,
|
|
6901
|
+
right: y + width,
|
|
6902
|
+
width,
|
|
6903
|
+
height
|
|
6904
|
+
};
|
|
6905
|
+
}
|
|
6906
|
+
};
|
|
6684
6907
|
onBeforeMount(() => {
|
|
6685
6908
|
registerCommand({ command: "openContextMenu", handle: onContextmenu });
|
|
6686
6909
|
});
|
|
@@ -6726,14 +6949,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6726
6949
|
ref: "menuTplRef",
|
|
6727
6950
|
modelValue: isActive.value,
|
|
6728
6951
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
6729
|
-
offset: 10,
|
|
6730
6952
|
class: "mce-context-menu",
|
|
6731
|
-
|
|
6732
|
-
|
|
6953
|
+
offset: 10,
|
|
6954
|
+
target,
|
|
6955
|
+
location: "right-start",
|
|
6733
6956
|
items: unref(contextMenu),
|
|
6734
6957
|
style: normalizeStyle$1({
|
|
6735
|
-
|
|
6958
|
+
"--max-height": `${unref(drawboardAabb).height * 0.8}px`
|
|
6736
6959
|
}),
|
|
6960
|
+
middlewares: ["offset", "shift"],
|
|
6737
6961
|
"onClick:item": onClickItem
|
|
6738
6962
|
}, {
|
|
6739
6963
|
title: withCtx(({ item }) => [
|
|
@@ -6745,7 +6969,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6745
6969
|
], 64)) : createCommentVNode("", true)
|
|
6746
6970
|
]),
|
|
6747
6971
|
_: 1
|
|
6748
|
-
}, 8, ["modelValue", "
|
|
6972
|
+
}, 8, ["modelValue", "items", "style"]);
|
|
6749
6973
|
};
|
|
6750
6974
|
}
|
|
6751
6975
|
});
|
|
@@ -7217,7 +7441,7 @@ const _open = definePlugin((editor) => {
|
|
|
7217
7441
|
{ command: "open", handle: open }
|
|
7218
7442
|
],
|
|
7219
7443
|
hotkeys: [
|
|
7220
|
-
{ command: "open", key: "CmdOrCtrl+
|
|
7444
|
+
{ command: "open", key: "CmdOrCtrl+O" }
|
|
7221
7445
|
]
|
|
7222
7446
|
};
|
|
7223
7447
|
});
|
|
@@ -7231,7 +7455,7 @@ const _panels = definePlugin((editor) => {
|
|
|
7231
7455
|
{ command: "panels", handle: (panel) => config.value[panel] = !config.value[panel] }
|
|
7232
7456
|
],
|
|
7233
7457
|
hotkeys: [
|
|
7234
|
-
{ command: "panels:layers", key: "Alt
|
|
7458
|
+
{ command: "panels:layers", key: "Alt+1" }
|
|
7235
7459
|
]
|
|
7236
7460
|
};
|
|
7237
7461
|
});
|
|
@@ -11304,8 +11528,8 @@ const _pen = definePlugin((editor) => {
|
|
|
11304
11528
|
}
|
|
11305
11529
|
],
|
|
11306
11530
|
hotkeys: [
|
|
11307
|
-
{ command: "setActiveDrawingTool:pen", key: "
|
|
11308
|
-
{ command: "setActiveDrawingTool:pencil", key: "Shift+
|
|
11531
|
+
{ command: "setActiveDrawingTool:pen", key: "P" },
|
|
11532
|
+
{ command: "setActiveDrawingTool:pencil", key: "Shift+P" }
|
|
11309
11533
|
]
|
|
11310
11534
|
};
|
|
11311
11535
|
});
|
|
@@ -11352,7 +11576,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11352
11576
|
const props = __props;
|
|
11353
11577
|
const isActive = useModel(__props, "modelValue");
|
|
11354
11578
|
const overlay = useTemplateRef("overlayTpl");
|
|
11355
|
-
const
|
|
11579
|
+
const contentClass = computed(() => {
|
|
11356
11580
|
const [side, align = "center"] = props.location.split("-");
|
|
11357
11581
|
return [
|
|
11358
11582
|
`mce-tooltip--side-${side}`,
|
|
@@ -11370,7 +11594,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11370
11594
|
ref: "overlayTpl",
|
|
11371
11595
|
modelValue: isActive.value,
|
|
11372
11596
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
11373
|
-
class:
|
|
11597
|
+
class: "mce-tooltip",
|
|
11598
|
+
"content-class": contentClass.value,
|
|
11374
11599
|
location: props.location,
|
|
11375
11600
|
offset: props.offset,
|
|
11376
11601
|
target: props.target,
|
|
@@ -11402,7 +11627,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11402
11627
|
]),
|
|
11403
11628
|
key: "0"
|
|
11404
11629
|
} : void 0
|
|
11405
|
-
]), 1032, ["modelValue", "class", "location", "offset", "target", "attach"]);
|
|
11630
|
+
]), 1032, ["modelValue", "content-class", "location", "offset", "target", "attach"]);
|
|
11406
11631
|
};
|
|
11407
11632
|
}
|
|
11408
11633
|
});
|
|
@@ -11949,6 +12174,36 @@ const _scroll = definePlugin((editor) => {
|
|
|
11949
12174
|
ignore: () => !config.value.scrollbar
|
|
11950
12175
|
}
|
|
11951
12176
|
]
|
|
12177
|
+
// setup: () => {
|
|
12178
|
+
// const {
|
|
12179
|
+
// viewportAabb,
|
|
12180
|
+
// getGlobalPointer,
|
|
12181
|
+
// state,
|
|
12182
|
+
// camera,
|
|
12183
|
+
// } = editor
|
|
12184
|
+
//
|
|
12185
|
+
// setInterval(() => {
|
|
12186
|
+
// if (state.value === 'transforming' || state.value === 'selecting') {
|
|
12187
|
+
// const _camera = camera.value
|
|
12188
|
+
// const { min, max } = viewportAabb.value
|
|
12189
|
+
// const { zoom } = _camera
|
|
12190
|
+
// const dist = 10 / zoom.x
|
|
12191
|
+
// const pointer = getGlobalPointer()
|
|
12192
|
+
// if (pointer.x - dist <= min.x) {
|
|
12193
|
+
// scrollTo({ x: min.x })
|
|
12194
|
+
// }
|
|
12195
|
+
// if (pointer.x + dist >= max.x) {
|
|
12196
|
+
// scrollTo({ x: max.x })
|
|
12197
|
+
// }
|
|
12198
|
+
// if (pointer.y - dist <= min.y) {
|
|
12199
|
+
// scrollTo({ y: min.y })
|
|
12200
|
+
// }
|
|
12201
|
+
// if (pointer.y + dist >= max.y) {
|
|
12202
|
+
// scrollTo({ y: max.y })
|
|
12203
|
+
// }
|
|
12204
|
+
// }
|
|
12205
|
+
// }, 100)
|
|
12206
|
+
// },
|
|
11952
12207
|
};
|
|
11953
12208
|
});
|
|
11954
12209
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
@@ -12022,8 +12277,8 @@ const _selection = definePlugin((editor) => {
|
|
|
12022
12277
|
{ command: "selectNextSibling", handle: () => selectSibling("next") }
|
|
12023
12278
|
],
|
|
12024
12279
|
hotkeys: [
|
|
12025
|
-
{ command: "selectAll", key: "CmdOrCtrl+
|
|
12026
|
-
{ command: "deselectAll", key: "Shift+CmdOrCtrl+
|
|
12280
|
+
{ command: "selectAll", key: "CmdOrCtrl+A" },
|
|
12281
|
+
{ command: "deselectAll", key: "Shift+CmdOrCtrl+A" },
|
|
12027
12282
|
{ command: "selectChildren", key: "Enter" },
|
|
12028
12283
|
{ command: "selectParent", key: "\\" },
|
|
12029
12284
|
{ command: "selectPreviousSibling", key: "Shift+Tab" },
|
|
@@ -12198,10 +12453,10 @@ const _shape = definePlugin((editor) => {
|
|
|
12198
12453
|
}
|
|
12199
12454
|
],
|
|
12200
12455
|
hotkeys: [
|
|
12201
|
-
{ command: "setActiveDrawingTool:rectangle", key: "
|
|
12202
|
-
{ command: "setActiveDrawingTool:line", key: "
|
|
12203
|
-
{ command: "setActiveDrawingTool:arrow", key: "Shift+
|
|
12204
|
-
{ command: "setActiveDrawingTool:ellipse", key: "
|
|
12456
|
+
{ command: "setActiveDrawingTool:rectangle", key: "R" },
|
|
12457
|
+
{ command: "setActiveDrawingTool:line", key: "L" },
|
|
12458
|
+
{ command: "setActiveDrawingTool:arrow", key: "Shift+L" },
|
|
12459
|
+
{ command: "setActiveDrawingTool:ellipse", key: "O" }
|
|
12205
12460
|
]
|
|
12206
12461
|
};
|
|
12207
12462
|
});
|
|
@@ -13548,8 +13803,8 @@ const _state = definePlugin((editor) => {
|
|
|
13548
13803
|
{ command: "setState", handle: (val) => state.value = val }
|
|
13549
13804
|
],
|
|
13550
13805
|
hotkeys: [
|
|
13551
|
-
{ command: "setState:move", key: "
|
|
13552
|
-
{ command: "setState:hand", key: "
|
|
13806
|
+
{ command: "setState:move", key: "V" },
|
|
13807
|
+
{ command: "setState:hand", key: "H" }
|
|
13553
13808
|
]
|
|
13554
13809
|
};
|
|
13555
13810
|
});
|
|
@@ -13598,9 +13853,9 @@ const _hoisted_5$2 = { class: "mce-statusbar__kbd" };
|
|
|
13598
13853
|
const _hoisted_6$2 = { class: "mce-statusbar__item" };
|
|
13599
13854
|
const _hoisted_7$2 = { class: "mce-statusbar__kbd" };
|
|
13600
13855
|
const _hoisted_8$1 = { class: "mce-statusbar__item" };
|
|
13601
|
-
const _hoisted_9 = { class: "mce-statusbar__item" };
|
|
13602
|
-
const _hoisted_10 = { class: "mce-statusbar__kbd" };
|
|
13603
|
-
const _hoisted_11 = { class: "mce-statusbar__item" };
|
|
13856
|
+
const _hoisted_9$1 = { class: "mce-statusbar__item" };
|
|
13857
|
+
const _hoisted_10$1 = { class: "mce-statusbar__kbd" };
|
|
13858
|
+
const _hoisted_11$1 = { class: "mce-statusbar__item" };
|
|
13604
13859
|
const _hoisted_12 = { class: "mce-statusbar__kbd" };
|
|
13605
13860
|
const _hoisted_13 = { key: 2 };
|
|
13606
13861
|
const _hoisted_14 = { class: "mce-statusbar__item" };
|
|
@@ -13642,12 +13897,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13642
13897
|
createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
|
|
13643
13898
|
]),
|
|
13644
13899
|
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
13645
|
-
createElementVNode("div", _hoisted_9, [
|
|
13646
|
-
createElementVNode("span", _hoisted_10, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
13900
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
13901
|
+
createElementVNode("span", _hoisted_10$1, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
13647
13902
|
createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
|
|
13648
13903
|
]),
|
|
13649
13904
|
_cache[3] || (_cache[3] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
13650
|
-
createElementVNode("div", _hoisted_11, [
|
|
13905
|
+
createElementVNode("div", _hoisted_11$1, [
|
|
13651
13906
|
createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
13652
13907
|
createElementVNode("span", null, toDisplayString(unref(t)("constrainToAxis")), 1)
|
|
13653
13908
|
])
|
|
@@ -13780,7 +14035,7 @@ const _text = definePlugin((editor) => {
|
|
|
13780
14035
|
}
|
|
13781
14036
|
],
|
|
13782
14037
|
hotkeys: [
|
|
13783
|
-
{ command: "setActiveDrawingTool:text", key: "
|
|
14038
|
+
{ command: "setActiveDrawingTool:text", key: "T" }
|
|
13784
14039
|
]
|
|
13785
14040
|
};
|
|
13786
14041
|
});
|
|
@@ -14111,7 +14366,7 @@ const _timeline = definePlugin((editor) => {
|
|
|
14111
14366
|
}
|
|
14112
14367
|
],
|
|
14113
14368
|
hotkeys: [
|
|
14114
|
-
{ command: "panels:timeline", key: "Alt
|
|
14369
|
+
{ command: "panels:timeline", key: "Alt+2" }
|
|
14115
14370
|
]
|
|
14116
14371
|
};
|
|
14117
14372
|
});
|
|
@@ -14308,8 +14563,18 @@ const _toolbelt = definePlugin((editor) => {
|
|
|
14308
14563
|
});
|
|
14309
14564
|
const _transform = definePlugin((editor) => {
|
|
14310
14565
|
const {
|
|
14311
|
-
elementSelection
|
|
14566
|
+
elementSelection,
|
|
14567
|
+
exec
|
|
14312
14568
|
} = editor;
|
|
14569
|
+
async function _enter() {
|
|
14570
|
+
if (elementSelection.value.length === 1) {
|
|
14571
|
+
const element = elementSelection.value[0];
|
|
14572
|
+
if (element.text.isValid()) {
|
|
14573
|
+
await exec("startTyping");
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
}
|
|
14577
|
+
const when = () => Boolean(elementSelection.value.length > 0);
|
|
14313
14578
|
function flipHorizontal() {
|
|
14314
14579
|
elementSelection.value.forEach((el) => {
|
|
14315
14580
|
el.style.scaleX = -el.style.scaleX;
|
|
@@ -14323,28 +14588,39 @@ const _transform = definePlugin((editor) => {
|
|
|
14323
14588
|
return {
|
|
14324
14589
|
name: "mce:transform",
|
|
14325
14590
|
commands: [
|
|
14591
|
+
{ command: "enter", handle: _enter },
|
|
14326
14592
|
{ command: "flipHorizontal", handle: flipHorizontal },
|
|
14327
14593
|
{ command: "flipVertical", handle: flipVertical }
|
|
14328
14594
|
],
|
|
14329
14595
|
hotkeys: [
|
|
14330
|
-
{ command: "
|
|
14331
|
-
{ command: "
|
|
14596
|
+
{ command: "enter", key: ["Enter"], when },
|
|
14597
|
+
{ command: "flipHorizontal", key: "Shift+H" },
|
|
14598
|
+
{ command: "flipVertical", key: "Shift+V" }
|
|
14332
14599
|
]
|
|
14333
14600
|
};
|
|
14334
14601
|
});
|
|
14335
14602
|
const _ui = definePlugin((editor) => {
|
|
14336
|
-
const {
|
|
14337
|
-
selectionAabbInDrawboard,
|
|
14338
|
-
emit
|
|
14339
|
-
} = editor;
|
|
14340
14603
|
return {
|
|
14341
14604
|
name: "mce:ui",
|
|
14342
14605
|
setup: () => {
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14606
|
+
const {
|
|
14607
|
+
drawboardDom,
|
|
14608
|
+
drawboardAabb,
|
|
14609
|
+
drawboardPointer,
|
|
14610
|
+
exec
|
|
14611
|
+
} = editor;
|
|
14612
|
+
useResizeObserver$1(drawboardDom, (entries) => {
|
|
14613
|
+
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
14614
|
+
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
14615
|
+
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
14616
|
+
exec("zoomToFit");
|
|
14617
|
+
});
|
|
14618
|
+
document.addEventListener("mousemove", (event) => {
|
|
14619
|
+
drawboardPointer.value = new Vector2$1(
|
|
14620
|
+
event.clientX - drawboardAabb.value.left,
|
|
14621
|
+
event.clientY - drawboardAabb.value.top
|
|
14622
|
+
);
|
|
14623
|
+
});
|
|
14348
14624
|
}
|
|
14349
14625
|
};
|
|
14350
14626
|
});
|
|
@@ -14417,7 +14693,7 @@ const _visibility = definePlugin((editor) => {
|
|
|
14417
14693
|
{ command: "hide/show", handle: hideOrShow }
|
|
14418
14694
|
],
|
|
14419
14695
|
hotkeys: [
|
|
14420
|
-
{ command: "hide/show", key: "Shift+CmdOrCtrl+
|
|
14696
|
+
{ command: "hide/show", key: "Shift+CmdOrCtrl+H" }
|
|
14421
14697
|
]
|
|
14422
14698
|
};
|
|
14423
14699
|
});
|
|
@@ -14425,9 +14701,7 @@ const _zoom = definePlugin((editor) => {
|
|
|
14425
14701
|
const {
|
|
14426
14702
|
registerConfig,
|
|
14427
14703
|
camera,
|
|
14428
|
-
drawboardAabb,
|
|
14429
14704
|
zoomTo,
|
|
14430
|
-
elementSelection,
|
|
14431
14705
|
exec,
|
|
14432
14706
|
config,
|
|
14433
14707
|
findFrame,
|
|
@@ -14447,7 +14721,6 @@ const _zoom = definePlugin((editor) => {
|
|
|
14447
14721
|
{ command: "zoomIn", handle: () => camera.value.addZoom(0.25) },
|
|
14448
14722
|
{ command: "zoomOut", handle: () => camera.value.addZoom(-0.25) },
|
|
14449
14723
|
{ command: "zoomTo100", handle: () => camera.value.setZoom(1) },
|
|
14450
|
-
{ command: "zoomToCover", handle: () => zoomTo("root", { mode: "cover" }) },
|
|
14451
14724
|
{ command: "zoomToFit", handle: () => zoomTo("root", { mode: config.value.zoomToFit }) },
|
|
14452
14725
|
{ command: "zoomToSelection", handle: (options) => zoomTo("selection", options) },
|
|
14453
14726
|
{ command: "zoomToNextFrame", handle: (options) => zoomToFrame("next", options) },
|
|
@@ -14457,31 +14730,13 @@ const _zoom = definePlugin((editor) => {
|
|
|
14457
14730
|
{ command: "zoomIn", key: "CmdOrCtrl+=" },
|
|
14458
14731
|
{ command: "zoomOut", key: "CmdOrCtrl+-" },
|
|
14459
14732
|
{ command: "zoomTo100", key: "CmdOrCtrl+0" },
|
|
14460
|
-
{ command: "zoomToFit", key: "Shift
|
|
14461
|
-
{ command: "zoomToSelection", key: "Shift
|
|
14462
|
-
{ command: "zoomToNextFrame", key: "
|
|
14733
|
+
{ command: "zoomToFit", key: "Shift+1" },
|
|
14734
|
+
{ command: "zoomToSelection", key: "Shift+2" },
|
|
14735
|
+
{ command: "zoomToNextFrame", key: "N" },
|
|
14463
14736
|
{ command: "zoomToPreviousFrame", key: "Shift+N" }
|
|
14464
14737
|
],
|
|
14465
14738
|
events: {
|
|
14466
|
-
setDoc: () => exec("zoomToFit")
|
|
14467
|
-
setCurrentFrame: () => {
|
|
14468
|
-
if (elementSelection.value.length) {
|
|
14469
|
-
exec("zoomToSelection");
|
|
14470
|
-
} else {
|
|
14471
|
-
exec("zoomToFit");
|
|
14472
|
-
}
|
|
14473
|
-
}
|
|
14474
|
-
},
|
|
14475
|
-
setup: () => {
|
|
14476
|
-
const {
|
|
14477
|
-
drawboardDom
|
|
14478
|
-
} = editor;
|
|
14479
|
-
useResizeObserver$1(drawboardDom, (entries) => {
|
|
14480
|
-
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
14481
|
-
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
14482
|
-
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
14483
|
-
exec("zoomToFit");
|
|
14484
|
-
});
|
|
14739
|
+
setDoc: () => exec("zoomToFit")
|
|
14485
14740
|
}
|
|
14486
14741
|
};
|
|
14487
14742
|
});
|
|
@@ -14492,7 +14747,6 @@ const plugins = [
|
|
|
14492
14747
|
_delete,
|
|
14493
14748
|
_drawingTool,
|
|
14494
14749
|
_edit,
|
|
14495
|
-
_enter,
|
|
14496
14750
|
_frame,
|
|
14497
14751
|
_gif,
|
|
14498
14752
|
_group,
|
|
@@ -14684,7 +14938,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14684
14938
|
__name: "Floatbar",
|
|
14685
14939
|
props: {
|
|
14686
14940
|
...makeMceOverlayProps({
|
|
14687
|
-
middlewares: ["offset", "shift"],
|
|
14688
14941
|
offset: 8
|
|
14689
14942
|
})
|
|
14690
14943
|
},
|
|
@@ -14701,11 +14954,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14701
14954
|
const aabb = selectionAabbInDrawboard.value;
|
|
14702
14955
|
if (location?.startsWith("top") || location?.startsWith("bottom")) {
|
|
14703
14956
|
return {
|
|
14704
|
-
|
|
14957
|
+
minWidth: `${aabb.width}px`
|
|
14705
14958
|
};
|
|
14706
14959
|
} else if (location?.startsWith("left") || location?.startsWith("right")) {
|
|
14707
14960
|
return {
|
|
14708
|
-
|
|
14961
|
+
minHeight: `${aabb.height}px`
|
|
14709
14962
|
};
|
|
14710
14963
|
}
|
|
14711
14964
|
return {};
|
|
@@ -14726,7 +14979,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14726
14979
|
return (_ctx, _cache) => {
|
|
14727
14980
|
return openBlock(), createBlock(_sfc_main$u, {
|
|
14728
14981
|
ref: "overlayTpl",
|
|
14729
|
-
style:
|
|
14982
|
+
"content-style": style.value,
|
|
14730
14983
|
class: "mce-floatbar",
|
|
14731
14984
|
location: props.location,
|
|
14732
14985
|
middlewares: props.middlewares,
|
|
@@ -14739,33 +14992,37 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14739
14992
|
unref(elementSelection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
|
|
14740
14993
|
]),
|
|
14741
14994
|
_: 3
|
|
14742
|
-
}, 8, ["style", "location", "middlewares", "offset", "target"]);
|
|
14995
|
+
}, 8, ["content-style", "location", "middlewares", "offset", "target"]);
|
|
14743
14996
|
};
|
|
14744
14997
|
}
|
|
14745
14998
|
});
|
|
14746
|
-
const _hoisted_1$4 = { class: "mce-
|
|
14999
|
+
const _hoisted_1$4 = { class: "mce-transform-controls__svg" };
|
|
14747
15000
|
const _hoisted_2$1 = ["rx", "ry"];
|
|
14748
|
-
const _hoisted_3$1 =
|
|
14749
|
-
const _hoisted_4 = ["
|
|
14750
|
-
const _hoisted_5 =
|
|
14751
|
-
const _hoisted_6 = ["x", "y", "width", "height", "aria-label", "
|
|
14752
|
-
const _hoisted_7 =
|
|
15001
|
+
const _hoisted_3$1 = { "pointer-events": "none" };
|
|
15002
|
+
const _hoisted_4 = ["x", "y", "width", "height", "aria-label"];
|
|
15003
|
+
const _hoisted_5 = ["cx", "cy", "r", "aria-label"];
|
|
15004
|
+
const _hoisted_6 = ["x", "y", "width", "height", "aria-label", "rx", "ry"];
|
|
15005
|
+
const _hoisted_7 = ["transform"];
|
|
15006
|
+
const _hoisted_8 = { "pointer-events": "all" };
|
|
15007
|
+
const _hoisted_9 = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"];
|
|
15008
|
+
const _hoisted_10 = {
|
|
14753
15009
|
"pointer-events": "all",
|
|
14754
|
-
class: "mce-
|
|
15010
|
+
class: "mce-transform-controls__svg-slot"
|
|
14755
15011
|
};
|
|
14756
|
-
const
|
|
15012
|
+
const _hoisted_11 = {
|
|
14757
15013
|
key: 0,
|
|
14758
|
-
class: "mce-
|
|
15014
|
+
class: "mce-transform-controls__tip"
|
|
14759
15015
|
};
|
|
14760
15016
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
14761
|
-
__name: "
|
|
15017
|
+
__name: "TransformControls",
|
|
14762
15018
|
props: {
|
|
14763
15019
|
tag: { default: "div" },
|
|
14764
15020
|
modelValue: {},
|
|
14765
15021
|
movable: { type: Boolean, default: true },
|
|
14766
15022
|
rotatable: { type: Boolean, default: true },
|
|
15023
|
+
rotator: { type: Boolean },
|
|
14767
15024
|
resizable: { type: Boolean, default: true },
|
|
14768
|
-
|
|
15025
|
+
roundable: { type: Boolean },
|
|
14769
15026
|
threshold: { default: 0 },
|
|
14770
15027
|
resizeStrategy: {},
|
|
14771
15028
|
handleStrategy: {},
|
|
@@ -14774,24 +15031,24 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14774
15031
|
handles: { default: () => [
|
|
14775
15032
|
"move",
|
|
14776
15033
|
// resize
|
|
14777
|
-
"resize-
|
|
14778
|
-
"resize-
|
|
14779
|
-
"resize-
|
|
14780
|
-
"resize-
|
|
14781
|
-
"resize-
|
|
14782
|
-
"resize-
|
|
14783
|
-
"resize-
|
|
14784
|
-
"resize-
|
|
14785
|
-
//
|
|
14786
|
-
"
|
|
14787
|
-
"
|
|
14788
|
-
"
|
|
14789
|
-
"
|
|
15034
|
+
"resize-l",
|
|
15035
|
+
"resize-t",
|
|
15036
|
+
"resize-r",
|
|
15037
|
+
"resize-b",
|
|
15038
|
+
"resize-tl",
|
|
15039
|
+
"resize-tr",
|
|
15040
|
+
"resize-br",
|
|
15041
|
+
"resize-bl",
|
|
15042
|
+
// round
|
|
15043
|
+
"round-tl",
|
|
15044
|
+
"round-tr",
|
|
15045
|
+
"round-bl",
|
|
15046
|
+
"round-br",
|
|
14790
15047
|
// rotate
|
|
14791
|
-
"rotate-
|
|
14792
|
-
"rotate-
|
|
14793
|
-
"rotate-
|
|
14794
|
-
"rotate-
|
|
15048
|
+
"rotate-tl",
|
|
15049
|
+
"rotate-tr",
|
|
15050
|
+
"rotate-bl",
|
|
15051
|
+
"rotate-br"
|
|
14795
15052
|
] },
|
|
14796
15053
|
initialSize: { type: Boolean },
|
|
14797
15054
|
borderStyle: {},
|
|
@@ -14802,18 +15059,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14802
15059
|
const props = __props;
|
|
14803
15060
|
const emit = __emit;
|
|
14804
15061
|
const cursors = {
|
|
14805
|
-
"rotate-
|
|
14806
|
-
"rotate-
|
|
14807
|
-
"rotate-
|
|
14808
|
-
"rotate-
|
|
14809
|
-
"resize-
|
|
14810
|
-
"resize-
|
|
14811
|
-
"resize-
|
|
14812
|
-
"resize-
|
|
14813
|
-
"resize-
|
|
14814
|
-
"resize-
|
|
14815
|
-
"resize-
|
|
14816
|
-
"resize-
|
|
15062
|
+
"rotate-tl": (angle) => createCursor("rotate", 360 + angle),
|
|
15063
|
+
"rotate-tr": (angle) => createCursor("rotate", 90 + angle),
|
|
15064
|
+
"rotate-bl": (angle) => createCursor("rotate", 270 + angle),
|
|
15065
|
+
"rotate-br": (angle) => createCursor("rotate", 180 + angle),
|
|
15066
|
+
"resize-l": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15067
|
+
"resize-t": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15068
|
+
"resize-r": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15069
|
+
"resize-b": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15070
|
+
"resize-tl": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15071
|
+
"resize-tr": (angle) => createCursor("resizeBevel", 180 + angle),
|
|
15072
|
+
"resize-br": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15073
|
+
"resize-bl": (angle) => createCursor("resizeBevel", 180 + angle)
|
|
14817
15074
|
};
|
|
14818
15075
|
const modelValue = useModel(props, "modelValue");
|
|
14819
15076
|
const model = computed({
|
|
@@ -14830,25 +15087,25 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14830
15087
|
const transforming = ref(false);
|
|
14831
15088
|
const activeHandle = ref();
|
|
14832
15089
|
const computedHandles = computed(() => {
|
|
14833
|
-
const
|
|
15090
|
+
const shape = props.handleShape;
|
|
15091
|
+
const size = shape === "rect" ? 8 : 10;
|
|
14834
15092
|
const { width = 0, height = 0, borderRadius } = model.value;
|
|
14835
15093
|
const center = { x: width / 2, y: height / 2 };
|
|
14836
|
-
const shape = props.handleShape;
|
|
14837
15094
|
const lines = [
|
|
14838
|
-
{ type: "
|
|
14839
|
-
{ type: "
|
|
14840
|
-
{ type: "
|
|
14841
|
-
{ type: "
|
|
15095
|
+
{ type: "t", points: [[0, 0], [1, 0]] },
|
|
15096
|
+
{ type: "r", points: [[1, 0], [1, 1]] },
|
|
15097
|
+
{ type: "b", points: [[0, 1], [1, 1]] },
|
|
15098
|
+
{ type: "l", points: [[0, 0], [0, 1]] }
|
|
14842
15099
|
];
|
|
14843
15100
|
const points = [
|
|
14844
|
-
{ type: "
|
|
14845
|
-
{ type: "
|
|
14846
|
-
{ type: "
|
|
14847
|
-
{ type: "
|
|
14848
|
-
{ type: "
|
|
14849
|
-
{ type: "
|
|
14850
|
-
{ type: "
|
|
14851
|
-
{ type: "
|
|
15101
|
+
{ type: "t", point: [0.5, 0], width: 1.4, height: 0.6 },
|
|
15102
|
+
{ type: "r", point: [1, 0.5], width: 0.6, height: 1.4 },
|
|
15103
|
+
{ type: "b", point: [0.5, 1], width: 1.4, height: 0.6 },
|
|
15104
|
+
{ type: "l", point: [0, 0.5], width: 0.6, height: 1.4 },
|
|
15105
|
+
{ type: "tl", point: [0, 0] },
|
|
15106
|
+
{ type: "tr", point: [1, 0] },
|
|
15107
|
+
{ type: "bl", point: [0, 1] },
|
|
15108
|
+
{ type: "br", point: [1, 1] }
|
|
14852
15109
|
];
|
|
14853
15110
|
const lineHandles = lines.map((item) => {
|
|
14854
15111
|
const [p1, p2] = item.points;
|
|
@@ -14865,31 +15122,47 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14865
15122
|
};
|
|
14866
15123
|
});
|
|
14867
15124
|
const pointHandles = points.map((item) => {
|
|
15125
|
+
const _w = size * (item.width ?? 1);
|
|
15126
|
+
const _h = size * (item.height ?? 1);
|
|
14868
15127
|
return {
|
|
14869
15128
|
type: item.type,
|
|
14870
15129
|
shape,
|
|
14871
|
-
x: item.point[0] * width -
|
|
14872
|
-
y: item.point[1] * height -
|
|
14873
|
-
width:
|
|
14874
|
-
height:
|
|
15130
|
+
x: item.point[0] * width - _w / 2,
|
|
15131
|
+
y: item.point[1] * height - _h / 2,
|
|
15132
|
+
width: _w,
|
|
15133
|
+
height: _h
|
|
14875
15134
|
};
|
|
14876
15135
|
});
|
|
14877
|
-
const diagonalPointHandles = pointHandles.filter((item) => item.type.
|
|
15136
|
+
const diagonalPointHandles = pointHandles.filter((item) => item.type.length === 2);
|
|
14878
15137
|
const rotateHandles = diagonalPointHandles.map((item) => {
|
|
14879
|
-
const
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
15138
|
+
const _w = item.width * 1.5;
|
|
15139
|
+
const _h = item.height * 1.5;
|
|
15140
|
+
let x = item.x;
|
|
15141
|
+
let y = item.y;
|
|
15142
|
+
if (center.x > item.x) {
|
|
15143
|
+
x -= _w;
|
|
15144
|
+
} else {
|
|
15145
|
+
x += item.width;
|
|
15146
|
+
}
|
|
15147
|
+
if (center.y > item.y) {
|
|
15148
|
+
y -= _h;
|
|
15149
|
+
} else {
|
|
15150
|
+
y += item.height;
|
|
15151
|
+
}
|
|
14883
15152
|
return {
|
|
14884
15153
|
...item,
|
|
14885
15154
|
shape: void 0,
|
|
14886
15155
|
type: `rotate-${item.type}`,
|
|
14887
|
-
x
|
|
14888
|
-
y
|
|
15156
|
+
x,
|
|
15157
|
+
y,
|
|
15158
|
+
width: _w,
|
|
15159
|
+
height: _h
|
|
14889
15160
|
};
|
|
14890
15161
|
});
|
|
14891
15162
|
const minSize = Math.min(width, height);
|
|
14892
|
-
const
|
|
15163
|
+
const roundedHandles = props.roundable ? diagonalPointHandles.map((item) => {
|
|
15164
|
+
const _w = item.width * 0.8;
|
|
15165
|
+
const _h = item.height * 0.8;
|
|
14893
15166
|
const sign2 = {
|
|
14894
15167
|
x: center.x - item.x > 0 ? 1 : -1,
|
|
14895
15168
|
y: center.y - item.y > 0 ? 1 : -1
|
|
@@ -14900,9 +15173,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14900
15173
|
return {
|
|
14901
15174
|
...item,
|
|
14902
15175
|
shape: "circle",
|
|
14903
|
-
type: `
|
|
15176
|
+
type: `round-${item.type}`,
|
|
14904
15177
|
x: item.x + sign2.x * width / 2 * ws,
|
|
14905
|
-
y: item.y + sign2.y * height / 2 * hs
|
|
15178
|
+
y: item.y + sign2.y * height / 2 * hs,
|
|
15179
|
+
width: _w,
|
|
15180
|
+
height: _h
|
|
14906
15181
|
};
|
|
14907
15182
|
}) : [];
|
|
14908
15183
|
let handles;
|
|
@@ -14912,8 +15187,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14912
15187
|
...lineHandles.map((item) => ({ ...item, type: "move" })),
|
|
14913
15188
|
// resize
|
|
14914
15189
|
...pointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14915
|
-
//
|
|
14916
|
-
...
|
|
15190
|
+
// round
|
|
15191
|
+
...roundedHandles,
|
|
14917
15192
|
// rotate
|
|
14918
15193
|
...rotateHandles
|
|
14919
15194
|
];
|
|
@@ -14922,8 +15197,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14922
15197
|
// resize
|
|
14923
15198
|
...lineHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14924
15199
|
...diagonalPointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14925
|
-
//
|
|
14926
|
-
...
|
|
15200
|
+
// round
|
|
15201
|
+
...roundedHandles,
|
|
14927
15202
|
// rotate
|
|
14928
15203
|
...rotateHandles
|
|
14929
15204
|
];
|
|
@@ -14971,11 +15246,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14971
15246
|
}
|
|
14972
15247
|
const handle = index === void 0 ? { type: "move", x: 0, y: 0, width: 0, height: 0 } : computedHandles.value[index];
|
|
14973
15248
|
activeHandle.value = handle.type;
|
|
14974
|
-
const
|
|
14975
|
-
const
|
|
14976
|
-
const
|
|
14977
|
-
const
|
|
14978
|
-
const
|
|
15249
|
+
const handleArr = handle.type.split("-");
|
|
15250
|
+
const last = handleArr.length > 1 ? handleArr.pop() || "" : "";
|
|
15251
|
+
const key = handleArr.join("-");
|
|
15252
|
+
const isMove = key === "move";
|
|
15253
|
+
const isRotate = key === "rotate";
|
|
15254
|
+
const isRound = key === "round";
|
|
15255
|
+
const isHorizontal = last === "l" || last === "r";
|
|
15256
|
+
const isHorizontalVertical = last.length === 1;
|
|
14979
15257
|
const centerPoint = {
|
|
14980
15258
|
x: left + width / 2,
|
|
14981
15259
|
y: top + height / 2
|
|
@@ -15009,7 +15287,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15009
15287
|
if (!props.threshold && !transforming.value) {
|
|
15010
15288
|
startTransform();
|
|
15011
15289
|
}
|
|
15012
|
-
function
|
|
15290
|
+
function _onPointerMove(event2) {
|
|
15013
15291
|
const updated = {};
|
|
15014
15292
|
if (!startClientPoint) {
|
|
15015
15293
|
startClientPoint = { x: event2.clientX, y: event2.clientY };
|
|
@@ -15041,7 +15319,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15041
15319
|
) / (Math.PI / 180);
|
|
15042
15320
|
updated.rotate = (rotate + endAngle - startAngle + 360) % 360;
|
|
15043
15321
|
}
|
|
15044
|
-
} else if (
|
|
15322
|
+
} else if (isRound) {
|
|
15045
15323
|
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
15046
15324
|
const dx = -sign2.x * offset2.x;
|
|
15047
15325
|
const dy = -sign2.y * offset2.y;
|
|
@@ -15118,15 +15396,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15118
15396
|
model.value = newValue;
|
|
15119
15397
|
emit("move", newValue, oldValue);
|
|
15120
15398
|
}
|
|
15121
|
-
function
|
|
15122
|
-
window.removeEventListener("pointermove",
|
|
15123
|
-
window.removeEventListener("pointerup",
|
|
15399
|
+
function _onPointerUp() {
|
|
15400
|
+
window.removeEventListener("pointermove", _onPointerMove);
|
|
15401
|
+
window.removeEventListener("pointerup", _onPointerUp, true);
|
|
15124
15402
|
transforming.value = false;
|
|
15125
15403
|
activeHandle.value = void 0;
|
|
15126
15404
|
emit("end", model.value);
|
|
15127
15405
|
}
|
|
15128
|
-
window.addEventListener("pointermove",
|
|
15129
|
-
window.addEventListener("pointerup",
|
|
15406
|
+
window.addEventListener("pointermove", _onPointerMove);
|
|
15407
|
+
window.addEventListener("pointerup", _onPointerUp, true);
|
|
15130
15408
|
return true;
|
|
15131
15409
|
}
|
|
15132
15410
|
const cursorMap = {
|
|
@@ -15220,17 +15498,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15220
15498
|
default:
|
|
15221
15499
|
return void 0;
|
|
15222
15500
|
}
|
|
15223
|
-
if (handle === "resize-
|
|
15501
|
+
if (handle === "resize-t" || handle === "resize-r" || handle === "resize-tr" || handle === "resize-bl") {
|
|
15224
15502
|
return h("line", {
|
|
15225
|
-
class: "mce-
|
|
15503
|
+
class: "mce-transform-controls__diagonal",
|
|
15226
15504
|
x1: "100%",
|
|
15227
15505
|
y1: "0",
|
|
15228
15506
|
x2: "0",
|
|
15229
15507
|
y2: "100%"
|
|
15230
15508
|
});
|
|
15231
|
-
} else if (handle === "resize-
|
|
15509
|
+
} else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
|
|
15232
15510
|
return h("line", {
|
|
15233
|
-
class: "mce-
|
|
15511
|
+
class: "mce-transform-controls__diagonal",
|
|
15234
15512
|
x1: "0",
|
|
15235
15513
|
y1: "0",
|
|
15236
15514
|
x2: "100%",
|
|
@@ -15241,15 +15519,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15241
15519
|
}
|
|
15242
15520
|
return (_ctx, _cache) => {
|
|
15243
15521
|
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
|
|
15244
|
-
class: normalizeClass(["mce-
|
|
15245
|
-
transforming.value && "mce-
|
|
15246
|
-
props.hideUi && "mce-
|
|
15247
|
-
__props.resizeStrategy && `mce-
|
|
15248
|
-
activeHandle.value && `mce-
|
|
15249
|
-
activeHandle.value === "move" && "mce-
|
|
15250
|
-
activeHandle.value?.startsWith("resize") && "mce-
|
|
15251
|
-
activeHandle.value?.startsWith("rotate") && "mce-
|
|
15252
|
-
props.borderStyle && `mce-
|
|
15522
|
+
class: normalizeClass(["mce-transform-controls", [
|
|
15523
|
+
transforming.value && "mce-transform-controls--transforming",
|
|
15524
|
+
props.hideUi && "mce-transform-controls--hide-ui",
|
|
15525
|
+
__props.resizeStrategy && `mce-transform-controls--${__props.resizeStrategy}`,
|
|
15526
|
+
activeHandle.value && `mce-transform-controls--${activeHandle.value}`,
|
|
15527
|
+
activeHandle.value === "move" && "mce-transform-controls--moving",
|
|
15528
|
+
activeHandle.value?.startsWith("resize") && "mce-transform-controls--resizing",
|
|
15529
|
+
activeHandle.value?.startsWith("rotate") && "mce-transform-controls--rotateing",
|
|
15530
|
+
props.borderStyle && `mce-transform-controls--${props.borderStyle}`
|
|
15253
15531
|
]]),
|
|
15254
15532
|
style: normalizeStyle$1(style.value)
|
|
15255
15533
|
}, {
|
|
@@ -15262,14 +15540,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15262
15540
|
start
|
|
15263
15541
|
}),
|
|
15264
15542
|
(openBlock(), createElementBlock("svg", _hoisted_1$4, [
|
|
15265
|
-
_cache[
|
|
15543
|
+
_cache[1] || (_cache[1] = createElementVNode("rect", {
|
|
15266
15544
|
width: "100%",
|
|
15267
15545
|
height: "100%",
|
|
15268
15546
|
fill: "none",
|
|
15269
|
-
class: "mce-
|
|
15547
|
+
class: "mce-transform-controls__rect"
|
|
15270
15548
|
}, null, -1)),
|
|
15271
15549
|
createElementVNode("rect", {
|
|
15272
|
-
class: "mce-
|
|
15550
|
+
class: "mce-transform-controls__rect",
|
|
15273
15551
|
width: "100%",
|
|
15274
15552
|
height: "100%",
|
|
15275
15553
|
fill: "none",
|
|
@@ -15277,7 +15555,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15277
15555
|
ry: model.value.borderRadius
|
|
15278
15556
|
}, null, 8, _hoisted_2$1),
|
|
15279
15557
|
createVNode(Diagonal),
|
|
15280
|
-
createElementVNode("g",
|
|
15558
|
+
createElementVNode("g", _hoisted_3$1, [
|
|
15281
15559
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15282
15560
|
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
15283
15561
|
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -15288,20 +15566,37 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15288
15566
|
width: handle.width,
|
|
15289
15567
|
height: handle.height,
|
|
15290
15568
|
"aria-label": handle.type,
|
|
15291
|
-
class: "mce-
|
|
15292
|
-
}, null, 8,
|
|
15569
|
+
class: "mce-transform-controls__handle"
|
|
15570
|
+
}, null, 8, _hoisted_4)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
|
|
15293
15571
|
key: 1,
|
|
15294
15572
|
cx: handle.x + handle.width / 2,
|
|
15295
15573
|
cy: handle.y + handle.width / 2,
|
|
15296
15574
|
r: handle.width / 2,
|
|
15297
15575
|
"aria-label": handle.type,
|
|
15298
|
-
class: "mce-
|
|
15299
|
-
}, null, 8,
|
|
15576
|
+
class: "mce-transform-controls__handle"
|
|
15577
|
+
}, null, 8, _hoisted_5)) : (openBlock(), createElementBlock("rect", {
|
|
15578
|
+
key: 2,
|
|
15579
|
+
x: handle.x,
|
|
15580
|
+
y: handle.y,
|
|
15581
|
+
width: handle.width,
|
|
15582
|
+
height: handle.height,
|
|
15583
|
+
"aria-label": handle.type,
|
|
15584
|
+
rx: handle.width / 4,
|
|
15585
|
+
ry: handle.height / 4,
|
|
15586
|
+
class: "mce-transform-controls__handle"
|
|
15587
|
+
}, null, 8, _hoisted_6))
|
|
15300
15588
|
], 64)) : createCommentVNode("", true)
|
|
15301
15589
|
], 64);
|
|
15302
|
-
}), 128))
|
|
15590
|
+
}), 128)),
|
|
15591
|
+
__props.rotator ? (openBlock(), createElementBlock("g", {
|
|
15592
|
+
key: 0,
|
|
15593
|
+
transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
|
|
15594
|
+
class: "mce-transform-controls__rotator"
|
|
15595
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
15596
|
+
createElementVNode("path", { d: "M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" }, null, -1)
|
|
15597
|
+
])], 8, _hoisted_7)) : createCommentVNode("", true)
|
|
15303
15598
|
]),
|
|
15304
|
-
createElementVNode("g",
|
|
15599
|
+
createElementVNode("g", _hoisted_8, [
|
|
15305
15600
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15306
15601
|
return openBlock(), createElementBlock("rect", {
|
|
15307
15602
|
key: index,
|
|
@@ -15313,17 +15608,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15313
15608
|
width: handle.width,
|
|
15314
15609
|
height: handle.height,
|
|
15315
15610
|
"aria-label": handle.type,
|
|
15316
|
-
class: "mce-
|
|
15611
|
+
class: "mce-transform-controls__handle-rect",
|
|
15317
15612
|
cursor: transforming.value ? "auto" : getCursor(handle.type),
|
|
15318
15613
|
onPointerdown: (event) => start(event, index)
|
|
15319
|
-
}, null, 40,
|
|
15614
|
+
}, null, 40, _hoisted_9);
|
|
15320
15615
|
}), 128))
|
|
15321
15616
|
]),
|
|
15322
|
-
createElementVNode("g",
|
|
15617
|
+
createElementVNode("g", _hoisted_10, [
|
|
15323
15618
|
renderSlot(_ctx.$slots, "svg", { box: model.value })
|
|
15324
15619
|
])
|
|
15325
15620
|
])),
|
|
15326
|
-
tip.value ? (openBlock(), createElementBlock("div",
|
|
15621
|
+
tip.value ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(tip.value), 1)) : createCommentVNode("", true)
|
|
15327
15622
|
]),
|
|
15328
15623
|
_: 3
|
|
15329
15624
|
}, 8, ["class", "style"]);
|
|
@@ -15536,6 +15831,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15536
15831
|
setup(__props, { expose: __expose }) {
|
|
15537
15832
|
const props = __props;
|
|
15538
15833
|
const {
|
|
15834
|
+
emit,
|
|
15539
15835
|
isElement,
|
|
15540
15836
|
state,
|
|
15541
15837
|
resizeElement,
|
|
@@ -15553,17 +15849,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15553
15849
|
config,
|
|
15554
15850
|
snapThreshold,
|
|
15555
15851
|
getSnapPoints,
|
|
15556
|
-
|
|
15557
|
-
getGlobalPointer
|
|
15852
|
+
hoverElement
|
|
15558
15853
|
} = useEditor();
|
|
15559
15854
|
const transformable = useTemplateRef("transformableTpl");
|
|
15560
|
-
const
|
|
15561
|
-
const currentEvent = ref();
|
|
15855
|
+
const startEvent = ref();
|
|
15562
15856
|
onBeforeMount(() => {
|
|
15563
15857
|
registerCommand({
|
|
15564
15858
|
command: "startTransform",
|
|
15565
15859
|
handle: (event) => {
|
|
15566
|
-
|
|
15860
|
+
startEvent.value = event;
|
|
15567
15861
|
Boolean(transformable.value?.start(event));
|
|
15568
15862
|
}
|
|
15569
15863
|
});
|
|
@@ -15637,6 +15931,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15637
15931
|
}
|
|
15638
15932
|
return currentPos;
|
|
15639
15933
|
}
|
|
15934
|
+
function createSelectionTransformContext() {
|
|
15935
|
+
return {
|
|
15936
|
+
startEvent: startEvent.value,
|
|
15937
|
+
handle: transformable.value?.activeHandle ?? "move",
|
|
15938
|
+
elements: elementSelection.value
|
|
15939
|
+
};
|
|
15940
|
+
}
|
|
15640
15941
|
const transform = computed({
|
|
15641
15942
|
get: () => _transform2.value,
|
|
15642
15943
|
set: (val) => {
|
|
@@ -15684,7 +15985,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15684
15985
|
element,
|
|
15685
15986
|
newStyle.width / element.style.width,
|
|
15686
15987
|
newStyle.height / element.style.height,
|
|
15687
|
-
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-").length >
|
|
15988
|
+
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-")[1].length > 1 ? { deep: true, textFontSizeToFit: true } : { deep: true, textToFit: true }
|
|
15688
15989
|
);
|
|
15689
15990
|
newStyle.width = element.style.width;
|
|
15690
15991
|
newStyle.height = element.style.height;
|
|
@@ -15697,16 +15998,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15697
15998
|
}
|
|
15698
15999
|
return false;
|
|
15699
16000
|
});
|
|
15700
|
-
if (handle === "move" && !currentEvent.value?.__FORM__) {
|
|
15701
|
-
handleDragOutReparent(
|
|
15702
|
-
element,
|
|
15703
|
-
{
|
|
15704
|
-
...startContext.value[element.instanceId],
|
|
15705
|
-
pointer: getGlobalPointer()
|
|
15706
|
-
}
|
|
15707
|
-
);
|
|
15708
|
-
}
|
|
15709
16001
|
});
|
|
16002
|
+
emit("selectionTransforming", createSelectionTransformContext());
|
|
15710
16003
|
}
|
|
15711
16004
|
});
|
|
15712
16005
|
const movable = computed(() => {
|
|
@@ -15724,19 +16017,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15724
16017
|
return !isLock(element) && element.meta.rotatable !== false && element.meta.transformable !== false;
|
|
15725
16018
|
});
|
|
15726
16019
|
});
|
|
15727
|
-
const
|
|
15728
|
-
|
|
15729
|
-
|
|
16020
|
+
const roundable = computed(() => {
|
|
16021
|
+
if (elementSelection.value.length === 1) {
|
|
16022
|
+
const element = elementSelection.value[0];
|
|
16023
|
+
return hoverElement.value?.equal(element) && !isLock(element) && element.foreground.isValid();
|
|
16024
|
+
}
|
|
16025
|
+
return false;
|
|
15730
16026
|
});
|
|
15731
16027
|
function onStart() {
|
|
15732
|
-
|
|
15733
|
-
elementSelection.value.forEach((el) => {
|
|
15734
|
-
ctx[el.instanceId] = {
|
|
15735
|
-
parent: el.getParent(),
|
|
15736
|
-
index: el.getIndex()
|
|
15737
|
-
};
|
|
15738
|
-
});
|
|
15739
|
-
startContext.value = ctx;
|
|
16028
|
+
emit("selectionTransformStart", createSelectionTransformContext());
|
|
15740
16029
|
}
|
|
15741
16030
|
function onMove() {
|
|
15742
16031
|
if (!state.value) {
|
|
@@ -15747,7 +16036,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15747
16036
|
if (state.value === "transforming") {
|
|
15748
16037
|
state.value = void 0;
|
|
15749
16038
|
}
|
|
15750
|
-
|
|
16039
|
+
emit("selectionTransformEnd", createSelectionTransformContext());
|
|
15751
16040
|
}
|
|
15752
16041
|
function tipFormat() {
|
|
15753
16042
|
const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : selectionObb.value;
|
|
@@ -15786,24 +16075,24 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15786
16075
|
})
|
|
15787
16076
|
}, null, 4);
|
|
15788
16077
|
}), 128)),
|
|
15789
|
-
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, {
|
|
16078
|
+
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, mergeProps({
|
|
15790
16079
|
key: 1,
|
|
15791
|
-
ref: "transformableTpl"
|
|
16080
|
+
ref: "transformableTpl"
|
|
16081
|
+
}, unref(config).transformControls, {
|
|
15792
16082
|
modelValue: transform.value,
|
|
15793
16083
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
|
|
15794
16084
|
movable: unref(state) !== "typing" && movable.value,
|
|
15795
16085
|
resizable: unref(state) !== "typing" && resizable.value,
|
|
15796
16086
|
rotatable: unref(state) !== "typing" && rotatable.value,
|
|
15797
|
-
"
|
|
16087
|
+
roundable: unref(state) !== "typing" && roundable.value,
|
|
15798
16088
|
"resize-strategy": props.resizeStrategy,
|
|
15799
|
-
"handle-shape": unref(config).handleShape,
|
|
15800
16089
|
class: "mce-selector__transform",
|
|
15801
16090
|
"border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
|
|
15802
16091
|
"tip-format": tipFormat,
|
|
15803
16092
|
onStart,
|
|
15804
16093
|
onMove,
|
|
15805
16094
|
onEnd
|
|
15806
|
-
}, createSlots({ _: 2 }, [
|
|
16095
|
+
}), createSlots({ _: 2 }, [
|
|
15807
16096
|
_ctx.$slots.transformable ? {
|
|
15808
16097
|
name: "svg",
|
|
15809
16098
|
fn: withCtx((slotProps) => [
|
|
@@ -15811,7 +16100,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15811
16100
|
]),
|
|
15812
16101
|
key: "0"
|
|
15813
16102
|
} : void 0
|
|
15814
|
-
]),
|
|
16103
|
+
]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "border-style"])) : createCommentVNode("", true),
|
|
15815
16104
|
transform.value.width && transform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
|
|
15816
16105
|
key: 2,
|
|
15817
16106
|
class: "mce-selector__slot",
|
|
@@ -16104,7 +16393,7 @@ const _hoisted_2 = {
|
|
|
16104
16393
|
};
|
|
16105
16394
|
const _hoisted_3 = {
|
|
16106
16395
|
ref: "overlayContainerTpl",
|
|
16107
|
-
class: "mce-
|
|
16396
|
+
class: "mce-overlay-container"
|
|
16108
16397
|
};
|
|
16109
16398
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
16110
16399
|
__name: "EditorLayout",
|
|
@@ -16177,17 +16466,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16177
16466
|
renderEngine.value.resize(width, height);
|
|
16178
16467
|
});
|
|
16179
16468
|
onBeforeMount(() => {
|
|
16180
|
-
renderEngine.value.on("pointerdown",
|
|
16181
|
-
renderEngine.value.on("pointermove",
|
|
16182
|
-
renderEngine.value.on("pointerover",
|
|
16469
|
+
renderEngine.value.on("pointerdown", onEnginePointerDown);
|
|
16470
|
+
renderEngine.value.on("pointermove", onEnginePointerMove);
|
|
16471
|
+
renderEngine.value.on("pointerover", onEnginePointerOver);
|
|
16183
16472
|
});
|
|
16184
16473
|
onMounted(() => {
|
|
16185
16474
|
bindRenderCanvas(canvas.value, drawboardDom.value);
|
|
16186
16475
|
});
|
|
16187
16476
|
onBeforeUnmount(() => {
|
|
16188
|
-
renderEngine.value.off("pointerdown",
|
|
16189
|
-
renderEngine.value.off("pointermove",
|
|
16190
|
-
renderEngine.value.off("pointerover",
|
|
16477
|
+
renderEngine.value.off("pointerdown", onEnginePointerDown);
|
|
16478
|
+
renderEngine.value.off("pointermove", onEnginePointerMove);
|
|
16479
|
+
renderEngine.value.off("pointerover", onEnginePointerOver);
|
|
16191
16480
|
});
|
|
16192
16481
|
function onHover(event) {
|
|
16193
16482
|
let cursor;
|
|
@@ -16211,14 +16500,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16211
16500
|
hovered = result;
|
|
16212
16501
|
}
|
|
16213
16502
|
}
|
|
16214
|
-
if (!(isElement(hovered) && !isLock(hovered) && !hovered.findAncestor((ancestor) => isLock(ancestor)) && !isTopFrame(hovered))) {
|
|
16503
|
+
if (!(isElement(hovered) && !isLock(hovered) && !hovered.findAncestor((ancestor) => isLock(ancestor)) && (!hovered.children.some((node) => isElement(node)) || !isTopFrame(hovered)))) {
|
|
16215
16504
|
hovered = void 0;
|
|
16216
16505
|
cursor = void 0;
|
|
16217
16506
|
}
|
|
16218
16507
|
hoverElement.value = hovered;
|
|
16219
16508
|
setCursor(cursor);
|
|
16220
16509
|
}
|
|
16221
|
-
function
|
|
16510
|
+
function onEnginePointerDown(downEvent, options = {}) {
|
|
16222
16511
|
if (downEvent.srcElement && downEvent.srcElement !== drawboardDom.value && downEvent.srcElement.dataset?.pointerdown_to_drawboard === void 0 || camera.value.spaceKey || ![0, 2].includes(downEvent.button)) {
|
|
16223
16512
|
return;
|
|
16224
16513
|
}
|
|
@@ -16226,7 +16515,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16226
16515
|
allowTopFrame = false
|
|
16227
16516
|
} = options;
|
|
16228
16517
|
function isIncluded(node) {
|
|
16229
|
-
return isElement(node) && !isLock(node) && (allowTopFrame || !isTopFrame(node)) && !node.findAncestor((ancestor) => isLock(ancestor));
|
|
16518
|
+
return isElement(node) && !isLock(node) && (allowTopFrame || (!node.children.some((node2) => isElement(node2)) || !isTopFrame(node))) && !node.findAncestor((ancestor) => isLock(ancestor));
|
|
16230
16519
|
}
|
|
16231
16520
|
const drawing = state.value === "drawing";
|
|
16232
16521
|
const hand = state.value === "hand";
|
|
@@ -16239,7 +16528,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16239
16528
|
let isUp = false;
|
|
16240
16529
|
let selected = [];
|
|
16241
16530
|
let ctxState;
|
|
16242
|
-
const inSelection = selectionAabbInDrawboard.value.contains({
|
|
16531
|
+
const inSelection = allowTopFrame && elementSelection.value.some((node) => node.equal(element)) || selectionAabbInDrawboard.value.contains({
|
|
16243
16532
|
x: start.x - drawboardAabb.value.left,
|
|
16244
16533
|
y: start.y - drawboardAabb.value.top
|
|
16245
16534
|
});
|
|
@@ -16323,7 +16612,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16323
16612
|
function canStartDrag() {
|
|
16324
16613
|
return !dragging && (Math.abs(current.x - start.x) >= 3 || Math.abs(current.y - start.y) >= 3);
|
|
16325
16614
|
}
|
|
16326
|
-
function
|
|
16615
|
+
function _onEnginePointerMove(moveEvent) {
|
|
16327
16616
|
if (drawing || hand) ;
|
|
16328
16617
|
else {
|
|
16329
16618
|
if (inSelection) {
|
|
@@ -16346,7 +16635,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16346
16635
|
}
|
|
16347
16636
|
}
|
|
16348
16637
|
}
|
|
16349
|
-
function
|
|
16638
|
+
function _onPointerMove(moveEvent) {
|
|
16350
16639
|
current = { x: moveEvent.clientX, y: moveEvent.clientY };
|
|
16351
16640
|
if (drawing) {
|
|
16352
16641
|
drawingTool?.move?.(
|
|
@@ -16369,7 +16658,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16369
16658
|
}
|
|
16370
16659
|
prev = { ...current };
|
|
16371
16660
|
}
|
|
16372
|
-
async function
|
|
16661
|
+
async function _onPointerUp(upEvent) {
|
|
16373
16662
|
current = { x: upEvent.clientX, y: upEvent.clientY };
|
|
16374
16663
|
if (drawing) {
|
|
16375
16664
|
drawingTool?.end?.(
|
|
@@ -16402,30 +16691,26 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16402
16691
|
onHover(downEvent);
|
|
16403
16692
|
}
|
|
16404
16693
|
}
|
|
16405
|
-
renderEngine.value.off("pointermove",
|
|
16406
|
-
document.removeEventListener("pointermove",
|
|
16407
|
-
document.removeEventListener("pointerup",
|
|
16694
|
+
renderEngine.value.off("pointermove", _onEnginePointerMove);
|
|
16695
|
+
document.removeEventListener("pointermove", _onPointerMove);
|
|
16696
|
+
document.removeEventListener("pointerup", _onPointerUp);
|
|
16408
16697
|
isUp = true;
|
|
16409
16698
|
}
|
|
16410
|
-
renderEngine.value.on("pointermove",
|
|
16411
|
-
document.addEventListener("pointermove",
|
|
16412
|
-
document.addEventListener("pointerup",
|
|
16699
|
+
renderEngine.value.on("pointermove", _onEnginePointerMove);
|
|
16700
|
+
document.addEventListener("pointermove", _onPointerMove);
|
|
16701
|
+
document.addEventListener("pointerup", _onPointerUp);
|
|
16413
16702
|
}
|
|
16414
|
-
editor.registerCommand({ command: "
|
|
16415
|
-
function
|
|
16703
|
+
editor.registerCommand({ command: "pointerDown", handle: onEnginePointerDown });
|
|
16704
|
+
function onEnginePointerMove(event) {
|
|
16416
16705
|
if (event.srcElement !== drawboardDom.value) {
|
|
16417
16706
|
return;
|
|
16418
16707
|
}
|
|
16419
|
-
drawboardPointer.value = new Vector2$1(
|
|
16420
|
-
event.clientX - drawboardAabb.value.left,
|
|
16421
|
-
event.clientY - drawboardAabb.value.top
|
|
16422
|
-
);
|
|
16423
16708
|
if (camera.value.grabbing || event.button === 1 || state.value && state.value !== "typing") {
|
|
16424
16709
|
return;
|
|
16425
16710
|
}
|
|
16426
16711
|
onHover(event);
|
|
16427
16712
|
}
|
|
16428
|
-
function
|
|
16713
|
+
function onEnginePointerOver(event) {
|
|
16429
16714
|
if (event.srcElement !== drawboardDom.value) {
|
|
16430
16715
|
return;
|
|
16431
16716
|
}
|
|
@@ -16478,36 +16763,33 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16478
16763
|
}, ["prevent"]))
|
|
16479
16764
|
}, [
|
|
16480
16765
|
createElementVNode("canvas", _hoisted_2, null, 512),
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
"
|
|
16485
|
-
"
|
|
16766
|
+
slots.floatbar ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16767
|
+
key: 0,
|
|
16768
|
+
location: "top-start",
|
|
16769
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16770
|
+
middlewares: ["offset", "shift"]
|
|
16486
16771
|
}, {
|
|
16487
|
-
|
|
16488
|
-
renderSlot(_ctx.$slots, "
|
|
16489
|
-
]),
|
|
16490
|
-
default: withCtx(({ box }) => [
|
|
16491
|
-
createVNode(_sfc_main$8),
|
|
16492
|
-
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16772
|
+
default: withCtx(() => [
|
|
16773
|
+
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps)))
|
|
16493
16774
|
]),
|
|
16494
16775
|
_: 3
|
|
16495
|
-
}, 8, ["
|
|
16496
|
-
slots
|
|
16497
|
-
key:
|
|
16776
|
+
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16777
|
+
slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16778
|
+
key: 1,
|
|
16498
16779
|
location: "top-start",
|
|
16499
|
-
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
|
|
16780
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16781
|
+
middlewares: ["offset", "shift"]
|
|
16500
16782
|
}, {
|
|
16501
16783
|
default: withCtx(() => [
|
|
16502
|
-
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps))),
|
|
16503
16784
|
renderSlot(_ctx.$slots, "floatbar-top", normalizeProps(guardReactiveProps(slotProps)))
|
|
16504
16785
|
]),
|
|
16505
16786
|
_: 3
|
|
16506
16787
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16507
16788
|
slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16508
|
-
key:
|
|
16789
|
+
key: 2,
|
|
16509
16790
|
location: "bottom-start",
|
|
16510
|
-
target: selector.value?.transformable?.$el
|
|
16791
|
+
target: selector.value?.transformable?.$el,
|
|
16792
|
+
middlewares: ["offset", "shift"]
|
|
16511
16793
|
}, {
|
|
16512
16794
|
default: withCtx(() => [
|
|
16513
16795
|
renderSlot(_ctx.$slots, "floatbar-bottom", normalizeProps(guardReactiveProps(slotProps)))
|
|
@@ -16517,6 +16799,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16517
16799
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay, (p, key) => {
|
|
16518
16800
|
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16519
16801
|
}), 128)),
|
|
16802
|
+
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
16803
|
+
createVNode(_sfc_main$7, {
|
|
16804
|
+
ref: "selectorTpl",
|
|
16805
|
+
"selected-area": selectedArea.value,
|
|
16806
|
+
"resize-strategy": resizeStrategy.value
|
|
16807
|
+
}, {
|
|
16808
|
+
transformable: withCtx(({ box }) => [
|
|
16809
|
+
renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
|
|
16810
|
+
]),
|
|
16811
|
+
default: withCtx(({ box }) => [
|
|
16812
|
+
createVNode(_sfc_main$8),
|
|
16813
|
+
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16814
|
+
]),
|
|
16815
|
+
_: 3
|
|
16816
|
+
}, 8, ["selected-area", "resize-strategy"]),
|
|
16520
16817
|
renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
|
|
16521
16818
|
], 40, _hoisted_1)
|
|
16522
16819
|
]),
|
|
@@ -16642,7 +16939,7 @@ export {
|
|
|
16642
16939
|
_sfc_main$p as Ruler,
|
|
16643
16940
|
SUPPORTS_CLIPBOARD,
|
|
16644
16941
|
_sfc_main$n as Scrollbar,
|
|
16645
|
-
_sfc_main$a as
|
|
16942
|
+
_sfc_main$a as TransformControls,
|
|
16646
16943
|
USER_AGENT,
|
|
16647
16944
|
boundingBoxToStyle,
|
|
16648
16945
|
consoleError,
|
|
@@ -16667,6 +16964,7 @@ export {
|
|
|
16667
16964
|
imageExts,
|
|
16668
16965
|
imageMimeTypeExtMap,
|
|
16669
16966
|
isClickInsideElement,
|
|
16967
|
+
isInputElement,
|
|
16670
16968
|
isInputEvent,
|
|
16671
16969
|
isMac,
|
|
16672
16970
|
isWindows,
|