mce 0.12.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/components/Floatbar.vue.d.ts +1 -1
- package/dist/components/Layer.vue.d.ts +41 -0
- package/dist/components/Selector.vue.d.ts +4 -7
- package/dist/components/shared/Btn.vue.d.ts +13 -0
- package/dist/components/shared/FloatPanel.vue.d.ts +26 -0
- package/dist/components/shared/Tooltip.vue.d.ts +1 -1
- package/dist/components/shared/Transformable.vue.d.ts +2 -5
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/layer.d.ts +33 -0
- package/dist/index.css +179 -100
- package/dist/index.js +847 -414
- package/dist/locale/en.d.ts +2 -0
- package/dist/locale/zh-Hans.d.ts +80 -0
- package/dist/mixins/0.config/base.d.ts +1 -0
- package/dist/mixins/0.context.d.ts +2 -0
- package/dist/mixins/0.element.d.ts +4 -2
- package/dist/mixins/0.helper.d.ts +7 -4
- package/dist/mixins/1.frame.d.ts +2 -2
- package/dist/mixins/1.screen.d.ts +4 -3
- package/dist/plugins/layerOrder.d.ts +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,6 +116,7 @@ const _0_config_base = defineMixin((editor, options) => {
|
|
|
116
116
|
registerConfig("camera", false);
|
|
117
117
|
registerConfig("ruler", false);
|
|
118
118
|
registerConfig("scrollbar", false);
|
|
119
|
+
registerConfig("layers", false);
|
|
119
120
|
registerConfig("timeline", false);
|
|
120
121
|
registerConfig("statusbar", false);
|
|
121
122
|
registerConfig("wheelZoom", false);
|
|
@@ -615,7 +616,7 @@ class Doc extends Model {
|
|
|
615
616
|
const first = nodeMap[0];
|
|
616
617
|
let parent;
|
|
617
618
|
let childrenIds;
|
|
618
|
-
if (parentId) {
|
|
619
|
+
if (parentId && parentId !== this.root.id) {
|
|
619
620
|
parent = this.nodeMap.get(parentId);
|
|
620
621
|
childrenIds = this._yChildren.get(parentId)?.get("childrenIds");
|
|
621
622
|
} else {
|
|
@@ -688,7 +689,7 @@ class Doc extends Model {
|
|
|
688
689
|
const fromIndex = childrenIds.toJSON().indexOf(id);
|
|
689
690
|
childrenIds.delete(fromIndex, 1);
|
|
690
691
|
childrenIds.insert(toIndex, [id]);
|
|
691
|
-
if (parent) {
|
|
692
|
+
if (parent && !parent.equal(this.root)) {
|
|
692
693
|
parent.moveChild(node, toIndex);
|
|
693
694
|
} else {
|
|
694
695
|
this.root.moveChild(node, toIndex);
|
|
@@ -879,6 +880,8 @@ const _0_context = defineMixin((editor) => {
|
|
|
879
880
|
const drawboardAabb = ref({ left: 0, top: 0, width: 0, height: 0 });
|
|
880
881
|
const doc = ref(new Doc());
|
|
881
882
|
const root = computed(() => doc.value.root);
|
|
883
|
+
const nodes = ref([]);
|
|
884
|
+
const nodeIndexMap = reactive(/* @__PURE__ */ new Map());
|
|
882
885
|
const drawboardPointer = ref();
|
|
883
886
|
const state = ref();
|
|
884
887
|
const stateContext = ref();
|
|
@@ -908,10 +911,12 @@ const _0_context = defineMixin((editor) => {
|
|
|
908
911
|
timeline,
|
|
909
912
|
camera,
|
|
910
913
|
drawboardEffect,
|
|
914
|
+
doc,
|
|
911
915
|
root,
|
|
916
|
+
nodes,
|
|
917
|
+
nodeIndexMap,
|
|
912
918
|
drawboardDom,
|
|
913
919
|
drawboardAabb,
|
|
914
|
-
doc,
|
|
915
920
|
state,
|
|
916
921
|
stateContext,
|
|
917
922
|
setState,
|
|
@@ -919,13 +924,40 @@ const _0_context = defineMixin((editor) => {
|
|
|
919
924
|
drawboardPointer,
|
|
920
925
|
getGlobalPointer
|
|
921
926
|
});
|
|
927
|
+
return () => {
|
|
928
|
+
const {
|
|
929
|
+
on,
|
|
930
|
+
root: root2
|
|
931
|
+
} = editor;
|
|
932
|
+
function updateNodes(value) {
|
|
933
|
+
let node;
|
|
934
|
+
if (value) {
|
|
935
|
+
node = value;
|
|
936
|
+
} else {
|
|
937
|
+
nodes.value.length = 0;
|
|
938
|
+
nodeIndexMap.clear();
|
|
939
|
+
node = root2.value;
|
|
940
|
+
}
|
|
941
|
+
for (const ch of node.children) {
|
|
942
|
+
updateNodes(ch);
|
|
943
|
+
}
|
|
944
|
+
nodes.value.push(node);
|
|
945
|
+
nodeIndexMap.set(node.id, nodes.value.length - 1);
|
|
946
|
+
}
|
|
947
|
+
on("setDoc", () => updateNodes());
|
|
948
|
+
};
|
|
922
949
|
});
|
|
923
950
|
const _0_element = defineMixin((editor) => {
|
|
924
951
|
const selection = ref([]);
|
|
952
|
+
const elementSelection = computed({
|
|
953
|
+
get: () => selection.value.filter((v) => v instanceof Element2D),
|
|
954
|
+
set: (val) => selection.value = val
|
|
955
|
+
});
|
|
925
956
|
const hoverElement = ref();
|
|
926
957
|
const textSelection = ref();
|
|
927
958
|
Object.assign(editor, {
|
|
928
959
|
selection,
|
|
960
|
+
elementSelection,
|
|
929
961
|
textSelection,
|
|
930
962
|
hoverElement
|
|
931
963
|
});
|
|
@@ -984,6 +1016,9 @@ const _0_font = defineMixin((editor, options) => {
|
|
|
984
1016
|
};
|
|
985
1017
|
});
|
|
986
1018
|
const _0_helper = defineMixin((editor) => {
|
|
1019
|
+
const {
|
|
1020
|
+
root
|
|
1021
|
+
} = editor;
|
|
987
1022
|
const block = ["top", "bottom"];
|
|
988
1023
|
const inline = ["start", "end", "left", "right"];
|
|
989
1024
|
function toPhysical(str, isRtl) {
|
|
@@ -1003,19 +1038,37 @@ const _0_helper = defineMixin((editor) => {
|
|
|
1003
1038
|
align: toPhysical(align, isRtl)
|
|
1004
1039
|
};
|
|
1005
1040
|
};
|
|
1041
|
+
function isRoot(value) {
|
|
1042
|
+
return value instanceof Node$1 && root.value.equal(value);
|
|
1043
|
+
}
|
|
1044
|
+
function isElement(value) {
|
|
1045
|
+
return value instanceof Element2D;
|
|
1046
|
+
}
|
|
1006
1047
|
function isFrame(node) {
|
|
1007
|
-
return node
|
|
1048
|
+
return isElement(node) && node.meta.inEditorIs === "Frame";
|
|
1008
1049
|
}
|
|
1009
|
-
function
|
|
1010
|
-
return
|
|
1050
|
+
function isVisible(node) {
|
|
1051
|
+
return isElement(node) && node.style.visibility === "visible";
|
|
1011
1052
|
}
|
|
1012
|
-
function
|
|
1013
|
-
|
|
1053
|
+
function setVisible(node, visible) {
|
|
1054
|
+
if (isElement(node)) {
|
|
1055
|
+
node.style.visibility = visible ? "visible" : "hidden";
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function isLock(node) {
|
|
1059
|
+
return Boolean(node.meta.lock);
|
|
1060
|
+
}
|
|
1061
|
+
function setLock(node, lock) {
|
|
1062
|
+
node.meta.lock = lock;
|
|
1014
1063
|
}
|
|
1015
1064
|
Object.assign(editor, {
|
|
1016
1065
|
parseAnchor,
|
|
1066
|
+
isRoot,
|
|
1067
|
+
isElement,
|
|
1017
1068
|
isFrame,
|
|
1018
|
-
|
|
1069
|
+
isVisible,
|
|
1070
|
+
setVisible,
|
|
1071
|
+
isLock,
|
|
1019
1072
|
setLock
|
|
1020
1073
|
});
|
|
1021
1074
|
});
|
|
@@ -1065,9 +1118,11 @@ const en = {
|
|
|
1065
1118
|
"view:pixelGrid": "Pixel grid",
|
|
1066
1119
|
"view:ruler": "Ruler",
|
|
1067
1120
|
"view:scrollbar": "Scrollbar",
|
|
1121
|
+
"view:layers": "Layers",
|
|
1068
1122
|
"view:timeline": "Timeline",
|
|
1069
1123
|
"view:statusbar": "Statusbar",
|
|
1070
1124
|
"view:frameOutline": "Frame outlines",
|
|
1125
|
+
"layers": "Layers",
|
|
1071
1126
|
"zoomIn": "Zoom in",
|
|
1072
1127
|
"zoomOut": "Zoom out",
|
|
1073
1128
|
"zoomTo100": "Zoom to 100%",
|
|
@@ -1096,6 +1151,85 @@ const en = {
|
|
|
1096
1151
|
"alignBottom": "Align bottom",
|
|
1097
1152
|
"exporting": "Exporting"
|
|
1098
1153
|
};
|
|
1154
|
+
const zhHans = {
|
|
1155
|
+
"cancel": "取消",
|
|
1156
|
+
"constrainToAxis": "约束到轴",
|
|
1157
|
+
"loading": "加载中...",
|
|
1158
|
+
"exporting": "导出中...",
|
|
1159
|
+
"selecting": "选择中...",
|
|
1160
|
+
"selectObject": "选择对象",
|
|
1161
|
+
"commitChanges": "提交修改",
|
|
1162
|
+
"extend": "扩展",
|
|
1163
|
+
"goBackSelectedArea": "返回选中区域",
|
|
1164
|
+
"selectArea": "选择区域",
|
|
1165
|
+
"dragSelected": "拖拽选择的",
|
|
1166
|
+
"file": "文件",
|
|
1167
|
+
"new": "新建",
|
|
1168
|
+
"open": "打开",
|
|
1169
|
+
"import": "导入",
|
|
1170
|
+
"export": "导出",
|
|
1171
|
+
"saveAs:png": "另存为 PNG",
|
|
1172
|
+
"saveAs:jpeg": "另存为 JPEG",
|
|
1173
|
+
"saveAs:webp": "另存为 WEBP",
|
|
1174
|
+
"saveAs:svg": "另存为 SVG",
|
|
1175
|
+
"saveAs:gif": "另存为 GIF",
|
|
1176
|
+
"saveAs:mp4": "另存为 MP4",
|
|
1177
|
+
"saveAs:pdf": "另存为 PDF",
|
|
1178
|
+
"saveAs:pptx": "另存为 PPTX",
|
|
1179
|
+
"saveAs:json": "另存为 JSON",
|
|
1180
|
+
"edit": "编辑",
|
|
1181
|
+
"undo": "撤销",
|
|
1182
|
+
"redo": "重做",
|
|
1183
|
+
"cut": "剪切",
|
|
1184
|
+
"copy": "复制",
|
|
1185
|
+
"copyAs": "复制为",
|
|
1186
|
+
"copyAs:svg": "复制为 SVG",
|
|
1187
|
+
"copyAs:json": "复制为 JSON",
|
|
1188
|
+
"paste": "粘贴",
|
|
1189
|
+
"duplicate": "创建副本",
|
|
1190
|
+
"delete": "删除",
|
|
1191
|
+
"selectAll": "选择全部",
|
|
1192
|
+
"deselectAll": "反选全部",
|
|
1193
|
+
"selectParent": "选择父元素",
|
|
1194
|
+
"previousSelection": "选择前一个",
|
|
1195
|
+
"nextSelection": "选择后一个",
|
|
1196
|
+
"view": "视图",
|
|
1197
|
+
"view:checkerboard": "棋盘",
|
|
1198
|
+
"view:pixelGrid": "像素网格",
|
|
1199
|
+
"view:ruler": "标尺",
|
|
1200
|
+
"view:scrollbar": "滚动条",
|
|
1201
|
+
"view:layers": "图层",
|
|
1202
|
+
"view:timeline": "时间线",
|
|
1203
|
+
"view:statusbar": "状态栏",
|
|
1204
|
+
"view:frameOutline": "框架轮廓",
|
|
1205
|
+
"layers": "图层",
|
|
1206
|
+
"zoomIn": "放大",
|
|
1207
|
+
"zoomOut": "缩小",
|
|
1208
|
+
"zoomTo100": "缩放到100%",
|
|
1209
|
+
"zoomToFit": "缩放到合适",
|
|
1210
|
+
"zoomToSelection": "缩放到选区",
|
|
1211
|
+
"object": "对象",
|
|
1212
|
+
"groupSelection": "成组",
|
|
1213
|
+
"frameSelection": "成框架",
|
|
1214
|
+
"ungroup": "解组(框架)",
|
|
1215
|
+
"flip": "翻转",
|
|
1216
|
+
"flipHorizontal": "水平翻转",
|
|
1217
|
+
"flipVertical": "垂直翻转",
|
|
1218
|
+
"hide/show": "隐藏/显示",
|
|
1219
|
+
"lock/unlock": "锁/解锁",
|
|
1220
|
+
"layerOrder": "图层顺序",
|
|
1221
|
+
"bringToFront": "移到顶层",
|
|
1222
|
+
"bringForward": "上移一层",
|
|
1223
|
+
"sendBackward": "下移一层",
|
|
1224
|
+
"sendToBack": "移到底层",
|
|
1225
|
+
"layerPosition": "图层位置",
|
|
1226
|
+
"alignLeft": "贴左侧",
|
|
1227
|
+
"alignHorizontalCenter": "水平居中",
|
|
1228
|
+
"alignRight": "贴右侧",
|
|
1229
|
+
"alignTop": "贴顶部",
|
|
1230
|
+
"alignVerticalCenter": "垂直居中",
|
|
1231
|
+
"alignBottom": "贴底部"
|
|
1232
|
+
};
|
|
1099
1233
|
const _0_locale = defineMixin((editor, options) => {
|
|
1100
1234
|
const {
|
|
1101
1235
|
locale
|
|
@@ -1109,7 +1243,8 @@ const _0_locale = defineMixin((editor, options) => {
|
|
|
1109
1243
|
locale: "en",
|
|
1110
1244
|
fallback: "en",
|
|
1111
1245
|
messages: {
|
|
1112
|
-
en
|
|
1246
|
+
en,
|
|
1247
|
+
zhHans
|
|
1113
1248
|
}
|
|
1114
1249
|
}, locale);
|
|
1115
1250
|
return {
|
|
@@ -1143,8 +1278,8 @@ const _1_frame = defineMixin((editor) => {
|
|
|
1143
1278
|
return { left, top, width, height };
|
|
1144
1279
|
});
|
|
1145
1280
|
const frameThumbs = ref([]);
|
|
1146
|
-
function getAncestorFrame(
|
|
1147
|
-
return
|
|
1281
|
+
function getAncestorFrame(node) {
|
|
1282
|
+
return node?.findAncestor((node2) => isFrame(node2));
|
|
1148
1283
|
}
|
|
1149
1284
|
Object.assign(editor, {
|
|
1150
1285
|
frames,
|
|
@@ -1160,9 +1295,9 @@ const _1_frame = defineMixin((editor) => {
|
|
|
1160
1295
|
} = editor;
|
|
1161
1296
|
watch(() => {
|
|
1162
1297
|
return selection.value.length === 1 && selection.value[0];
|
|
1163
|
-
}, (
|
|
1164
|
-
if (
|
|
1165
|
-
currentFrameIndex.value = frames.value.findIndex((v) => v.equal(
|
|
1298
|
+
}, (node) => {
|
|
1299
|
+
if (node && isFrame(node)) {
|
|
1300
|
+
currentFrameIndex.value = frames.value.findIndex((v) => v.equal(node));
|
|
1166
1301
|
}
|
|
1167
1302
|
});
|
|
1168
1303
|
};
|
|
@@ -1585,7 +1720,7 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1585
1720
|
config,
|
|
1586
1721
|
drawboardAabb
|
|
1587
1722
|
} = editor;
|
|
1588
|
-
const
|
|
1723
|
+
const screenCenterOffset = computed(() => {
|
|
1589
1724
|
const offset2 = {
|
|
1590
1725
|
left: 0,
|
|
1591
1726
|
top: 0,
|
|
@@ -1602,21 +1737,22 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1602
1737
|
offset2.top += 16;
|
|
1603
1738
|
}
|
|
1604
1739
|
return offset2;
|
|
1605
|
-
};
|
|
1606
|
-
const
|
|
1607
|
-
const offset2 =
|
|
1740
|
+
});
|
|
1741
|
+
const screenCenter = computed(() => {
|
|
1742
|
+
const offset2 = screenCenterOffset.value;
|
|
1608
1743
|
return {
|
|
1609
1744
|
x: offset2.left + (drawboardAabb.value.width - offset2.left - offset2.right) / 2,
|
|
1610
1745
|
y: offset2.top + (drawboardAabb.value.height - offset2.top - offset2.bottom) / 2
|
|
1611
1746
|
};
|
|
1612
|
-
};
|
|
1747
|
+
});
|
|
1613
1748
|
Object.assign(editor, {
|
|
1614
|
-
|
|
1615
|
-
|
|
1749
|
+
screenCenterOffset,
|
|
1750
|
+
screenCenter
|
|
1616
1751
|
});
|
|
1617
1752
|
});
|
|
1618
1753
|
const _1_timeline = defineMixin((editor) => {
|
|
1619
1754
|
const {
|
|
1755
|
+
isElement,
|
|
1620
1756
|
root,
|
|
1621
1757
|
timeline,
|
|
1622
1758
|
renderEngine
|
|
@@ -1638,7 +1774,7 @@ const _1_timeline = defineMixin((editor) => {
|
|
|
1638
1774
|
range.startTime = Math.min(range.startTime, node2.globalStartTime);
|
|
1639
1775
|
range.endTime = Math.max(range.endTime, node2.globalEndTime);
|
|
1640
1776
|
}
|
|
1641
|
-
if (node2
|
|
1777
|
+
if (isElement(node2)) {
|
|
1642
1778
|
if (node2.background.animatedTexture) {
|
|
1643
1779
|
range.endTime = Math.max(range.endTime, node2.globalStartTime + node2.background.animatedTexture.duration);
|
|
1644
1780
|
}
|
|
@@ -1692,6 +1828,7 @@ function noop(..._args) {
|
|
|
1692
1828
|
}
|
|
1693
1829
|
const _2_box = defineMixin((editor) => {
|
|
1694
1830
|
const {
|
|
1831
|
+
isElement,
|
|
1695
1832
|
camera,
|
|
1696
1833
|
root,
|
|
1697
1834
|
selection,
|
|
@@ -1764,7 +1901,7 @@ const _2_box = defineMixin((editor) => {
|
|
|
1764
1901
|
} else {
|
|
1765
1902
|
obb = { ...getAabb(node), rotate: 0 };
|
|
1766
1903
|
}
|
|
1767
|
-
} else if (node
|
|
1904
|
+
} else if (isElement(node)) {
|
|
1768
1905
|
const style = node.style;
|
|
1769
1906
|
noop([style.left, style.top, style.width, style.height, style.rotate]);
|
|
1770
1907
|
const { rect, rotation } = node.getGlobalObb();
|
|
@@ -1840,7 +1977,7 @@ const _2_box = defineMixin((editor) => {
|
|
|
1840
1977
|
height: minmax.maxY - minmax.minY
|
|
1841
1978
|
};
|
|
1842
1979
|
}
|
|
1843
|
-
} else if (node
|
|
1980
|
+
} else if (isElement(node)) {
|
|
1844
1981
|
const style = node.style;
|
|
1845
1982
|
noop([style.left, style.top, style.width, style.height, style.rotate]);
|
|
1846
1983
|
const rect = node.getGlobalAabb();
|
|
@@ -2219,13 +2356,13 @@ const _4_2_element = defineMixin((editor) => {
|
|
|
2219
2356
|
log,
|
|
2220
2357
|
root,
|
|
2221
2358
|
isFrame,
|
|
2222
|
-
|
|
2359
|
+
isLock,
|
|
2223
2360
|
getObbInDrawboard,
|
|
2224
2361
|
config,
|
|
2225
2362
|
getAncestorFrame,
|
|
2226
2363
|
getAabb,
|
|
2227
2364
|
getGlobalPointer,
|
|
2228
|
-
|
|
2365
|
+
screenCenter,
|
|
2229
2366
|
selection,
|
|
2230
2367
|
camera,
|
|
2231
2368
|
parseAnchor
|
|
@@ -2247,12 +2384,12 @@ const _4_2_element = defineMixin((editor) => {
|
|
|
2247
2384
|
if (config.value.viewMode === "frame") {
|
|
2248
2385
|
parent = currentFrame.value;
|
|
2249
2386
|
} else {
|
|
2250
|
-
const
|
|
2251
|
-
if (
|
|
2252
|
-
if (isFrame(
|
|
2253
|
-
parent =
|
|
2387
|
+
const node = selection.value[0];
|
|
2388
|
+
if (node) {
|
|
2389
|
+
if (isFrame(node)) {
|
|
2390
|
+
parent = node;
|
|
2254
2391
|
} else {
|
|
2255
|
-
parent = getAncestorFrame(
|
|
2392
|
+
parent = getAncestorFrame(node);
|
|
2256
2393
|
}
|
|
2257
2394
|
}
|
|
2258
2395
|
}
|
|
@@ -2309,7 +2446,7 @@ const _4_2_element = defineMixin((editor) => {
|
|
|
2309
2446
|
case "pointer":
|
|
2310
2447
|
break;
|
|
2311
2448
|
case "screenCenter":
|
|
2312
|
-
globalPosition = camera.value.toGlobal(
|
|
2449
|
+
globalPosition = camera.value.toGlobal(screenCenter.value);
|
|
2313
2450
|
globalPosition.x -= aabb.width / 2;
|
|
2314
2451
|
globalPosition.y -= aabb.height / 2;
|
|
2315
2452
|
break;
|
|
@@ -2458,7 +2595,7 @@ const _4_2_element = defineMixin((editor) => {
|
|
|
2458
2595
|
}
|
|
2459
2596
|
return [node];
|
|
2460
2597
|
}).filter((node) => {
|
|
2461
|
-
return "isVisibleInTree" in node && node.isVisibleInTree() && isOverlappingObb(areaInDrawboard, getObbInDrawboard(node)) && !
|
|
2598
|
+
return "isVisibleInTree" in node && node.isVisibleInTree() && isOverlappingObb(areaInDrawboard, getObbInDrawboard(node)) && !isLock(node);
|
|
2462
2599
|
}) ?? [];
|
|
2463
2600
|
selection.value = selected;
|
|
2464
2601
|
return selected;
|
|
@@ -2659,7 +2796,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
2659
2796
|
getAabb,
|
|
2660
2797
|
selectionAabb,
|
|
2661
2798
|
viewAabb,
|
|
2662
|
-
|
|
2799
|
+
screenCenter
|
|
2663
2800
|
} = editor;
|
|
2664
2801
|
const scrollTo = async (target, options = {}) => {
|
|
2665
2802
|
const {
|
|
@@ -2667,7 +2804,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
2667
2804
|
duration = 500
|
|
2668
2805
|
} = options;
|
|
2669
2806
|
const _camera = camera.value;
|
|
2670
|
-
const
|
|
2807
|
+
const _screenCenter = screenCenter.value;
|
|
2671
2808
|
const offset2 = { x: 0, y: 0 };
|
|
2672
2809
|
let position = { x: 0, y: 0 };
|
|
2673
2810
|
if (typeof target === "object" && "x" in target && "y" in target) {
|
|
@@ -2689,8 +2826,8 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
2689
2826
|
}
|
|
2690
2827
|
}
|
|
2691
2828
|
position = { x: aabb.left + aabb.width / 2, y: aabb.top + aabb.height / 2 };
|
|
2692
|
-
offset2.x += -
|
|
2693
|
-
offset2.y = -
|
|
2829
|
+
offset2.x += -_screenCenter.x;
|
|
2830
|
+
offset2.y = -_screenCenter.y;
|
|
2694
2831
|
}
|
|
2695
2832
|
position.x *= _camera.zoom.x;
|
|
2696
2833
|
position.x += offset2.x;
|
|
@@ -2850,7 +2987,7 @@ const _zoom$1 = defineMixin((editor) => {
|
|
|
2850
2987
|
selectionAabb,
|
|
2851
2988
|
viewAabb,
|
|
2852
2989
|
getAabb,
|
|
2853
|
-
|
|
2990
|
+
screenCenterOffset
|
|
2854
2991
|
} = editor;
|
|
2855
2992
|
const zoomTo = async (target, options = {}) => {
|
|
2856
2993
|
const {
|
|
@@ -2872,7 +3009,7 @@ const _zoom$1 = defineMixin((editor) => {
|
|
|
2872
3009
|
break;
|
|
2873
3010
|
}
|
|
2874
3011
|
}
|
|
2875
|
-
const offset2 =
|
|
3012
|
+
const offset2 = screenCenterOffset.value;
|
|
2876
3013
|
const { width, height } = drawboardAabb.value;
|
|
2877
3014
|
const tw = width - (offset2.left + offset2.right);
|
|
2878
3015
|
const th = height - (offset2.top + offset2.bottom);
|
|
@@ -3941,7 +4078,7 @@ function isLeftTopLine(line) {
|
|
|
3941
4078
|
const _auxiliary = definePlugin((editor) => {
|
|
3942
4079
|
const {
|
|
3943
4080
|
currentFrame,
|
|
3944
|
-
|
|
4081
|
+
elementSelection,
|
|
3945
4082
|
state,
|
|
3946
4083
|
getObbInDrawboard,
|
|
3947
4084
|
root
|
|
@@ -3973,18 +4110,18 @@ const _auxiliary = definePlugin((editor) => {
|
|
|
3973
4110
|
const excluded = computed(() => {
|
|
3974
4111
|
return new Set(
|
|
3975
4112
|
[
|
|
3976
|
-
|
|
4113
|
+
elementSelection.value[0]?.instanceId
|
|
3977
4114
|
].filter(Boolean)
|
|
3978
4115
|
);
|
|
3979
4116
|
});
|
|
3980
4117
|
const activatedBox = computed(() => {
|
|
3981
|
-
if (
|
|
3982
|
-
return createBox(
|
|
4118
|
+
if (elementSelection.value[0]) {
|
|
4119
|
+
return createBox(elementSelection.value[0]);
|
|
3983
4120
|
}
|
|
3984
4121
|
return void 0;
|
|
3985
4122
|
});
|
|
3986
4123
|
const parnet = computed(() => {
|
|
3987
|
-
const p =
|
|
4124
|
+
const p = elementSelection.value[0].parent;
|
|
3988
4125
|
return p instanceof Element2D ? p : void 0;
|
|
3989
4126
|
});
|
|
3990
4127
|
const parentBox = computed(() => createBox(
|
|
@@ -4512,15 +4649,15 @@ const _delete = definePlugin((editor) => {
|
|
|
4512
4649
|
});
|
|
4513
4650
|
const _flip = definePlugin((editor) => {
|
|
4514
4651
|
const {
|
|
4515
|
-
|
|
4652
|
+
elementSelection
|
|
4516
4653
|
} = editor;
|
|
4517
4654
|
function flipHorizontal() {
|
|
4518
|
-
|
|
4655
|
+
elementSelection.value.forEach((el) => {
|
|
4519
4656
|
el.style.scaleX = -el.style.scaleX;
|
|
4520
4657
|
});
|
|
4521
4658
|
}
|
|
4522
4659
|
function flipVertical() {
|
|
4523
|
-
|
|
4660
|
+
elementSelection.value.forEach((el) => {
|
|
4524
4661
|
el.style.scaleY = -el.style.scaleY;
|
|
4525
4662
|
});
|
|
4526
4663
|
}
|
|
@@ -4578,13 +4715,13 @@ const _group = definePlugin((editor) => {
|
|
|
4578
4715
|
const {
|
|
4579
4716
|
getObb,
|
|
4580
4717
|
getAabb,
|
|
4581
|
-
|
|
4718
|
+
elementSelection,
|
|
4582
4719
|
addElement,
|
|
4583
4720
|
deleteElement,
|
|
4584
4721
|
doc
|
|
4585
4722
|
} = editor;
|
|
4586
4723
|
function group(inEditorIs) {
|
|
4587
|
-
const elements =
|
|
4724
|
+
const elements = elementSelection.value;
|
|
4588
4725
|
if (!elements.length) {
|
|
4589
4726
|
return;
|
|
4590
4727
|
}
|
|
@@ -4616,7 +4753,7 @@ const _group = definePlugin((editor) => {
|
|
|
4616
4753
|
});
|
|
4617
4754
|
}
|
|
4618
4755
|
function ungroup() {
|
|
4619
|
-
const element =
|
|
4756
|
+
const element = elementSelection.value[0];
|
|
4620
4757
|
if (!element || !element.children.length)
|
|
4621
4758
|
return;
|
|
4622
4759
|
const parent = getObb(element, "parent");
|
|
@@ -4856,7 +4993,7 @@ const _import = definePlugin((editor) => {
|
|
|
4856
4993
|
const _json = definePlugin((editor) => {
|
|
4857
4994
|
const {
|
|
4858
4995
|
getAabb,
|
|
4859
|
-
|
|
4996
|
+
elementSelection,
|
|
4860
4997
|
root,
|
|
4861
4998
|
getTimeRange
|
|
4862
4999
|
} = editor;
|
|
@@ -4903,7 +5040,7 @@ const _json = definePlugin((editor) => {
|
|
|
4903
5040
|
elements = selected;
|
|
4904
5041
|
} else {
|
|
4905
5042
|
if (selected === true) {
|
|
4906
|
-
elements =
|
|
5043
|
+
elements = elementSelection.value;
|
|
4907
5044
|
}
|
|
4908
5045
|
if (elements.length === 0 && root.value) {
|
|
4909
5046
|
id = root.value.id;
|
|
@@ -5004,12 +5141,12 @@ const _layerOrder = definePlugin((editor) => {
|
|
|
5004
5141
|
const _layerPosition = definePlugin((editor) => {
|
|
5005
5142
|
const {
|
|
5006
5143
|
currentFrameAabb,
|
|
5007
|
-
|
|
5144
|
+
elementSelection,
|
|
5008
5145
|
getAabb
|
|
5009
5146
|
} = editor;
|
|
5010
5147
|
function align(direction) {
|
|
5011
|
-
const box =
|
|
5012
|
-
|
|
5148
|
+
const box = elementSelection.value.length === 1 ? currentFrameAabb.value : getAabb(elementSelection.value);
|
|
5149
|
+
elementSelection.value.forEach((el) => {
|
|
5013
5150
|
switch (direction) {
|
|
5014
5151
|
case "left":
|
|
5015
5152
|
el.style.left = 0;
|
|
@@ -5056,7 +5193,7 @@ const _layerPosition = definePlugin((editor) => {
|
|
|
5056
5193
|
const _lock = definePlugin((editor) => {
|
|
5057
5194
|
const {
|
|
5058
5195
|
selection,
|
|
5059
|
-
|
|
5196
|
+
isLock,
|
|
5060
5197
|
setLock
|
|
5061
5198
|
} = editor;
|
|
5062
5199
|
return {
|
|
@@ -5064,7 +5201,7 @@ const _lock = definePlugin((editor) => {
|
|
|
5064
5201
|
commands: [
|
|
5065
5202
|
{ command: "lock", handle: () => selection.value.forEach((el) => setLock(el, true)) },
|
|
5066
5203
|
{ command: "unlock", handle: () => selection.value.forEach((el) => setLock(el, false)) },
|
|
5067
|
-
{ command: "lock/unlock", handle: () => selection.value.forEach((el) => setLock(el, !
|
|
5204
|
+
{ command: "lock/unlock", handle: () => selection.value.forEach((el) => setLock(el, !isLock(el))) }
|
|
5068
5205
|
],
|
|
5069
5206
|
hotkeys: [
|
|
5070
5207
|
{ command: "lock/unlock", key: "Shift+CmdOrCtrl+l" }
|
|
@@ -5152,6 +5289,7 @@ const _menu = definePlugin((editor, options) => {
|
|
|
5152
5289
|
{ key: "view:pixelGrid", checked: config.value.pixelGrid },
|
|
5153
5290
|
{ key: "view:ruler", checked: config.value.ruler },
|
|
5154
5291
|
{ key: "view:scrollbar", checked: config.value.scrollbar },
|
|
5292
|
+
{ key: "view:layers", checked: config.value.layers },
|
|
5155
5293
|
{ key: "view:timeline", checked: config.value.timeline },
|
|
5156
5294
|
{ key: "view:statusbar", checked: config.value.statusbar },
|
|
5157
5295
|
{ key: "view:frameOutline", checked: config.value.frameOutline },
|
|
@@ -5262,7 +5400,7 @@ const _menu = definePlugin((editor, options) => {
|
|
|
5262
5400
|
});
|
|
5263
5401
|
const _move = definePlugin((editor) => {
|
|
5264
5402
|
const {
|
|
5265
|
-
|
|
5403
|
+
elementSelection
|
|
5266
5404
|
} = editor;
|
|
5267
5405
|
function move(direction, distance = 1) {
|
|
5268
5406
|
let prop;
|
|
@@ -5279,12 +5417,12 @@ const _move = definePlugin((editor) => {
|
|
|
5279
5417
|
prop = "left";
|
|
5280
5418
|
break;
|
|
5281
5419
|
}
|
|
5282
|
-
|
|
5420
|
+
elementSelection.value.forEach((element) => {
|
|
5283
5421
|
element.style[prop] += distance;
|
|
5284
5422
|
});
|
|
5285
5423
|
}
|
|
5286
5424
|
function when() {
|
|
5287
|
-
return
|
|
5425
|
+
return elementSelection.value.length > 0;
|
|
5288
5426
|
}
|
|
5289
5427
|
return {
|
|
5290
5428
|
name: "mce:move",
|
|
@@ -5401,21 +5539,21 @@ const _select = definePlugin((editor) => {
|
|
|
5401
5539
|
}
|
|
5402
5540
|
}
|
|
5403
5541
|
function previousSelection() {
|
|
5404
|
-
const
|
|
5405
|
-
if (
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5542
|
+
const node = selection.value[0];
|
|
5543
|
+
if (node) {
|
|
5544
|
+
const previousSibling = node.previousSibling;
|
|
5545
|
+
if (previousSibling && !node.equal(previousSibling)) {
|
|
5546
|
+
selection.value = [previousSibling];
|
|
5547
|
+
}
|
|
5410
5548
|
}
|
|
5411
5549
|
}
|
|
5412
5550
|
function nextSelection() {
|
|
5413
|
-
const
|
|
5414
|
-
if (
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5551
|
+
const node = selection.value[0];
|
|
5552
|
+
if (node) {
|
|
5553
|
+
const nextSibling = node.nextSibling;
|
|
5554
|
+
if (nextSibling && node.equal(nextSibling)) {
|
|
5555
|
+
selection.value = [nextSibling];
|
|
5556
|
+
}
|
|
5419
5557
|
}
|
|
5420
5558
|
}
|
|
5421
5559
|
return {
|
|
@@ -5553,20 +5691,20 @@ const _view = definePlugin((editor) => {
|
|
|
5553
5691
|
});
|
|
5554
5692
|
const _visibility = definePlugin((editor) => {
|
|
5555
5693
|
const {
|
|
5556
|
-
|
|
5694
|
+
elementSelection
|
|
5557
5695
|
} = editor;
|
|
5558
5696
|
function show() {
|
|
5559
|
-
|
|
5697
|
+
elementSelection.value.forEach((el) => {
|
|
5560
5698
|
el.style.visibility = "visible";
|
|
5561
5699
|
});
|
|
5562
5700
|
}
|
|
5563
5701
|
function hide() {
|
|
5564
|
-
|
|
5702
|
+
elementSelection.value.forEach((el) => {
|
|
5565
5703
|
el.style.visibility = "hidden";
|
|
5566
5704
|
});
|
|
5567
5705
|
}
|
|
5568
5706
|
function hideOrShow() {
|
|
5569
|
-
|
|
5707
|
+
elementSelection.value.forEach((el) => {
|
|
5570
5708
|
el.style.visibility = el.style.visibility === "hidden" ? "visible" : "hidden";
|
|
5571
5709
|
});
|
|
5572
5710
|
}
|
|
@@ -5587,7 +5725,7 @@ const _zoom = definePlugin((editor) => {
|
|
|
5587
5725
|
camera,
|
|
5588
5726
|
drawboardAabb,
|
|
5589
5727
|
zoomTo,
|
|
5590
|
-
|
|
5728
|
+
elementSelection,
|
|
5591
5729
|
exec
|
|
5592
5730
|
} = editor;
|
|
5593
5731
|
return {
|
|
@@ -5610,7 +5748,7 @@ const _zoom = definePlugin((editor) => {
|
|
|
5610
5748
|
events: {
|
|
5611
5749
|
setDoc: () => exec("zoomToFit"),
|
|
5612
5750
|
setCurrentFrame: () => {
|
|
5613
|
-
if (
|
|
5751
|
+
if (elementSelection.value.length) {
|
|
5614
5752
|
exec("zoomToSelection");
|
|
5615
5753
|
} else {
|
|
5616
5754
|
exec("zoomToFit");
|
|
@@ -5898,6 +6036,7 @@ function useIcon(props) {
|
|
|
5898
6036
|
};
|
|
5899
6037
|
}
|
|
5900
6038
|
const aliases = {
|
|
6039
|
+
close: "M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z",
|
|
5901
6040
|
play: "M8 5.14v14l11-7z",
|
|
5902
6041
|
pause: "M14 19h4V5h-4M6 19h4V5H6z",
|
|
5903
6042
|
gps: "M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m-8.95 5H1v-2h2.05C3.5 6.83 6.83 3.5 11 3.05V1h2v2.05c4.17.45 7.5 3.78 7.95 7.95H23v2h-2.05c-.45 4.17-3.78 7.5-7.95 7.95V23h-2v-2.05C6.83 20.5 3.5 17.17 3.05 13M12 5a7 7 0 0 0-7 7a7 7 0 0 0 7 7a7 7 0 0 0 7-7a7 7 0 0 0-7-7",
|
|
@@ -6018,13 +6157,13 @@ const defaultHoverStrategy = (context) => {
|
|
|
6018
6157
|
}
|
|
6019
6158
|
return void 0;
|
|
6020
6159
|
};
|
|
6021
|
-
const _hoisted_1$
|
|
6022
|
-
const _sfc_main$
|
|
6160
|
+
const _hoisted_1$l = { class: "mce-auxiliary" };
|
|
6161
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
6023
6162
|
__name: "Auxiliary",
|
|
6024
6163
|
setup(__props) {
|
|
6025
6164
|
const { auxiliaryLines } = useEditor();
|
|
6026
6165
|
return (_ctx, _cache) => {
|
|
6027
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6166
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
6028
6167
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(auxiliaryLines), (item, key) => {
|
|
6029
6168
|
return openBlock(), createElementBlock("div", {
|
|
6030
6169
|
key,
|
|
@@ -6041,6 +6180,67 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6041
6180
|
};
|
|
6042
6181
|
}
|
|
6043
6182
|
});
|
|
6183
|
+
const MceLayerKey = Symbol.for("mce:layer");
|
|
6184
|
+
const MceLayerItemKey = Symbol.for("mce:layer-item");
|
|
6185
|
+
function createLayer(options) {
|
|
6186
|
+
const {
|
|
6187
|
+
sortedSelection
|
|
6188
|
+
} = options;
|
|
6189
|
+
const registered = ref([]);
|
|
6190
|
+
const selecting = ref(false);
|
|
6191
|
+
const openedItems = reactive(/* @__PURE__ */ new Map());
|
|
6192
|
+
const domItems = reactive(/* @__PURE__ */ new Map());
|
|
6193
|
+
const rootVm = getCurrentInstance();
|
|
6194
|
+
provide(MceLayerKey, {
|
|
6195
|
+
selecting,
|
|
6196
|
+
sortedSelection,
|
|
6197
|
+
register: (vm, options2) => {
|
|
6198
|
+
const {
|
|
6199
|
+
id,
|
|
6200
|
+
dom,
|
|
6201
|
+
opened
|
|
6202
|
+
} = options2;
|
|
6203
|
+
openedItems.set(id, opened);
|
|
6204
|
+
domItems.set(id, dom);
|
|
6205
|
+
registered.value.push(id);
|
|
6206
|
+
const instances = findChildrenWithProvide(MceLayerItemKey, rootVm?.vnode);
|
|
6207
|
+
const instanceIndex = instances.indexOf(vm);
|
|
6208
|
+
if (instanceIndex > -1) {
|
|
6209
|
+
registered.value.splice(instanceIndex, 0, id);
|
|
6210
|
+
} else {
|
|
6211
|
+
registered.value.push(id);
|
|
6212
|
+
}
|
|
6213
|
+
},
|
|
6214
|
+
unregister: (id) => {
|
|
6215
|
+
openedItems.delete(id);
|
|
6216
|
+
domItems.delete(id);
|
|
6217
|
+
registered.value = registered.value.filter((v) => v !== id);
|
|
6218
|
+
}
|
|
6219
|
+
});
|
|
6220
|
+
return {
|
|
6221
|
+
selecting,
|
|
6222
|
+
openedItems,
|
|
6223
|
+
domItems
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
function useLayerItem(options) {
|
|
6227
|
+
const {
|
|
6228
|
+
id,
|
|
6229
|
+
opened,
|
|
6230
|
+
dom
|
|
6231
|
+
} = options;
|
|
6232
|
+
const vm = getCurrentInstance();
|
|
6233
|
+
provide(MceLayerItemKey, { id });
|
|
6234
|
+
const rootLayer = inject(MceLayerKey);
|
|
6235
|
+
const { register, unregister, ...props } = rootLayer;
|
|
6236
|
+
register(vm, {
|
|
6237
|
+
id,
|
|
6238
|
+
dom,
|
|
6239
|
+
opened
|
|
6240
|
+
});
|
|
6241
|
+
onBeforeUnmount(() => unregister(id));
|
|
6242
|
+
return props;
|
|
6243
|
+
}
|
|
6044
6244
|
function useResizeObserver(callback, box = "content") {
|
|
6045
6245
|
const resizeRef = templateRef();
|
|
6046
6246
|
const contentRect = ref();
|
|
@@ -6317,7 +6517,7 @@ function createLayout(props) {
|
|
|
6317
6517
|
};
|
|
6318
6518
|
}
|
|
6319
6519
|
const MceMenuSymbol = Symbol.for("MceMenuSymbol");
|
|
6320
|
-
const _sfc_main$
|
|
6520
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
6321
6521
|
__name: "Icon",
|
|
6322
6522
|
props: {
|
|
6323
6523
|
disabled: Boolean,
|
|
@@ -6342,7 +6542,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
6342
6542
|
};
|
|
6343
6543
|
}
|
|
6344
6544
|
});
|
|
6345
|
-
const _sfc_main$
|
|
6545
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6346
6546
|
...{
|
|
6347
6547
|
inheritAttrs: false
|
|
6348
6548
|
},
|
|
@@ -6454,8 +6654,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
6454
6654
|
};
|
|
6455
6655
|
}
|
|
6456
6656
|
});
|
|
6457
|
-
const _hoisted_1$
|
|
6458
|
-
const _hoisted_2$
|
|
6657
|
+
const _hoisted_1$k = ["onMouseenter"];
|
|
6658
|
+
const _hoisted_2$a = ["onClick"];
|
|
6459
6659
|
const _hoisted_3$7 = {
|
|
6460
6660
|
key: 0,
|
|
6461
6661
|
class: "mce-list-item__prepend"
|
|
@@ -6465,7 +6665,7 @@ const _hoisted_5$3 = {
|
|
|
6465
6665
|
key: 1,
|
|
6466
6666
|
class: "mce-list-item__append"
|
|
6467
6667
|
};
|
|
6468
|
-
const _sfc_main$
|
|
6668
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
6469
6669
|
...{
|
|
6470
6670
|
name: "MceMenu"
|
|
6471
6671
|
},
|
|
@@ -6538,7 +6738,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6538
6738
|
});
|
|
6539
6739
|
return (_ctx, _cache) => {
|
|
6540
6740
|
const _component_MceMenu = resolveComponent("MceMenu");
|
|
6541
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6741
|
+
return openBlock(), createBlock(_sfc_main$y, {
|
|
6542
6742
|
ref: "overlayTpl",
|
|
6543
6743
|
modelValue: isActive.value,
|
|
6544
6744
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
|
|
@@ -6582,7 +6782,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6582
6782
|
onClick: (e) => onClickItem(item, index, e)
|
|
6583
6783
|
}, [
|
|
6584
6784
|
hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
|
|
6585
|
-
item.checked ? (openBlock(), createBlock(_sfc_main$
|
|
6785
|
+
item.checked ? (openBlock(), createBlock(_sfc_main$z, {
|
|
6586
6786
|
key: 0,
|
|
6587
6787
|
icon: "$check"
|
|
6588
6788
|
})) : createCommentVNode("", true)
|
|
@@ -6593,10 +6793,10 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6593
6793
|
])
|
|
6594
6794
|
]),
|
|
6595
6795
|
item.children?.length ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
|
|
6596
|
-
createVNode(_sfc_main$
|
|
6796
|
+
createVNode(_sfc_main$z, { icon: "$arrowRight" })
|
|
6597
6797
|
])) : createCommentVNode("", true)
|
|
6598
|
-
], 10, _hoisted_2$
|
|
6599
|
-
], 40, _hoisted_1$
|
|
6798
|
+
], 10, _hoisted_2$a)
|
|
6799
|
+
], 40, _hoisted_1$k))
|
|
6600
6800
|
], 64);
|
|
6601
6801
|
}), 128)),
|
|
6602
6802
|
opened.value > -1 && __props.items?.[opened.value]?.children?.length ? (openBlock(), createBlock(_component_MceMenu, {
|
|
@@ -6626,12 +6826,12 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6626
6826
|
};
|
|
6627
6827
|
}
|
|
6628
6828
|
});
|
|
6629
|
-
const _hoisted_1$
|
|
6630
|
-
const _hoisted_2$
|
|
6829
|
+
const _hoisted_1$j = { class: "mce-context-menu__title" };
|
|
6830
|
+
const _hoisted_2$9 = {
|
|
6631
6831
|
key: 0,
|
|
6632
6832
|
class: "mce-context-menu__kbd"
|
|
6633
6833
|
};
|
|
6634
|
-
const _sfc_main$
|
|
6834
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
6635
6835
|
__name: "ContextMenu",
|
|
6636
6836
|
props: {
|
|
6637
6837
|
"modelValue": { type: Boolean },
|
|
@@ -6689,7 +6889,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6689
6889
|
updateLocation
|
|
6690
6890
|
});
|
|
6691
6891
|
return (_ctx, _cache) => {
|
|
6692
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6892
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
6693
6893
|
ref: "menuTplRef",
|
|
6694
6894
|
modelValue: model.value,
|
|
6695
6895
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
@@ -6704,19 +6904,19 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6704
6904
|
"onClick:item": onClickItem
|
|
6705
6905
|
}, {
|
|
6706
6906
|
title: withCtx(({ item }) => [
|
|
6707
|
-
createElementVNode("span", _hoisted_1$
|
|
6708
|
-
unref(hotkeys).has(item.key) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
6907
|
+
createElementVNode("span", _hoisted_1$j, toDisplayString(unref(t)(item.key)), 1),
|
|
6908
|
+
unref(hotkeys).has(item.key) ? (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(unref(getKbd)(item.key)), 1)) : createCommentVNode("", true)
|
|
6709
6909
|
]),
|
|
6710
6910
|
_: 1
|
|
6711
6911
|
}, 8, ["modelValue", "target", "items", "style"]);
|
|
6712
6912
|
};
|
|
6713
6913
|
}
|
|
6714
6914
|
});
|
|
6715
|
-
const _hoisted_1$
|
|
6915
|
+
const _hoisted_1$i = {
|
|
6716
6916
|
key: 0,
|
|
6717
6917
|
class: "mce-drawing__content"
|
|
6718
6918
|
};
|
|
6719
|
-
const _sfc_main$
|
|
6919
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
6720
6920
|
__name: "Drawing",
|
|
6721
6921
|
setup(__props) {
|
|
6722
6922
|
const {
|
|
@@ -6746,12 +6946,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6746
6946
|
}),
|
|
6747
6947
|
onMousedown
|
|
6748
6948
|
}, [
|
|
6749
|
-
unref(stateContext)?.content ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6949
|
+
unref(stateContext)?.content ? (openBlock(), createElementBlock("div", _hoisted_1$i, toDisplayString(unref(t)(unref(stateContext).content)), 1)) : createCommentVNode("", true)
|
|
6750
6950
|
], 36)) : createCommentVNode("", true);
|
|
6751
6951
|
};
|
|
6752
6952
|
}
|
|
6753
6953
|
});
|
|
6754
|
-
const _sfc_main$
|
|
6954
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
6755
6955
|
__name: "Floatbar",
|
|
6756
6956
|
props: {
|
|
6757
6957
|
...makeMceOverlayProps({
|
|
@@ -6777,7 +6977,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6777
6977
|
updateLocation
|
|
6778
6978
|
});
|
|
6779
6979
|
return (_ctx, _cache) => {
|
|
6780
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6980
|
+
return openBlock(), createBlock(_sfc_main$y, {
|
|
6781
6981
|
ref: "overlayTpl",
|
|
6782
6982
|
class: "mce-floatbar",
|
|
6783
6983
|
location: props.location,
|
|
@@ -6794,7 +6994,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6794
6994
|
};
|
|
6795
6995
|
}
|
|
6796
6996
|
});
|
|
6797
|
-
const _sfc_main$
|
|
6997
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
6798
6998
|
__name: "Frame",
|
|
6799
6999
|
props: {
|
|
6800
7000
|
"modelValue": { required: true },
|
|
@@ -6860,7 +7060,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6860
7060
|
};
|
|
6861
7061
|
}
|
|
6862
7062
|
});
|
|
6863
|
-
const _sfc_main$
|
|
7063
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6864
7064
|
__name: "Frames",
|
|
6865
7065
|
setup(__props) {
|
|
6866
7066
|
const {
|
|
@@ -6868,7 +7068,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6868
7068
|
} = useEditor();
|
|
6869
7069
|
return (_ctx, _cache) => {
|
|
6870
7070
|
return openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
|
|
6871
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7071
|
+
return openBlock(), createBlock(_sfc_main$t, {
|
|
6872
7072
|
key,
|
|
6873
7073
|
"model-value": frame
|
|
6874
7074
|
}, null, 8, ["model-value"]);
|
|
@@ -6876,7 +7076,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6876
7076
|
};
|
|
6877
7077
|
}
|
|
6878
7078
|
});
|
|
6879
|
-
const _sfc_main$
|
|
7079
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6880
7080
|
__name: "GoBackSelectedArea",
|
|
6881
7081
|
setup(__props) {
|
|
6882
7082
|
const {
|
|
@@ -6898,14 +7098,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6898
7098
|
class: "mce-back-selected-aera",
|
|
6899
7099
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
|
|
6900
7100
|
}, [
|
|
6901
|
-
createVNode(_sfc_main$
|
|
7101
|
+
createVNode(_sfc_main$z, { icon: "$gps" }),
|
|
6902
7102
|
createElementVNode("span", null, toDisplayString(unref(t)("goBackSelectedArea")), 1)
|
|
6903
7103
|
])) : createCommentVNode("", true);
|
|
6904
7104
|
};
|
|
6905
7105
|
}
|
|
6906
7106
|
});
|
|
6907
|
-
const _hoisted_1$
|
|
6908
|
-
const _sfc_main$
|
|
7107
|
+
const _hoisted_1$h = ["data-name"];
|
|
7108
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
6909
7109
|
__name: "Hover",
|
|
6910
7110
|
setup(__props) {
|
|
6911
7111
|
const {
|
|
@@ -6923,7 +7123,371 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6923
7123
|
borderColor: "currentcolor",
|
|
6924
7124
|
...unref(boundingBoxToStyle)(hoverElementObb.value)
|
|
6925
7125
|
})
|
|
6926
|
-
}, null, 12, _hoisted_1$
|
|
7126
|
+
}, null, 12, _hoisted_1$h)) : createCommentVNode("", true);
|
|
7127
|
+
};
|
|
7128
|
+
}
|
|
7129
|
+
});
|
|
7130
|
+
const _hoisted_1$g = { class: "mce-btn" };
|
|
7131
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
7132
|
+
__name: "Btn",
|
|
7133
|
+
setup(__props) {
|
|
7134
|
+
return (_ctx, _cache) => {
|
|
7135
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
7136
|
+
renderSlot(_ctx.$slots, "default")
|
|
7137
|
+
]);
|
|
7138
|
+
};
|
|
7139
|
+
}
|
|
7140
|
+
});
|
|
7141
|
+
const _hoisted_1$f = { class: "mce-layer__name" };
|
|
7142
|
+
const _hoisted_2$8 = { class: "mce-layer__action" };
|
|
7143
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
7144
|
+
...{
|
|
7145
|
+
name: "MceLayer",
|
|
7146
|
+
inheritAttrs: false
|
|
7147
|
+
},
|
|
7148
|
+
__name: "Layer",
|
|
7149
|
+
props: /* @__PURE__ */ mergeModels({
|
|
7150
|
+
root: Boolean,
|
|
7151
|
+
node: {
|
|
7152
|
+
type: Object,
|
|
7153
|
+
required: true
|
|
7154
|
+
},
|
|
7155
|
+
active: Boolean,
|
|
7156
|
+
indent: {
|
|
7157
|
+
type: Number,
|
|
7158
|
+
default: 0
|
|
7159
|
+
}
|
|
7160
|
+
}, {
|
|
7161
|
+
"opened": { default: false },
|
|
7162
|
+
"openedModifiers": {}
|
|
7163
|
+
}),
|
|
7164
|
+
emits: ["update:opened"],
|
|
7165
|
+
setup(__props) {
|
|
7166
|
+
const props = __props;
|
|
7167
|
+
const {
|
|
7168
|
+
isElement,
|
|
7169
|
+
isFrame,
|
|
7170
|
+
isVisible,
|
|
7171
|
+
setVisible,
|
|
7172
|
+
isLock,
|
|
7173
|
+
setLock,
|
|
7174
|
+
selection,
|
|
7175
|
+
nodes,
|
|
7176
|
+
nodeIndexMap,
|
|
7177
|
+
zoomTo,
|
|
7178
|
+
hoverElement,
|
|
7179
|
+
exec
|
|
7180
|
+
} = useEditor();
|
|
7181
|
+
const opened = useModel(__props, "opened");
|
|
7182
|
+
const dom = ref();
|
|
7183
|
+
const {
|
|
7184
|
+
selecting,
|
|
7185
|
+
sortedSelection
|
|
7186
|
+
} = useLayerItem({
|
|
7187
|
+
id: props.node.id,
|
|
7188
|
+
opened,
|
|
7189
|
+
node: computed(() => props.node),
|
|
7190
|
+
dom: computed(() => dom.value)
|
|
7191
|
+
});
|
|
7192
|
+
const isFrist = computed(() => sortedSelection.value[0]?.equal(props.node));
|
|
7193
|
+
const isLast = computed(() => {
|
|
7194
|
+
const last = sortedSelection.value[sortedSelection.value.length - 1];
|
|
7195
|
+
if (last) {
|
|
7196
|
+
if (last.equal(props.node)) {
|
|
7197
|
+
if (!opened.value || !props.node?.children.length)
|
|
7198
|
+
return true;
|
|
7199
|
+
} else if (last.equal(props.node?.parent)) ;
|
|
7200
|
+
}
|
|
7201
|
+
return false;
|
|
7202
|
+
});
|
|
7203
|
+
const isActive = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
7204
|
+
const inputDom = ref();
|
|
7205
|
+
const isHoverElement = computed(() => props.node?.equal(hoverElement.value));
|
|
7206
|
+
const hovering = ref(false);
|
|
7207
|
+
const editing = ref(false);
|
|
7208
|
+
const editValue = ref();
|
|
7209
|
+
const thumbnailIcon = computed(() => {
|
|
7210
|
+
const node = props.node;
|
|
7211
|
+
if (isFrame(node)) {
|
|
7212
|
+
return "$frame";
|
|
7213
|
+
} else if (node.children.length) {
|
|
7214
|
+
return "$group";
|
|
7215
|
+
} else if (isElement(node)) {
|
|
7216
|
+
if (node.foreground.isValid() && node.foreground.image) {
|
|
7217
|
+
return "$image";
|
|
7218
|
+
}
|
|
7219
|
+
if (node.text.isValid()) {
|
|
7220
|
+
return "$text";
|
|
7221
|
+
}
|
|
7222
|
+
}
|
|
7223
|
+
return "$shape";
|
|
7224
|
+
});
|
|
7225
|
+
function onMousedown() {
|
|
7226
|
+
}
|
|
7227
|
+
function onClickExpand() {
|
|
7228
|
+
opened.value = !opened.value;
|
|
7229
|
+
}
|
|
7230
|
+
function onClickContent(e) {
|
|
7231
|
+
selecting.value = true;
|
|
7232
|
+
if (isElement(props.node)) {
|
|
7233
|
+
if (e.shiftKey) {
|
|
7234
|
+
const _nodes = [
|
|
7235
|
+
...selection.value.filter((v) => !v.equal(props.node)),
|
|
7236
|
+
props.node
|
|
7237
|
+
];
|
|
7238
|
+
let min;
|
|
7239
|
+
let max;
|
|
7240
|
+
_nodes.forEach((el) => {
|
|
7241
|
+
const index = nodeIndexMap.get(el.id);
|
|
7242
|
+
if (index !== void 0) {
|
|
7243
|
+
min = min === void 0 ? index : Math.min(min, index);
|
|
7244
|
+
max = max === void 0 ? index : Math.max(max, index);
|
|
7245
|
+
}
|
|
7246
|
+
});
|
|
7247
|
+
if (min !== void 0 && max !== void 0) {
|
|
7248
|
+
let _selection = nodes.value.slice(min, max + 1);
|
|
7249
|
+
const result = new Set(_selection.map((node) => node.id));
|
|
7250
|
+
const parents = /* @__PURE__ */ new Set();
|
|
7251
|
+
_selection.forEach((node) => node.parent && parents.add(node.parent));
|
|
7252
|
+
parents.forEach((parent) => {
|
|
7253
|
+
if (parent.children.every((ch) => result.has(ch.id))) {
|
|
7254
|
+
const ids = new Set(parent.children.map((ch) => ch.id));
|
|
7255
|
+
_selection = [
|
|
7256
|
+
..._selection.filter((v) => !ids.has(v.id)),
|
|
7257
|
+
parent
|
|
7258
|
+
];
|
|
7259
|
+
}
|
|
7260
|
+
});
|
|
7261
|
+
selection.value = _selection;
|
|
7262
|
+
}
|
|
7263
|
+
} else if (e.ctrlKey || e.metaKey) {
|
|
7264
|
+
const filtered = selection.value.filter((v) => !v.equal(props.node));
|
|
7265
|
+
if (filtered.length !== selection.value.length) {
|
|
7266
|
+
selection.value = filtered;
|
|
7267
|
+
} else {
|
|
7268
|
+
selection.value = [...filtered, props.node];
|
|
7269
|
+
}
|
|
7270
|
+
} else {
|
|
7271
|
+
selection.value = [props.node];
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
nextTick().then(() => {
|
|
7275
|
+
selecting.value = false;
|
|
7276
|
+
});
|
|
7277
|
+
}
|
|
7278
|
+
function onDblclickThumbnail(e) {
|
|
7279
|
+
e.stopPropagation();
|
|
7280
|
+
if (isElement(props.node)) {
|
|
7281
|
+
zoomTo("selection", {
|
|
7282
|
+
behavior: "smooth"
|
|
7283
|
+
});
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
function onDblclickContent() {
|
|
7287
|
+
editing.value = true;
|
|
7288
|
+
editValue.value = props.node.name;
|
|
7289
|
+
nextTick().then(() => {
|
|
7290
|
+
inputDom.value?.focus();
|
|
7291
|
+
});
|
|
7292
|
+
}
|
|
7293
|
+
function onMouseenter() {
|
|
7294
|
+
if (isElement(props.node)) {
|
|
7295
|
+
hoverElement.value = props.node;
|
|
7296
|
+
hovering.value = true;
|
|
7297
|
+
}
|
|
7298
|
+
}
|
|
7299
|
+
function onMouseleave() {
|
|
7300
|
+
hoverElement.value = void 0;
|
|
7301
|
+
hovering.value = false;
|
|
7302
|
+
}
|
|
7303
|
+
function onContextmenu(e) {
|
|
7304
|
+
if (isElement(props.node)) {
|
|
7305
|
+
if (!selection.value.some((v) => v.equal(props.node))) {
|
|
7306
|
+
selection.value = [props.node];
|
|
7307
|
+
}
|
|
7308
|
+
exec("openContextMenu", e);
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7311
|
+
function onInputBlur() {
|
|
7312
|
+
console.log("onInputBlur");
|
|
7313
|
+
editing.value = false;
|
|
7314
|
+
if (editValue.value) {
|
|
7315
|
+
props.node.name = editValue.value;
|
|
7316
|
+
editValue.value = void 0;
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
return (_ctx, _cache) => {
|
|
7320
|
+
const _component_MceLayer = resolveComponent("MceLayer");
|
|
7321
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
7322
|
+
createElementVNode("div", {
|
|
7323
|
+
ref_key: "dom",
|
|
7324
|
+
ref: dom,
|
|
7325
|
+
class: normalizeClass(["mce-layer", [
|
|
7326
|
+
props.root && "mce-layer--root",
|
|
7327
|
+
(__props.active || isActive.value) && "mce-layer--active",
|
|
7328
|
+
isFrist.value && "mce-layer--first",
|
|
7329
|
+
isLast.value && "mce-layer--last",
|
|
7330
|
+
opened.value && "mce-layer--open",
|
|
7331
|
+
isHoverElement.value && "mce-layer--hover"
|
|
7332
|
+
]]),
|
|
7333
|
+
style: normalizeStyle({
|
|
7334
|
+
"--indent-padding": `${props.indent * 16}px`
|
|
7335
|
+
}),
|
|
7336
|
+
onMousedown,
|
|
7337
|
+
onMouseenter,
|
|
7338
|
+
onMouseleave,
|
|
7339
|
+
onContextmenu
|
|
7340
|
+
}, [
|
|
7341
|
+
createElementVNode("div", {
|
|
7342
|
+
class: "mce-layer__expand",
|
|
7343
|
+
onClick: onClickExpand
|
|
7344
|
+
}, [
|
|
7345
|
+
props.node.children.length ? (openBlock(), createBlock(_sfc_main$z, {
|
|
7346
|
+
key: 0,
|
|
7347
|
+
icon: "$arrowRight"
|
|
7348
|
+
})) : createCommentVNode("", true)
|
|
7349
|
+
]),
|
|
7350
|
+
createElementVNode("div", {
|
|
7351
|
+
class: "mce-layer__content",
|
|
7352
|
+
onClick: onClickContent,
|
|
7353
|
+
onDblclick: onDblclickContent
|
|
7354
|
+
}, [
|
|
7355
|
+
createElementVNode("div", {
|
|
7356
|
+
class: "mce-layer__thumbnail",
|
|
7357
|
+
onDblclick: onDblclickThumbnail
|
|
7358
|
+
}, [
|
|
7359
|
+
createVNode(_sfc_main$z, { icon: thumbnailIcon.value }, null, 8, ["icon"])
|
|
7360
|
+
], 32),
|
|
7361
|
+
createElementVNode("div", _hoisted_1$f, [
|
|
7362
|
+
withDirectives(createElementVNode("input", {
|
|
7363
|
+
ref_key: "inputDom",
|
|
7364
|
+
ref: inputDom,
|
|
7365
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editValue.value = $event),
|
|
7366
|
+
type: "text",
|
|
7367
|
+
class: "mce-layer__input",
|
|
7368
|
+
autofocus: "",
|
|
7369
|
+
onBlur: onInputBlur
|
|
7370
|
+
}, null, 544), [
|
|
7371
|
+
[vShow, editing.value],
|
|
7372
|
+
[vModelText, editValue.value]
|
|
7373
|
+
]),
|
|
7374
|
+
createElementVNode("div", {
|
|
7375
|
+
style: normalizeStyle({ visibility: editing.value ? "hidden" : void 0 })
|
|
7376
|
+
}, toDisplayString(editValue.value || props.node.name || props.node.id), 5)
|
|
7377
|
+
]),
|
|
7378
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
7379
|
+
props.root ? (openBlock(), createElementBlock("div", {
|
|
7380
|
+
key: 0,
|
|
7381
|
+
class: normalizeClass(["mce-btn", {
|
|
7382
|
+
"mce-btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
7383
|
+
}]),
|
|
7384
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(setLock)(props.node, !unref(isLock)(props.node)))
|
|
7385
|
+
}, [
|
|
7386
|
+
createVNode(_sfc_main$z, {
|
|
7387
|
+
icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
|
|
7388
|
+
}, null, 8, ["icon"])
|
|
7389
|
+
], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
7390
|
+
createVNode(_sfc_main$p, {
|
|
7391
|
+
class: normalizeClass({
|
|
7392
|
+
"mce-btn--hide": !hovering.value && !unref(isLock)(props.node)
|
|
7393
|
+
}),
|
|
7394
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
7395
|
+
}, {
|
|
7396
|
+
default: withCtx(() => [
|
|
7397
|
+
createVNode(_sfc_main$z, {
|
|
7398
|
+
icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
|
|
7399
|
+
}, null, 8, ["icon"])
|
|
7400
|
+
]),
|
|
7401
|
+
_: 1
|
|
7402
|
+
}, 8, ["class"]),
|
|
7403
|
+
createVNode(_sfc_main$p, {
|
|
7404
|
+
class: normalizeClass({
|
|
7405
|
+
"mce-btn--hide": !hovering.value && unref(isVisible)(props.node)
|
|
7406
|
+
}),
|
|
7407
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
7408
|
+
}, {
|
|
7409
|
+
default: withCtx(() => [
|
|
7410
|
+
createVNode(_sfc_main$z, {
|
|
7411
|
+
icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
|
|
7412
|
+
}, null, 8, ["icon"])
|
|
7413
|
+
]),
|
|
7414
|
+
_: 1
|
|
7415
|
+
}, 8, ["class"])
|
|
7416
|
+
], 64))
|
|
7417
|
+
])
|
|
7418
|
+
], 32)
|
|
7419
|
+
], 38),
|
|
7420
|
+
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.node.children, (child, key) => {
|
|
7421
|
+
return openBlock(), createBlock(_component_MceLayer, {
|
|
7422
|
+
key,
|
|
7423
|
+
node: child,
|
|
7424
|
+
indent: __props.root ? props.indent : props.indent + 1,
|
|
7425
|
+
active: __props.active || isActive.value
|
|
7426
|
+
}, null, 8, ["node", "indent", "active"]);
|
|
7427
|
+
}), 128)) : createCommentVNode("", true)
|
|
7428
|
+
], 64);
|
|
7429
|
+
};
|
|
7430
|
+
}
|
|
7431
|
+
});
|
|
7432
|
+
const _hoisted_1$e = { class: "mce-layers" };
|
|
7433
|
+
const _hoisted_2$7 = { class: "mce-layers__wrapper" };
|
|
7434
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
7435
|
+
__name: "Layers",
|
|
7436
|
+
setup(__props) {
|
|
7437
|
+
const {
|
|
7438
|
+
root,
|
|
7439
|
+
selection,
|
|
7440
|
+
state,
|
|
7441
|
+
nodeIndexMap
|
|
7442
|
+
} = useEditor();
|
|
7443
|
+
const sortedSelection = computed(() => {
|
|
7444
|
+
return selection.value.map((node) => {
|
|
7445
|
+
return {
|
|
7446
|
+
node,
|
|
7447
|
+
index: nodeIndexMap.get(node.id) ?? 0
|
|
7448
|
+
};
|
|
7449
|
+
}).sort((a, b) => a.index - b.index).map((v) => v.node);
|
|
7450
|
+
});
|
|
7451
|
+
const {
|
|
7452
|
+
selecting,
|
|
7453
|
+
openedItems,
|
|
7454
|
+
domItems
|
|
7455
|
+
} = createLayer({
|
|
7456
|
+
sortedSelection
|
|
7457
|
+
});
|
|
7458
|
+
watch(selection, (selection2) => {
|
|
7459
|
+
if (state.value === "selecting" || selecting.value) {
|
|
7460
|
+
return;
|
|
7461
|
+
}
|
|
7462
|
+
let last;
|
|
7463
|
+
selection2.forEach((node) => {
|
|
7464
|
+
node.findAncestor((ancestor) => {
|
|
7465
|
+
const opened = openedItems.get(ancestor.id);
|
|
7466
|
+
if (opened) {
|
|
7467
|
+
opened.value = true;
|
|
7468
|
+
}
|
|
7469
|
+
return false;
|
|
7470
|
+
});
|
|
7471
|
+
last = node;
|
|
7472
|
+
});
|
|
7473
|
+
if (last) {
|
|
7474
|
+
nextTick().then(() => {
|
|
7475
|
+
domItems.get(last.id)?.value?.scrollIntoView({
|
|
7476
|
+
block: "center"
|
|
7477
|
+
});
|
|
7478
|
+
});
|
|
7479
|
+
}
|
|
7480
|
+
});
|
|
7481
|
+
return (_ctx, _cache) => {
|
|
7482
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
7483
|
+
createElementVNode("div", _hoisted_2$7, [
|
|
7484
|
+
createVNode(_sfc_main$o, {
|
|
7485
|
+
root: true,
|
|
7486
|
+
node: unref(root),
|
|
7487
|
+
opened: true
|
|
7488
|
+
}, null, 8, ["node"])
|
|
7489
|
+
])
|
|
7490
|
+
]);
|
|
6927
7491
|
};
|
|
6928
7492
|
}
|
|
6929
7493
|
});
|
|
@@ -6950,7 +7514,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
6950
7514
|
updateLocation
|
|
6951
7515
|
});
|
|
6952
7516
|
return (_ctx, _cache) => {
|
|
6953
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7517
|
+
return openBlock(), createBlock(_sfc_main$y, {
|
|
6954
7518
|
ref: "overlayTpl",
|
|
6955
7519
|
modelValue: isActive.value,
|
|
6956
7520
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
@@ -6976,7 +7540,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
6976
7540
|
};
|
|
6977
7541
|
}
|
|
6978
7542
|
});
|
|
6979
|
-
const _hoisted_1$
|
|
7543
|
+
const _hoisted_1$d = ["width", "height"];
|
|
6980
7544
|
const _hoisted_2$6 = ["onDblclick", "onMousedown", "onMousemove"];
|
|
6981
7545
|
const _hoisted_3$6 = { style: { "font-size": "12px", "text-wrap": "nowrap" } };
|
|
6982
7546
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
@@ -7235,7 +7799,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7235
7799
|
class: "mce-ruler__canvas",
|
|
7236
7800
|
width: props.size,
|
|
7237
7801
|
height: props.size
|
|
7238
|
-
}, null, 8, _hoisted_1$
|
|
7802
|
+
}, null, 8, _hoisted_1$d)
|
|
7239
7803
|
], 16)), [
|
|
7240
7804
|
[unref(vResizeObserver), unref(resize)]
|
|
7241
7805
|
]),
|
|
@@ -7273,7 +7837,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7273
7837
|
};
|
|
7274
7838
|
}
|
|
7275
7839
|
});
|
|
7276
|
-
const _hoisted_1$
|
|
7840
|
+
const _hoisted_1$c = { class: "mce-rulers" };
|
|
7277
7841
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
7278
7842
|
...{
|
|
7279
7843
|
inheritAttrs: false
|
|
@@ -7287,7 +7851,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7287
7851
|
} = useEditor();
|
|
7288
7852
|
const activeAabb = computed(() => getAabbInDrawboard(selection.value));
|
|
7289
7853
|
return (_ctx, _cache) => {
|
|
7290
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7854
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
7291
7855
|
createVNode(_sfc_main$l, {
|
|
7292
7856
|
refline: "",
|
|
7293
7857
|
zoom: unref(camera).zoom.x,
|
|
@@ -7310,7 +7874,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7310
7874
|
};
|
|
7311
7875
|
}
|
|
7312
7876
|
});
|
|
7313
|
-
const _hoisted_1$
|
|
7877
|
+
const _hoisted_1$b = {
|
|
7314
7878
|
ref: "trackTplRef",
|
|
7315
7879
|
class: "mce-scrollbar__track"
|
|
7316
7880
|
};
|
|
@@ -7401,7 +7965,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
7401
7965
|
[props.vertical ? "top" : "left"]: `${props.offset}px`
|
|
7402
7966
|
})
|
|
7403
7967
|
}, [
|
|
7404
|
-
createElementVNode("div", _hoisted_1$
|
|
7968
|
+
createElementVNode("div", _hoisted_1$b, [
|
|
7405
7969
|
createElementVNode("div", {
|
|
7406
7970
|
ref: "thumbTplRef",
|
|
7407
7971
|
class: normalizeClass(["mce-scrollbar__thumb", {
|
|
@@ -7454,7 +8018,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7454
8018
|
};
|
|
7455
8019
|
}
|
|
7456
8020
|
});
|
|
7457
|
-
const _hoisted_1$
|
|
8021
|
+
const _hoisted_1$a = { class: "mce-transformable__svg" };
|
|
7458
8022
|
const _hoisted_2$5 = { "pointer-events": "all" };
|
|
7459
8023
|
const _hoisted_3$5 = ["x", "y", "width", "height", "aria-label", "fill"];
|
|
7460
8024
|
const _hoisted_4$3 = ["cx", "cy", "r", "aria-label", "fill"];
|
|
@@ -7830,13 +8394,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7830
8394
|
default: withCtx(() => [
|
|
7831
8395
|
renderSlot(_ctx.$slots, "default", {
|
|
7832
8396
|
value: unref(modelValue),
|
|
7833
|
-
|
|
7834
|
-
onPointerdown: start
|
|
7835
|
-
style: { cursor: "move" }
|
|
8397
|
+
props: {
|
|
8398
|
+
onPointerdown: start
|
|
7836
8399
|
},
|
|
7837
8400
|
start
|
|
7838
8401
|
}),
|
|
7839
|
-
(openBlock(), createElementBlock("svg", _hoisted_1$
|
|
8402
|
+
(openBlock(), createElementBlock("svg", _hoisted_1$a, [
|
|
7840
8403
|
createElementVNode("rect", {
|
|
7841
8404
|
width: "100%",
|
|
7842
8405
|
height: "100%",
|
|
@@ -7926,7 +8489,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7926
8489
|
const {
|
|
7927
8490
|
state,
|
|
7928
8491
|
resizeElement,
|
|
7929
|
-
|
|
8492
|
+
elementSelection,
|
|
7930
8493
|
camera,
|
|
7931
8494
|
obbToFit,
|
|
7932
8495
|
getObbInDrawboard,
|
|
@@ -7934,7 +8497,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7934
8497
|
registerCommand,
|
|
7935
8498
|
unregisterCommand,
|
|
7936
8499
|
isFrame,
|
|
7937
|
-
|
|
8500
|
+
isLock,
|
|
7938
8501
|
config
|
|
7939
8502
|
} = useEditor();
|
|
7940
8503
|
const transformable = useTemplateRef("transformableRef");
|
|
@@ -7945,11 +8508,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7945
8508
|
unregisterCommand("startTransform");
|
|
7946
8509
|
});
|
|
7947
8510
|
const parentObbs = computed(() => {
|
|
7948
|
-
if (
|
|
8511
|
+
if (elementSelection.value.length !== 1) {
|
|
7949
8512
|
return [];
|
|
7950
8513
|
}
|
|
7951
8514
|
const obbs = [];
|
|
7952
|
-
|
|
8515
|
+
elementSelection.value[0]?.findAncestor((ancestor) => {
|
|
7953
8516
|
if (ancestor instanceof Element2D) {
|
|
7954
8517
|
obbs.push(getObbInDrawboard(ancestor));
|
|
7955
8518
|
}
|
|
@@ -7958,17 +8521,17 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7958
8521
|
return obbs;
|
|
7959
8522
|
});
|
|
7960
8523
|
const selectionObbs = computed(() => {
|
|
7961
|
-
if (state.value !== "selecting" &&
|
|
8524
|
+
if (state.value !== "selecting" && elementSelection.value.length === 1) {
|
|
7962
8525
|
return [];
|
|
7963
8526
|
}
|
|
7964
|
-
return
|
|
8527
|
+
return elementSelection.value.map((el) => {
|
|
7965
8528
|
return {
|
|
7966
8529
|
name: el.name,
|
|
7967
8530
|
box: getObbInDrawboard(el)
|
|
7968
8531
|
};
|
|
7969
8532
|
});
|
|
7970
8533
|
});
|
|
7971
|
-
const _selectionObb = computed(() => getObbInDrawboard(
|
|
8534
|
+
const _selectionObb = computed(() => getObbInDrawboard(elementSelection.value));
|
|
7972
8535
|
const selectionObb = computed({
|
|
7973
8536
|
get: () => _selectionObb.value,
|
|
7974
8537
|
set: (val) => {
|
|
@@ -7982,7 +8545,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7982
8545
|
rotate: Math.round((val.rotate ?? 0) - (oldBox.rotate ?? 0))
|
|
7983
8546
|
};
|
|
7984
8547
|
const handle = transformable.value?.activeHandle ?? "move";
|
|
7985
|
-
|
|
8548
|
+
elementSelection.value.forEach((element) => {
|
|
7986
8549
|
const style = element.style;
|
|
7987
8550
|
const box = {
|
|
7988
8551
|
left: style.left + offsetBox.left,
|
|
@@ -8015,7 +8578,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
8015
8578
|
}
|
|
8016
8579
|
});
|
|
8017
8580
|
function tipFormat() {
|
|
8018
|
-
const obb =
|
|
8581
|
+
const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : getObb(elementSelection.value);
|
|
8019
8582
|
return `${Number(obb.width.toFixed(2))} × ${Number(obb.height.toFixed(2))}`;
|
|
8020
8583
|
}
|
|
8021
8584
|
__expose({
|
|
@@ -8057,11 +8620,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
8057
8620
|
modelValue: selectionObb.value,
|
|
8058
8621
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectionObb.value = $event),
|
|
8059
8622
|
visibility: unref(state) !== "selecting" ? "auto" : "none",
|
|
8060
|
-
moveable: unref(
|
|
8623
|
+
moveable: unref(elementSelection)[0] && !unref(isLock)(unref(elementSelection)[0]),
|
|
8061
8624
|
"resize-strategy": props.resizeStrategy,
|
|
8062
8625
|
"handle-shape": unref(config).handleShape,
|
|
8063
8626
|
class: "mce-selection-obb",
|
|
8064
|
-
"border-style": unref(
|
|
8627
|
+
"border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
|
|
8065
8628
|
"tip-format": tipFormat,
|
|
8066
8629
|
onMove: _cache[1] || (_cache[1] = () => !unref(state) && (state.value = "transforming")),
|
|
8067
8630
|
onEnd: _cache[2] || (_cache[2] = () => unref(state) === "transforming" && (state.value = void 0))
|
|
@@ -8093,7 +8656,67 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
8093
8656
|
};
|
|
8094
8657
|
}
|
|
8095
8658
|
});
|
|
8659
|
+
const _hoisted_1$9 = {
|
|
8660
|
+
key: 0,
|
|
8661
|
+
class: "mce-float-panel__title"
|
|
8662
|
+
};
|
|
8096
8663
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
8664
|
+
__name: "FloatPanel",
|
|
8665
|
+
props: /* @__PURE__ */ mergeModels({
|
|
8666
|
+
title: {},
|
|
8667
|
+
defaultTransform: {}
|
|
8668
|
+
}, {
|
|
8669
|
+
"modelValue": { type: Boolean },
|
|
8670
|
+
"modelModifiers": {}
|
|
8671
|
+
}),
|
|
8672
|
+
emits: ["update:modelValue"],
|
|
8673
|
+
setup(__props) {
|
|
8674
|
+
const props = __props;
|
|
8675
|
+
const isActive = useModel(__props, "modelValue");
|
|
8676
|
+
const transform = ref({
|
|
8677
|
+
width: 300,
|
|
8678
|
+
height: 600,
|
|
8679
|
+
left: 60,
|
|
8680
|
+
top: 60,
|
|
8681
|
+
...props.defaultTransform
|
|
8682
|
+
});
|
|
8683
|
+
return (_ctx, _cache) => {
|
|
8684
|
+
return openBlock(), createBlock(_sfc_main$h, {
|
|
8685
|
+
modelValue: transform.value,
|
|
8686
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
|
|
8687
|
+
class: "mce-float-panel",
|
|
8688
|
+
visibility: "none",
|
|
8689
|
+
onWheel: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
8690
|
+
}, ["stop"]))
|
|
8691
|
+
}, {
|
|
8692
|
+
default: withCtx(({ props: slotProps }) => [
|
|
8693
|
+
createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
|
|
8694
|
+
__props.title ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
8695
|
+
createElementVNode("div", null, toDisplayString(__props.title), 1),
|
|
8696
|
+
createVNode(_sfc_main$p, {
|
|
8697
|
+
onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
|
|
8698
|
+
}, {
|
|
8699
|
+
default: withCtx(() => [
|
|
8700
|
+
createVNode(_sfc_main$z, { icon: "$close" })
|
|
8701
|
+
]),
|
|
8702
|
+
_: 1
|
|
8703
|
+
})
|
|
8704
|
+
])) : createCommentVNode("", true),
|
|
8705
|
+
createElementVNode("div", {
|
|
8706
|
+
class: "mce-float-panel__content",
|
|
8707
|
+
onPointerdown: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
8708
|
+
}, ["stop"]))
|
|
8709
|
+
}, [
|
|
8710
|
+
renderSlot(_ctx.$slots, "default")
|
|
8711
|
+
], 32)
|
|
8712
|
+
], 16)
|
|
8713
|
+
]),
|
|
8714
|
+
_: 3
|
|
8715
|
+
}, 8, ["modelValue"]);
|
|
8716
|
+
};
|
|
8717
|
+
}
|
|
8718
|
+
});
|
|
8719
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
8097
8720
|
__name: "Layout",
|
|
8098
8721
|
props: {
|
|
8099
8722
|
...makeLayoutProps()
|
|
@@ -8122,7 +8745,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8122
8745
|
};
|
|
8123
8746
|
}
|
|
8124
8747
|
});
|
|
8125
|
-
const _sfc_main$
|
|
8748
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
8126
8749
|
__name: "LayoutItem",
|
|
8127
8750
|
props: {
|
|
8128
8751
|
position: {
|
|
@@ -8166,7 +8789,7 @@ const _hoisted_1$8 = {
|
|
|
8166
8789
|
key: 0,
|
|
8167
8790
|
class: "mce-main__scroller"
|
|
8168
8791
|
};
|
|
8169
|
-
const _sfc_main$
|
|
8792
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
8170
8793
|
__name: "Main",
|
|
8171
8794
|
props: {
|
|
8172
8795
|
scrollable: Boolean
|
|
@@ -8198,7 +8821,7 @@ const _hoisted_4$2 = {
|
|
|
8198
8821
|
key: 1,
|
|
8199
8822
|
class: "progress-indicator__bar-indeterminate"
|
|
8200
8823
|
};
|
|
8201
|
-
const _sfc_main$
|
|
8824
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
8202
8825
|
__name: "ProgressIndicator",
|
|
8203
8826
|
props: /* @__PURE__ */ mergeModels({
|
|
8204
8827
|
label: {},
|
|
@@ -8231,7 +8854,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
8231
8854
|
}
|
|
8232
8855
|
return target;
|
|
8233
8856
|
};
|
|
8234
|
-
const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
8857
|
+
const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-c4234331"]]);
|
|
8235
8858
|
const _hoisted_1$6 = { class: "mce-statusbar" };
|
|
8236
8859
|
const _hoisted_2$3 = { class: "mce-statusbar__main" };
|
|
8237
8860
|
const _hoisted_3$3 = { class: "mce-statusbar__item" };
|
|
@@ -8253,7 +8876,7 @@ const _hoisted_18 = { class: "mce-statusbar__item" };
|
|
|
8253
8876
|
const _hoisted_19 = { class: "mce-statusbar__kbd" };
|
|
8254
8877
|
const _hoisted_20 = { class: "mce-statusbar__item" };
|
|
8255
8878
|
const _hoisted_21 = { class: "mce-statusbar__progress" };
|
|
8256
|
-
const _sfc_main$
|
|
8879
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
8257
8880
|
__name: "Statusbar",
|
|
8258
8881
|
setup(__props) {
|
|
8259
8882
|
const {
|
|
@@ -8278,7 +8901,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8278
8901
|
])
|
|
8279
8902
|
], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
8280
8903
|
createElementVNode("div", _hoisted_8, [
|
|
8281
|
-
createVNode(_sfc_main$
|
|
8904
|
+
createVNode(_sfc_main$z, { icon: "$mouseRightClick" })
|
|
8282
8905
|
]),
|
|
8283
8906
|
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
8284
8907
|
createElementVNode("div", _hoisted_9, [
|
|
@@ -8292,7 +8915,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8292
8915
|
])
|
|
8293
8916
|
], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
8294
8917
|
createElementVNode("div", _hoisted_14, [
|
|
8295
|
-
createVNode(_sfc_main$
|
|
8918
|
+
createVNode(_sfc_main$z, { icon: "$mouseLeftClick" }),
|
|
8296
8919
|
createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
|
|
8297
8920
|
]),
|
|
8298
8921
|
_cache[4] || (_cache[4] = createElementVNode("span", null, " + ", -1)),
|
|
@@ -8302,7 +8925,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8302
8925
|
]),
|
|
8303
8926
|
_cache[5] || (_cache[5] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
8304
8927
|
createElementVNode("div", _hoisted_17, [
|
|
8305
|
-
createVNode(_sfc_main$
|
|
8928
|
+
createVNode(_sfc_main$z, { icon: "$mouseLeftClick" }),
|
|
8306
8929
|
createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
|
|
8307
8930
|
]),
|
|
8308
8931
|
_cache[6] || (_cache[6] = createElementVNode("span", null, " + ", -1)),
|
|
@@ -8312,7 +8935,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8312
8935
|
]),
|
|
8313
8936
|
_cache[7] || (_cache[7] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
8314
8937
|
createElementVNode("div", _hoisted_20, [
|
|
8315
|
-
createVNode(_sfc_main$
|
|
8938
|
+
createVNode(_sfc_main$z, { icon: "$mouseLeftClick" }),
|
|
8316
8939
|
createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
|
|
8317
8940
|
])
|
|
8318
8941
|
], 64))
|
|
@@ -8329,12 +8952,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8329
8952
|
};
|
|
8330
8953
|
}
|
|
8331
8954
|
});
|
|
8332
|
-
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
8333
|
-
const _sfc_main$
|
|
8955
|
+
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-36c89bd7"]]);
|
|
8956
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
8334
8957
|
__name: "TextEditor",
|
|
8335
8958
|
setup(__props, { expose: __expose }) {
|
|
8336
8959
|
const {
|
|
8337
|
-
|
|
8960
|
+
elementSelection,
|
|
8338
8961
|
state,
|
|
8339
8962
|
textSelection,
|
|
8340
8963
|
textToFit,
|
|
@@ -8352,7 +8975,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
8352
8975
|
};
|
|
8353
8976
|
});
|
|
8354
8977
|
const textEditorStyle = computed(() => {
|
|
8355
|
-
const element =
|
|
8978
|
+
const element = elementSelection.value[0];
|
|
8356
8979
|
const obb = getObb(element);
|
|
8357
8980
|
const textBox = element?.text.base?.boundingBox;
|
|
8358
8981
|
if (textBox) {
|
|
@@ -8368,14 +8991,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
8368
8991
|
textSelection.value = e.detail;
|
|
8369
8992
|
}
|
|
8370
8993
|
function onUpdate() {
|
|
8371
|
-
const element =
|
|
8994
|
+
const element = elementSelection.value[0];
|
|
8372
8995
|
const shape = element.shape;
|
|
8373
8996
|
if (!shape.enabled || !shape._path2DSet.paths.length) {
|
|
8374
8997
|
textToFit(element);
|
|
8375
8998
|
}
|
|
8376
8999
|
}
|
|
8377
9000
|
async function startTyping(e) {
|
|
8378
|
-
const element =
|
|
9001
|
+
const element = elementSelection.value[0];
|
|
8379
9002
|
if (!element) {
|
|
8380
9003
|
return false;
|
|
8381
9004
|
}
|
|
@@ -8420,13 +9043,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
8420
9043
|
}, null, 544)
|
|
8421
9044
|
], 4)
|
|
8422
9045
|
], 4)), [
|
|
8423
|
-
[vShow, unref(
|
|
9046
|
+
[vShow, unref(elementSelection)[0] && unref(state) === "typing"]
|
|
8424
9047
|
]);
|
|
8425
9048
|
};
|
|
8426
9049
|
}
|
|
8427
9050
|
});
|
|
8428
9051
|
const _hoisted_1$5 = { class: "mce-payhead" };
|
|
8429
|
-
const _sfc_main$
|
|
9052
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
8430
9053
|
__name: "Playhead",
|
|
8431
9054
|
setup(__props) {
|
|
8432
9055
|
return (_ctx, _cache) => {
|
|
@@ -8449,7 +9072,7 @@ const _hoisted_3$2 = {
|
|
|
8449
9072
|
key: 1,
|
|
8450
9073
|
class: "mce-segment__edge mce-segment__edge--end"
|
|
8451
9074
|
};
|
|
8452
|
-
const _sfc_main$
|
|
9075
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
8453
9076
|
__name: "Segment",
|
|
8454
9077
|
props: {
|
|
8455
9078
|
node: {},
|
|
@@ -8488,7 +9111,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
8488
9111
|
}
|
|
8489
9112
|
});
|
|
8490
9113
|
const _hoisted_1$3 = { class: "mce-track" };
|
|
8491
|
-
const _sfc_main$
|
|
9114
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
8492
9115
|
__name: "Track",
|
|
8493
9116
|
setup(__props) {
|
|
8494
9117
|
return (_ctx, _cache) => {
|
|
@@ -8498,7 +9121,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
8498
9121
|
};
|
|
8499
9122
|
}
|
|
8500
9123
|
});
|
|
8501
|
-
const _sfc_main$
|
|
9124
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
8502
9125
|
__name: "Trackhead",
|
|
8503
9126
|
props: {
|
|
8504
9127
|
node: {}
|
|
@@ -8522,10 +9145,11 @@ const _hoisted_5 = { class: "mce-timeline__right-wrapper" };
|
|
|
8522
9145
|
const _hoisted_6 = { class: "mce-timeline__ruler" };
|
|
8523
9146
|
const _hoisted_7 = { class: "mce-timeline__track" };
|
|
8524
9147
|
const wheelSensitivity = 0.02;
|
|
8525
|
-
const _sfc_main$
|
|
9148
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
8526
9149
|
__name: "Timeline",
|
|
8527
9150
|
setup(__props) {
|
|
8528
9151
|
const {
|
|
9152
|
+
isElement,
|
|
8529
9153
|
root,
|
|
8530
9154
|
msPerPx,
|
|
8531
9155
|
currentTime,
|
|
@@ -8539,7 +9163,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8539
9163
|
const position = ref([0, 0]);
|
|
8540
9164
|
const elements = computed(() => {
|
|
8541
9165
|
return root.value.findAll((node) => {
|
|
8542
|
-
if (node
|
|
9166
|
+
if (isElement(node)) {
|
|
8543
9167
|
if (node.children.some((child) => child instanceof Animation)) {
|
|
8544
9168
|
return true;
|
|
8545
9169
|
}
|
|
@@ -8630,7 +9254,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8630
9254
|
class: "mce-timeline__play",
|
|
8631
9255
|
onClick: toggle
|
|
8632
9256
|
}, [
|
|
8633
|
-
createVNode(_sfc_main$
|
|
9257
|
+
createVNode(_sfc_main$z, {
|
|
8634
9258
|
icon: paused.value ? "$play" : "$pause"
|
|
8635
9259
|
}, null, 8, ["icon"])
|
|
8636
9260
|
])
|
|
@@ -8644,7 +9268,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8644
9268
|
})
|
|
8645
9269
|
}, [
|
|
8646
9270
|
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
8647
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9271
|
+
return openBlock(), createBlock(_sfc_main$4, {
|
|
8648
9272
|
key: index,
|
|
8649
9273
|
node
|
|
8650
9274
|
}, null, 8, ["node"]);
|
|
@@ -8677,9 +9301,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8677
9301
|
})
|
|
8678
9302
|
}, [
|
|
8679
9303
|
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
8680
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9304
|
+
return openBlock(), createBlock(_sfc_main$5, { key: index }, {
|
|
8681
9305
|
default: withCtx(() => [
|
|
8682
|
-
createVNode(_sfc_main$
|
|
9306
|
+
createVNode(_sfc_main$6, {
|
|
8683
9307
|
node,
|
|
8684
9308
|
"ms-per-px": unref(msPerPx),
|
|
8685
9309
|
active: unref(selection).some((v) => v.equal(node)),
|
|
@@ -8691,7 +9315,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8691
9315
|
}), 128))
|
|
8692
9316
|
], 4)
|
|
8693
9317
|
]),
|
|
8694
|
-
createVNode(_sfc_main$
|
|
9318
|
+
createVNode(_sfc_main$7, {
|
|
8695
9319
|
style: normalizeStyle({
|
|
8696
9320
|
transform: `translate(${position.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
|
|
8697
9321
|
})
|
|
@@ -8703,12 +9327,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
8703
9327
|
};
|
|
8704
9328
|
}
|
|
8705
9329
|
});
|
|
8706
|
-
const _sfc_main$
|
|
9330
|
+
const _sfc_main$2 = {};
|
|
8707
9331
|
const _hoisted_1$1 = { class: "mce-toolbelt" };
|
|
8708
9332
|
function _sfc_render(_ctx, _cache) {
|
|
8709
9333
|
return openBlock(), createElementBlock("div", _hoisted_1$1);
|
|
8710
9334
|
}
|
|
8711
|
-
const Toolbelt = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
9335
|
+
const Toolbelt = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
|
|
8712
9336
|
const _hoisted_1 = ["data-pixel-ratio"];
|
|
8713
9337
|
const _hoisted_2 = {
|
|
8714
9338
|
ref: "canvasTpl",
|
|
@@ -8718,7 +9342,7 @@ const _hoisted_3 = {
|
|
|
8718
9342
|
ref: "overlayContainerTpl",
|
|
8719
9343
|
class: "mce-editor__overlay-container"
|
|
8720
9344
|
};
|
|
8721
|
-
const _sfc_main$
|
|
9345
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
8722
9346
|
__name: "EditorLayout",
|
|
8723
9347
|
props: {
|
|
8724
9348
|
...makeMceStrategyProps({
|
|
@@ -8751,11 +9375,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8751
9375
|
isFrame,
|
|
8752
9376
|
selectArea,
|
|
8753
9377
|
exec,
|
|
8754
|
-
|
|
8755
|
-
|
|
9378
|
+
isLock,
|
|
9379
|
+
elementSelection,
|
|
8756
9380
|
getAabbInDrawboard,
|
|
8757
9381
|
drawboardAabb,
|
|
8758
|
-
drawboardPointer
|
|
9382
|
+
drawboardPointer,
|
|
9383
|
+
screenCenterOffset,
|
|
9384
|
+
t
|
|
8759
9385
|
} = editor;
|
|
8760
9386
|
const overlayContainer = useTemplateRef("overlayContainerTpl");
|
|
8761
9387
|
const canvas = useTemplateRef("canvasTpl");
|
|
@@ -8790,12 +9416,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8790
9416
|
let hovered;
|
|
8791
9417
|
if (isPointInsideAabb(
|
|
8792
9418
|
{ x: event.clientX, y: event.clientY },
|
|
8793
|
-
getAabbInDrawboard(
|
|
9419
|
+
getAabbInDrawboard(elementSelection.value)
|
|
8794
9420
|
)) {
|
|
8795
9421
|
cursor = "move";
|
|
8796
9422
|
} else {
|
|
8797
9423
|
const element = event.target;
|
|
8798
|
-
const oldElement =
|
|
9424
|
+
const oldElement = elementSelection.value[0];
|
|
8799
9425
|
const result = props.hoverStrategy({
|
|
8800
9426
|
element,
|
|
8801
9427
|
oldElement,
|
|
@@ -8816,7 +9442,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8816
9442
|
if (event.srcElement !== drawboardDom.value && event.srcElement.dataset?.pointerdown_to_drawboard === void 0 || camera.value.spaceKey || ![0, 2].includes(event.button)) {
|
|
8817
9443
|
return;
|
|
8818
9444
|
}
|
|
8819
|
-
const oldElement =
|
|
9445
|
+
const oldElement = elementSelection.value[0];
|
|
8820
9446
|
const element = event.target;
|
|
8821
9447
|
const start = { x: event.clientX, y: event.clientY };
|
|
8822
9448
|
let current = { ...start };
|
|
@@ -8827,7 +9453,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8827
9453
|
const inSelected = isPointInsideAabb({
|
|
8828
9454
|
x: start.x + -drawboardAabb.value.left,
|
|
8829
9455
|
y: start.y + -drawboardAabb.value.top
|
|
8830
|
-
}, getAabbInDrawboard(
|
|
9456
|
+
}, getAabbInDrawboard(elementSelection.value));
|
|
8831
9457
|
if (event.button === 2) {
|
|
8832
9458
|
if (!inSelected) {
|
|
8833
9459
|
const result = props.activeStrategy({
|
|
@@ -8841,7 +9467,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8841
9467
|
} else {
|
|
8842
9468
|
selected = result ? [result] : [];
|
|
8843
9469
|
}
|
|
8844
|
-
|
|
9470
|
+
elementSelection.value = selected;
|
|
8845
9471
|
}
|
|
8846
9472
|
return;
|
|
8847
9473
|
}
|
|
@@ -8857,7 +9483,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8857
9483
|
} else {
|
|
8858
9484
|
selected = result ? [result] : [];
|
|
8859
9485
|
}
|
|
8860
|
-
|
|
9486
|
+
elementSelection.value = selected;
|
|
8861
9487
|
}
|
|
8862
9488
|
function onSelectArea() {
|
|
8863
9489
|
if (state.value !== "selecting") {
|
|
@@ -8886,10 +9512,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8886
9512
|
_element = result;
|
|
8887
9513
|
}
|
|
8888
9514
|
if (_element && (event?.ctrlKey || event?.shiftKey || event?.metaKey)) {
|
|
8889
|
-
if (
|
|
8890
|
-
selected =
|
|
9515
|
+
if (elementSelection.value.findIndex((v) => v.equal(_element)) > -1) {
|
|
9516
|
+
selected = elementSelection.value.filter((v) => !v.equal(_element));
|
|
8891
9517
|
} else {
|
|
8892
|
-
selected = [...
|
|
9518
|
+
selected = [...elementSelection.value, _element];
|
|
8893
9519
|
}
|
|
8894
9520
|
} else {
|
|
8895
9521
|
selected = _element ? [_element] : [];
|
|
@@ -8934,9 +9560,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8934
9560
|
if (element) {
|
|
8935
9561
|
onActivate();
|
|
8936
9562
|
}
|
|
8937
|
-
|
|
9563
|
+
elementSelection.value = selected;
|
|
8938
9564
|
if (ctxState) {
|
|
8939
|
-
if (selected[0] && !
|
|
9565
|
+
if (selected[0] && !isLock(selected[0])) {
|
|
8940
9566
|
switch (ctxState) {
|
|
8941
9567
|
case "typing": {
|
|
8942
9568
|
await exec("startTyping", _event);
|
|
@@ -8982,31 +9608,31 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8982
9608
|
}
|
|
8983
9609
|
}
|
|
8984
9610
|
return (_ctx, _cache) => {
|
|
8985
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9611
|
+
return openBlock(), createBlock(_sfc_main$d, { class: "mce-editor" }, {
|
|
8986
9612
|
default: withCtx(() => [
|
|
8987
9613
|
createVNode(_sfc_main$f),
|
|
8988
|
-
createVNode(_sfc_main$
|
|
9614
|
+
createVNode(_sfc_main$b, null, {
|
|
8989
9615
|
default: withCtx(() => [
|
|
8990
9616
|
createElementVNode("div", {
|
|
8991
9617
|
ref_key: "drawboardDom",
|
|
8992
9618
|
ref: drawboardDom,
|
|
8993
9619
|
class: "mce-editor__drawboard",
|
|
8994
9620
|
"data-pixel-ratio": unref(renderEngine).pixelRatio,
|
|
8995
|
-
onDblclick: _cache[
|
|
9621
|
+
onDblclick: _cache[1] || (_cache[1] = ($event) => emit("dblclick:drawboard", $event)),
|
|
8996
9622
|
onScroll,
|
|
8997
|
-
onWheel: _cache[
|
|
9623
|
+
onWheel: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
8998
9624
|
}, ["prevent"]))
|
|
8999
9625
|
}, [
|
|
9000
9626
|
createElementVNode("canvas", _hoisted_2, null, 512),
|
|
9001
|
-
createVNode(_sfc_main$
|
|
9002
|
-
createVNode(_sfc_main$
|
|
9003
|
-
createVNode(_sfc_main$
|
|
9004
|
-
createVNode(_sfc_main$p),
|
|
9627
|
+
createVNode(_sfc_main$8, { ref: "textEditorTpl" }, null, 512),
|
|
9628
|
+
createVNode(_sfc_main$A),
|
|
9629
|
+
createVNode(_sfc_main$q),
|
|
9005
9630
|
createVNode(_sfc_main$s),
|
|
9631
|
+
createVNode(_sfc_main$v),
|
|
9006
9632
|
createVNode(_sfc_main$g, {
|
|
9007
9633
|
ref: "selectorTpl",
|
|
9008
9634
|
"selected-area": selectedArea.value,
|
|
9009
|
-
"resize-strategy": unref(
|
|
9635
|
+
"resize-strategy": unref(elementSelection)[0] ? props.resizeStrategy(unref(elementSelection)[0]) : void 0
|
|
9010
9636
|
}, {
|
|
9011
9637
|
transformable: withCtx(({ box }) => [
|
|
9012
9638
|
renderSlot(_ctx.$slots, "transformer", { box })
|
|
@@ -9017,7 +9643,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9017
9643
|
_: 3
|
|
9018
9644
|
}, 8, ["selected-area", "resize-strategy"]),
|
|
9019
9645
|
unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$i, { key: 0 })) : createCommentVNode("", true),
|
|
9020
|
-
_ctx.$slots.floatbar ? (openBlock(), createBlock(_sfc_main$
|
|
9646
|
+
_ctx.$slots.floatbar ? (openBlock(), createBlock(_sfc_main$u, {
|
|
9021
9647
|
key: 1,
|
|
9022
9648
|
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
|
|
9023
9649
|
}, {
|
|
@@ -9026,9 +9652,26 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9026
9652
|
]),
|
|
9027
9653
|
_: 3
|
|
9028
9654
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
9029
|
-
createVNode(_sfc_main$
|
|
9030
|
-
createVNode(_sfc_main$
|
|
9655
|
+
createVNode(_sfc_main$w),
|
|
9656
|
+
createVNode(_sfc_main$r),
|
|
9031
9657
|
unref(config).ruler ? (openBlock(), createBlock(_sfc_main$k, { key: 2 })) : createCommentVNode("", true),
|
|
9658
|
+
unref(config).layers ? (openBlock(), createBlock(_sfc_main$e, {
|
|
9659
|
+
key: 3,
|
|
9660
|
+
modelValue: unref(config).layers,
|
|
9661
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(config).layers = $event),
|
|
9662
|
+
title: unref(t)("layers"),
|
|
9663
|
+
"default-transform": {
|
|
9664
|
+
width: 240,
|
|
9665
|
+
height: unref(drawboardAabb).height * 0.7,
|
|
9666
|
+
top: unref(screenCenterOffset).top + 24,
|
|
9667
|
+
left: unref(screenCenterOffset).left + 24
|
|
9668
|
+
}
|
|
9669
|
+
}, {
|
|
9670
|
+
default: withCtx(() => [
|
|
9671
|
+
createVNode(_sfc_main$n)
|
|
9672
|
+
]),
|
|
9673
|
+
_: 1
|
|
9674
|
+
}, 8, ["modelValue", "title", "default-transform"])) : createCommentVNode("", true),
|
|
9032
9675
|
createVNode(Toolbelt),
|
|
9033
9676
|
renderSlot(_ctx.$slots, "drawboard")
|
|
9034
9677
|
], 40, _hoisted_1)
|
|
@@ -9036,9 +9679,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9036
9679
|
_: 3
|
|
9037
9680
|
}),
|
|
9038
9681
|
renderSlot(_ctx.$slots, "default"),
|
|
9039
|
-
createVNode(_sfc_main$
|
|
9682
|
+
createVNode(_sfc_main$c, {
|
|
9040
9683
|
modelValue: unref(config).statusbar,
|
|
9041
|
-
"onUpdate:modelValue": _cache[
|
|
9684
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(config).statusbar = $event),
|
|
9042
9685
|
position: "bottom",
|
|
9043
9686
|
size: 24
|
|
9044
9687
|
}, {
|
|
@@ -9047,14 +9690,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9047
9690
|
]),
|
|
9048
9691
|
_: 1
|
|
9049
9692
|
}, 8, ["modelValue"]),
|
|
9050
|
-
createVNode(_sfc_main$
|
|
9693
|
+
createVNode(_sfc_main$c, {
|
|
9051
9694
|
modelValue: unref(config).timeline,
|
|
9052
|
-
"onUpdate:modelValue": _cache[
|
|
9695
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(config).timeline = $event),
|
|
9053
9696
|
position: "bottom",
|
|
9054
9697
|
size: 160
|
|
9055
9698
|
}, {
|
|
9056
9699
|
default: withCtx(() => [
|
|
9057
|
-
createVNode(_sfc_main$
|
|
9700
|
+
createVNode(_sfc_main$3)
|
|
9058
9701
|
]),
|
|
9059
9702
|
_: 1
|
|
9060
9703
|
}, 8, ["modelValue"]),
|
|
@@ -9065,220 +9708,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9065
9708
|
};
|
|
9066
9709
|
}
|
|
9067
9710
|
});
|
|
9068
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
9069
|
-
__name: "Layers",
|
|
9070
|
-
setup(__props) {
|
|
9071
|
-
const {
|
|
9072
|
-
root,
|
|
9073
|
-
selection,
|
|
9074
|
-
exec,
|
|
9075
|
-
zoomTo,
|
|
9076
|
-
isFrame
|
|
9077
|
-
} = useEditor();
|
|
9078
|
-
const rootRef = ref();
|
|
9079
|
-
const hover = ref();
|
|
9080
|
-
const current = ref();
|
|
9081
|
-
watch(hover, (hover2) => {
|
|
9082
|
-
const rootBox = rootRef.value?.getBoundingClientRect();
|
|
9083
|
-
const hoverBox = hover2?.dom.getBoundingClientRect();
|
|
9084
|
-
if (rootBox && hoverBox && hover2.node instanceof Element2D) {
|
|
9085
|
-
current.value = {
|
|
9086
|
-
x: -rootRef.value.scrollLeft,
|
|
9087
|
-
y: rootRef.value.scrollTop + hoverBox.y - rootBox.y,
|
|
9088
|
-
node: hover2.node
|
|
9089
|
-
};
|
|
9090
|
-
} else {
|
|
9091
|
-
current.value = void 0;
|
|
9092
|
-
}
|
|
9093
|
-
});
|
|
9094
|
-
function onMouseleave() {
|
|
9095
|
-
hover.value = void 0;
|
|
9096
|
-
}
|
|
9097
|
-
const Layer = defineComponent({
|
|
9098
|
-
name: "MceLayer",
|
|
9099
|
-
inheritAttrs: false,
|
|
9100
|
-
props: {
|
|
9101
|
-
node: {
|
|
9102
|
-
type: Object,
|
|
9103
|
-
required: true
|
|
9104
|
-
},
|
|
9105
|
-
indent: {
|
|
9106
|
-
type: Number,
|
|
9107
|
-
default: 0
|
|
9108
|
-
}
|
|
9109
|
-
},
|
|
9110
|
-
setup(props, { attrs }) {
|
|
9111
|
-
const opened = ref(false);
|
|
9112
|
-
const isActive = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
9113
|
-
const children = computed(() => props.node?.children ?? []);
|
|
9114
|
-
const itemRef = ref();
|
|
9115
|
-
const editing = ref(false);
|
|
9116
|
-
const editValue = ref();
|
|
9117
|
-
function onClickExpand() {
|
|
9118
|
-
opened.value = !opened.value;
|
|
9119
|
-
}
|
|
9120
|
-
function onClickContent(e) {
|
|
9121
|
-
if (props.node instanceof Element2D) {
|
|
9122
|
-
if (e.shiftKey) {
|
|
9123
|
-
selection.value = [
|
|
9124
|
-
...selection.value.filter((v) => !v.equal(props.node)),
|
|
9125
|
-
props.node
|
|
9126
|
-
];
|
|
9127
|
-
} else {
|
|
9128
|
-
selection.value = [props.node];
|
|
9129
|
-
}
|
|
9130
|
-
}
|
|
9131
|
-
}
|
|
9132
|
-
function onDblclickThumbnail(e) {
|
|
9133
|
-
e.stopPropagation();
|
|
9134
|
-
if (props.node instanceof Element2D) {
|
|
9135
|
-
zoomTo("selection", {
|
|
9136
|
-
behavior: "smooth"
|
|
9137
|
-
});
|
|
9138
|
-
}
|
|
9139
|
-
}
|
|
9140
|
-
function onDblclickContent() {
|
|
9141
|
-
editing.value = true;
|
|
9142
|
-
}
|
|
9143
|
-
function onMouseenter() {
|
|
9144
|
-
hover.value = {
|
|
9145
|
-
node: props.node,
|
|
9146
|
-
dom: itemRef.value
|
|
9147
|
-
};
|
|
9148
|
-
}
|
|
9149
|
-
function onContextmenu(e) {
|
|
9150
|
-
if (props.node instanceof Element2D) {
|
|
9151
|
-
if (!selection.value.some((v) => v.equal(props.node))) {
|
|
9152
|
-
selection.value = [props.node];
|
|
9153
|
-
}
|
|
9154
|
-
exec("openContextMenu", e);
|
|
9155
|
-
}
|
|
9156
|
-
}
|
|
9157
|
-
return () => {
|
|
9158
|
-
function thumbnail() {
|
|
9159
|
-
const node = props.node;
|
|
9160
|
-
if (isFrame(node)) {
|
|
9161
|
-
return createVNode(_sfc_main$w, { icon: "$frame" });
|
|
9162
|
-
}
|
|
9163
|
-
if (node.children.length > 0) {
|
|
9164
|
-
return createVNode(_sfc_main$w, { icon: "$group" });
|
|
9165
|
-
}
|
|
9166
|
-
if (node instanceof Element2D) {
|
|
9167
|
-
if (node.foreground.isValid() && node.foreground.image) {
|
|
9168
|
-
return createVNode(_sfc_main$w, { icon: "$image" });
|
|
9169
|
-
}
|
|
9170
|
-
if (node.text.isValid()) {
|
|
9171
|
-
return createVNode(_sfc_main$w, { icon: "$text" });
|
|
9172
|
-
}
|
|
9173
|
-
}
|
|
9174
|
-
return createVNode(_sfc_main$w, { icon: "$shape" });
|
|
9175
|
-
}
|
|
9176
|
-
return createElementVNode(
|
|
9177
|
-
"div",
|
|
9178
|
-
mergeProps(attrs, {
|
|
9179
|
-
class: [
|
|
9180
|
-
"mce-layer",
|
|
9181
|
-
isActive.value && "mce-layer--active",
|
|
9182
|
-
opened.value && "mce-layer--opened"
|
|
9183
|
-
]
|
|
9184
|
-
}),
|
|
9185
|
-
[
|
|
9186
|
-
createElementVNode("div", {
|
|
9187
|
-
class: "mce-layer-item",
|
|
9188
|
-
style: {
|
|
9189
|
-
"--indent-padding": `${props.indent * 16}px`
|
|
9190
|
-
},
|
|
9191
|
-
ref: itemRef,
|
|
9192
|
-
onMouseenter,
|
|
9193
|
-
onContextmenu
|
|
9194
|
-
}, [
|
|
9195
|
-
createElementVNode("div", {
|
|
9196
|
-
class: "mce-layer-item__expand",
|
|
9197
|
-
onClick: onClickExpand
|
|
9198
|
-
}, [
|
|
9199
|
-
children.value.length ? createVNode(_sfc_main$w, { icon: "$arrowRight" }) : void 0
|
|
9200
|
-
]),
|
|
9201
|
-
createElementVNode("div", {
|
|
9202
|
-
class: "mce-layer-item__content",
|
|
9203
|
-
onClick: onClickContent,
|
|
9204
|
-
onDblclick: onDblclickContent
|
|
9205
|
-
}, [
|
|
9206
|
-
createElementVNode("div", {
|
|
9207
|
-
class: "mce-layer-item__thumbnail",
|
|
9208
|
-
onDblclick: onDblclickThumbnail
|
|
9209
|
-
}, [
|
|
9210
|
-
thumbnail()
|
|
9211
|
-
]),
|
|
9212
|
-
createElementVNode("div", {
|
|
9213
|
-
class: "mce-layer-item__name"
|
|
9214
|
-
}, [
|
|
9215
|
-
editing.value ? createElementVNode("input", {
|
|
9216
|
-
class: "mce-layer-item__name-input",
|
|
9217
|
-
autofocus: true,
|
|
9218
|
-
value: props.node.name,
|
|
9219
|
-
onBlur: () => {
|
|
9220
|
-
editing.value = false;
|
|
9221
|
-
if (editValue.value) {
|
|
9222
|
-
props.node.name = editValue.value;
|
|
9223
|
-
editValue.value = void 0;
|
|
9224
|
-
}
|
|
9225
|
-
},
|
|
9226
|
-
onInput: (e) => editValue.value = e.target.value
|
|
9227
|
-
}) : props.node.name || props.node.id
|
|
9228
|
-
])
|
|
9229
|
-
])
|
|
9230
|
-
]),
|
|
9231
|
-
...opened.value ? children.value.map((child) => createVNode(Layer, {
|
|
9232
|
-
node: child,
|
|
9233
|
-
indent: props.indent + 1
|
|
9234
|
-
})) : []
|
|
9235
|
-
]
|
|
9236
|
-
);
|
|
9237
|
-
};
|
|
9238
|
-
}
|
|
9239
|
-
});
|
|
9240
|
-
return (_ctx, _cache) => {
|
|
9241
|
-
return openBlock(), createElementBlock("div", {
|
|
9242
|
-
ref_key: "rootRef",
|
|
9243
|
-
ref: rootRef,
|
|
9244
|
-
class: "mce-layers",
|
|
9245
|
-
onMouseleave
|
|
9246
|
-
}, [
|
|
9247
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(root).children, (child, index) => {
|
|
9248
|
-
return openBlock(), createBlock(unref(Layer), {
|
|
9249
|
-
key: index,
|
|
9250
|
-
node: child
|
|
9251
|
-
}, null, 8, ["node"]);
|
|
9252
|
-
}), 128)),
|
|
9253
|
-
current.value !== void 0 ? (openBlock(), createElementBlock("div", {
|
|
9254
|
-
key: 0,
|
|
9255
|
-
class: "mce-layers__action",
|
|
9256
|
-
style: normalizeStyle({
|
|
9257
|
-
right: `${current.value.x}px`,
|
|
9258
|
-
top: `${current.value.y}px`
|
|
9259
|
-
})
|
|
9260
|
-
}, [
|
|
9261
|
-
createElementVNode("div", {
|
|
9262
|
-
class: "mce-btn",
|
|
9263
|
-
onClick: _cache[0] || (_cache[0] = ($event) => current.value.node.meta.lock = !current.value.node.meta.lock)
|
|
9264
|
-
}, [
|
|
9265
|
-
createVNode(_sfc_main$w, {
|
|
9266
|
-
icon: current.value.node.meta.lock ? "$lock" : "$unlock"
|
|
9267
|
-
}, null, 8, ["icon"])
|
|
9268
|
-
]),
|
|
9269
|
-
createElementVNode("div", {
|
|
9270
|
-
class: "mce-btn",
|
|
9271
|
-
onClick: _cache[1] || (_cache[1] = ($event) => current.value.node.style.visibility = current.value.node.style.visibility === "visible" ? "hidden" : "visible")
|
|
9272
|
-
}, [
|
|
9273
|
-
createVNode(_sfc_main$w, {
|
|
9274
|
-
icon: current.value.node.style.visibility === "visible" ? "$visible" : "$unvisible"
|
|
9275
|
-
}, null, 8, ["icon"])
|
|
9276
|
-
])
|
|
9277
|
-
], 4)) : createCommentVNode("", true)
|
|
9278
|
-
], 544);
|
|
9279
|
-
};
|
|
9280
|
-
}
|
|
9281
|
-
});
|
|
9282
9711
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9283
9712
|
__name: "Dialog",
|
|
9284
9713
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -9306,7 +9735,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9306
9735
|
updateLocation
|
|
9307
9736
|
});
|
|
9308
9737
|
return (_ctx, _cache) => {
|
|
9309
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9738
|
+
return openBlock(), createBlock(_sfc_main$y, {
|
|
9310
9739
|
ref: "overlayTpl",
|
|
9311
9740
|
modelValue: isActive.value,
|
|
9312
9741
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
@@ -9333,18 +9762,20 @@ export {
|
|
|
9333
9762
|
_sfc_main as Dialog,
|
|
9334
9763
|
Doc,
|
|
9335
9764
|
Editor,
|
|
9336
|
-
_sfc_main$
|
|
9337
|
-
_sfc_main$
|
|
9338
|
-
_sfc_main$
|
|
9765
|
+
_sfc_main$n as EditorLayers,
|
|
9766
|
+
_sfc_main$1 as EditorLayout,
|
|
9767
|
+
_sfc_main$c as EditorLayoutItem,
|
|
9339
9768
|
Toolbelt as EditorToolbelt,
|
|
9340
9769
|
IconsSymbol,
|
|
9341
9770
|
MceComponentIcon,
|
|
9771
|
+
MceLayerItemKey,
|
|
9772
|
+
MceLayerKey,
|
|
9342
9773
|
MceLayoutItemKey,
|
|
9343
9774
|
MceLayoutKey,
|
|
9344
9775
|
MceMenuSymbol,
|
|
9345
9776
|
MceOverlaySymbol,
|
|
9346
9777
|
MceSvgIcon,
|
|
9347
|
-
_sfc_main$
|
|
9778
|
+
_sfc_main$x as Menu,
|
|
9348
9779
|
Model,
|
|
9349
9780
|
_sfc_main$l as Ruler,
|
|
9350
9781
|
SUPPORTS_CLIPBOARD,
|
|
@@ -9357,6 +9788,7 @@ export {
|
|
|
9357
9788
|
convertToUnit,
|
|
9358
9789
|
createIcons,
|
|
9359
9790
|
createImageElement,
|
|
9791
|
+
createLayer,
|
|
9360
9792
|
createLayout,
|
|
9361
9793
|
createTextElement,
|
|
9362
9794
|
defaultActiveStrategy,
|
|
@@ -9394,6 +9826,7 @@ export {
|
|
|
9394
9826
|
uint32,
|
|
9395
9827
|
useEditor,
|
|
9396
9828
|
useIcon,
|
|
9829
|
+
useLayerItem,
|
|
9397
9830
|
useLayout,
|
|
9398
9831
|
useLayoutItem,
|
|
9399
9832
|
useOverlay,
|