mce 0.15.32 → 0.15.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Selector.vue.d.ts +6 -0
- package/dist/components/SmartGuides.vue.d.ts +4 -1
- package/dist/components/SmartSelection.vue.d.ts +3 -0
- package/dist/components/shared/TransformControls.vue.d.ts +1 -0
- package/dist/index.css +125 -80
- package/dist/index.js +2137 -1883
- package/dist/locale/en.d.ts +4 -1
- package/dist/locale/zh-Hans.d.ts +3 -0
- package/dist/plugins/arrange.d.ts +1 -1
- package/dist/plugins/smartGuides.d.ts +0 -1
- package/dist/plugins/smartSelection.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1072,6 +1072,7 @@ const en = {
|
|
|
1072
1072
|
"constrainToAxis": "Constrain to axis",
|
|
1073
1073
|
"loading": "Loading",
|
|
1074
1074
|
"drawing": "Drawing",
|
|
1075
|
+
"exporting": "Exporting",
|
|
1075
1076
|
"selecting": "Selecting",
|
|
1076
1077
|
"selectObject": "Select object",
|
|
1077
1078
|
"commitChanges": "Commit changes",
|
|
@@ -1177,7 +1178,9 @@ const en = {
|
|
|
1177
1178
|
"alignTop": "Align top",
|
|
1178
1179
|
"alignVerticalCenter": "Align vertical center",
|
|
1179
1180
|
"alignBottom": "Align bottom",
|
|
1180
|
-
"
|
|
1181
|
+
"distributeHorizontalSpacing": "Distribute horizontal spacing",
|
|
1182
|
+
"distributeVerticalSpacing": "Distribute vertical spacing",
|
|
1183
|
+
"tidyUp": "Tidy up"
|
|
1181
1184
|
};
|
|
1182
1185
|
const zhHans = {
|
|
1183
1186
|
"cancel": "取消",
|
|
@@ -1290,7 +1293,10 @@ const zhHans = {
|
|
|
1290
1293
|
"alignRight": "贴右侧",
|
|
1291
1294
|
"alignTop": "贴顶部",
|
|
1292
1295
|
"alignVerticalCenter": "垂直居中",
|
|
1293
|
-
"alignBottom": "贴底部"
|
|
1296
|
+
"alignBottom": "贴底部",
|
|
1297
|
+
"distributeHorizontalSpacing": "水平分布间距",
|
|
1298
|
+
"distributeVerticalSpacing": "垂直分布间距",
|
|
1299
|
+
"tidyUp": "整理"
|
|
1294
1300
|
};
|
|
1295
1301
|
const _0_locale = defineMixin((editor, options) => {
|
|
1296
1302
|
const {
|
|
@@ -1688,11 +1694,12 @@ function parseKey(key) {
|
|
|
1688
1694
|
switch (v) {
|
|
1689
1695
|
case "Meta":
|
|
1690
1696
|
case "Control":
|
|
1697
|
+
case "Ctrl":
|
|
1691
1698
|
case "CommandOrControl":
|
|
1699
|
+
case "CmdOrCtrl":
|
|
1692
1700
|
return "CmdOrCtrl";
|
|
1693
1701
|
case "Alt":
|
|
1694
1702
|
case "Shift":
|
|
1695
|
-
case "CmdOrCtrl":
|
|
1696
1703
|
return v;
|
|
1697
1704
|
default:
|
|
1698
1705
|
return String.fromCharCode(getCharCode(v));
|
|
@@ -4276,7 +4283,7 @@ const _arrange = definePlugin((editor) => {
|
|
|
4276
4283
|
selection,
|
|
4277
4284
|
getAabb
|
|
4278
4285
|
} = editor;
|
|
4279
|
-
function zOrder2(
|
|
4286
|
+
function zOrder2(type, target = selection.value) {
|
|
4280
4287
|
const els = Array.isArray(target) ? target : [target];
|
|
4281
4288
|
els.forEach((el) => {
|
|
4282
4289
|
const parent = el.getParent();
|
|
@@ -4349,30 +4356,78 @@ const _arrange = definePlugin((editor) => {
|
|
|
4349
4356
|
}
|
|
4350
4357
|
});
|
|
4351
4358
|
}
|
|
4352
|
-
function
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4359
|
+
function distributeSpacing(direction) {
|
|
4360
|
+
const els = elementSelection.value;
|
|
4361
|
+
if (els.length < 2) {
|
|
4362
|
+
return;
|
|
4363
|
+
}
|
|
4364
|
+
const items = els.map((el) => {
|
|
4365
|
+
return {
|
|
4366
|
+
el,
|
|
4367
|
+
aabb: el.getGlobalAabb()
|
|
4368
|
+
};
|
|
4369
|
+
});
|
|
4370
|
+
const count2 = items.length;
|
|
4371
|
+
switch (direction) {
|
|
4372
|
+
case "vertical": {
|
|
4373
|
+
const sorted = [...items].sort((a, b) => a.aabb.y - b.aabb.y);
|
|
4374
|
+
const start = sorted[0];
|
|
4375
|
+
const end = sorted[count2 - 1];
|
|
4376
|
+
const startEdge = start.aabb.y;
|
|
4377
|
+
const endEdge = end.aabb.y + end.aabb.height;
|
|
4378
|
+
const totalSize = sorted.reduce((sum, node) => sum + node.aabb.height, 0);
|
|
4379
|
+
const totalSpacing = endEdge - startEdge - totalSize;
|
|
4380
|
+
const gapSize = totalSpacing / (count2 - 1);
|
|
4381
|
+
let current = start.aabb.y + start.aabb.height;
|
|
4382
|
+
for (let i = 1; i < count2 - 1; i++) {
|
|
4383
|
+
const item = sorted[i];
|
|
4384
|
+
current += gapSize;
|
|
4385
|
+
let top = current;
|
|
4386
|
+
const parentAabb = item.el.getParent()?.getGlobalAabb?.();
|
|
4387
|
+
if (parentAabb) {
|
|
4388
|
+
top = top - parentAabb.top;
|
|
4389
|
+
}
|
|
4390
|
+
item.el.style.top = top;
|
|
4391
|
+
current += item.aabb.height;
|
|
4392
|
+
}
|
|
4393
|
+
break;
|
|
4394
|
+
}
|
|
4395
|
+
case "horizontal": {
|
|
4396
|
+
const sorted = [...items].sort((a, b) => a.aabb.x - b.aabb.x);
|
|
4397
|
+
const start = sorted[0];
|
|
4398
|
+
const end = sorted[count2 - 1];
|
|
4399
|
+
const startEdge = start.aabb.x;
|
|
4400
|
+
const endEdge = end.aabb.x + end.aabb.width;
|
|
4401
|
+
const totalSize = sorted.reduce((sum, node) => sum + node.aabb.width, 0);
|
|
4402
|
+
const totalSpacing = endEdge - startEdge - totalSize;
|
|
4403
|
+
const gapSize = totalSpacing / (count2 - 1);
|
|
4404
|
+
let current = start.aabb.x + start.aabb.width;
|
|
4405
|
+
for (let i = 1; i < count2 - 1; i++) {
|
|
4406
|
+
const item = sorted[i];
|
|
4407
|
+
current += gapSize;
|
|
4408
|
+
let left = current;
|
|
4409
|
+
const parentAabb = item.el.getParent()?.getGlobalAabb?.();
|
|
4410
|
+
if (parentAabb) {
|
|
4411
|
+
left = left - parentAabb.left;
|
|
4412
|
+
}
|
|
4413
|
+
item.el.style.left = left;
|
|
4414
|
+
current += item.aabb.width;
|
|
4415
|
+
}
|
|
4416
|
+
break;
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
4365
4419
|
}
|
|
4366
4420
|
function tidyUp() {
|
|
4421
|
+
distributeSpacing("vertical");
|
|
4367
4422
|
}
|
|
4368
4423
|
return {
|
|
4369
4424
|
name: "mce:arrange",
|
|
4370
4425
|
commands: [
|
|
4371
4426
|
{ command: "zOrder", handle: zOrder2 },
|
|
4372
|
-
{ command: "bringForward", handle: bringForward },
|
|
4373
|
-
{ command: "sendBackward", handle: sendBackward },
|
|
4374
|
-
{ command: "bringToFront", handle: bringToFront },
|
|
4375
|
-
{ command: "sendToBack", handle: sendToBack },
|
|
4427
|
+
{ command: "bringForward", handle: () => zOrder2("bringForward") },
|
|
4428
|
+
{ command: "sendBackward", handle: () => zOrder2("sendBackward") },
|
|
4429
|
+
{ command: "bringToFront", handle: () => zOrder2("bringToFront") },
|
|
4430
|
+
{ command: "sendToBack", handle: () => zOrder2("sendToBack") },
|
|
4376
4431
|
{ command: "align", handle: align },
|
|
4377
4432
|
{ command: "alignLeft", handle: () => align("left") },
|
|
4378
4433
|
{ command: "alignRight", handle: () => align("right") },
|
|
@@ -4381,8 +4436,8 @@ const _arrange = definePlugin((editor) => {
|
|
|
4381
4436
|
{ command: "alignHorizontalCenter", handle: () => align("horizontal-center") },
|
|
4382
4437
|
{ command: "alignVerticalCenter", handle: () => align("vertical-center") },
|
|
4383
4438
|
{ command: "distributeSpacing", handle: distributeSpacing },
|
|
4384
|
-
{ command: "distributeHorizontalSpacing", handle: () => distributeSpacing() },
|
|
4385
|
-
{ command: "distributeVerticalSpacing", handle: () => distributeSpacing() },
|
|
4439
|
+
{ command: "distributeHorizontalSpacing", handle: () => distributeSpacing("horizontal") },
|
|
4440
|
+
{ command: "distributeVerticalSpacing", handle: () => distributeSpacing("vertical") },
|
|
4386
4441
|
{ command: "tidyUp", handle: tidyUp }
|
|
4387
4442
|
],
|
|
4388
4443
|
hotkeys: [
|
|
@@ -4529,11 +4584,11 @@ const _copyAs = definePlugin((editor) => {
|
|
|
4529
4584
|
]
|
|
4530
4585
|
};
|
|
4531
4586
|
});
|
|
4532
|
-
const _hoisted_1$
|
|
4587
|
+
const _hoisted_1$r = {
|
|
4533
4588
|
key: 0,
|
|
4534
4589
|
class: "mce-drawing__tip"
|
|
4535
4590
|
};
|
|
4536
|
-
const _sfc_main$
|
|
4591
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
4537
4592
|
__name: "Drawing",
|
|
4538
4593
|
setup(__props) {
|
|
4539
4594
|
const {
|
|
@@ -4551,7 +4606,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4551
4606
|
top: `${unref(drawboardPointer).y}px`
|
|
4552
4607
|
})
|
|
4553
4608
|
}, [
|
|
4554
|
-
unref(activeDrawingTool)?.name ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4609
|
+
unref(activeDrawingTool)?.name ? (openBlock(), createElementBlock("div", _hoisted_1$r, toDisplayString(unref(t)(unref(activeDrawingTool).name)), 1)) : createCommentVNode("", true)
|
|
4555
4610
|
], 4)) : createCommentVNode("", true);
|
|
4556
4611
|
};
|
|
4557
4612
|
}
|
|
@@ -4563,7 +4618,7 @@ const _drawingTool = definePlugin((editor) => {
|
|
|
4563
4618
|
return {
|
|
4564
4619
|
name: "mce:drawingTool",
|
|
4565
4620
|
components: [
|
|
4566
|
-
{ name: "drawing", type: "overlay", component: _sfc_main$
|
|
4621
|
+
{ name: "drawing", type: "overlay", component: _sfc_main$E }
|
|
4567
4622
|
],
|
|
4568
4623
|
commands: [
|
|
4569
4624
|
{ command: "setActiveDrawingTool", handle: (val) => setActiveDrawingTool(val) }
|
|
@@ -4860,7 +4915,7 @@ const ComponentIcon = defineComponent({
|
|
|
4860
4915
|
};
|
|
4861
4916
|
}
|
|
4862
4917
|
});
|
|
4863
|
-
const _sfc_main$
|
|
4918
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
4864
4919
|
__name: "Icon",
|
|
4865
4920
|
props: {
|
|
4866
4921
|
disabled: Boolean,
|
|
@@ -5518,7 +5573,7 @@ const defaultHoverStrategy = (context) => {
|
|
|
5518
5573
|
}
|
|
5519
5574
|
return element.findAncestor(cb);
|
|
5520
5575
|
};
|
|
5521
|
-
const _sfc_main$
|
|
5576
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5522
5577
|
__name: "Frame",
|
|
5523
5578
|
props: {
|
|
5524
5579
|
"modelValue": { required: true },
|
|
@@ -5593,19 +5648,22 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5593
5648
|
};
|
|
5594
5649
|
}
|
|
5595
5650
|
});
|
|
5596
|
-
const
|
|
5651
|
+
const _hoisted_1$q = { class: "mce-frames" };
|
|
5652
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
5597
5653
|
__name: "Frames",
|
|
5598
5654
|
setup(__props) {
|
|
5599
5655
|
const {
|
|
5600
5656
|
frames
|
|
5601
5657
|
} = useEditor();
|
|
5602
5658
|
return (_ctx, _cache) => {
|
|
5603
|
-
return openBlock(
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5659
|
+
return openBlock(), createElementBlock("div", _hoisted_1$q, [
|
|
5660
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
|
|
5661
|
+
return openBlock(), createBlock(_sfc_main$C, {
|
|
5662
|
+
key,
|
|
5663
|
+
"model-value": frame
|
|
5664
|
+
}, null, 8, ["model-value"]);
|
|
5665
|
+
}), 128))
|
|
5666
|
+
]);
|
|
5609
5667
|
};
|
|
5610
5668
|
}
|
|
5611
5669
|
});
|
|
@@ -5660,7 +5718,7 @@ const _frame = definePlugin((editor) => {
|
|
|
5660
5718
|
{ command: "setActiveDrawingTool:frame", key: "F" }
|
|
5661
5719
|
],
|
|
5662
5720
|
components: [
|
|
5663
|
-
{ type: "overlay", component: _sfc_main$
|
|
5721
|
+
{ type: "overlay", component: _sfc_main$B, order: "before" }
|
|
5664
5722
|
]
|
|
5665
5723
|
};
|
|
5666
5724
|
});
|
|
@@ -5739,8 +5797,8 @@ const _history = definePlugin((editor) => {
|
|
|
5739
5797
|
]
|
|
5740
5798
|
};
|
|
5741
5799
|
});
|
|
5742
|
-
const _hoisted_1$
|
|
5743
|
-
const _sfc_main$
|
|
5800
|
+
const _hoisted_1$p = ["data-name"];
|
|
5801
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
5744
5802
|
__name: "Hover",
|
|
5745
5803
|
setup(__props) {
|
|
5746
5804
|
const {
|
|
@@ -5760,7 +5818,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5760
5818
|
borderRadius: `${(unref(hoverElement).style.borderRadius ?? 0) * unref(camera).zoom.x}px`,
|
|
5761
5819
|
...hoverElementObb.value.toCssStyle()
|
|
5762
5820
|
})
|
|
5763
|
-
}, null, 12, _hoisted_1$
|
|
5821
|
+
}, null, 12, _hoisted_1$p)) : createCommentVNode("", true);
|
|
5764
5822
|
};
|
|
5765
5823
|
}
|
|
5766
5824
|
});
|
|
@@ -5768,7 +5826,7 @@ const _hover = definePlugin(() => {
|
|
|
5768
5826
|
return {
|
|
5769
5827
|
name: "mce:hover",
|
|
5770
5828
|
components: [
|
|
5771
|
-
{ type: "overlay", component: _sfc_main$
|
|
5829
|
+
{ type: "overlay", component: _sfc_main$A, order: "before" }
|
|
5772
5830
|
]
|
|
5773
5831
|
};
|
|
5774
5832
|
});
|
|
@@ -6047,7 +6105,7 @@ const _json = definePlugin((editor) => {
|
|
|
6047
6105
|
]
|
|
6048
6106
|
};
|
|
6049
6107
|
});
|
|
6050
|
-
const _sfc_main$
|
|
6108
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
6051
6109
|
__name: "Btn",
|
|
6052
6110
|
props: {
|
|
6053
6111
|
active: { type: Boolean },
|
|
@@ -6066,10 +6124,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6066
6124
|
};
|
|
6067
6125
|
}
|
|
6068
6126
|
});
|
|
6069
|
-
const _hoisted_1$
|
|
6070
|
-
const _hoisted_2$
|
|
6127
|
+
const _hoisted_1$o = ["data-id"];
|
|
6128
|
+
const _hoisted_2$d = { class: "mce-layer__content" };
|
|
6071
6129
|
const _hoisted_3$b = { class: "mce-layer__prepend" };
|
|
6072
|
-
const _sfc_main$
|
|
6130
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6073
6131
|
...{
|
|
6074
6132
|
name: "MceLayer",
|
|
6075
6133
|
inheritAttrs: false
|
|
@@ -6292,9 +6350,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6292
6350
|
}, [
|
|
6293
6351
|
_cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
|
|
6294
6352
|
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
6295
|
-
createElementVNode("div", _hoisted_2$
|
|
6353
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
6296
6354
|
createElementVNode("div", _hoisted_3$b, [
|
|
6297
|
-
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$
|
|
6355
|
+
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$D), {
|
|
6298
6356
|
key: 0,
|
|
6299
6357
|
class: "mce-layer__arrow",
|
|
6300
6358
|
icon: "$arrowRight",
|
|
@@ -6307,7 +6365,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6307
6365
|
class: "mce-layer__thumbnail",
|
|
6308
6366
|
onDblclick: onDblclickThumbnail
|
|
6309
6367
|
}, [
|
|
6310
|
-
createVNode(unref(_sfc_main$
|
|
6368
|
+
createVNode(unref(_sfc_main$D), { icon: thumbnailIcon.value }, null, 8, ["icon"])
|
|
6311
6369
|
], 32),
|
|
6312
6370
|
createElementVNode("div", {
|
|
6313
6371
|
class: "mce-layer__name",
|
|
@@ -6340,7 +6398,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6340
6398
|
}])
|
|
6341
6399
|
}, [
|
|
6342
6400
|
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6343
|
-
Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$
|
|
6401
|
+
Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$z, {
|
|
6344
6402
|
key: 0,
|
|
6345
6403
|
icon: "",
|
|
6346
6404
|
class: "mce-layer__btn mce-layer__btn--show",
|
|
@@ -6351,12 +6409,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6351
6409
|
}), ["prevent", "stop"]))
|
|
6352
6410
|
}, {
|
|
6353
6411
|
default: withCtx(() => [
|
|
6354
|
-
createVNode(unref(_sfc_main$
|
|
6412
|
+
createVNode(unref(_sfc_main$D), { icon: "$collapse" })
|
|
6355
6413
|
]),
|
|
6356
6414
|
_: 1
|
|
6357
6415
|
})) : createCommentVNode("", true)
|
|
6358
6416
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6359
|
-
createVNode(_sfc_main$
|
|
6417
|
+
createVNode(_sfc_main$z, {
|
|
6360
6418
|
icon: "",
|
|
6361
6419
|
class: normalizeClass(["mce-layer__btn", {
|
|
6362
6420
|
"mce-layer__btn--show": unref(isLock)(props.node)
|
|
@@ -6364,13 +6422,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6364
6422
|
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
6365
6423
|
}, {
|
|
6366
6424
|
default: withCtx(() => [
|
|
6367
|
-
createVNode(unref(_sfc_main$
|
|
6425
|
+
createVNode(unref(_sfc_main$D), {
|
|
6368
6426
|
icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
|
|
6369
6427
|
}, null, 8, ["icon"])
|
|
6370
6428
|
]),
|
|
6371
6429
|
_: 1
|
|
6372
6430
|
}, 8, ["class"]),
|
|
6373
|
-
createVNode(_sfc_main$
|
|
6431
|
+
createVNode(_sfc_main$z, {
|
|
6374
6432
|
icon: "",
|
|
6375
6433
|
class: normalizeClass(["mce-layer__btn", {
|
|
6376
6434
|
"mce-layer__btn--show": !unref(isVisible)(props.node)
|
|
@@ -6378,7 +6436,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6378
6436
|
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
6379
6437
|
}, {
|
|
6380
6438
|
default: withCtx(() => [
|
|
6381
|
-
createVNode(unref(_sfc_main$
|
|
6439
|
+
createVNode(unref(_sfc_main$D), {
|
|
6382
6440
|
icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
|
|
6383
6441
|
}, null, 8, ["icon"])
|
|
6384
6442
|
]),
|
|
@@ -6387,7 +6445,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6387
6445
|
], 64))
|
|
6388
6446
|
], 2)
|
|
6389
6447
|
])
|
|
6390
|
-
], 46, _hoisted_1$
|
|
6448
|
+
], 46, _hoisted_1$o),
|
|
6391
6449
|
opened.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(childrenLength.value, (i) => {
|
|
6392
6450
|
return openBlock(), createBlock(_component_MceLayer, {
|
|
6393
6451
|
key: i,
|
|
@@ -6400,9 +6458,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6400
6458
|
};
|
|
6401
6459
|
}
|
|
6402
6460
|
});
|
|
6403
|
-
const _hoisted_1$
|
|
6404
|
-
const _hoisted_2$
|
|
6405
|
-
const _sfc_main$
|
|
6461
|
+
const _hoisted_1$n = { class: "mce-layers" };
|
|
6462
|
+
const _hoisted_2$c = { class: "mce-layers__wrapper" };
|
|
6463
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
6406
6464
|
__name: "Layers",
|
|
6407
6465
|
setup(__props) {
|
|
6408
6466
|
const {
|
|
@@ -6446,9 +6504,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
6446
6504
|
layerScrollIntoView();
|
|
6447
6505
|
});
|
|
6448
6506
|
return (_ctx, _cache) => {
|
|
6449
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6450
|
-
createElementVNode("div", _hoisted_2$
|
|
6451
|
-
createVNode(_sfc_main$
|
|
6507
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
6508
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
6509
|
+
createVNode(_sfc_main$y, {
|
|
6452
6510
|
root: true,
|
|
6453
6511
|
node: unref(root),
|
|
6454
6512
|
opened: true
|
|
@@ -6462,7 +6520,7 @@ const _layers = definePlugin(() => {
|
|
|
6462
6520
|
return {
|
|
6463
6521
|
name: "mce:layers",
|
|
6464
6522
|
components: [
|
|
6465
|
-
{ name: "layers", type: "panel", position: "float", component: _sfc_main$
|
|
6523
|
+
{ name: "layers", type: "panel", position: "float", component: _sfc_main$x }
|
|
6466
6524
|
]
|
|
6467
6525
|
};
|
|
6468
6526
|
});
|
|
@@ -6473,19 +6531,19 @@ const _export_sfc = (sfc, props) => {
|
|
|
6473
6531
|
}
|
|
6474
6532
|
return target;
|
|
6475
6533
|
};
|
|
6476
|
-
const _sfc_main$
|
|
6477
|
-
const _hoisted_1$
|
|
6534
|
+
const _sfc_main$w = {};
|
|
6535
|
+
const _hoisted_1$m = {
|
|
6478
6536
|
class: "mce-made-with",
|
|
6479
6537
|
href: "https://github.com/qq15725/mce",
|
|
6480
6538
|
target: "_blank"
|
|
6481
6539
|
};
|
|
6482
6540
|
function _sfc_render(_ctx, _cache) {
|
|
6483
|
-
return openBlock(), createElementBlock("a", _hoisted_1$
|
|
6541
|
+
return openBlock(), createElementBlock("a", _hoisted_1$m, [..._cache[0] || (_cache[0] = [
|
|
6484
6542
|
createElementVNode("div", null, "MADE WITH", -1),
|
|
6485
6543
|
createElementVNode("div", null, "MCE", -1)
|
|
6486
6544
|
])]);
|
|
6487
6545
|
}
|
|
6488
|
-
const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
6546
|
+
const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render]]);
|
|
6489
6547
|
const _madeWith = definePlugin((editor) => {
|
|
6490
6548
|
const {
|
|
6491
6549
|
config,
|
|
@@ -6503,7 +6561,7 @@ const _madeWith = definePlugin((editor) => {
|
|
|
6503
6561
|
]
|
|
6504
6562
|
};
|
|
6505
6563
|
});
|
|
6506
|
-
const _sfc_main$
|
|
6564
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
6507
6565
|
...{
|
|
6508
6566
|
inheritAttrs: false
|
|
6509
6567
|
},
|
|
@@ -6629,8 +6687,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6629
6687
|
};
|
|
6630
6688
|
}
|
|
6631
6689
|
});
|
|
6632
|
-
const _hoisted_1$
|
|
6633
|
-
const _hoisted_2$
|
|
6690
|
+
const _hoisted_1$l = ["onMouseenter"];
|
|
6691
|
+
const _hoisted_2$b = ["onClick"];
|
|
6634
6692
|
const _hoisted_3$a = {
|
|
6635
6693
|
key: 0,
|
|
6636
6694
|
class: "mce-list-item__checked"
|
|
@@ -6648,7 +6706,7 @@ const _hoisted_7$3 = {
|
|
|
6648
6706
|
key: 3,
|
|
6649
6707
|
class: "mce-list-item__append"
|
|
6650
6708
|
};
|
|
6651
|
-
const _sfc_main$
|
|
6709
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
6652
6710
|
...{
|
|
6653
6711
|
name: "MceMenu"
|
|
6654
6712
|
},
|
|
@@ -6731,7 +6789,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6731
6789
|
});
|
|
6732
6790
|
return (_ctx, _cache) => {
|
|
6733
6791
|
const _component_MceMenu = resolveComponent("MceMenu");
|
|
6734
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6792
|
+
return openBlock(), createBlock(_sfc_main$v, {
|
|
6735
6793
|
ref: "overlayTpl",
|
|
6736
6794
|
modelValue: isActive.value,
|
|
6737
6795
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
|
|
@@ -6778,7 +6836,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6778
6836
|
onClick: (e) => onClickItem(item, index, e)
|
|
6779
6837
|
}, [
|
|
6780
6838
|
hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$a, [
|
|
6781
|
-
item.checked ? (openBlock(), createBlock(unref(_sfc_main$
|
|
6839
|
+
item.checked ? (openBlock(), createBlock(unref(_sfc_main$D), {
|
|
6782
6840
|
key: 0,
|
|
6783
6841
|
icon: "$check"
|
|
6784
6842
|
})) : createCommentVNode("", true)
|
|
@@ -6796,13 +6854,13 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6796
6854
|
])) : createCommentVNode("", true),
|
|
6797
6855
|
item.children?.length || _ctx.$slots.append ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
|
|
6798
6856
|
renderSlot(_ctx.$slots, "append", { item }),
|
|
6799
|
-
item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$
|
|
6857
|
+
item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$D), {
|
|
6800
6858
|
key: 0,
|
|
6801
6859
|
icon: "$arrowRight"
|
|
6802
6860
|
})) : createCommentVNode("", true)
|
|
6803
6861
|
])) : createCommentVNode("", true)
|
|
6804
|
-
], 10, _hoisted_2$
|
|
6805
|
-
], 40, _hoisted_1$
|
|
6862
|
+
], 10, _hoisted_2$b)
|
|
6863
|
+
], 40, _hoisted_1$l))
|
|
6806
6864
|
], 64);
|
|
6807
6865
|
}), 128)),
|
|
6808
6866
|
opened.value > -1 && __props.items?.[opened.value]?.children?.length ? (openBlock(), createBlock(_component_MceMenu, {
|
|
@@ -6853,7 +6911,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6853
6911
|
};
|
|
6854
6912
|
}
|
|
6855
6913
|
});
|
|
6856
|
-
const _sfc_main$
|
|
6914
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
6857
6915
|
__name: "ContextMenu",
|
|
6858
6916
|
props: {
|
|
6859
6917
|
"modelValue": { type: Boolean },
|
|
@@ -6939,7 +6997,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6939
6997
|
updateLocation
|
|
6940
6998
|
});
|
|
6941
6999
|
return (_ctx, _cache) => {
|
|
6942
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7000
|
+
return openBlock(), createBlock(_sfc_main$u, {
|
|
6943
7001
|
ref: "menuTplRef",
|
|
6944
7002
|
modelValue: isActive.value,
|
|
6945
7003
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
@@ -7166,7 +7224,10 @@ const _menu = definePlugin((editor, options) => {
|
|
|
7166
7224
|
const layerPositionMenu = computed(() => ({
|
|
7167
7225
|
key: "layerPosition",
|
|
7168
7226
|
children: [
|
|
7169
|
-
...alignMenus.value
|
|
7227
|
+
...alignMenus.value,
|
|
7228
|
+
{ key: "distributeHorizontalSpacing", disabled: !hasSelected.value },
|
|
7229
|
+
{ key: "distributeVerticalSpacing", disabled: !hasSelected.value },
|
|
7230
|
+
{ key: "tidyUp", disabled: !hasSelected.value }
|
|
7170
7231
|
]
|
|
7171
7232
|
}));
|
|
7172
7233
|
const mainMenu = computed(() => [
|
|
@@ -7226,7 +7287,7 @@ const _menu = definePlugin((editor, options) => {
|
|
|
7226
7287
|
return {
|
|
7227
7288
|
name: "mce:menu",
|
|
7228
7289
|
components: [
|
|
7229
|
-
{ type: "overlay", component: _sfc_main$
|
|
7290
|
+
{ type: "overlay", component: _sfc_main$t }
|
|
7230
7291
|
]
|
|
7231
7292
|
};
|
|
7232
7293
|
});
|
|
@@ -7290,10 +7351,10 @@ const _new = definePlugin((editor) => {
|
|
|
7290
7351
|
]
|
|
7291
7352
|
};
|
|
7292
7353
|
});
|
|
7293
|
-
const _hoisted_1$
|
|
7294
|
-
const _hoisted_2$
|
|
7354
|
+
const _hoisted_1$k = { class: "mce-node-creator" };
|
|
7355
|
+
const _hoisted_2$a = { class: "mce-node-creator__tree" };
|
|
7295
7356
|
const _hoisted_3$9 = { class: "mce-node-creator__actions" };
|
|
7296
|
-
const _sfc_main$
|
|
7357
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
7297
7358
|
__name: "NodeCreator",
|
|
7298
7359
|
props: {
|
|
7299
7360
|
"isActive": { type: Boolean },
|
|
@@ -7376,8 +7437,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7376
7437
|
];
|
|
7377
7438
|
}
|
|
7378
7439
|
return (_ctx, _cache) => {
|
|
7379
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7380
|
-
createElementVNode("div", _hoisted_2$
|
|
7440
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
7441
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
7381
7442
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tree.value, (node, index) => {
|
|
7382
7443
|
return openBlock(), createBlock(Node2, {
|
|
7383
7444
|
key: index,
|
|
@@ -7386,13 +7447,13 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7386
7447
|
}), 128))
|
|
7387
7448
|
]),
|
|
7388
7449
|
createElementVNode("div", _hoisted_3$9, [
|
|
7389
|
-
createVNode(_sfc_main$
|
|
7450
|
+
createVNode(_sfc_main$z, { onClick: cancel }, {
|
|
7390
7451
|
default: withCtx(() => [
|
|
7391
7452
|
createTextVNode(toDisplayString(unref(t)("cancel")), 1)
|
|
7392
7453
|
]),
|
|
7393
7454
|
_: 1
|
|
7394
7455
|
}),
|
|
7395
|
-
createVNode(_sfc_main$
|
|
7456
|
+
createVNode(_sfc_main$z, { onClick: create }, {
|
|
7396
7457
|
default: withCtx(() => [
|
|
7397
7458
|
createTextVNode(toDisplayString(unref(t)("create")), 1)
|
|
7398
7459
|
]),
|
|
@@ -7412,7 +7473,7 @@ const _node = definePlugin((editor) => {
|
|
|
7412
7473
|
return {
|
|
7413
7474
|
name: "mce:node",
|
|
7414
7475
|
components: [
|
|
7415
|
-
{ name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$
|
|
7476
|
+
{ name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$s }
|
|
7416
7477
|
],
|
|
7417
7478
|
commands: [
|
|
7418
7479
|
{ command: "addSubNode", handle: () => config.value.nodeCreator = true }
|
|
@@ -11545,16 +11606,16 @@ const _rotate = definePlugin((editor) => {
|
|
|
11545
11606
|
]
|
|
11546
11607
|
};
|
|
11547
11608
|
});
|
|
11548
|
-
const _hoisted_1$
|
|
11609
|
+
const _hoisted_1$j = {
|
|
11549
11610
|
key: 0,
|
|
11550
11611
|
class: "mce-tooltip__arrow"
|
|
11551
11612
|
};
|
|
11552
|
-
const _hoisted_2$
|
|
11613
|
+
const _hoisted_2$9 = { class: "mce-tooltip__content" };
|
|
11553
11614
|
const _hoisted_3$8 = {
|
|
11554
11615
|
key: 0,
|
|
11555
11616
|
class: "mce-tooltip__kbd"
|
|
11556
11617
|
};
|
|
11557
|
-
const _sfc_main$
|
|
11618
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
11558
11619
|
__name: "Tooltip",
|
|
11559
11620
|
props: /* @__PURE__ */ mergeModels({
|
|
11560
11621
|
...makeMceOverlayProps({
|
|
@@ -11585,7 +11646,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11585
11646
|
updateLocation
|
|
11586
11647
|
});
|
|
11587
11648
|
return (_ctx, _cache) => {
|
|
11588
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11649
|
+
return openBlock(), createBlock(_sfc_main$v, {
|
|
11589
11650
|
ref: "overlayTpl",
|
|
11590
11651
|
modelValue: isActive.value,
|
|
11591
11652
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
@@ -11598,8 +11659,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11598
11659
|
}, createSlots({
|
|
11599
11660
|
default: withCtx(() => [
|
|
11600
11661
|
isActive.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
11601
|
-
__props.showArrow ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
11602
|
-
createElementVNode("div", _hoisted_2$
|
|
11662
|
+
__props.showArrow ? (openBlock(), createElementBlock("div", _hoisted_1$j)) : createCommentVNode("", true),
|
|
11663
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
11603
11664
|
renderSlot(_ctx.$slots, "default"),
|
|
11604
11665
|
_ctx.$slots.kbd ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
|
|
11605
11666
|
renderSlot(_ctx.$slots, "kbd")
|
|
@@ -11626,10 +11687,10 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11626
11687
|
};
|
|
11627
11688
|
}
|
|
11628
11689
|
});
|
|
11629
|
-
const _hoisted_1$
|
|
11630
|
-
const _hoisted_2$
|
|
11690
|
+
const _hoisted_1$i = ["width", "height"];
|
|
11691
|
+
const _hoisted_2$8 = ["onDblclick", "onMousedown", "onMousemove"];
|
|
11631
11692
|
const _hoisted_3$7 = { style: { "font-size": "0.75rem", "text-wrap": "nowrap" } };
|
|
11632
|
-
const _sfc_main$
|
|
11693
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
11633
11694
|
...{
|
|
11634
11695
|
inheritAttrs: false
|
|
11635
11696
|
},
|
|
@@ -11885,7 +11946,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
11885
11946
|
class: "mce-ruler__canvas",
|
|
11886
11947
|
width: props.size,
|
|
11887
11948
|
height: props.size
|
|
11888
|
-
}, null, 8, _hoisted_1$
|
|
11949
|
+
}, null, 8, _hoisted_1$i)
|
|
11889
11950
|
], 16)), [
|
|
11890
11951
|
[unref(vResizeObserver), unref(resize)]
|
|
11891
11952
|
]),
|
|
@@ -11907,9 +11968,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
11907
11968
|
onMousedown: ($event) => onReflineMousedown($event, index),
|
|
11908
11969
|
onMousemove: () => tipText.value = `${item}`,
|
|
11909
11970
|
onMouseleave: onLeave
|
|
11910
|
-
}, null, 46, _hoisted_2$
|
|
11971
|
+
}, null, 46, _hoisted_2$8);
|
|
11911
11972
|
}), 128)),
|
|
11912
|
-
createVNode(_sfc_main$
|
|
11973
|
+
createVNode(_sfc_main$r, {
|
|
11913
11974
|
"model-value": !!tipText.value,
|
|
11914
11975
|
target: tipPos.value,
|
|
11915
11976
|
offset: 24
|
|
@@ -11923,8 +11984,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
11923
11984
|
};
|
|
11924
11985
|
}
|
|
11925
11986
|
});
|
|
11926
|
-
const _hoisted_1$
|
|
11927
|
-
const _sfc_main$
|
|
11987
|
+
const _hoisted_1$h = { class: "mce-rulers" };
|
|
11988
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
11928
11989
|
...{
|
|
11929
11990
|
inheritAttrs: false
|
|
11930
11991
|
},
|
|
@@ -11935,8 +11996,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
11935
11996
|
selectionAabbInDrawboard
|
|
11936
11997
|
} = useEditor();
|
|
11937
11998
|
return (_ctx, _cache) => {
|
|
11938
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
11939
|
-
createVNode(_sfc_main$
|
|
11999
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
12000
|
+
createVNode(_sfc_main$q, {
|
|
11940
12001
|
refline: "",
|
|
11941
12002
|
zoom: unref(camera).zoom.x,
|
|
11942
12003
|
position: unref(camera).position.x,
|
|
@@ -11944,7 +12005,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
11944
12005
|
axis: "",
|
|
11945
12006
|
size: 16
|
|
11946
12007
|
}, null, 8, ["zoom", "position", "selected"]),
|
|
11947
|
-
createVNode(_sfc_main$
|
|
12008
|
+
createVNode(_sfc_main$q, {
|
|
11948
12009
|
refline: "",
|
|
11949
12010
|
zoom: unref(camera).zoom.y,
|
|
11950
12011
|
position: unref(camera).position.y,
|
|
@@ -11969,7 +12030,7 @@ const _ruler = definePlugin((editor) => {
|
|
|
11969
12030
|
components: [
|
|
11970
12031
|
{
|
|
11971
12032
|
type: "overlay",
|
|
11972
|
-
component: _sfc_main$
|
|
12033
|
+
component: _sfc_main$p,
|
|
11973
12034
|
ignore: () => !config.value.ruler
|
|
11974
12035
|
}
|
|
11975
12036
|
]
|
|
@@ -12006,11 +12067,11 @@ const _saveAs = definePlugin((editor) => {
|
|
|
12006
12067
|
]
|
|
12007
12068
|
};
|
|
12008
12069
|
});
|
|
12009
|
-
const _hoisted_1$
|
|
12070
|
+
const _hoisted_1$g = {
|
|
12010
12071
|
ref: "trackTplRef",
|
|
12011
12072
|
class: "mce-scrollbar__track"
|
|
12012
12073
|
};
|
|
12013
|
-
const _sfc_main$
|
|
12074
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
12014
12075
|
__name: "Scrollbar",
|
|
12015
12076
|
props: /* @__PURE__ */ mergeModels({
|
|
12016
12077
|
length: {},
|
|
@@ -12097,7 +12158,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
12097
12158
|
[props.vertical ? "top" : "left"]: `${props.offset}px`
|
|
12098
12159
|
})
|
|
12099
12160
|
}, [
|
|
12100
|
-
createElementVNode("div", _hoisted_1$
|
|
12161
|
+
createElementVNode("div", _hoisted_1$g, [
|
|
12101
12162
|
createElementVNode("div", {
|
|
12102
12163
|
ref: "thumbTplRef",
|
|
12103
12164
|
class: normalizeClass(["mce-scrollbar__thumb", {
|
|
@@ -12117,7 +12178,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
12117
12178
|
};
|
|
12118
12179
|
}
|
|
12119
12180
|
});
|
|
12120
|
-
const
|
|
12181
|
+
const _hoisted_1$f = { class: "mce-scrollbars" };
|
|
12182
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
12121
12183
|
...{
|
|
12122
12184
|
inheritAttrs: false
|
|
12123
12185
|
},
|
|
@@ -12133,19 +12195,19 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
12133
12195
|
rootAabb
|
|
12134
12196
|
} = useEditor();
|
|
12135
12197
|
return (_ctx, _cache) => {
|
|
12136
|
-
return openBlock(), createElementBlock(
|
|
12137
|
-
createVNode(_sfc_main$
|
|
12198
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
12199
|
+
createVNode(_sfc_main$o, mergeProps(props, {
|
|
12138
12200
|
modelValue: unref(camera).position.y,
|
|
12139
12201
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
|
|
12140
12202
|
vertical: "",
|
|
12141
12203
|
length: unref(rootAabb).height * unref(camera).zoom.y
|
|
12142
12204
|
}), null, 16, ["modelValue", "length"]),
|
|
12143
|
-
createVNode(_sfc_main$
|
|
12205
|
+
createVNode(_sfc_main$o, mergeProps(props, {
|
|
12144
12206
|
modelValue: unref(camera).position.x,
|
|
12145
12207
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
|
|
12146
12208
|
length: unref(rootAabb).width * unref(camera).zoom.x
|
|
12147
12209
|
}), null, 16, ["modelValue", "length"])
|
|
12148
|
-
]
|
|
12210
|
+
]);
|
|
12149
12211
|
};
|
|
12150
12212
|
}
|
|
12151
12213
|
});
|
|
@@ -12164,7 +12226,7 @@ const _scroll = definePlugin((editor) => {
|
|
|
12164
12226
|
components: [
|
|
12165
12227
|
{
|
|
12166
12228
|
type: "overlay",
|
|
12167
|
-
component: _sfc_main$
|
|
12229
|
+
component: _sfc_main$n,
|
|
12168
12230
|
ignore: () => !config.value.scrollbar
|
|
12169
12231
|
}
|
|
12170
12232
|
]
|
|
@@ -12200,7 +12262,7 @@ const _scroll = definePlugin((editor) => {
|
|
|
12200
12262
|
// },
|
|
12201
12263
|
};
|
|
12202
12264
|
});
|
|
12203
|
-
const _sfc_main$
|
|
12265
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
12204
12266
|
__name: "GoBackSelectedArea",
|
|
12205
12267
|
setup(__props) {
|
|
12206
12268
|
const {
|
|
@@ -12218,7 +12280,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
12218
12280
|
class: "mce-back-selected-aera",
|
|
12219
12281
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
|
|
12220
12282
|
}, [
|
|
12221
|
-
createVNode(unref(_sfc_main$
|
|
12283
|
+
createVNode(unref(_sfc_main$D), { icon: "$gps" }),
|
|
12222
12284
|
createElementVNode("span", null, toDisplayString(unref(t)("goBackSelectedArea")), 1)
|
|
12223
12285
|
])) : createCommentVNode("", true);
|
|
12224
12286
|
};
|
|
@@ -12407,7 +12469,7 @@ const _selection = definePlugin((editor) => {
|
|
|
12407
12469
|
{ command: "lockOrUnlockSelection", key: "Shift+CmdOrCtrl+L" }
|
|
12408
12470
|
],
|
|
12409
12471
|
components: [
|
|
12410
|
-
{ type: "overlay", component: _sfc_main$
|
|
12472
|
+
{ type: "overlay", component: _sfc_main$m }
|
|
12411
12473
|
],
|
|
12412
12474
|
events: {
|
|
12413
12475
|
selectionTransforming: ({ elements }) => {
|
|
@@ -12694,14 +12756,16 @@ const _slice = definePlugin((editor) => {
|
|
|
12694
12756
|
]
|
|
12695
12757
|
};
|
|
12696
12758
|
});
|
|
12697
|
-
const _hoisted_1$
|
|
12698
|
-
const _sfc_main$
|
|
12759
|
+
const _hoisted_1$e = { class: "mce-smart-guides" };
|
|
12760
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
12699
12761
|
__name: "SmartGuides",
|
|
12762
|
+
props: {
|
|
12763
|
+
snapLines: {}
|
|
12764
|
+
},
|
|
12700
12765
|
setup(__props) {
|
|
12701
|
-
const { snapLines } = useEditor();
|
|
12702
12766
|
return (_ctx, _cache) => {
|
|
12703
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
12704
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
12767
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
12768
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.snapLines, (item, key) => {
|
|
12705
12769
|
return openBlock(), createElementBlock("div", {
|
|
12706
12770
|
key,
|
|
12707
12771
|
class: normalizeClass(item.class.map((v) => `mce-smart-guides__${v}`)),
|
|
@@ -13998,14 +14062,10 @@ const _smartGuides = definePlugin((editor) => {
|
|
|
13998
14062
|
}
|
|
13999
14063
|
Object.assign(editor, {
|
|
14000
14064
|
snapThreshold,
|
|
14001
|
-
snapLines,
|
|
14002
14065
|
getSnapPoints
|
|
14003
14066
|
});
|
|
14004
14067
|
return {
|
|
14005
14068
|
name: "mce:smartGuides",
|
|
14006
|
-
components: [
|
|
14007
|
-
{ type: "overlay", component: _sfc_main$k }
|
|
14008
|
-
],
|
|
14009
14069
|
events: {
|
|
14010
14070
|
selectionTransforming: ({ handle }) => {
|
|
14011
14071
|
if (handle === "move") {
|
|
@@ -14015,7 +14075,13 @@ const _smartGuides = definePlugin((editor) => {
|
|
|
14015
14075
|
selectionTransformEnd: () => {
|
|
14016
14076
|
linePairs.value = [];
|
|
14017
14077
|
}
|
|
14018
|
-
}
|
|
14078
|
+
},
|
|
14079
|
+
components: [
|
|
14080
|
+
{
|
|
14081
|
+
type: "overlay",
|
|
14082
|
+
component: () => h(_sfc_main$l, { snapLines: snapLines.value })
|
|
14083
|
+
}
|
|
14084
|
+
]
|
|
14019
14085
|
};
|
|
14020
14086
|
});
|
|
14021
14087
|
function createLine(pos, type, box) {
|
|
@@ -14044,1819 +14110,2006 @@ function flipType(type) {
|
|
|
14044
14110
|
function isLeftTopLine(line) {
|
|
14045
14111
|
return ["vt", "hl"].includes(line.type);
|
|
14046
14112
|
}
|
|
14047
|
-
const
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
const
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
commands: [
|
|
14059
|
-
{ command: "setState", handle: (val) => state.value = val }
|
|
14060
|
-
],
|
|
14061
|
-
hotkeys: [
|
|
14062
|
-
{ command: "setState:move", key: "V" },
|
|
14063
|
-
{ command: "setState:hand", key: "H" }
|
|
14064
|
-
]
|
|
14065
|
-
};
|
|
14066
|
-
});
|
|
14067
|
-
const _hoisted_1$b = { class: "progress-indicator" };
|
|
14068
|
-
const _hoisted_2$6 = {
|
|
14069
|
-
key: 0,
|
|
14070
|
-
class: "progress-indicator__status"
|
|
14113
|
+
const _hoisted_1$d = ["rx", "ry"];
|
|
14114
|
+
const _hoisted_2$7 = { "pointer-events": "none" };
|
|
14115
|
+
const _hoisted_3$6 = ["x", "y", "width", "height", "aria-label"];
|
|
14116
|
+
const _hoisted_4$3 = ["cx", "cy", "r", "aria-label"];
|
|
14117
|
+
const _hoisted_5$2 = ["x", "y", "width", "height", "aria-label", "rx", "ry"];
|
|
14118
|
+
const _hoisted_6$2 = ["transform"];
|
|
14119
|
+
const _hoisted_7$2 = { "pointer-events": "all" };
|
|
14120
|
+
const _hoisted_8$1 = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"];
|
|
14121
|
+
const _hoisted_9$1 = {
|
|
14122
|
+
"pointer-events": "all",
|
|
14123
|
+
class: "mce-transform-controls__svg-slot"
|
|
14071
14124
|
};
|
|
14072
|
-
const
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
class: "progress-indicator__bar-indeterminate"
|
|
14125
|
+
const _hoisted_10$1 = {
|
|
14126
|
+
key: 0,
|
|
14127
|
+
class: "mce-transform-controls__tip"
|
|
14076
14128
|
};
|
|
14077
|
-
const _sfc_main$
|
|
14078
|
-
__name: "
|
|
14079
|
-
props:
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14129
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
14130
|
+
__name: "TransformControls",
|
|
14131
|
+
props: {
|
|
14132
|
+
tag: { default: "div" },
|
|
14133
|
+
modelValue: {},
|
|
14134
|
+
color: {},
|
|
14135
|
+
movable: { type: Boolean, default: true },
|
|
14136
|
+
rotatable: { type: Boolean, default: true },
|
|
14137
|
+
rotator: { type: Boolean },
|
|
14138
|
+
resizable: { type: Boolean, default: true },
|
|
14139
|
+
roundable: { type: Boolean },
|
|
14140
|
+
threshold: { default: 0 },
|
|
14141
|
+
resizeStrategy: {},
|
|
14142
|
+
handleStrategy: {},
|
|
14143
|
+
handleShape: { default: "rect" },
|
|
14144
|
+
hideUi: { type: Boolean },
|
|
14145
|
+
handles: { default: () => [
|
|
14146
|
+
"move",
|
|
14147
|
+
// resize
|
|
14148
|
+
"resize-l",
|
|
14149
|
+
"resize-t",
|
|
14150
|
+
"resize-r",
|
|
14151
|
+
"resize-b",
|
|
14152
|
+
"resize-tl",
|
|
14153
|
+
"resize-tr",
|
|
14154
|
+
"resize-br",
|
|
14155
|
+
"resize-bl",
|
|
14156
|
+
// round
|
|
14157
|
+
"round-tl",
|
|
14158
|
+
"round-tr",
|
|
14159
|
+
"round-bl",
|
|
14160
|
+
"round-br",
|
|
14161
|
+
// rotate
|
|
14162
|
+
"rotate-tl",
|
|
14163
|
+
"rotate-tr",
|
|
14164
|
+
"rotate-bl",
|
|
14165
|
+
"rotate-br"
|
|
14166
|
+
] },
|
|
14167
|
+
initialSize: { type: Boolean },
|
|
14168
|
+
borderStyle: {},
|
|
14169
|
+
tipFormat: {}
|
|
14170
|
+
},
|
|
14171
|
+
emits: ["update:modelValue", "start", "move", "end"],
|
|
14172
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
14173
|
+
const props = __props;
|
|
14174
|
+
const emit = __emit;
|
|
14175
|
+
const cursors = {
|
|
14176
|
+
"rotate-tl": (angle) => createCursor("rotate", 360 + angle),
|
|
14177
|
+
"rotate-tr": (angle) => createCursor("rotate", 90 + angle),
|
|
14178
|
+
"rotate-bl": (angle) => createCursor("rotate", 270 + angle),
|
|
14179
|
+
"rotate-br": (angle) => createCursor("rotate", 180 + angle),
|
|
14180
|
+
"resize-l": (angle) => createCursor("resizeXy", 180 + angle),
|
|
14181
|
+
"resize-t": (angle) => createCursor("resizeXy", 90 + angle),
|
|
14182
|
+
"resize-r": (angle) => createCursor("resizeXy", 180 + angle),
|
|
14183
|
+
"resize-b": (angle) => createCursor("resizeXy", 90 + angle),
|
|
14184
|
+
"resize-tl": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
14185
|
+
"resize-tr": (angle) => createCursor("resizeBevel", 180 + angle),
|
|
14186
|
+
"resize-br": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
14187
|
+
"resize-bl": (angle) => createCursor("resizeBevel", 180 + angle)
|
|
14100
14188
|
};
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
const _hoisted_9$1 = { class: "mce-statusbar__item" };
|
|
14113
|
-
const _hoisted_10$1 = { class: "mce-statusbar__kbd" };
|
|
14114
|
-
const _hoisted_11$1 = { class: "mce-statusbar__item" };
|
|
14115
|
-
const _hoisted_12 = { class: "mce-statusbar__kbd" };
|
|
14116
|
-
const _hoisted_13 = { key: 2 };
|
|
14117
|
-
const _hoisted_14 = { class: "mce-statusbar__item" };
|
|
14118
|
-
const _hoisted_15 = { class: "mce-statusbar__item" };
|
|
14119
|
-
const _hoisted_16 = { class: "mce-statusbar__kbd" };
|
|
14120
|
-
const _hoisted_17 = { class: "mce-statusbar__item" };
|
|
14121
|
-
const _hoisted_18 = { class: "mce-statusbar__item" };
|
|
14122
|
-
const _hoisted_19 = { class: "mce-statusbar__kbd" };
|
|
14123
|
-
const _hoisted_20 = { class: "mce-statusbar__item" };
|
|
14124
|
-
const _hoisted_21 = { class: "mce-statusbar__item" };
|
|
14125
|
-
const _hoisted_22 = { class: "mce-statusbar__progress" };
|
|
14126
|
-
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
14127
|
-
__name: "Statusbar",
|
|
14128
|
-
setup(__props) {
|
|
14129
|
-
const {
|
|
14130
|
-
state,
|
|
14131
|
-
t,
|
|
14132
|
-
getKbd,
|
|
14133
|
-
exporting,
|
|
14134
|
-
exportProgress,
|
|
14135
|
-
selection,
|
|
14136
|
-
isElement
|
|
14137
|
-
} = useEditor();
|
|
14138
|
-
return (_ctx, _cache) => {
|
|
14139
|
-
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
14140
|
-
createElementVNode("div", _hoisted_2$5, [
|
|
14141
|
-
unref(state) === "typing" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
14142
|
-
createElementVNode("div", _hoisted_3$5, [
|
|
14143
|
-
createElementVNode("span", _hoisted_4$2, toDisplayString(unref(getKbd)("Command")), 1),
|
|
14144
|
-
createElementVNode("span", _hoisted_5$2, toDisplayString(unref(getKbd)("Enter")), 1)
|
|
14145
|
-
]),
|
|
14146
|
-
_cache[1] || (_cache[1] = createElementVNode("span", null, "/", -1)),
|
|
14147
|
-
createElementVNode("div", _hoisted_6$2, [
|
|
14148
|
-
createElementVNode("span", _hoisted_7$2, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
14149
|
-
createElementVNode("span", null, toDisplayString(unref(t)("commitChanges")), 1)
|
|
14150
|
-
])
|
|
14151
|
-
], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
14152
|
-
createElementVNode("div", _hoisted_8$1, [
|
|
14153
|
-
createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
|
|
14154
|
-
]),
|
|
14155
|
-
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
14156
|
-
createElementVNode("div", _hoisted_9$1, [
|
|
14157
|
-
createElementVNode("span", _hoisted_10$1, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
14158
|
-
createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
|
|
14159
|
-
]),
|
|
14160
|
-
_cache[3] || (_cache[3] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
14161
|
-
createElementVNode("div", _hoisted_11$1, [
|
|
14162
|
-
createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
14163
|
-
createElementVNode("span", null, toDisplayString(unref(t)("constrainToAxis")), 1)
|
|
14164
|
-
])
|
|
14165
|
-
], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
14166
|
-
createElementVNode("div", _hoisted_14, [
|
|
14167
|
-
createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
|
|
14168
|
-
createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
|
|
14169
|
-
]),
|
|
14170
|
-
_cache[5] || (_cache[5] = createElementVNode("span", null, " + ", -1)),
|
|
14171
|
-
createElementVNode("div", _hoisted_15, [
|
|
14172
|
-
createElementVNode("span", _hoisted_16, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
14173
|
-
createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
|
|
14174
|
-
]),
|
|
14175
|
-
_cache[6] || (_cache[6] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
14176
|
-
createElementVNode("div", _hoisted_17, [
|
|
14177
|
-
createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
|
|
14178
|
-
createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
|
|
14179
|
-
]),
|
|
14180
|
-
_cache[7] || (_cache[7] = createElementVNode("span", null, " + ", -1)),
|
|
14181
|
-
createElementVNode("div", _hoisted_18, [
|
|
14182
|
-
createElementVNode("span", _hoisted_19, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
14183
|
-
createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
|
|
14184
|
-
]),
|
|
14185
|
-
_cache[8] || (_cache[8] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
14186
|
-
createElementVNode("div", _hoisted_20, [
|
|
14187
|
-
createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
|
|
14188
|
-
createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
|
|
14189
|
-
]),
|
|
14190
|
-
unref(selection).length === 1 && unref(isElement)(unref(selection)[0]) && unref(selection)[0].text.isValid() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
14191
|
-
_cache[4] || (_cache[4] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
14192
|
-
createElementVNode("div", _hoisted_21, [
|
|
14193
|
-
createElementVNode("span", null, toDisplayString(unref(getKbd)("Enter")), 1),
|
|
14194
|
-
createElementVNode("span", null, toDisplayString(unref(t)("startTyping")), 1)
|
|
14195
|
-
])
|
|
14196
|
-
], 64)) : createCommentVNode("", true)
|
|
14197
|
-
], 64))
|
|
14198
|
-
]),
|
|
14199
|
-
createElementVNode("div", _hoisted_22, [
|
|
14200
|
-
unref(exporting) ? (openBlock(), createBlock(ProgressIndicator, {
|
|
14201
|
-
key: 0,
|
|
14202
|
-
modelValue: unref(exportProgress),
|
|
14203
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(exportProgress) ? exportProgress.value = $event : null),
|
|
14204
|
-
label: unref(t)("exporting")
|
|
14205
|
-
}, null, 8, ["modelValue", "label"])) : createCommentVNode("", true)
|
|
14206
|
-
])
|
|
14207
|
-
]);
|
|
14208
|
-
};
|
|
14209
|
-
}
|
|
14210
|
-
});
|
|
14211
|
-
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-a1f0e31b"]]);
|
|
14212
|
-
const _statusbar = definePlugin((editor) => {
|
|
14213
|
-
const {
|
|
14214
|
-
registerConfig
|
|
14215
|
-
} = editor;
|
|
14216
|
-
registerConfig("statusbar", false);
|
|
14217
|
-
return {
|
|
14218
|
-
name: "mce:statusbar",
|
|
14219
|
-
components: [
|
|
14220
|
-
{
|
|
14221
|
-
name: "statusbar",
|
|
14222
|
-
type: "panel",
|
|
14223
|
-
position: "bottom",
|
|
14224
|
-
size: 24,
|
|
14225
|
-
component: Statusbar
|
|
14226
|
-
}
|
|
14227
|
-
]
|
|
14228
|
-
};
|
|
14229
|
-
});
|
|
14230
|
-
const _text = definePlugin((editor) => {
|
|
14231
|
-
const {
|
|
14232
|
-
t,
|
|
14233
|
-
addElement,
|
|
14234
|
-
setActiveDrawingTool
|
|
14235
|
-
} = editor;
|
|
14236
|
-
const addTextElement = (options = {}) => {
|
|
14237
|
-
const {
|
|
14238
|
-
content = t("doubleClickEditText"),
|
|
14239
|
-
style,
|
|
14240
|
-
...restOptions
|
|
14241
|
-
} = options;
|
|
14242
|
-
return addElement(
|
|
14243
|
-
createTextElement(content, {
|
|
14244
|
-
fontSize: 64,
|
|
14245
|
-
...style
|
|
14246
|
-
}),
|
|
14247
|
-
{
|
|
14248
|
-
sizeToFit: true,
|
|
14249
|
-
active: true,
|
|
14250
|
-
...restOptions
|
|
14251
|
-
}
|
|
14252
|
-
);
|
|
14253
|
-
};
|
|
14254
|
-
const RE = /\.txt$/i;
|
|
14255
|
-
return {
|
|
14256
|
-
name: "mce:text",
|
|
14257
|
-
commands: [
|
|
14258
|
-
{ command: "addTextElement", handle: addTextElement }
|
|
14259
|
-
],
|
|
14260
|
-
loaders: [
|
|
14261
|
-
{
|
|
14262
|
-
name: "txt",
|
|
14263
|
-
accept: ".txt",
|
|
14264
|
-
test: (source) => {
|
|
14265
|
-
if (source instanceof Blob) {
|
|
14266
|
-
if (source.type.startsWith("text/plain")) {
|
|
14267
|
-
return true;
|
|
14268
|
-
}
|
|
14269
|
-
}
|
|
14270
|
-
if (source instanceof File) {
|
|
14271
|
-
if (RE.test(source.name)) {
|
|
14272
|
-
return true;
|
|
14273
|
-
}
|
|
14274
|
-
}
|
|
14275
|
-
return false;
|
|
14276
|
-
},
|
|
14277
|
-
load: async (source) => {
|
|
14278
|
-
return createTextElement(await source.text());
|
|
14279
|
-
}
|
|
14280
|
-
}
|
|
14281
|
-
],
|
|
14282
|
-
drawingTools: [
|
|
14283
|
-
{
|
|
14284
|
-
name: "text",
|
|
14285
|
-
handle: (position) => {
|
|
14286
|
-
addTextElement({
|
|
14287
|
-
position
|
|
14288
|
-
});
|
|
14289
|
-
setActiveDrawingTool(void 0);
|
|
14290
|
-
}
|
|
14291
|
-
}
|
|
14292
|
-
],
|
|
14293
|
-
hotkeys: [
|
|
14294
|
-
{ command: "setActiveDrawingTool:text", key: "T" }
|
|
14295
|
-
]
|
|
14296
|
-
};
|
|
14297
|
-
});
|
|
14298
|
-
const _hoisted_1$9 = { class: "mce-payhead" };
|
|
14299
|
-
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
14300
|
-
__name: "Playhead",
|
|
14301
|
-
setup(__props) {
|
|
14302
|
-
return (_ctx, _cache) => {
|
|
14303
|
-
return openBlock(), createElementBlock("div", _hoisted_1$9, [..._cache[0] || (_cache[0] = [
|
|
14304
|
-
createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
|
|
14305
|
-
createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
|
|
14306
|
-
])]);
|
|
14307
|
-
};
|
|
14308
|
-
}
|
|
14309
|
-
});
|
|
14310
|
-
const _hoisted_1$8 = {
|
|
14311
|
-
key: 0,
|
|
14312
|
-
class: "mce-segment__edge mce-segment__edge--front"
|
|
14313
|
-
};
|
|
14314
|
-
const _hoisted_2$4 = {
|
|
14315
|
-
class: "mce-segment__node",
|
|
14316
|
-
style: { "overflow": "hidden" }
|
|
14317
|
-
};
|
|
14318
|
-
const _hoisted_3$4 = {
|
|
14319
|
-
key: 1,
|
|
14320
|
-
class: "mce-segment__edge mce-segment__edge--end"
|
|
14321
|
-
};
|
|
14322
|
-
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
14323
|
-
__name: "Segment",
|
|
14324
|
-
props: {
|
|
14325
|
-
node: {},
|
|
14326
|
-
msPerPx: { default: 1 },
|
|
14327
|
-
active: { type: Boolean }
|
|
14328
|
-
},
|
|
14329
|
-
setup(__props) {
|
|
14330
|
-
const props = __props;
|
|
14331
|
-
const blocks = computed(() => {
|
|
14332
|
-
const node = props.node;
|
|
14333
|
-
if (node instanceof Element2D) {
|
|
14334
|
-
return node.children.filter((child) => child instanceof Animation).map((anim) => {
|
|
14335
|
-
const box = {
|
|
14336
|
-
left: anim.delay / props.msPerPx,
|
|
14337
|
-
top: 0,
|
|
14338
|
-
width: anim.duration / props.msPerPx
|
|
14339
|
-
};
|
|
14340
|
-
if (box.width) {
|
|
14341
|
-
box.width = `${box.width}px`;
|
|
14342
|
-
} else {
|
|
14343
|
-
box.width = "100%";
|
|
14344
|
-
}
|
|
14345
|
-
return {
|
|
14346
|
-
name: anim.name,
|
|
14347
|
-
style: {
|
|
14348
|
-
width: box.width,
|
|
14349
|
-
transform: `matrix(1, 0, 0, 1, ${box.left}, ${box.top})`
|
|
14350
|
-
}
|
|
14351
|
-
};
|
|
14352
|
-
});
|
|
14353
|
-
}
|
|
14354
|
-
return [];
|
|
14355
|
-
});
|
|
14356
|
-
const style = computed(() => {
|
|
14357
|
-
const node = props.node;
|
|
14358
|
-
const box = {
|
|
14359
|
-
left: node.delay / props.msPerPx,
|
|
14360
|
-
top: 0,
|
|
14361
|
-
width: node.duration / props.msPerPx
|
|
14362
|
-
};
|
|
14363
|
-
if (box.width) {
|
|
14364
|
-
box.width = `${box.width}px`;
|
|
14365
|
-
} else {
|
|
14366
|
-
box.width = "100%";
|
|
14367
|
-
}
|
|
14368
|
-
return {
|
|
14369
|
-
width: box.width,
|
|
14370
|
-
transform: `matrix(1, 0, 0, 1, ${box.left}, ${box.top})`
|
|
14371
|
-
};
|
|
14372
|
-
});
|
|
14373
|
-
return (_ctx, _cache) => {
|
|
14374
|
-
return openBlock(), createElementBlock("div", {
|
|
14375
|
-
class: normalizeClass(["mce-segment", [
|
|
14376
|
-
`mce-segment--${(__props.node.meta.inEditorIs ?? "none").toLowerCase()}`,
|
|
14377
|
-
__props.active && `mce-segment--active`
|
|
14378
|
-
]]),
|
|
14379
|
-
style: normalizeStyle$1(style.value)
|
|
14380
|
-
}, [
|
|
14381
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, index) => {
|
|
14382
|
-
return openBlock(), createElementBlock("div", {
|
|
14383
|
-
key: index,
|
|
14384
|
-
class: "mce-segment__block",
|
|
14385
|
-
style: normalizeStyle$1(block.style)
|
|
14386
|
-
}, toDisplayString(block.name), 5);
|
|
14387
|
-
}), 128)),
|
|
14388
|
-
__props.active ? (openBlock(), createElementBlock("div", _hoisted_1$8)) : createCommentVNode("", true),
|
|
14389
|
-
createElementVNode("span", _hoisted_2$4, toDisplayString(props.node.name), 1),
|
|
14390
|
-
__props.active ? (openBlock(), createElementBlock("div", _hoisted_3$4)) : createCommentVNode("", true)
|
|
14391
|
-
], 6);
|
|
14392
|
-
};
|
|
14393
|
-
}
|
|
14394
|
-
});
|
|
14395
|
-
const _hoisted_1$7 = { class: "mce-track" };
|
|
14396
|
-
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
14397
|
-
__name: "Track",
|
|
14398
|
-
setup(__props) {
|
|
14399
|
-
return (_ctx, _cache) => {
|
|
14400
|
-
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
14401
|
-
renderSlot(_ctx.$slots, "default")
|
|
14402
|
-
]);
|
|
14403
|
-
};
|
|
14404
|
-
}
|
|
14405
|
-
});
|
|
14406
|
-
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
14407
|
-
__name: "Trackhead",
|
|
14408
|
-
props: {
|
|
14409
|
-
node: {}
|
|
14410
|
-
},
|
|
14411
|
-
setup(__props) {
|
|
14412
|
-
return (_ctx, _cache) => {
|
|
14413
|
-
return openBlock(), createElementBlock("div", {
|
|
14414
|
-
class: "mce-trackhead",
|
|
14415
|
-
style: normalizeStyle$1({
|
|
14416
|
-
height: `var(--timeline-track-height__${__props.node.meta.inEditorIs}, 22px)`
|
|
14417
|
-
})
|
|
14418
|
-
}, toDisplayString(__props.node.meta.inEditorIs), 5);
|
|
14419
|
-
};
|
|
14420
|
-
}
|
|
14421
|
-
});
|
|
14422
|
-
const _hoisted_1$6 = { class: "mce-timeline__toolbar" };
|
|
14423
|
-
const _hoisted_2$3 = { class: "mce-timeline__main" };
|
|
14424
|
-
const _hoisted_3$3 = { class: "mce-timeline__left" };
|
|
14425
|
-
const _hoisted_4$1 = { class: "mce-timeline__left-wrapper" };
|
|
14426
|
-
const _hoisted_5$1 = { class: "mce-timeline__right-wrapper" };
|
|
14427
|
-
const _hoisted_6$1 = { class: "mce-timeline__ruler" };
|
|
14428
|
-
const _hoisted_7$1 = { class: "mce-timeline__track" };
|
|
14429
|
-
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
14430
|
-
__name: "Timeline",
|
|
14431
|
-
setup(__props) {
|
|
14432
|
-
const {
|
|
14433
|
-
isElement,
|
|
14434
|
-
root,
|
|
14435
|
-
msPerPx,
|
|
14436
|
-
currentTime,
|
|
14437
|
-
timeline,
|
|
14438
|
-
endTime,
|
|
14439
|
-
selection
|
|
14440
|
-
} = useEditor();
|
|
14441
|
-
const fps = ref(1e3 / 30);
|
|
14442
|
-
const ruler = useTemplateRef("rulerTpl");
|
|
14443
|
-
const paused = ref(true);
|
|
14444
|
-
const offset2 = ref([0, 0]);
|
|
14445
|
-
const elements = computed(() => {
|
|
14446
|
-
return root.value.findAll((node) => {
|
|
14447
|
-
if (isElement(node)) {
|
|
14448
|
-
if (node.children.some((child) => child instanceof Animation)) {
|
|
14449
|
-
return true;
|
|
14450
|
-
}
|
|
14451
|
-
}
|
|
14452
|
-
return false;
|
|
14453
|
-
});
|
|
14189
|
+
const modelValue = useModel(props, "modelValue");
|
|
14190
|
+
const model = computed({
|
|
14191
|
+
get: () => {
|
|
14192
|
+
let { left = 0, top = 0, width = 0, height = 0, rotate = 0, borderRadius = 0 } = modelValue.value ?? {};
|
|
14193
|
+
if (Number.isNaN(Number(width)))
|
|
14194
|
+
width = 0;
|
|
14195
|
+
if (Number.isNaN(Number(height)))
|
|
14196
|
+
height = 0;
|
|
14197
|
+
return { left, top, width, height, rotate, borderRadius };
|
|
14198
|
+
},
|
|
14199
|
+
set: (val) => modelValue.value = val
|
|
14454
14200
|
});
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14201
|
+
const transforming = ref(false);
|
|
14202
|
+
const activeHandle = ref();
|
|
14203
|
+
const computedHandles = computed(() => {
|
|
14204
|
+
const shape = props.handleShape;
|
|
14205
|
+
const size = shape === "rect" ? 8 : 10;
|
|
14206
|
+
const { width = 0, height = 0, borderRadius } = model.value;
|
|
14207
|
+
const center = { x: width / 2, y: height / 2 };
|
|
14208
|
+
const lines = [
|
|
14209
|
+
{ type: "t", points: [[0, 0], [1, 0]] },
|
|
14210
|
+
{ type: "r", points: [[1, 0], [1, 1]] },
|
|
14211
|
+
{ type: "b", points: [[0, 1], [1, 1]] },
|
|
14212
|
+
{ type: "l", points: [[0, 0], [0, 1]] }
|
|
14213
|
+
];
|
|
14214
|
+
const points = [
|
|
14215
|
+
{ type: "t", point: [0.5, 0], width: 1.4, height: 0.6 },
|
|
14216
|
+
{ type: "r", point: [1, 0.5], width: 0.6, height: 1.4 },
|
|
14217
|
+
{ type: "b", point: [0.5, 1], width: 1.4, height: 0.6 },
|
|
14218
|
+
{ type: "l", point: [0, 0.5], width: 0.6, height: 1.4 },
|
|
14219
|
+
{ type: "tl", point: [0, 0] },
|
|
14220
|
+
{ type: "tr", point: [1, 0] },
|
|
14221
|
+
{ type: "bl", point: [0, 1] },
|
|
14222
|
+
{ type: "br", point: [1, 1] }
|
|
14223
|
+
];
|
|
14224
|
+
const lineHandles = lines.map((item) => {
|
|
14225
|
+
const [p1, p2] = item.points;
|
|
14226
|
+
const minX = Math.min(p1[0], p2[0]) * width;
|
|
14227
|
+
const maxX = Math.max(p1[0], p2[0]) * width;
|
|
14228
|
+
const minY = Math.min(p1[1], p2[1]) * height;
|
|
14229
|
+
const maxY = Math.max(p1[1], p2[1]) * height;
|
|
14230
|
+
return {
|
|
14231
|
+
type: item.type,
|
|
14232
|
+
x: minX - size / 2,
|
|
14233
|
+
y: minY - size / 2,
|
|
14234
|
+
width: maxX - minX + size,
|
|
14235
|
+
height: maxY - minY + size
|
|
14477
14236
|
};
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14237
|
+
});
|
|
14238
|
+
const pointHandles = points.map((item) => {
|
|
14239
|
+
const _w = size * (item.width ?? 1);
|
|
14240
|
+
const _h = size * (item.height ?? 1);
|
|
14241
|
+
return {
|
|
14242
|
+
type: item.type,
|
|
14243
|
+
shape,
|
|
14244
|
+
x: item.point[0] * width - _w / 2,
|
|
14245
|
+
y: item.point[1] * height - _h / 2,
|
|
14246
|
+
width: _w,
|
|
14247
|
+
height: _h
|
|
14481
14248
|
};
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
}
|
|
14494
|
-
return `${Math.floor(f % 30)}f`;
|
|
14495
|
-
}
|
|
14496
|
-
let requestId;
|
|
14497
|
-
function play() {
|
|
14498
|
-
paused.value = false;
|
|
14499
|
-
let prevTime;
|
|
14500
|
-
function loop(time) {
|
|
14501
|
-
if (prevTime !== void 0 && time !== void 0) {
|
|
14502
|
-
timeline.value.addTime(time - prevTime);
|
|
14249
|
+
});
|
|
14250
|
+
const diagonalPointHandles = pointHandles.filter((item) => item.type.length === 2);
|
|
14251
|
+
const rotateHandles = diagonalPointHandles.map((item) => {
|
|
14252
|
+
const _w = item.width * 1.5;
|
|
14253
|
+
const _h = item.height * 1.5;
|
|
14254
|
+
let x = item.x;
|
|
14255
|
+
let y = item.y;
|
|
14256
|
+
if (center.x > item.x) {
|
|
14257
|
+
x -= _w;
|
|
14258
|
+
} else {
|
|
14259
|
+
x += item.width;
|
|
14503
14260
|
}
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14261
|
+
if (center.y > item.y) {
|
|
14262
|
+
y -= _h;
|
|
14263
|
+
} else {
|
|
14264
|
+
y += item.height;
|
|
14265
|
+
}
|
|
14266
|
+
return {
|
|
14267
|
+
...item,
|
|
14268
|
+
shape: void 0,
|
|
14269
|
+
type: `rotate-${item.type}`,
|
|
14270
|
+
x,
|
|
14271
|
+
y,
|
|
14272
|
+
width: _w,
|
|
14273
|
+
height: _h
|
|
14274
|
+
};
|
|
14275
|
+
});
|
|
14276
|
+
const minSize = Math.min(width, height);
|
|
14277
|
+
const roundedHandles = props.roundable ? diagonalPointHandles.map((item) => {
|
|
14278
|
+
const _w = item.width * 0.8;
|
|
14279
|
+
const _h = item.height * 0.8;
|
|
14280
|
+
const sign2 = {
|
|
14281
|
+
x: center.x - item.x > 0 ? 1 : -1,
|
|
14282
|
+
y: center.y - item.y > 0 ? 1 : -1
|
|
14283
|
+
};
|
|
14284
|
+
const offset2 = minSize * 0.1;
|
|
14285
|
+
const ws = (borderRadius + offset2) / (width / 2 + offset2);
|
|
14286
|
+
const hs = (borderRadius + offset2) / (height / 2 + offset2);
|
|
14287
|
+
return {
|
|
14288
|
+
...item,
|
|
14289
|
+
shape: "circle",
|
|
14290
|
+
type: `round-${item.type}`,
|
|
14291
|
+
x: item.x + sign2.x * width / 2 * ws,
|
|
14292
|
+
y: item.y + sign2.y * height / 2 * hs,
|
|
14293
|
+
width: _w,
|
|
14294
|
+
height: _h
|
|
14295
|
+
};
|
|
14296
|
+
}) : [];
|
|
14297
|
+
let handles;
|
|
14298
|
+
if (props.handleStrategy === "point") {
|
|
14299
|
+
handles = [
|
|
14300
|
+
// move
|
|
14301
|
+
...lineHandles.map((item) => ({ ...item, type: "move" })),
|
|
14302
|
+
// resize
|
|
14303
|
+
...pointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14304
|
+
// round
|
|
14305
|
+
...roundedHandles,
|
|
14306
|
+
// rotate
|
|
14307
|
+
...rotateHandles
|
|
14308
|
+
];
|
|
14519
14309
|
} else {
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
}, [
|
|
14530
|
-
createElementVNode("div", _hoisted_1$6, [
|
|
14531
|
-
createElementVNode("div", {
|
|
14532
|
-
class: "mce-timeline__play",
|
|
14533
|
-
onClick: toggle
|
|
14534
|
-
}, [
|
|
14535
|
-
createVNode(unref(_sfc_main$C), {
|
|
14536
|
-
icon: paused.value ? "$play" : "$pause"
|
|
14537
|
-
}, null, 8, ["icon"])
|
|
14538
|
-
])
|
|
14539
|
-
]),
|
|
14540
|
-
createElementVNode("div", _hoisted_2$3, [
|
|
14541
|
-
createElementVNode("div", _hoisted_3$3, [
|
|
14542
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
14543
|
-
createElementVNode("div", {
|
|
14544
|
-
style: normalizeStyle$1({
|
|
14545
|
-
transform: `translateY(${offset2.value[1]}px)`
|
|
14546
|
-
})
|
|
14547
|
-
}, [
|
|
14548
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
14549
|
-
return openBlock(), createBlock(_sfc_main$e, {
|
|
14550
|
-
key: index,
|
|
14551
|
-
node
|
|
14552
|
-
}, null, 8, ["node"]);
|
|
14553
|
-
}), 128))
|
|
14554
|
-
], 4)
|
|
14555
|
-
])
|
|
14556
|
-
]),
|
|
14557
|
-
createElementVNode("div", {
|
|
14558
|
-
class: "mce-timeline__right",
|
|
14559
|
-
onWheel,
|
|
14560
|
-
onMousedown
|
|
14561
|
-
}, [
|
|
14562
|
-
createElementVNode("div", _hoisted_5$1, [
|
|
14563
|
-
createElementVNode("div", _hoisted_6$1, [
|
|
14564
|
-
createVNode(_sfc_main$p, {
|
|
14565
|
-
ref: "rulerTpl",
|
|
14566
|
-
zoom: 1 / unref(msPerPx) * fps.value,
|
|
14567
|
-
unit: 100,
|
|
14568
|
-
"unit-fractions": [1, 3],
|
|
14569
|
-
style: { "position": "relative" },
|
|
14570
|
-
position: -offset2.value[0],
|
|
14571
|
-
"label-format": rulerLabelFormat
|
|
14572
|
-
}, null, 8, ["zoom", "position"])
|
|
14573
|
-
]),
|
|
14574
|
-
createElementVNode("div", _hoisted_7$1, [
|
|
14575
|
-
createElementVNode("div", {
|
|
14576
|
-
style: normalizeStyle$1({
|
|
14577
|
-
width: `${unref(endTime) / unref(msPerPx)}px`,
|
|
14578
|
-
transform: `translate(${offset2.value[0]}px, ${offset2.value[1]}px)`
|
|
14579
|
-
})
|
|
14580
|
-
}, [
|
|
14581
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
14582
|
-
return openBlock(), createBlock(_sfc_main$f, { key: index }, {
|
|
14583
|
-
default: withCtx(() => [
|
|
14584
|
-
createVNode(_sfc_main$g, {
|
|
14585
|
-
node,
|
|
14586
|
-
"ms-per-px": unref(msPerPx),
|
|
14587
|
-
active: unref(selection).some((v) => v.equal(node)),
|
|
14588
|
-
onMousedown: withModifiers(($event) => selection.value = [node], ["stop"])
|
|
14589
|
-
}, null, 8, ["node", "ms-per-px", "active", "onMousedown"])
|
|
14590
|
-
]),
|
|
14591
|
-
_: 2
|
|
14592
|
-
}, 1024);
|
|
14593
|
-
}), 128))
|
|
14594
|
-
], 4)
|
|
14595
|
-
]),
|
|
14596
|
-
createVNode(_sfc_main$h, {
|
|
14597
|
-
style: normalizeStyle$1({
|
|
14598
|
-
transform: `translate(${offset2.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
|
|
14599
|
-
})
|
|
14600
|
-
}, null, 8, ["style"])
|
|
14601
|
-
])
|
|
14602
|
-
], 32)
|
|
14603
|
-
])
|
|
14604
|
-
], 32);
|
|
14605
|
-
};
|
|
14606
|
-
}
|
|
14607
|
-
});
|
|
14608
|
-
const _timeline = definePlugin((editor) => {
|
|
14609
|
-
const {
|
|
14610
|
-
registerConfig
|
|
14611
|
-
} = editor;
|
|
14612
|
-
registerConfig("timeline", false);
|
|
14613
|
-
return {
|
|
14614
|
-
name: "mce:timeline",
|
|
14615
|
-
components: [
|
|
14616
|
-
{
|
|
14617
|
-
name: "timeline",
|
|
14618
|
-
type: "panel",
|
|
14619
|
-
position: "bottom",
|
|
14620
|
-
size: 160,
|
|
14621
|
-
component: _sfc_main$d
|
|
14310
|
+
handles = [
|
|
14311
|
+
// resize
|
|
14312
|
+
...lineHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14313
|
+
...diagonalPointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
14314
|
+
// round
|
|
14315
|
+
...roundedHandles,
|
|
14316
|
+
// rotate
|
|
14317
|
+
...rotateHandles
|
|
14318
|
+
];
|
|
14622
14319
|
}
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
]
|
|
14627
|
-
};
|
|
14628
|
-
});
|
|
14629
|
-
const _hoisted_1$5 = { class: "mce-toolbelt" };
|
|
14630
|
-
const _hoisted_2$2 = { key: 0 };
|
|
14631
|
-
const _hoisted_3$2 = { key: 1 };
|
|
14632
|
-
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
14633
|
-
__name: "Toolbelt",
|
|
14634
|
-
setup(__props) {
|
|
14635
|
-
const {
|
|
14636
|
-
state,
|
|
14637
|
-
t,
|
|
14638
|
-
setActiveDrawingTool,
|
|
14639
|
-
activeDrawingTool,
|
|
14640
|
-
hotkeys,
|
|
14641
|
-
getKbd
|
|
14642
|
-
} = useEditor();
|
|
14643
|
-
const activeShape = ref(0);
|
|
14644
|
-
const activePen = ref(0);
|
|
14645
|
-
const shapeItems = computed(() => {
|
|
14646
|
-
const keys = [
|
|
14647
|
-
"rectangle",
|
|
14648
|
-
"line",
|
|
14649
|
-
"arrow",
|
|
14650
|
-
"ellipse",
|
|
14651
|
-
"polygon",
|
|
14652
|
-
"star"
|
|
14653
|
-
];
|
|
14654
|
-
return [
|
|
14655
|
-
...keys.map((key, index) => {
|
|
14656
|
-
return {
|
|
14657
|
-
key,
|
|
14658
|
-
handle: () => {
|
|
14659
|
-
activeShape.value = index;
|
|
14660
|
-
setActiveDrawingTool(key);
|
|
14661
|
-
},
|
|
14662
|
-
checked: activeDrawingTool.value?.name === key
|
|
14663
|
-
};
|
|
14664
|
-
}),
|
|
14665
|
-
{
|
|
14666
|
-
key: "image",
|
|
14667
|
-
handle: () => setActiveDrawingTool("image"),
|
|
14668
|
-
checked: activeDrawingTool.value?.name === "image"
|
|
14320
|
+
return handles.filter((handle) => {
|
|
14321
|
+
if (props.handles.includes(handle.type)) {
|
|
14322
|
+
return !(!props.resizable && handle.type.startsWith("resize") || !props.rotatable && handle.type.startsWith("rotate") || !props.movable && handle.type === "move");
|
|
14669
14323
|
}
|
|
14670
|
-
|
|
14324
|
+
return false;
|
|
14325
|
+
}).map((anchor) => {
|
|
14326
|
+
anchor.width = Math.max(anchor.width, 0);
|
|
14327
|
+
anchor.height = Math.max(anchor.height, 0);
|
|
14328
|
+
return anchor;
|
|
14329
|
+
});
|
|
14671
14330
|
});
|
|
14672
|
-
const
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
return {
|
|
14680
|
-
key,
|
|
14681
|
-
handle: () => {
|
|
14682
|
-
activePen.value = index;
|
|
14683
|
-
setActiveDrawingTool(key);
|
|
14684
|
-
},
|
|
14685
|
-
checked: activeDrawingTool.value?.name === key
|
|
14686
|
-
};
|
|
14687
|
-
})
|
|
14688
|
-
];
|
|
14331
|
+
const handlesRef = ref();
|
|
14332
|
+
const sizeStyle = computed(() => {
|
|
14333
|
+
const { width = 0, height = 0 } = model.value;
|
|
14334
|
+
return {
|
|
14335
|
+
width: props.initialSize && !width ? void 0 : `${width}px`,
|
|
14336
|
+
height: props.initialSize && !height ? void 0 : `${height}px`
|
|
14337
|
+
};
|
|
14689
14338
|
});
|
|
14690
|
-
const
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
}
|
|
14700
|
-
},
|
|
14701
|
-
children: [
|
|
14702
|
-
{ key: "move", handle: () => setActiveDrawingTool(void 0) },
|
|
14703
|
-
{ key: "hand", handle: () => state.value = "hand" }
|
|
14704
|
-
]
|
|
14705
|
-
},
|
|
14706
|
-
{
|
|
14707
|
-
key: activeDrawingTool.value?.name === "slice" ? "slice" : "frame",
|
|
14708
|
-
active: ["frame", "slice"].includes(activeDrawingTool.value?.name),
|
|
14709
|
-
handle: () => setActiveDrawingTool("frame"),
|
|
14710
|
-
children: [
|
|
14711
|
-
{ key: "frame", handle: () => setActiveDrawingTool("frame") },
|
|
14712
|
-
{ key: "slice", handle: () => setActiveDrawingTool("slice") }
|
|
14713
|
-
]
|
|
14714
|
-
},
|
|
14715
|
-
{
|
|
14716
|
-
...shapeItems.value.find((v) => v.checked) ?? shapeItems.value[activeShape.value],
|
|
14717
|
-
children: shapeItems.value
|
|
14718
|
-
},
|
|
14719
|
-
{
|
|
14720
|
-
key: "text",
|
|
14721
|
-
active: activeDrawingTool.value?.name === "text",
|
|
14722
|
-
handle: () => setActiveDrawingTool("text")
|
|
14723
|
-
},
|
|
14724
|
-
{
|
|
14725
|
-
...penItems.value.find((v) => v.checked) ?? penItems.value[activePen.value],
|
|
14726
|
-
children: penItems.value
|
|
14727
|
-
}
|
|
14728
|
-
];
|
|
14339
|
+
const style = computed(() => {
|
|
14340
|
+
const { left = 0, top = 0, rotate = 0 } = model.value;
|
|
14341
|
+
const radian = rotate * Math.PI / 180;
|
|
14342
|
+
const cos = Math.cos(radian);
|
|
14343
|
+
const sin = Math.sin(radian);
|
|
14344
|
+
return {
|
|
14345
|
+
...sizeStyle.value,
|
|
14346
|
+
transform: `matrix(${cos}, ${sin}, ${-sin}, ${cos}, ${left}, ${top})`
|
|
14347
|
+
};
|
|
14729
14348
|
});
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
key,
|
|
14735
|
-
class: "mce-toolbelt__group"
|
|
14736
|
-
}, [
|
|
14737
|
-
createVNode(_sfc_main$q, {
|
|
14738
|
-
location: "top",
|
|
14739
|
-
offset: 12,
|
|
14740
|
-
"show-arrow": ""
|
|
14741
|
-
}, {
|
|
14742
|
-
activator: withCtx(({ props: slotProps }) => [
|
|
14743
|
-
createVNode(_sfc_main$y, mergeProps({
|
|
14744
|
-
icon: "",
|
|
14745
|
-
class: "mce-toolbelt__btn",
|
|
14746
|
-
active: tool.active || tool.checked || false
|
|
14747
|
-
}, { ref_for: true }, slotProps, {
|
|
14748
|
-
onClick: tool.handle
|
|
14749
|
-
}), {
|
|
14750
|
-
default: withCtx(() => [
|
|
14751
|
-
createVNode(unref(_sfc_main$C), {
|
|
14752
|
-
icon: `$${tool.key}`
|
|
14753
|
-
}, null, 8, ["icon"])
|
|
14754
|
-
]),
|
|
14755
|
-
_: 2
|
|
14756
|
-
}, 1040, ["active", "onClick"])
|
|
14757
|
-
]),
|
|
14758
|
-
default: withCtx(() => [
|
|
14759
|
-
createElementVNode("span", null, toDisplayString(unref(t)(tool.key)), 1)
|
|
14760
|
-
]),
|
|
14761
|
-
kbd: withCtx(() => [
|
|
14762
|
-
unref(hotkeys).has(`setState:${tool.key}`) ? (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(unref(getKbd)(`setState:${tool.key}`)), 1)) : unref(hotkeys).has(`setActiveDrawingTool:${tool.key}`) ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(unref(getKbd)(`setActiveDrawingTool:${tool.key}`)), 1)) : createCommentVNode("", true)
|
|
14763
|
-
]),
|
|
14764
|
-
_: 2
|
|
14765
|
-
}, 1024),
|
|
14766
|
-
tool.children?.length ? (openBlock(), createBlock(_sfc_main$t, {
|
|
14767
|
-
key: 0,
|
|
14768
|
-
items: tool.children,
|
|
14769
|
-
offset: 12,
|
|
14770
|
-
location: "top-start"
|
|
14771
|
-
}, {
|
|
14772
|
-
activator: withCtx(({ props }) => [
|
|
14773
|
-
createVNode(_sfc_main$y, mergeProps({
|
|
14774
|
-
icon: "",
|
|
14775
|
-
class: "mce-toolbelt__arrow"
|
|
14776
|
-
}, { ref_for: true }, props), {
|
|
14777
|
-
default: withCtx(() => [
|
|
14778
|
-
createVNode(unref(_sfc_main$C), { icon: "$arrowDown" })
|
|
14779
|
-
]),
|
|
14780
|
-
_: 1
|
|
14781
|
-
}, 16)
|
|
14782
|
-
]),
|
|
14783
|
-
title: withCtx(({ item }) => [
|
|
14784
|
-
createTextVNode(toDisplayString(unref(t)(item.key)), 1)
|
|
14785
|
-
]),
|
|
14786
|
-
kbd: withCtx(({ item }) => [
|
|
14787
|
-
unref(hotkeys).has(`setState:${item.key}`) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
14788
|
-
createTextVNode(toDisplayString(unref(getKbd)(`setState:${item.key}`)), 1)
|
|
14789
|
-
], 64)) : unref(hotkeys).has(`setActiveDrawingTool:${item.key}`) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
14790
|
-
createTextVNode(toDisplayString(unref(getKbd)(`setActiveDrawingTool:${item.key}`)), 1)
|
|
14791
|
-
], 64)) : createCommentVNode("", true)
|
|
14792
|
-
]),
|
|
14793
|
-
prepend: withCtx(({ item }) => [
|
|
14794
|
-
createVNode(unref(_sfc_main$C), {
|
|
14795
|
-
class: "mce-toolbelt__icon",
|
|
14796
|
-
icon: `$${item.key}`
|
|
14797
|
-
}, null, 8, ["icon"])
|
|
14798
|
-
]),
|
|
14799
|
-
_: 2
|
|
14800
|
-
}, 1032, ["items"])) : createCommentVNode("", true)
|
|
14801
|
-
]);
|
|
14802
|
-
}), 128))
|
|
14803
|
-
]);
|
|
14804
|
-
};
|
|
14805
|
-
}
|
|
14806
|
-
});
|
|
14807
|
-
const _toolbelt = definePlugin((editor) => {
|
|
14808
|
-
const {
|
|
14809
|
-
registerConfig
|
|
14810
|
-
} = editor;
|
|
14811
|
-
const toolbelt = registerConfig("toolbelt", false);
|
|
14812
|
-
return {
|
|
14813
|
-
name: "mce:toolbelt",
|
|
14814
|
-
components: [
|
|
14815
|
-
{
|
|
14816
|
-
name: "toolbelt",
|
|
14817
|
-
type: "overlay",
|
|
14818
|
-
component: _sfc_main$c,
|
|
14819
|
-
ignore: () => !toolbelt.value
|
|
14349
|
+
const tip = computed(() => props.tipFormat?.("size"));
|
|
14350
|
+
function start(event, index) {
|
|
14351
|
+
if (event && event.button !== void 0 && event.button !== 0) {
|
|
14352
|
+
return false;
|
|
14820
14353
|
}
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
}
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
exec
|
|
14828
|
-
} = editor;
|
|
14829
|
-
async function _enter() {
|
|
14830
|
-
if (elementSelection.value.length === 1) {
|
|
14831
|
-
const element = elementSelection.value[0];
|
|
14832
|
-
if (element.text.isValid()) {
|
|
14833
|
-
await exec("startTyping");
|
|
14354
|
+
event?.preventDefault();
|
|
14355
|
+
event?.stopPropagation();
|
|
14356
|
+
const { left, top, width, height, rotate, borderRadius } = model.value;
|
|
14357
|
+
let aspectRatio = 0;
|
|
14358
|
+
if (width && height) {
|
|
14359
|
+
aspectRatio = width / height;
|
|
14834
14360
|
}
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
}
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
throw new Error(`Failed to load source "${url}", ${error}`);
|
|
14361
|
+
const handle = index === void 0 ? { type: "move", x: 0, y: 0, width: 0, height: 0 } : computedHandles.value[index];
|
|
14362
|
+
activeHandle.value = handle.type;
|
|
14363
|
+
const handleArr = handle.type.split("-");
|
|
14364
|
+
const last = handleArr.length > 1 ? handleArr.pop() || "" : "";
|
|
14365
|
+
const key = handleArr.join("-");
|
|
14366
|
+
const isMove = key === "move";
|
|
14367
|
+
const isRotate = key === "rotate";
|
|
14368
|
+
const isRound = key === "round";
|
|
14369
|
+
const isHorizontal = last === "l" || last === "r";
|
|
14370
|
+
const isHorizontalVertical = last.length === 1;
|
|
14371
|
+
const centerPoint = {
|
|
14372
|
+
x: left + width / 2,
|
|
14373
|
+
y: top + height / 2
|
|
14374
|
+
};
|
|
14375
|
+
const startPoint = {
|
|
14376
|
+
x: left,
|
|
14377
|
+
y: top
|
|
14378
|
+
};
|
|
14379
|
+
if (!isMove) {
|
|
14380
|
+
startPoint.x += handle.x + handle.width / 2;
|
|
14381
|
+
startPoint.y += handle.y + handle.height / 2;
|
|
14382
|
+
}
|
|
14383
|
+
const sign2 = {
|
|
14384
|
+
x: startPoint.x - centerPoint.x > 0 ? 1 : -1,
|
|
14385
|
+
y: startPoint.y - centerPoint.y > 0 ? 1 : -1
|
|
14386
|
+
};
|
|
14387
|
+
const rotatedStartPoint = rotatePoint2(startPoint, centerPoint, rotate);
|
|
14388
|
+
const rotatedSymmetricPoint = {
|
|
14389
|
+
x: centerPoint.x * 2 - rotatedStartPoint.x,
|
|
14390
|
+
y: centerPoint.y * 2 - rotatedStartPoint.y
|
|
14391
|
+
};
|
|
14392
|
+
const startAngle = Math.atan2(
|
|
14393
|
+
rotatedStartPoint.y - centerPoint.y,
|
|
14394
|
+
rotatedStartPoint.x - centerPoint.x
|
|
14395
|
+
) / (Math.PI / 180);
|
|
14396
|
+
let startClientPoint = event ? { x: event.clientX, y: event.clientY } : void 0;
|
|
14397
|
+
function startTransform() {
|
|
14398
|
+
transforming.value = true;
|
|
14399
|
+
emit("start", model.value);
|
|
14400
|
+
}
|
|
14401
|
+
if (!props.threshold && !transforming.value) {
|
|
14402
|
+
startTransform();
|
|
14403
|
+
}
|
|
14404
|
+
function _onPointerMove(event2) {
|
|
14405
|
+
const updated = {};
|
|
14406
|
+
if (!startClientPoint) {
|
|
14407
|
+
startClientPoint = { x: event2.clientX, y: event2.clientY };
|
|
14408
|
+
}
|
|
14409
|
+
const rotatedOffset = {
|
|
14410
|
+
x: event2.clientX - startClientPoint.x,
|
|
14411
|
+
y: event2.clientY - startClientPoint.y
|
|
14412
|
+
};
|
|
14413
|
+
if (!transforming.value) {
|
|
14414
|
+
if (Math.abs(rotatedOffset.x) < props.threshold && Math.abs(rotatedOffset.y) < props.threshold) {
|
|
14415
|
+
return;
|
|
14416
|
+
}
|
|
14417
|
+
startTransform();
|
|
14418
|
+
}
|
|
14419
|
+
const rotatedCurrentPoint = {
|
|
14420
|
+
x: rotatedStartPoint.x + rotatedOffset.x,
|
|
14421
|
+
y: rotatedStartPoint.y + rotatedOffset.y
|
|
14422
|
+
};
|
|
14423
|
+
if (isMove) {
|
|
14424
|
+
if (props.movable) {
|
|
14425
|
+
updated.left = startPoint.x + rotatedOffset.x;
|
|
14426
|
+
updated.top = startPoint.y + rotatedOffset.y;
|
|
14427
|
+
}
|
|
14428
|
+
} else if (isRotate) {
|
|
14429
|
+
if (props.rotatable) {
|
|
14430
|
+
const endAngle = Math.atan2(
|
|
14431
|
+
rotatedCurrentPoint.y - centerPoint.y,
|
|
14432
|
+
rotatedCurrentPoint.x - centerPoint.x
|
|
14433
|
+
) / (Math.PI / 180);
|
|
14434
|
+
updated.rotate = rotate + endAngle - startAngle;
|
|
14910
14435
|
}
|
|
14911
|
-
}
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
};
|
|
14930
|
-
});
|
|
14931
|
-
const _zoom = definePlugin((editor) => {
|
|
14932
|
-
const {
|
|
14933
|
-
registerConfig,
|
|
14934
|
-
camera,
|
|
14935
|
-
zoomTo,
|
|
14936
|
-
exec,
|
|
14937
|
-
config,
|
|
14938
|
-
findFrame,
|
|
14939
|
-
selection
|
|
14940
|
-
} = editor;
|
|
14941
|
-
registerConfig("zoomToFit", "contain");
|
|
14942
|
-
function zoomToFrame(type, options) {
|
|
14943
|
-
const value = findFrame(type);
|
|
14944
|
-
if (value) {
|
|
14945
|
-
selection.value = [value];
|
|
14946
|
-
zoomTo(value, options);
|
|
14947
|
-
}
|
|
14948
|
-
}
|
|
14949
|
-
return {
|
|
14950
|
-
name: "mce:zoom",
|
|
14951
|
-
commands: [
|
|
14952
|
-
{ command: "zoomIn", handle: () => camera.value.addZoom(0.25) },
|
|
14953
|
-
{ command: "zoomOut", handle: () => camera.value.addZoom(-0.25) },
|
|
14954
|
-
{ command: "zoomTo100", handle: () => camera.value.setZoom(1) },
|
|
14955
|
-
{ command: "zoomToFit", handle: () => zoomTo("root", { mode: config.value.zoomToFit }) },
|
|
14956
|
-
{ command: "zoomToSelection", handle: (options) => zoomTo("selection", options) },
|
|
14957
|
-
{ command: "zoomToNextFrame", handle: (options) => zoomToFrame("next", options) },
|
|
14958
|
-
{ command: "zoomToPreviousFrame", handle: (options) => zoomToFrame("previous", options) }
|
|
14959
|
-
],
|
|
14960
|
-
hotkeys: [
|
|
14961
|
-
{ command: "zoomIn", key: "CmdOrCtrl+=" },
|
|
14962
|
-
{ command: "zoomOut", key: "CmdOrCtrl+-" },
|
|
14963
|
-
{ command: "zoomTo100", key: "CmdOrCtrl+0" },
|
|
14964
|
-
{ command: "zoomToFit", key: "Shift+1" },
|
|
14965
|
-
{ command: "zoomToSelection", key: "Shift+2" },
|
|
14966
|
-
{ command: "zoomToNextFrame", key: "N" },
|
|
14967
|
-
{ command: "zoomToPreviousFrame", key: "Shift+N" }
|
|
14968
|
-
],
|
|
14969
|
-
events: {
|
|
14970
|
-
setDoc: () => exec("zoomToFit")
|
|
14971
|
-
}
|
|
14972
|
-
};
|
|
14973
|
-
});
|
|
14974
|
-
const plugins = [
|
|
14975
|
-
_arrange,
|
|
14976
|
-
_autoNest,
|
|
14977
|
-
_copyAs,
|
|
14978
|
-
_drawingTool,
|
|
14979
|
-
_edit,
|
|
14980
|
-
_frame,
|
|
14981
|
-
_gif,
|
|
14982
|
-
_history,
|
|
14983
|
-
_hover,
|
|
14984
|
-
_html,
|
|
14985
|
-
_image,
|
|
14986
|
-
_import,
|
|
14987
|
-
_json,
|
|
14988
|
-
_layers,
|
|
14989
|
-
_madeWith,
|
|
14990
|
-
_menu,
|
|
14991
|
-
_move,
|
|
14992
|
-
_new,
|
|
14993
|
-
_node,
|
|
14994
|
-
_open,
|
|
14995
|
-
_panels,
|
|
14996
|
-
_pen,
|
|
14997
|
-
_rotate,
|
|
14998
|
-
_ruler,
|
|
14999
|
-
_saveAs,
|
|
15000
|
-
_scroll,
|
|
15001
|
-
_selection,
|
|
15002
|
-
_shape,
|
|
15003
|
-
_slice,
|
|
15004
|
-
_smartGuides,
|
|
15005
|
-
_smartSelection,
|
|
15006
|
-
_state,
|
|
15007
|
-
_statusbar,
|
|
15008
|
-
_text,
|
|
15009
|
-
_timeline,
|
|
15010
|
-
_toolbelt,
|
|
15011
|
-
_transform,
|
|
15012
|
-
_ui,
|
|
15013
|
-
_url,
|
|
15014
|
-
_view,
|
|
15015
|
-
_zoom
|
|
15016
|
-
];
|
|
15017
|
-
class Editor extends Observable {
|
|
15018
|
-
static injectionKey = /* @__PURE__ */ Symbol.for("EditorKey");
|
|
15019
|
-
debug = ref(false);
|
|
15020
|
-
onEmit;
|
|
15021
|
-
plugins = /* @__PURE__ */ new Map();
|
|
15022
|
-
pluginsComponents = computed(() => {
|
|
15023
|
-
return {
|
|
15024
|
-
overlay: this.getPlugins("overlay"),
|
|
15025
|
-
panel: this.getPlugins("panel")
|
|
15026
|
-
};
|
|
15027
|
-
});
|
|
15028
|
-
_setups = [];
|
|
15029
|
-
constructor(options = {}) {
|
|
15030
|
-
super();
|
|
15031
|
-
this._setupObservable();
|
|
15032
|
-
this._setupOptions(options);
|
|
15033
|
-
}
|
|
15034
|
-
_setupObservable() {
|
|
15035
|
-
this.on = this.on.bind(this);
|
|
15036
|
-
this.once = this.once.bind(this);
|
|
15037
|
-
this.off = this.off.bind(this);
|
|
15038
|
-
this.emit = this.emit.bind(this);
|
|
15039
|
-
}
|
|
15040
|
-
getPlugins = (type) => {
|
|
15041
|
-
return Array.from(this.plugins.values()).flatMap((p) => p.components?.filter((c) => {
|
|
15042
|
-
return c.type === type && c.ignore?.() !== true;
|
|
15043
|
-
}) ?? []);
|
|
15044
|
-
};
|
|
15045
|
-
log = (...args) => {
|
|
15046
|
-
if (this.debug.value) {
|
|
15047
|
-
console.warn(`[mce][${(/* @__PURE__ */ new Date()).toLocaleTimeString()}]`, ...args);
|
|
15048
|
-
}
|
|
15049
|
-
};
|
|
15050
|
-
emit = (event, ...args) => {
|
|
15051
|
-
this.onEmit?.(event, ...args);
|
|
15052
|
-
return super.emit(event, ...args);
|
|
15053
|
-
};
|
|
15054
|
-
_setupOptions(options) {
|
|
15055
|
-
const {
|
|
15056
|
-
debug = false,
|
|
15057
|
-
plugins: plugins$1 = [],
|
|
15058
|
-
configCacheInLocal
|
|
15059
|
-
} = options;
|
|
15060
|
-
this.debug.value = debug;
|
|
15061
|
-
this.config = configCacheInLocal ? useLocalStorage("config", () => ({})) : ref({});
|
|
15062
|
-
this._setups = [];
|
|
15063
|
-
this._useMixins(
|
|
15064
|
-
mixins,
|
|
15065
|
-
options
|
|
15066
|
-
);
|
|
15067
|
-
this.use([
|
|
15068
|
-
...plugins,
|
|
15069
|
-
...plugins$1
|
|
15070
|
-
], options);
|
|
15071
|
-
}
|
|
15072
|
-
_useMixins(mixins2, options) {
|
|
15073
|
-
const use = (mixin) => {
|
|
15074
|
-
const result = mixin(this, options);
|
|
15075
|
-
switch (typeof result) {
|
|
15076
|
-
case "object":
|
|
15077
|
-
if (Array.isArray(result)) {
|
|
15078
|
-
result.map((v) => use(v));
|
|
14436
|
+
} else if (isRound) {
|
|
14437
|
+
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
14438
|
+
const dx = -sign2.x * offset2.x;
|
|
14439
|
+
const dy = -sign2.y * offset2.y;
|
|
14440
|
+
const _offset = dx < dy ? dy : dx;
|
|
14441
|
+
updated.borderRadius = borderRadius + _offset;
|
|
14442
|
+
} else if (isHorizontalVertical) {
|
|
14443
|
+
const currentPoint = rotatePoint2(rotatedCurrentPoint, centerPoint, -rotate);
|
|
14444
|
+
const newCurrentPoint = isHorizontal ? { x: currentPoint.x, y: startPoint.y } : { x: startPoint.x, y: currentPoint.y };
|
|
14445
|
+
const newRotatedCurrentPoint = rotatePoint2(newCurrentPoint, centerPoint, rotate);
|
|
14446
|
+
const distance2 = Math.abs(getDistance(newRotatedCurrentPoint, rotatedSymmetricPoint));
|
|
14447
|
+
if (isHorizontal) {
|
|
14448
|
+
updated.width = distance2;
|
|
14449
|
+
if (props.resizeStrategy === "lockAspectRatio" && aspectRatio) {
|
|
14450
|
+
updated.height = distance2 / aspectRatio;
|
|
14451
|
+
} else {
|
|
14452
|
+
updated.height = height;
|
|
14453
|
+
}
|
|
15079
14454
|
} else {
|
|
15080
|
-
|
|
14455
|
+
updated.height = distance2;
|
|
14456
|
+
if (props.resizeStrategy === "lockAspectRatio" && aspectRatio) {
|
|
14457
|
+
updated.width = distance2 * aspectRatio;
|
|
14458
|
+
} else {
|
|
14459
|
+
updated.width = width;
|
|
14460
|
+
}
|
|
15081
14461
|
}
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
14462
|
+
const newCenterPoint = getMidpoint(newRotatedCurrentPoint, rotatedSymmetricPoint);
|
|
14463
|
+
updated.left = newCenterPoint.x - updated.width / 2;
|
|
14464
|
+
updated.top = newCenterPoint.y - updated.height / 2;
|
|
14465
|
+
} else {
|
|
14466
|
+
let newRotatedCurrentPoint;
|
|
14467
|
+
if ((props.resizeStrategy === "lockAspectRatio" || props.resizeStrategy === "lockAspectRatioDiagonal") && aspectRatio) {
|
|
14468
|
+
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
14469
|
+
const dx = sign2.x * offset2.x;
|
|
14470
|
+
const dy = sign2.y * offset2.y;
|
|
14471
|
+
let newCurrentPoint;
|
|
14472
|
+
if (dx > dy * aspectRatio) {
|
|
14473
|
+
newCurrentPoint = {
|
|
14474
|
+
x: startPoint.x + sign2.x * dx,
|
|
14475
|
+
y: startPoint.y + sign2.y * dx / aspectRatio
|
|
14476
|
+
};
|
|
14477
|
+
} else {
|
|
14478
|
+
newCurrentPoint = {
|
|
14479
|
+
x: startPoint.x + sign2.x * dy * aspectRatio,
|
|
14480
|
+
y: startPoint.y + sign2.y * dy
|
|
14481
|
+
};
|
|
14482
|
+
}
|
|
14483
|
+
newRotatedCurrentPoint = rotatePoint2(newCurrentPoint, centerPoint, rotate);
|
|
14484
|
+
} else {
|
|
14485
|
+
newRotatedCurrentPoint = rotatedCurrentPoint;
|
|
15087
14486
|
}
|
|
15088
|
-
|
|
14487
|
+
const newCenterPoint = getMidpoint(newRotatedCurrentPoint, rotatedSymmetricPoint);
|
|
14488
|
+
const points = [
|
|
14489
|
+
rotatePoint2(newRotatedCurrentPoint, newCenterPoint, -rotate),
|
|
14490
|
+
rotatePoint2(rotatedSymmetricPoint, newCenterPoint, -rotate)
|
|
14491
|
+
];
|
|
14492
|
+
const [minX, maxX] = points[0].x > points[1].x ? [points[1].x, points[0].x] : [points[0].x, points[1].x];
|
|
14493
|
+
const [minY, maxY] = points[0].y > points[1].y ? [points[1].y, points[0].y] : [points[0].y, points[1].y];
|
|
14494
|
+
updated.width = maxX - minX;
|
|
14495
|
+
updated.height = maxY - minY;
|
|
14496
|
+
updated.left = minX;
|
|
14497
|
+
updated.top = minY;
|
|
14498
|
+
}
|
|
14499
|
+
if ("width" in updated && updated.width <= 0 || "height" in updated && updated.height <= 0) {
|
|
14500
|
+
return;
|
|
14501
|
+
}
|
|
14502
|
+
if (updated.borderRadius ?? borderRadius) {
|
|
14503
|
+
updated.borderRadius = Math.min(
|
|
14504
|
+
Math.max(0, updated.borderRadius ?? borderRadius),
|
|
14505
|
+
Math.min((updated.width ?? width) / 2, (updated.height ?? height) / 2)
|
|
14506
|
+
);
|
|
14507
|
+
}
|
|
14508
|
+
const oldValue = { ...model.value };
|
|
14509
|
+
const newValue = { ...model.value, ...updated };
|
|
14510
|
+
model.value = newValue;
|
|
14511
|
+
emit("move", newValue, oldValue);
|
|
14512
|
+
}
|
|
14513
|
+
function _onPointerUp() {
|
|
14514
|
+
window.removeEventListener("pointermove", _onPointerMove);
|
|
14515
|
+
window.removeEventListener("pointerup", _onPointerUp, true);
|
|
14516
|
+
transforming.value = false;
|
|
14517
|
+
activeHandle.value = void 0;
|
|
14518
|
+
emit("end", model.value);
|
|
15089
14519
|
}
|
|
14520
|
+
window.addEventListener("pointermove", _onPointerMove);
|
|
14521
|
+
window.addEventListener("pointerup", _onPointerUp, true);
|
|
14522
|
+
return true;
|
|
14523
|
+
}
|
|
14524
|
+
const cursorMap = {
|
|
14525
|
+
rotate: '<path d="M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill="white"/>',
|
|
14526
|
+
resizeXy: '<path d="m9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z" fill="white"/><path d="m17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z" fill="black"/>',
|
|
14527
|
+
resizeBevel: '<path d="m19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z" fill="white"/><path d="m18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z" fill="black"/>'
|
|
15090
14528
|
};
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
if (
|
|
15097
|
-
|
|
15098
|
-
} else {
|
|
15099
|
-
result = plugin;
|
|
14529
|
+
function createCursor(type, angle) {
|
|
14530
|
+
const path = cursorMap[type];
|
|
14531
|
+
return `<svg height="32" width="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><filter id="shadow" color-interpolation-filters="sRGB"><feDropShadow dx="1" dy="1" stdDeviation="1.2" flood-opacity=".5"/></filter></defs><g fill="none" transform="rotate(${angle} 16 16)" filter="url(%23shadow)">${path}</g></svg>`.replace(/"/g, "'");
|
|
14532
|
+
}
|
|
14533
|
+
function getCursor(type) {
|
|
14534
|
+
if (type === "move") {
|
|
14535
|
+
return "move";
|
|
15100
14536
|
}
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
commands = [],
|
|
15105
|
-
hotkeys = [],
|
|
15106
|
-
loaders = [],
|
|
15107
|
-
exporters = [],
|
|
15108
|
-
drawingTools = []
|
|
15109
|
-
} = result;
|
|
15110
|
-
this.registerCommand(commands);
|
|
15111
|
-
this.registerHotkey(hotkeys);
|
|
15112
|
-
this.registerLoader(loaders);
|
|
15113
|
-
this.registerExporter(exporters);
|
|
15114
|
-
this.registerDrawingTool(drawingTools);
|
|
15115
|
-
if (events) {
|
|
15116
|
-
for (const k in events) {
|
|
15117
|
-
this.on(k, events[k]);
|
|
15118
|
-
}
|
|
14537
|
+
const create = cursors[type];
|
|
14538
|
+
if (!create) {
|
|
14539
|
+
return void 0;
|
|
15119
14540
|
}
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
14541
|
+
return `url("data:image/svg+xml,${create(model.value.rotate ?? 0)}") 16 16, pointer`;
|
|
14542
|
+
}
|
|
14543
|
+
function rotatePoint2(point, origin, angle) {
|
|
14544
|
+
const radian = angle * Math.PI / 180;
|
|
14545
|
+
const cos = Math.cos(radian);
|
|
14546
|
+
const sin = Math.sin(radian);
|
|
14547
|
+
return {
|
|
14548
|
+
x: (point.x - origin.x) * cos - (point.y - origin.y) * sin + origin.x,
|
|
14549
|
+
y: (point.x - origin.x) * sin + (point.y - origin.y) * cos + origin.y
|
|
14550
|
+
};
|
|
14551
|
+
}
|
|
14552
|
+
function getMidpoint(point1, point2) {
|
|
14553
|
+
return {
|
|
14554
|
+
x: (point2.x + point1.x) / 2,
|
|
14555
|
+
y: (point2.y + point1.y) / 2
|
|
14556
|
+
};
|
|
14557
|
+
}
|
|
14558
|
+
function getDistance(point1, point2) {
|
|
14559
|
+
const dx = point2.x - point1.x;
|
|
14560
|
+
const dy = point2.y - point1.y;
|
|
14561
|
+
return (dx + dy >= 0 ? 1 : -1) * Math.sqrt(dx * dx + dy * dy);
|
|
14562
|
+
}
|
|
14563
|
+
onMounted(async () => {
|
|
14564
|
+
const vm = getCurrentInstance();
|
|
14565
|
+
const root = vm?.proxy?.$el;
|
|
14566
|
+
if (root && props.initialSize) {
|
|
14567
|
+
await nextTick();
|
|
14568
|
+
let width;
|
|
14569
|
+
let height;
|
|
14570
|
+
const style2 = getComputedStyle(root);
|
|
14571
|
+
if (style2.width.endsWith("px") && style2.height.endsWith("px")) {
|
|
14572
|
+
width = Number(style2.width.replace("px", ""));
|
|
14573
|
+
height = Number(style2.height.replace("px", ""));
|
|
14574
|
+
} else {
|
|
14575
|
+
({ width, height } = root.getBoundingClientRect());
|
|
14576
|
+
}
|
|
14577
|
+
if (width && height) {
|
|
14578
|
+
model.value = { ...model.value, width, height };
|
|
14579
|
+
} else if ("ResizeObserver" in globalThis) {
|
|
14580
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
14581
|
+
if (entry.contentRect.width && entry.contentRect.height) {
|
|
14582
|
+
model.value = {
|
|
14583
|
+
...model.value,
|
|
14584
|
+
width: entry.contentRect.width,
|
|
14585
|
+
height: entry.contentRect.height
|
|
14586
|
+
};
|
|
14587
|
+
observer.unobserve(root);
|
|
14588
|
+
}
|
|
14589
|
+
});
|
|
14590
|
+
observer.observe(root);
|
|
14591
|
+
}
|
|
15126
14592
|
}
|
|
15127
14593
|
});
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
} catch (err) {
|
|
15145
|
-
console.error(`Failed to setup ${p.name} plugin`, err);
|
|
14594
|
+
__expose({
|
|
14595
|
+
start,
|
|
14596
|
+
activeHandle,
|
|
14597
|
+
transforming
|
|
14598
|
+
});
|
|
14599
|
+
function Diagonal() {
|
|
14600
|
+
const handle = activeHandle.value;
|
|
14601
|
+
if (!handle || !handle.startsWith("resize")) {
|
|
14602
|
+
return void 0;
|
|
14603
|
+
}
|
|
14604
|
+
switch (props.resizeStrategy) {
|
|
14605
|
+
case "lockAspectRatio":
|
|
14606
|
+
break;
|
|
14607
|
+
case "lockAspectRatioDiagonal":
|
|
14608
|
+
if (handle.split("-").length === 2) {
|
|
14609
|
+
return void 0;
|
|
15146
14610
|
}
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
14611
|
+
break;
|
|
14612
|
+
default:
|
|
14613
|
+
return void 0;
|
|
14614
|
+
}
|
|
14615
|
+
if (handle === "resize-t" || handle === "resize-r" || handle === "resize-tr" || handle === "resize-bl") {
|
|
14616
|
+
return h("line", {
|
|
14617
|
+
class: "mce-transform-controls__diagonal",
|
|
14618
|
+
x1: "100%",
|
|
14619
|
+
y1: "0",
|
|
14620
|
+
x2: "0",
|
|
14621
|
+
y2: "100%"
|
|
14622
|
+
});
|
|
14623
|
+
} else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
|
|
14624
|
+
return h("line", {
|
|
14625
|
+
class: "mce-transform-controls__diagonal",
|
|
14626
|
+
x1: "0",
|
|
14627
|
+
y1: "0",
|
|
14628
|
+
x2: "100%",
|
|
14629
|
+
y2: "100%"
|
|
14630
|
+
});
|
|
14631
|
+
}
|
|
14632
|
+
return void 0;
|
|
15162
14633
|
}
|
|
14634
|
+
return (_ctx, _cache) => {
|
|
14635
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
|
|
14636
|
+
class: normalizeClass(["mce-transform-controls", [
|
|
14637
|
+
transforming.value && "mce-transform-controls--transforming",
|
|
14638
|
+
props.hideUi && "mce-transform-controls--hide-ui",
|
|
14639
|
+
__props.resizeStrategy && `mce-transform-controls--${__props.resizeStrategy}`,
|
|
14640
|
+
activeHandle.value && `mce-transform-controls--${activeHandle.value}`,
|
|
14641
|
+
activeHandle.value === "move" && "mce-transform-controls--moving",
|
|
14642
|
+
activeHandle.value?.startsWith("resize") && "mce-transform-controls--resizing",
|
|
14643
|
+
activeHandle.value?.startsWith("rotate") && "mce-transform-controls--rotateing",
|
|
14644
|
+
props.borderStyle && `mce-transform-controls--${props.borderStyle}`
|
|
14645
|
+
]]),
|
|
14646
|
+
style: normalizeStyle$1(style.value)
|
|
14647
|
+
}, {
|
|
14648
|
+
default: withCtx(() => [
|
|
14649
|
+
renderSlot(_ctx.$slots, "default", {
|
|
14650
|
+
value: unref(modelValue),
|
|
14651
|
+
props: {
|
|
14652
|
+
onPointerdown: start
|
|
14653
|
+
},
|
|
14654
|
+
start
|
|
14655
|
+
}),
|
|
14656
|
+
(openBlock(), createElementBlock("svg", {
|
|
14657
|
+
class: "mce-transform-controls__svg",
|
|
14658
|
+
style: normalizeStyle$1({ color: __props.color })
|
|
14659
|
+
}, [
|
|
14660
|
+
_cache[1] || (_cache[1] = createElementVNode("rect", {
|
|
14661
|
+
width: "100%",
|
|
14662
|
+
height: "100%",
|
|
14663
|
+
fill: "none",
|
|
14664
|
+
class: "mce-transform-controls__rect"
|
|
14665
|
+
}, null, -1)),
|
|
14666
|
+
createElementVNode("rect", {
|
|
14667
|
+
class: "mce-transform-controls__rect",
|
|
14668
|
+
width: "100%",
|
|
14669
|
+
height: "100%",
|
|
14670
|
+
fill: "none",
|
|
14671
|
+
rx: model.value.borderRadius,
|
|
14672
|
+
ry: model.value.borderRadius
|
|
14673
|
+
}, null, 8, _hoisted_1$d),
|
|
14674
|
+
createVNode(Diagonal),
|
|
14675
|
+
createElementVNode("g", _hoisted_2$7, [
|
|
14676
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
14677
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
14678
|
+
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
14679
|
+
handle.shape === "rect" ? (openBlock(), createElementBlock("rect", {
|
|
14680
|
+
key: 0,
|
|
14681
|
+
x: handle.x,
|
|
14682
|
+
y: handle.y,
|
|
14683
|
+
width: handle.width,
|
|
14684
|
+
height: handle.height,
|
|
14685
|
+
"aria-label": handle.type,
|
|
14686
|
+
class: "mce-transform-controls__handle"
|
|
14687
|
+
}, null, 8, _hoisted_3$6)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
|
|
14688
|
+
key: 1,
|
|
14689
|
+
cx: handle.x + handle.width / 2,
|
|
14690
|
+
cy: handle.y + handle.width / 2,
|
|
14691
|
+
r: handle.width / 2,
|
|
14692
|
+
"aria-label": handle.type,
|
|
14693
|
+
class: "mce-transform-controls__handle"
|
|
14694
|
+
}, null, 8, _hoisted_4$3)) : (openBlock(), createElementBlock("rect", {
|
|
14695
|
+
key: 2,
|
|
14696
|
+
x: handle.x,
|
|
14697
|
+
y: handle.y,
|
|
14698
|
+
width: handle.width,
|
|
14699
|
+
height: handle.height,
|
|
14700
|
+
"aria-label": handle.type,
|
|
14701
|
+
rx: handle.width / 4,
|
|
14702
|
+
ry: handle.height / 4,
|
|
14703
|
+
class: "mce-transform-controls__handle"
|
|
14704
|
+
}, null, 8, _hoisted_5$2))
|
|
14705
|
+
], 64)) : createCommentVNode("", true)
|
|
14706
|
+
], 64);
|
|
14707
|
+
}), 128)),
|
|
14708
|
+
__props.rotator ? (openBlock(), createElementBlock("g", {
|
|
14709
|
+
key: 0,
|
|
14710
|
+
transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
|
|
14711
|
+
class: "mce-transform-controls__rotator"
|
|
14712
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
14713
|
+
createElementVNode("path", { d: "M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" }, null, -1)
|
|
14714
|
+
])], 8, _hoisted_6$2)) : createCommentVNode("", true)
|
|
14715
|
+
]),
|
|
14716
|
+
createElementVNode("g", _hoisted_7$2, [
|
|
14717
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
14718
|
+
return openBlock(), createElementBlock("rect", {
|
|
14719
|
+
key: index,
|
|
14720
|
+
ref_for: true,
|
|
14721
|
+
ref_key: "handlesRef",
|
|
14722
|
+
ref: handlesRef,
|
|
14723
|
+
x: handle.x,
|
|
14724
|
+
y: handle.y,
|
|
14725
|
+
width: handle.width,
|
|
14726
|
+
height: handle.height,
|
|
14727
|
+
"aria-label": handle.type,
|
|
14728
|
+
class: "mce-transform-controls__handle-rect",
|
|
14729
|
+
cursor: transforming.value ? "auto" : getCursor(handle.type),
|
|
14730
|
+
onPointerdown: (event) => start(event, index)
|
|
14731
|
+
}, null, 40, _hoisted_8$1);
|
|
14732
|
+
}), 128))
|
|
14733
|
+
]),
|
|
14734
|
+
createElementVNode("g", _hoisted_9$1, [
|
|
14735
|
+
renderSlot(_ctx.$slots, "svg", { box: model.value })
|
|
14736
|
+
])
|
|
14737
|
+
], 4)),
|
|
14738
|
+
tip.value ? (openBlock(), createElementBlock("div", _hoisted_10$1, toDisplayString(tip.value), 1)) : createCommentVNode("", true)
|
|
14739
|
+
]),
|
|
14740
|
+
_: 3
|
|
14741
|
+
}, 8, ["class", "style"]);
|
|
14742
|
+
};
|
|
15163
14743
|
}
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
setup(__props, { expose: __expose }) {
|
|
15174
|
-
const props = __props;
|
|
14744
|
+
});
|
|
14745
|
+
const _hoisted_1$c = {
|
|
14746
|
+
key: 0,
|
|
14747
|
+
class: "mce-smart-selection"
|
|
14748
|
+
};
|
|
14749
|
+
const _hoisted_2$6 = ["onClick"];
|
|
14750
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
14751
|
+
__name: "SmartSelection",
|
|
14752
|
+
setup(__props) {
|
|
15175
14753
|
const {
|
|
15176
14754
|
elementSelection,
|
|
15177
|
-
|
|
15178
|
-
|
|
14755
|
+
getObb,
|
|
14756
|
+
getAabb,
|
|
14757
|
+
state,
|
|
14758
|
+
camera,
|
|
14759
|
+
resizeElement,
|
|
14760
|
+
inEditorIs,
|
|
14761
|
+
registerCommand
|
|
15179
14762
|
} = useEditor();
|
|
15180
|
-
const
|
|
15181
|
-
const
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
14763
|
+
const currentElement = ref();
|
|
14764
|
+
const info = ref({
|
|
14765
|
+
active: false,
|
|
14766
|
+
spacing: void 0
|
|
14767
|
+
});
|
|
14768
|
+
registerCommand({
|
|
14769
|
+
command: "setSmartSelectionCurrentElement",
|
|
14770
|
+
handle: (el) => {
|
|
14771
|
+
currentElement.value = el;
|
|
14772
|
+
}
|
|
14773
|
+
});
|
|
14774
|
+
function update() {
|
|
14775
|
+
if (currentElement.value) {
|
|
14776
|
+
return;
|
|
14777
|
+
}
|
|
14778
|
+
const els = elementSelection.value;
|
|
14779
|
+
let active = false;
|
|
14780
|
+
let spacing;
|
|
14781
|
+
if (state.value !== "transforming" && els.length > 1) {
|
|
14782
|
+
let prev;
|
|
14783
|
+
const items = els.map((el) => ({ el, aabb: getAabb(el) }));
|
|
14784
|
+
active = true;
|
|
14785
|
+
const sorted = [...items].sort((a, b) => a.aabb.y - b.aabb.y);
|
|
14786
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
14787
|
+
const cur = sorted[i];
|
|
14788
|
+
if (prev) {
|
|
14789
|
+
if (!cur.aabb.overlap(prev.aabb, "x")) {
|
|
14790
|
+
active = false;
|
|
14791
|
+
break;
|
|
14792
|
+
}
|
|
14793
|
+
const _spacing = cur.aabb.y - (prev.aabb.y + prev.aabb.height);
|
|
14794
|
+
if (spacing !== void 0 && Math.abs(spacing - _spacing) >= 1) {
|
|
14795
|
+
active = false;
|
|
14796
|
+
break;
|
|
14797
|
+
}
|
|
14798
|
+
spacing = _spacing;
|
|
14799
|
+
}
|
|
14800
|
+
prev = cur;
|
|
14801
|
+
}
|
|
14802
|
+
if (!active) {
|
|
14803
|
+
active = true;
|
|
14804
|
+
prev = void 0;
|
|
14805
|
+
spacing = void 0;
|
|
14806
|
+
const sorted2 = [...items].sort((a, b) => a.aabb.x - b.aabb.x);
|
|
14807
|
+
for (let i = 0; i < sorted2.length; i++) {
|
|
14808
|
+
const cur = sorted2[i];
|
|
14809
|
+
if (prev) {
|
|
14810
|
+
if (!cur.aabb.overlap(prev.aabb, "y")) {
|
|
14811
|
+
active = false;
|
|
14812
|
+
break;
|
|
14813
|
+
}
|
|
14814
|
+
const _spacing = cur.aabb.x - (prev.aabb.x + prev.aabb.width);
|
|
14815
|
+
if (spacing !== void 0 && Math.abs(spacing - _spacing) >= 1) {
|
|
14816
|
+
active = false;
|
|
14817
|
+
break;
|
|
14818
|
+
}
|
|
14819
|
+
spacing = _spacing;
|
|
14820
|
+
}
|
|
14821
|
+
prev = cur;
|
|
14822
|
+
}
|
|
14823
|
+
}
|
|
14824
|
+
}
|
|
14825
|
+
info.value = {
|
|
14826
|
+
active,
|
|
14827
|
+
spacing
|
|
14828
|
+
};
|
|
14829
|
+
}
|
|
14830
|
+
watch(() => elementSelection.value.map((el) => getAabb(el)), update);
|
|
14831
|
+
watch(
|
|
14832
|
+
state,
|
|
14833
|
+
() => {
|
|
14834
|
+
currentElement.value = void 0;
|
|
14835
|
+
}
|
|
14836
|
+
);
|
|
14837
|
+
const handles = computed(() => {
|
|
14838
|
+
return elementSelection.value.map((el) => {
|
|
15185
14839
|
return {
|
|
15186
|
-
|
|
15187
|
-
"
|
|
14840
|
+
el,
|
|
14841
|
+
style: getObb(el, "drawboard").toCssStyle()
|
|
15188
14842
|
};
|
|
15189
|
-
}
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
14843
|
+
});
|
|
14844
|
+
});
|
|
14845
|
+
const _transform2 = computed(() => {
|
|
14846
|
+
const { left, top, width, height, rotationDegrees } = getObb(currentElement.value, "drawboard");
|
|
14847
|
+
return {
|
|
14848
|
+
left,
|
|
14849
|
+
top,
|
|
14850
|
+
width,
|
|
14851
|
+
height,
|
|
14852
|
+
rotate: rotationDegrees
|
|
14853
|
+
};
|
|
14854
|
+
});
|
|
14855
|
+
const transform = computed({
|
|
14856
|
+
get: () => _transform2.value,
|
|
14857
|
+
set: (val) => {
|
|
14858
|
+
const zoom = camera.value.zoom;
|
|
14859
|
+
const oldTransform = _transform2.value;
|
|
14860
|
+
const transform2 = {
|
|
14861
|
+
left: val.left / zoom.x,
|
|
14862
|
+
top: val.top / zoom.y,
|
|
14863
|
+
width: Math.max(1, val.width / zoom.x),
|
|
14864
|
+
height: Math.max(1, val.height / zoom.y)
|
|
14865
|
+
};
|
|
14866
|
+
const offsetStyle = {
|
|
14867
|
+
left: transform2.left - oldTransform.left / zoom.x,
|
|
14868
|
+
top: transform2.top - oldTransform.top / zoom.y,
|
|
14869
|
+
width: transform2.width - oldTransform.width / zoom.x,
|
|
14870
|
+
height: transform2.height - oldTransform.height / zoom.y
|
|
14871
|
+
};
|
|
14872
|
+
const el = currentElement.value;
|
|
14873
|
+
const style = el.style;
|
|
14874
|
+
const newStyle = {
|
|
14875
|
+
left: style.left + offsetStyle.left,
|
|
14876
|
+
top: style.top + offsetStyle.top,
|
|
14877
|
+
width: style.width + offsetStyle.width,
|
|
14878
|
+
height: style.height + offsetStyle.height
|
|
15193
14879
|
};
|
|
14880
|
+
const newWidth = Math.max(1, newStyle.width);
|
|
14881
|
+
const newHeight = Math.max(1, newStyle.height);
|
|
14882
|
+
const shape = el.shape;
|
|
14883
|
+
resizeElement(
|
|
14884
|
+
el,
|
|
14885
|
+
newWidth,
|
|
14886
|
+
newHeight,
|
|
14887
|
+
inEditorIs(el, "Frame") ? void 0 : shape.isValid() ? { deep: true } : { deep: true, textToFit: true }
|
|
14888
|
+
);
|
|
14889
|
+
newStyle.width = el.style.width;
|
|
14890
|
+
newStyle.height = el.style.height;
|
|
14891
|
+
Object.assign(style, newStyle);
|
|
14892
|
+
el.updateGlobalTransform();
|
|
15194
14893
|
}
|
|
15195
|
-
return {};
|
|
15196
14894
|
});
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
14895
|
+
return (_ctx, _cache) => {
|
|
14896
|
+
return info.value.active ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
14897
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (item, index) => {
|
|
14898
|
+
return openBlock(), createElementBlock("div", {
|
|
14899
|
+
key: index,
|
|
14900
|
+
class: normalizeClass(["mce-smart-handle", {
|
|
14901
|
+
"mce-smart-handle--active": item.el.equal(currentElement.value)
|
|
14902
|
+
}]),
|
|
14903
|
+
style: normalizeStyle$1(item.style)
|
|
14904
|
+
}, [
|
|
14905
|
+
createElementVNode("div", {
|
|
14906
|
+
class: "mce-smart-handle__btn",
|
|
14907
|
+
onClick: ($event) => currentElement.value = item.el
|
|
14908
|
+
}, null, 8, _hoisted_2$6)
|
|
14909
|
+
], 6);
|
|
14910
|
+
}), 128)),
|
|
14911
|
+
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, {
|
|
14912
|
+
key: 0,
|
|
14913
|
+
modelValue: transform.value,
|
|
14914
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
|
|
14915
|
+
handles: ["resize-l", "resize-r", "resize-t", "resize-b"],
|
|
14916
|
+
class: "mce-smart-selection__transform",
|
|
14917
|
+
color: "#FF24BD"
|
|
14918
|
+
}, null, 8, ["modelValue"])) : createCommentVNode("", true)
|
|
14919
|
+
])) : createCommentVNode("", true);
|
|
14920
|
+
};
|
|
14921
|
+
}
|
|
14922
|
+
});
|
|
14923
|
+
const _smartSelection = definePlugin((_editor) => {
|
|
14924
|
+
return {
|
|
14925
|
+
name: "mce:smartSelection",
|
|
14926
|
+
components: [
|
|
14927
|
+
{
|
|
14928
|
+
type: "overlay",
|
|
14929
|
+
component: _sfc_main$j
|
|
15200
14930
|
}
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
14931
|
+
]
|
|
14932
|
+
};
|
|
14933
|
+
});
|
|
14934
|
+
const _state = definePlugin((editor) => {
|
|
14935
|
+
const {
|
|
14936
|
+
state
|
|
14937
|
+
} = editor;
|
|
14938
|
+
return {
|
|
14939
|
+
name: "mce:state",
|
|
14940
|
+
commands: [
|
|
14941
|
+
{ command: "setState", handle: (val) => state.value = val }
|
|
14942
|
+
],
|
|
14943
|
+
hotkeys: [
|
|
14944
|
+
{ command: "setState:move", key: "V" },
|
|
14945
|
+
{ command: "setState:hand", key: "H" }
|
|
14946
|
+
]
|
|
14947
|
+
};
|
|
14948
|
+
});
|
|
14949
|
+
const _hoisted_1$b = { class: "progress-indicator" };
|
|
14950
|
+
const _hoisted_2$5 = {
|
|
14951
|
+
key: 0,
|
|
14952
|
+
class: "progress-indicator__status"
|
|
14953
|
+
};
|
|
14954
|
+
const _hoisted_3$5 = { class: "progress-indicator__bar" };
|
|
14955
|
+
const _hoisted_4$2 = {
|
|
14956
|
+
key: 1,
|
|
14957
|
+
class: "progress-indicator__bar-indeterminate"
|
|
14958
|
+
};
|
|
14959
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
14960
|
+
__name: "ProgressIndicator",
|
|
14961
|
+
props: /* @__PURE__ */ mergeModels({
|
|
14962
|
+
label: {},
|
|
14963
|
+
indeterminate: { type: Boolean }
|
|
14964
|
+
}, {
|
|
14965
|
+
"modelValue": { default: 0 },
|
|
14966
|
+
"modelModifiers": {}
|
|
14967
|
+
}),
|
|
14968
|
+
emits: ["update:modelValue"],
|
|
14969
|
+
setup(__props) {
|
|
14970
|
+
const progress = useModel(__props, "modelValue");
|
|
15210
14971
|
return (_ctx, _cache) => {
|
|
15211
|
-
return openBlock(),
|
|
15212
|
-
|
|
15213
|
-
"
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
14972
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
14973
|
+
__props.label ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
|
|
14974
|
+
createElementVNode("div", _hoisted_3$5, [
|
|
14975
|
+
!__props.indeterminate ? (openBlock(), createElementBlock("div", {
|
|
14976
|
+
key: 0,
|
|
14977
|
+
class: "progress-indicator__bar-fill",
|
|
14978
|
+
style: normalizeStyle$1({ width: `${progress.value * 100}%` })
|
|
14979
|
+
}, null, 4)) : (openBlock(), createElementBlock("div", _hoisted_4$2))
|
|
14980
|
+
])
|
|
14981
|
+
]);
|
|
14982
|
+
};
|
|
14983
|
+
}
|
|
14984
|
+
});
|
|
14985
|
+
const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-3b286483"]]);
|
|
14986
|
+
const _hoisted_1$a = { class: "mce-statusbar" };
|
|
14987
|
+
const _hoisted_2$4 = { class: "mce-statusbar__main" };
|
|
14988
|
+
const _hoisted_3$4 = { class: "mce-statusbar__item" };
|
|
14989
|
+
const _hoisted_4$1 = { class: "mce-statusbar__kbd" };
|
|
14990
|
+
const _hoisted_5$1 = { class: "mce-statusbar__kbd" };
|
|
14991
|
+
const _hoisted_6$1 = { class: "mce-statusbar__item" };
|
|
14992
|
+
const _hoisted_7$1 = { class: "mce-statusbar__kbd" };
|
|
14993
|
+
const _hoisted_8 = { class: "mce-statusbar__item" };
|
|
14994
|
+
const _hoisted_9 = { class: "mce-statusbar__item" };
|
|
14995
|
+
const _hoisted_10 = { class: "mce-statusbar__kbd" };
|
|
14996
|
+
const _hoisted_11 = { class: "mce-statusbar__item" };
|
|
14997
|
+
const _hoisted_12 = { class: "mce-statusbar__kbd" };
|
|
14998
|
+
const _hoisted_13 = { key: 2 };
|
|
14999
|
+
const _hoisted_14 = { class: "mce-statusbar__item" };
|
|
15000
|
+
const _hoisted_15 = { class: "mce-statusbar__item" };
|
|
15001
|
+
const _hoisted_16 = { class: "mce-statusbar__kbd" };
|
|
15002
|
+
const _hoisted_17 = { class: "mce-statusbar__item" };
|
|
15003
|
+
const _hoisted_18 = { class: "mce-statusbar__item" };
|
|
15004
|
+
const _hoisted_19 = { class: "mce-statusbar__kbd" };
|
|
15005
|
+
const _hoisted_20 = { class: "mce-statusbar__item" };
|
|
15006
|
+
const _hoisted_21 = { class: "mce-statusbar__item" };
|
|
15007
|
+
const _hoisted_22 = { class: "mce-statusbar__progress" };
|
|
15008
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
15009
|
+
__name: "Statusbar",
|
|
15010
|
+
setup(__props) {
|
|
15011
|
+
const {
|
|
15012
|
+
state,
|
|
15013
|
+
t,
|
|
15014
|
+
getKbd,
|
|
15015
|
+
exporting,
|
|
15016
|
+
exportProgress,
|
|
15017
|
+
selection,
|
|
15018
|
+
isElement
|
|
15019
|
+
} = useEditor();
|
|
15020
|
+
return (_ctx, _cache) => {
|
|
15021
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
15022
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
15023
|
+
unref(state) === "typing" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
15024
|
+
createElementVNode("div", _hoisted_3$4, [
|
|
15025
|
+
createElementVNode("span", _hoisted_4$1, toDisplayString(unref(getKbd)("Command")), 1),
|
|
15026
|
+
createElementVNode("span", _hoisted_5$1, toDisplayString(unref(getKbd)("Enter")), 1)
|
|
15027
|
+
]),
|
|
15028
|
+
_cache[1] || (_cache[1] = createElementVNode("span", null, "/", -1)),
|
|
15029
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
15030
|
+
createElementVNode("span", _hoisted_7$1, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
15031
|
+
createElementVNode("span", null, toDisplayString(unref(t)("commitChanges")), 1)
|
|
15032
|
+
])
|
|
15033
|
+
], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
15034
|
+
createElementVNode("div", _hoisted_8, [
|
|
15035
|
+
createVNode(unref(_sfc_main$D), { icon: "$mouseRightClick" })
|
|
15036
|
+
]),
|
|
15037
|
+
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
15038
|
+
createElementVNode("div", _hoisted_9, [
|
|
15039
|
+
createElementVNode("span", _hoisted_10, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
15040
|
+
createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
|
|
15041
|
+
]),
|
|
15042
|
+
_cache[3] || (_cache[3] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
15043
|
+
createElementVNode("div", _hoisted_11, [
|
|
15044
|
+
createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
15045
|
+
createElementVNode("span", null, toDisplayString(unref(t)("constrainToAxis")), 1)
|
|
15046
|
+
])
|
|
15047
|
+
], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
15048
|
+
createElementVNode("div", _hoisted_14, [
|
|
15049
|
+
createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
|
|
15050
|
+
createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
|
|
15051
|
+
]),
|
|
15052
|
+
_cache[5] || (_cache[5] = createElementVNode("span", null, " + ", -1)),
|
|
15053
|
+
createElementVNode("div", _hoisted_15, [
|
|
15054
|
+
createElementVNode("span", _hoisted_16, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
15055
|
+
createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
|
|
15056
|
+
]),
|
|
15057
|
+
_cache[6] || (_cache[6] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
15058
|
+
createElementVNode("div", _hoisted_17, [
|
|
15059
|
+
createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
|
|
15060
|
+
createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
|
|
15061
|
+
]),
|
|
15062
|
+
_cache[7] || (_cache[7] = createElementVNode("span", null, " + ", -1)),
|
|
15063
|
+
createElementVNode("div", _hoisted_18, [
|
|
15064
|
+
createElementVNode("span", _hoisted_19, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
15065
|
+
createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
|
|
15066
|
+
]),
|
|
15067
|
+
_cache[8] || (_cache[8] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
15068
|
+
createElementVNode("div", _hoisted_20, [
|
|
15069
|
+
createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
|
|
15070
|
+
createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
|
|
15071
|
+
]),
|
|
15072
|
+
unref(selection).length === 1 && unref(isElement)(unref(selection)[0]) && unref(selection)[0].text.isValid() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
15073
|
+
_cache[4] || (_cache[4] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
15074
|
+
createElementVNode("div", _hoisted_21, [
|
|
15075
|
+
createElementVNode("span", null, toDisplayString(unref(getKbd)("Enter")), 1),
|
|
15076
|
+
createElementVNode("span", null, toDisplayString(unref(t)("startTyping")), 1)
|
|
15077
|
+
])
|
|
15078
|
+
], 64)) : createCommentVNode("", true)
|
|
15079
|
+
], 64))
|
|
15224
15080
|
]),
|
|
15225
|
-
|
|
15226
|
-
|
|
15081
|
+
createElementVNode("div", _hoisted_22, [
|
|
15082
|
+
unref(exporting) ? (openBlock(), createBlock(ProgressIndicator, {
|
|
15083
|
+
key: 0,
|
|
15084
|
+
modelValue: unref(exportProgress),
|
|
15085
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(exportProgress) ? exportProgress.value = $event : null),
|
|
15086
|
+
label: unref(t)("exporting")
|
|
15087
|
+
}, null, 8, ["modelValue", "label"])) : createCommentVNode("", true)
|
|
15088
|
+
])
|
|
15089
|
+
]);
|
|
15227
15090
|
};
|
|
15228
15091
|
}
|
|
15229
15092
|
});
|
|
15230
|
-
const
|
|
15231
|
-
const
|
|
15232
|
-
const
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
"
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
"resize-r": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15300
|
-
"resize-b": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15301
|
-
"resize-tl": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15302
|
-
"resize-tr": (angle) => createCursor("resizeBevel", 180 + angle),
|
|
15303
|
-
"resize-br": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15304
|
-
"resize-bl": (angle) => createCursor("resizeBevel", 180 + angle)
|
|
15305
|
-
};
|
|
15306
|
-
const modelValue = useModel(props, "modelValue");
|
|
15307
|
-
const model = computed({
|
|
15308
|
-
get: () => {
|
|
15309
|
-
let { left = 0, top = 0, width = 0, height = 0, rotate = 0, borderRadius = 0 } = modelValue.value ?? {};
|
|
15310
|
-
if (Number.isNaN(Number(width)))
|
|
15311
|
-
width = 0;
|
|
15312
|
-
if (Number.isNaN(Number(height)))
|
|
15313
|
-
height = 0;
|
|
15314
|
-
return { left, top, width, height, rotate, borderRadius };
|
|
15315
|
-
},
|
|
15316
|
-
set: (val) => modelValue.value = val
|
|
15317
|
-
});
|
|
15318
|
-
const transforming = ref(false);
|
|
15319
|
-
const activeHandle = ref();
|
|
15320
|
-
const computedHandles = computed(() => {
|
|
15321
|
-
const shape = props.handleShape;
|
|
15322
|
-
const size = shape === "rect" ? 8 : 10;
|
|
15323
|
-
const { width = 0, height = 0, borderRadius } = model.value;
|
|
15324
|
-
const center = { x: width / 2, y: height / 2 };
|
|
15325
|
-
const lines = [
|
|
15326
|
-
{ type: "t", points: [[0, 0], [1, 0]] },
|
|
15327
|
-
{ type: "r", points: [[1, 0], [1, 1]] },
|
|
15328
|
-
{ type: "b", points: [[0, 1], [1, 1]] },
|
|
15329
|
-
{ type: "l", points: [[0, 0], [0, 1]] }
|
|
15330
|
-
];
|
|
15331
|
-
const points = [
|
|
15332
|
-
{ type: "t", point: [0.5, 0], width: 1.4, height: 0.6 },
|
|
15333
|
-
{ type: "r", point: [1, 0.5], width: 0.6, height: 1.4 },
|
|
15334
|
-
{ type: "b", point: [0.5, 1], width: 1.4, height: 0.6 },
|
|
15335
|
-
{ type: "l", point: [0, 0.5], width: 0.6, height: 1.4 },
|
|
15336
|
-
{ type: "tl", point: [0, 0] },
|
|
15337
|
-
{ type: "tr", point: [1, 0] },
|
|
15338
|
-
{ type: "bl", point: [0, 1] },
|
|
15339
|
-
{ type: "br", point: [1, 1] }
|
|
15340
|
-
];
|
|
15341
|
-
const lineHandles = lines.map((item) => {
|
|
15342
|
-
const [p1, p2] = item.points;
|
|
15343
|
-
const minX = Math.min(p1[0], p2[0]) * width;
|
|
15344
|
-
const maxX = Math.max(p1[0], p2[0]) * width;
|
|
15345
|
-
const minY = Math.min(p1[1], p2[1]) * height;
|
|
15346
|
-
const maxY = Math.max(p1[1], p2[1]) * height;
|
|
15347
|
-
return {
|
|
15348
|
-
type: item.type,
|
|
15349
|
-
x: minX - size / 2,
|
|
15350
|
-
y: minY - size / 2,
|
|
15351
|
-
width: maxX - minX + size,
|
|
15352
|
-
height: maxY - minY + size
|
|
15353
|
-
};
|
|
15354
|
-
});
|
|
15355
|
-
const pointHandles = points.map((item) => {
|
|
15356
|
-
const _w = size * (item.width ?? 1);
|
|
15357
|
-
const _h = size * (item.height ?? 1);
|
|
15358
|
-
return {
|
|
15359
|
-
type: item.type,
|
|
15360
|
-
shape,
|
|
15361
|
-
x: item.point[0] * width - _w / 2,
|
|
15362
|
-
y: item.point[1] * height - _h / 2,
|
|
15363
|
-
width: _w,
|
|
15364
|
-
height: _h
|
|
15365
|
-
};
|
|
15366
|
-
});
|
|
15367
|
-
const diagonalPointHandles = pointHandles.filter((item) => item.type.length === 2);
|
|
15368
|
-
const rotateHandles = diagonalPointHandles.map((item) => {
|
|
15369
|
-
const _w = item.width * 1.5;
|
|
15370
|
-
const _h = item.height * 1.5;
|
|
15371
|
-
let x = item.x;
|
|
15372
|
-
let y = item.y;
|
|
15373
|
-
if (center.x > item.x) {
|
|
15374
|
-
x -= _w;
|
|
15375
|
-
} else {
|
|
15376
|
-
x += item.width;
|
|
15377
|
-
}
|
|
15378
|
-
if (center.y > item.y) {
|
|
15379
|
-
y -= _h;
|
|
15380
|
-
} else {
|
|
15381
|
-
y += item.height;
|
|
15382
|
-
}
|
|
15383
|
-
return {
|
|
15384
|
-
...item,
|
|
15385
|
-
shape: void 0,
|
|
15386
|
-
type: `rotate-${item.type}`,
|
|
15387
|
-
x,
|
|
15388
|
-
y,
|
|
15389
|
-
width: _w,
|
|
15390
|
-
height: _h
|
|
15391
|
-
};
|
|
15392
|
-
});
|
|
15393
|
-
const minSize = Math.min(width, height);
|
|
15394
|
-
const roundedHandles = props.roundable ? diagonalPointHandles.map((item) => {
|
|
15395
|
-
const _w = item.width * 0.8;
|
|
15396
|
-
const _h = item.height * 0.8;
|
|
15397
|
-
const sign2 = {
|
|
15398
|
-
x: center.x - item.x > 0 ? 1 : -1,
|
|
15399
|
-
y: center.y - item.y > 0 ? 1 : -1
|
|
15400
|
-
};
|
|
15401
|
-
const offset2 = minSize * 0.1;
|
|
15402
|
-
const ws = (borderRadius + offset2) / (width / 2 + offset2);
|
|
15403
|
-
const hs = (borderRadius + offset2) / (height / 2 + offset2);
|
|
15404
|
-
return {
|
|
15405
|
-
...item,
|
|
15406
|
-
shape: "circle",
|
|
15407
|
-
type: `round-${item.type}`,
|
|
15408
|
-
x: item.x + sign2.x * width / 2 * ws,
|
|
15409
|
-
y: item.y + sign2.y * height / 2 * hs,
|
|
15410
|
-
width: _w,
|
|
15411
|
-
height: _h
|
|
15412
|
-
};
|
|
15413
|
-
}) : [];
|
|
15414
|
-
let handles;
|
|
15415
|
-
if (props.handleStrategy === "point") {
|
|
15416
|
-
handles = [
|
|
15417
|
-
// move
|
|
15418
|
-
...lineHandles.map((item) => ({ ...item, type: "move" })),
|
|
15419
|
-
// resize
|
|
15420
|
-
...pointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15421
|
-
// round
|
|
15422
|
-
...roundedHandles,
|
|
15423
|
-
// rotate
|
|
15424
|
-
...rotateHandles
|
|
15425
|
-
];
|
|
15426
|
-
} else {
|
|
15427
|
-
handles = [
|
|
15428
|
-
// resize
|
|
15429
|
-
...lineHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15430
|
-
...diagonalPointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15431
|
-
// round
|
|
15432
|
-
...roundedHandles,
|
|
15433
|
-
// rotate
|
|
15434
|
-
...rotateHandles
|
|
15435
|
-
];
|
|
15093
|
+
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-a1f0e31b"]]);
|
|
15094
|
+
const _statusbar = definePlugin((editor) => {
|
|
15095
|
+
const {
|
|
15096
|
+
registerConfig
|
|
15097
|
+
} = editor;
|
|
15098
|
+
registerConfig("statusbar", false);
|
|
15099
|
+
return {
|
|
15100
|
+
name: "mce:statusbar",
|
|
15101
|
+
components: [
|
|
15102
|
+
{
|
|
15103
|
+
name: "statusbar",
|
|
15104
|
+
type: "panel",
|
|
15105
|
+
position: "bottom",
|
|
15106
|
+
size: 24,
|
|
15107
|
+
component: Statusbar
|
|
15108
|
+
}
|
|
15109
|
+
]
|
|
15110
|
+
};
|
|
15111
|
+
});
|
|
15112
|
+
const _text = definePlugin((editor) => {
|
|
15113
|
+
const {
|
|
15114
|
+
t,
|
|
15115
|
+
addElement,
|
|
15116
|
+
setActiveDrawingTool
|
|
15117
|
+
} = editor;
|
|
15118
|
+
const addTextElement = (options = {}) => {
|
|
15119
|
+
const {
|
|
15120
|
+
content = t("doubleClickEditText"),
|
|
15121
|
+
style,
|
|
15122
|
+
...restOptions
|
|
15123
|
+
} = options;
|
|
15124
|
+
return addElement(
|
|
15125
|
+
createTextElement(content, {
|
|
15126
|
+
fontSize: 64,
|
|
15127
|
+
...style
|
|
15128
|
+
}),
|
|
15129
|
+
{
|
|
15130
|
+
sizeToFit: true,
|
|
15131
|
+
active: true,
|
|
15132
|
+
...restOptions
|
|
15133
|
+
}
|
|
15134
|
+
);
|
|
15135
|
+
};
|
|
15136
|
+
const RE = /\.txt$/i;
|
|
15137
|
+
return {
|
|
15138
|
+
name: "mce:text",
|
|
15139
|
+
commands: [
|
|
15140
|
+
{ command: "addTextElement", handle: addTextElement }
|
|
15141
|
+
],
|
|
15142
|
+
loaders: [
|
|
15143
|
+
{
|
|
15144
|
+
name: "txt",
|
|
15145
|
+
accept: ".txt",
|
|
15146
|
+
test: (source) => {
|
|
15147
|
+
if (source instanceof Blob) {
|
|
15148
|
+
if (source.type.startsWith("text/plain")) {
|
|
15149
|
+
return true;
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
15152
|
+
if (source instanceof File) {
|
|
15153
|
+
if (RE.test(source.name)) {
|
|
15154
|
+
return true;
|
|
15155
|
+
}
|
|
15156
|
+
}
|
|
15157
|
+
return false;
|
|
15158
|
+
},
|
|
15159
|
+
load: async (source) => {
|
|
15160
|
+
return createTextElement(await source.text());
|
|
15161
|
+
}
|
|
15436
15162
|
}
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15163
|
+
],
|
|
15164
|
+
drawingTools: [
|
|
15165
|
+
{
|
|
15166
|
+
name: "text",
|
|
15167
|
+
handle: (position) => {
|
|
15168
|
+
addTextElement({
|
|
15169
|
+
position
|
|
15170
|
+
});
|
|
15171
|
+
setActiveDrawingTool(void 0);
|
|
15440
15172
|
}
|
|
15441
|
-
return false;
|
|
15442
|
-
}).map((anchor) => {
|
|
15443
|
-
anchor.width = Math.max(anchor.width, 0);
|
|
15444
|
-
anchor.height = Math.max(anchor.height, 0);
|
|
15445
|
-
return anchor;
|
|
15446
|
-
});
|
|
15447
|
-
});
|
|
15448
|
-
const handlesRef = ref();
|
|
15449
|
-
const sizeStyle = computed(() => {
|
|
15450
|
-
const { width = 0, height = 0 } = model.value;
|
|
15451
|
-
return {
|
|
15452
|
-
width: props.initialSize && !width ? void 0 : `${width}px`,
|
|
15453
|
-
height: props.initialSize && !height ? void 0 : `${height}px`
|
|
15454
|
-
};
|
|
15455
|
-
});
|
|
15456
|
-
const style = computed(() => {
|
|
15457
|
-
const { left = 0, top = 0, rotate = 0 } = model.value;
|
|
15458
|
-
const radian = rotate * Math.PI / 180;
|
|
15459
|
-
const cos = Math.cos(radian);
|
|
15460
|
-
const sin = Math.sin(radian);
|
|
15461
|
-
return {
|
|
15462
|
-
...sizeStyle.value,
|
|
15463
|
-
transform: `matrix(${cos}, ${sin}, ${-sin}, ${cos}, ${left}, ${top})`
|
|
15464
|
-
};
|
|
15465
|
-
});
|
|
15466
|
-
const tip = computed(() => props.tipFormat?.("size"));
|
|
15467
|
-
function start(event, index) {
|
|
15468
|
-
if (event && event.button !== void 0 && event.button !== 0) {
|
|
15469
|
-
return false;
|
|
15470
15173
|
}
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15174
|
+
],
|
|
15175
|
+
hotkeys: [
|
|
15176
|
+
{ command: "setActiveDrawingTool:text", key: "T" }
|
|
15177
|
+
]
|
|
15178
|
+
};
|
|
15179
|
+
});
|
|
15180
|
+
const _hoisted_1$9 = { class: "mce-payhead" };
|
|
15181
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
15182
|
+
__name: "Playhead",
|
|
15183
|
+
setup(__props) {
|
|
15184
|
+
return (_ctx, _cache) => {
|
|
15185
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [..._cache[0] || (_cache[0] = [
|
|
15186
|
+
createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
|
|
15187
|
+
createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
|
|
15188
|
+
])]);
|
|
15189
|
+
};
|
|
15190
|
+
}
|
|
15191
|
+
});
|
|
15192
|
+
const _hoisted_1$8 = {
|
|
15193
|
+
key: 0,
|
|
15194
|
+
class: "mce-segment__edge mce-segment__edge--front"
|
|
15195
|
+
};
|
|
15196
|
+
const _hoisted_2$3 = {
|
|
15197
|
+
class: "mce-segment__node",
|
|
15198
|
+
style: { "overflow": "hidden" }
|
|
15199
|
+
};
|
|
15200
|
+
const _hoisted_3$3 = {
|
|
15201
|
+
key: 1,
|
|
15202
|
+
class: "mce-segment__edge mce-segment__edge--end"
|
|
15203
|
+
};
|
|
15204
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
15205
|
+
__name: "Segment",
|
|
15206
|
+
props: {
|
|
15207
|
+
node: {},
|
|
15208
|
+
msPerPx: { default: 1 },
|
|
15209
|
+
active: { type: Boolean }
|
|
15210
|
+
},
|
|
15211
|
+
setup(__props) {
|
|
15212
|
+
const props = __props;
|
|
15213
|
+
const blocks = computed(() => {
|
|
15214
|
+
const node = props.node;
|
|
15215
|
+
if (node instanceof Element2D) {
|
|
15216
|
+
return node.children.filter((child) => child instanceof Animation).map((anim) => {
|
|
15217
|
+
const box = {
|
|
15218
|
+
left: anim.delay / props.msPerPx,
|
|
15219
|
+
top: 0,
|
|
15220
|
+
width: anim.duration / props.msPerPx
|
|
15221
|
+
};
|
|
15222
|
+
if (box.width) {
|
|
15223
|
+
box.width = `${box.width}px`;
|
|
15224
|
+
} else {
|
|
15225
|
+
box.width = "100%";
|
|
15226
|
+
}
|
|
15227
|
+
return {
|
|
15228
|
+
name: anim.name,
|
|
15229
|
+
style: {
|
|
15230
|
+
width: box.width,
|
|
15231
|
+
transform: `matrix(1, 0, 0, 1, ${box.left}, ${box.top})`
|
|
15232
|
+
}
|
|
15233
|
+
};
|
|
15234
|
+
});
|
|
15477
15235
|
}
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
const
|
|
15482
|
-
const
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
const isHorizontal = last === "l" || last === "r";
|
|
15487
|
-
const isHorizontalVertical = last.length === 1;
|
|
15488
|
-
const centerPoint = {
|
|
15489
|
-
x: left + width / 2,
|
|
15490
|
-
y: top + height / 2
|
|
15491
|
-
};
|
|
15492
|
-
const startPoint = {
|
|
15493
|
-
x: left,
|
|
15494
|
-
y: top
|
|
15236
|
+
return [];
|
|
15237
|
+
});
|
|
15238
|
+
const style = computed(() => {
|
|
15239
|
+
const node = props.node;
|
|
15240
|
+
const box = {
|
|
15241
|
+
left: node.delay / props.msPerPx,
|
|
15242
|
+
top: 0,
|
|
15243
|
+
width: node.duration / props.msPerPx
|
|
15495
15244
|
};
|
|
15496
|
-
if (
|
|
15497
|
-
|
|
15498
|
-
|
|
15245
|
+
if (box.width) {
|
|
15246
|
+
box.width = `${box.width}px`;
|
|
15247
|
+
} else {
|
|
15248
|
+
box.width = "100%";
|
|
15499
15249
|
}
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
};
|
|
15504
|
-
const rotatedStartPoint = rotatePoint2(startPoint, centerPoint, rotate);
|
|
15505
|
-
const rotatedSymmetricPoint = {
|
|
15506
|
-
x: centerPoint.x * 2 - rotatedStartPoint.x,
|
|
15507
|
-
y: centerPoint.y * 2 - rotatedStartPoint.y
|
|
15250
|
+
return {
|
|
15251
|
+
width: box.width,
|
|
15252
|
+
transform: `matrix(1, 0, 0, 1, ${box.left}, ${box.top})`
|
|
15508
15253
|
};
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
}
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15254
|
+
});
|
|
15255
|
+
return (_ctx, _cache) => {
|
|
15256
|
+
return openBlock(), createElementBlock("div", {
|
|
15257
|
+
class: normalizeClass(["mce-segment", [
|
|
15258
|
+
`mce-segment--${(__props.node.meta.inEditorIs ?? "none").toLowerCase()}`,
|
|
15259
|
+
__props.active && `mce-segment--active`
|
|
15260
|
+
]]),
|
|
15261
|
+
style: normalizeStyle$1(style.value)
|
|
15262
|
+
}, [
|
|
15263
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, index) => {
|
|
15264
|
+
return openBlock(), createElementBlock("div", {
|
|
15265
|
+
key: index,
|
|
15266
|
+
class: "mce-segment__block",
|
|
15267
|
+
style: normalizeStyle$1(block.style)
|
|
15268
|
+
}, toDisplayString(block.name), 5);
|
|
15269
|
+
}), 128)),
|
|
15270
|
+
__props.active ? (openBlock(), createElementBlock("div", _hoisted_1$8)) : createCommentVNode("", true),
|
|
15271
|
+
createElementVNode("span", _hoisted_2$3, toDisplayString(props.node.name), 1),
|
|
15272
|
+
__props.active ? (openBlock(), createElementBlock("div", _hoisted_3$3)) : createCommentVNode("", true)
|
|
15273
|
+
], 6);
|
|
15274
|
+
};
|
|
15275
|
+
}
|
|
15276
|
+
});
|
|
15277
|
+
const _hoisted_1$7 = { class: "mce-track" };
|
|
15278
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
15279
|
+
__name: "Track",
|
|
15280
|
+
setup(__props) {
|
|
15281
|
+
return (_ctx, _cache) => {
|
|
15282
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
15283
|
+
renderSlot(_ctx.$slots, "default")
|
|
15284
|
+
]);
|
|
15285
|
+
};
|
|
15286
|
+
}
|
|
15287
|
+
});
|
|
15288
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
15289
|
+
__name: "Trackhead",
|
|
15290
|
+
props: {
|
|
15291
|
+
node: {}
|
|
15292
|
+
},
|
|
15293
|
+
setup(__props) {
|
|
15294
|
+
return (_ctx, _cache) => {
|
|
15295
|
+
return openBlock(), createElementBlock("div", {
|
|
15296
|
+
class: "mce-trackhead",
|
|
15297
|
+
style: normalizeStyle$1({
|
|
15298
|
+
height: `var(--timeline-track-height__${__props.node.meta.inEditorIs}, 22px)`
|
|
15299
|
+
})
|
|
15300
|
+
}, toDisplayString(__props.node.meta.inEditorIs), 5);
|
|
15301
|
+
};
|
|
15302
|
+
}
|
|
15303
|
+
});
|
|
15304
|
+
const _hoisted_1$6 = { class: "mce-timeline__toolbar" };
|
|
15305
|
+
const _hoisted_2$2 = { class: "mce-timeline__main" };
|
|
15306
|
+
const _hoisted_3$2 = { class: "mce-timeline__left" };
|
|
15307
|
+
const _hoisted_4 = { class: "mce-timeline__left-wrapper" };
|
|
15308
|
+
const _hoisted_5 = { class: "mce-timeline__right-wrapper" };
|
|
15309
|
+
const _hoisted_6 = { class: "mce-timeline__ruler" };
|
|
15310
|
+
const _hoisted_7 = { class: "mce-timeline__track" };
|
|
15311
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
15312
|
+
__name: "Timeline",
|
|
15313
|
+
setup(__props) {
|
|
15314
|
+
const {
|
|
15315
|
+
isElement,
|
|
15316
|
+
root,
|
|
15317
|
+
msPerPx,
|
|
15318
|
+
currentTime,
|
|
15319
|
+
timeline,
|
|
15320
|
+
endTime,
|
|
15321
|
+
selection
|
|
15322
|
+
} = useEditor();
|
|
15323
|
+
const fps = ref(1e3 / 30);
|
|
15324
|
+
const ruler = useTemplateRef("rulerTpl");
|
|
15325
|
+
const paused = ref(true);
|
|
15326
|
+
const offset2 = ref([0, 0]);
|
|
15327
|
+
const elements = computed(() => {
|
|
15328
|
+
return root.value.findAll((node) => {
|
|
15329
|
+
if (isElement(node)) {
|
|
15330
|
+
if (node.children.some((child) => child instanceof Animation)) {
|
|
15331
|
+
return true;
|
|
15533
15332
|
}
|
|
15534
|
-
startTransform();
|
|
15535
15333
|
}
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15334
|
+
return false;
|
|
15335
|
+
});
|
|
15336
|
+
});
|
|
15337
|
+
function onWheel(e) {
|
|
15338
|
+
if (e.ctrlKey || e.metaKey) {
|
|
15339
|
+
e.preventDefault();
|
|
15340
|
+
const factor = e.ctrlKey && IN_MAC_OS ? 10 : 1;
|
|
15341
|
+
const delta = e.deltaY * (e.deltaMode === 1 ? 0.05 : e.deltaMode ? 1 : 2e-3) * factor;
|
|
15342
|
+
const logCur = Math.log(msPerPx.value);
|
|
15343
|
+
const logNew = logCur + delta;
|
|
15344
|
+
msPerPx.value = Math.exp(logNew);
|
|
15345
|
+
} else {
|
|
15346
|
+
e.preventDefault();
|
|
15347
|
+
offset2.value = [
|
|
15348
|
+
Math.min(0, offset2.value[0] - e.deltaX),
|
|
15349
|
+
Math.min(0, offset2.value[1] - e.deltaY)
|
|
15350
|
+
];
|
|
15351
|
+
}
|
|
15352
|
+
}
|
|
15353
|
+
function onMousedown(e) {
|
|
15354
|
+
const box = ruler.value?.box;
|
|
15355
|
+
if (box) {
|
|
15356
|
+
currentTime.value = (e.clientX - box.left - offset2.value[0]) * msPerPx.value;
|
|
15357
|
+
const move = (e2) => {
|
|
15358
|
+
currentTime.value = (e2.clientX - box.left - offset2.value[0]) * msPerPx.value;
|
|
15539
15359
|
};
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
updated.width = distance2;
|
|
15566
|
-
if (props.resizeStrategy === "lockAspectRatio" && aspectRatio) {
|
|
15567
|
-
updated.height = distance2 / aspectRatio;
|
|
15568
|
-
} else {
|
|
15569
|
-
updated.height = height;
|
|
15570
|
-
}
|
|
15571
|
-
} else {
|
|
15572
|
-
updated.height = distance2;
|
|
15573
|
-
if (props.resizeStrategy === "lockAspectRatio" && aspectRatio) {
|
|
15574
|
-
updated.width = distance2 * aspectRatio;
|
|
15575
|
-
} else {
|
|
15576
|
-
updated.width = width;
|
|
15577
|
-
}
|
|
15578
|
-
}
|
|
15579
|
-
const newCenterPoint = getMidpoint(newRotatedCurrentPoint, rotatedSymmetricPoint);
|
|
15580
|
-
updated.left = newCenterPoint.x - updated.width / 2;
|
|
15581
|
-
updated.top = newCenterPoint.y - updated.height / 2;
|
|
15582
|
-
} else {
|
|
15583
|
-
let newRotatedCurrentPoint;
|
|
15584
|
-
if ((props.resizeStrategy === "lockAspectRatio" || props.resizeStrategy === "lockAspectRatioDiagonal") && aspectRatio) {
|
|
15585
|
-
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
15586
|
-
const dx = sign2.x * offset2.x;
|
|
15587
|
-
const dy = sign2.y * offset2.y;
|
|
15588
|
-
let newCurrentPoint;
|
|
15589
|
-
if (dx > dy * aspectRatio) {
|
|
15590
|
-
newCurrentPoint = {
|
|
15591
|
-
x: startPoint.x + sign2.x * dx,
|
|
15592
|
-
y: startPoint.y + sign2.y * dx / aspectRatio
|
|
15593
|
-
};
|
|
15594
|
-
} else {
|
|
15595
|
-
newCurrentPoint = {
|
|
15596
|
-
x: startPoint.x + sign2.x * dy * aspectRatio,
|
|
15597
|
-
y: startPoint.y + sign2.y * dy
|
|
15598
|
-
};
|
|
15599
|
-
}
|
|
15600
|
-
newRotatedCurrentPoint = rotatePoint2(newCurrentPoint, centerPoint, rotate);
|
|
15601
|
-
} else {
|
|
15602
|
-
newRotatedCurrentPoint = rotatedCurrentPoint;
|
|
15603
|
-
}
|
|
15604
|
-
const newCenterPoint = getMidpoint(newRotatedCurrentPoint, rotatedSymmetricPoint);
|
|
15605
|
-
const points = [
|
|
15606
|
-
rotatePoint2(newRotatedCurrentPoint, newCenterPoint, -rotate),
|
|
15607
|
-
rotatePoint2(rotatedSymmetricPoint, newCenterPoint, -rotate)
|
|
15608
|
-
];
|
|
15609
|
-
const [minX, maxX] = points[0].x > points[1].x ? [points[1].x, points[0].x] : [points[0].x, points[1].x];
|
|
15610
|
-
const [minY, maxY] = points[0].y > points[1].y ? [points[1].y, points[0].y] : [points[0].y, points[1].y];
|
|
15611
|
-
updated.width = maxX - minX;
|
|
15612
|
-
updated.height = maxY - minY;
|
|
15613
|
-
updated.left = minX;
|
|
15614
|
-
updated.top = minY;
|
|
15360
|
+
const up = () => {
|
|
15361
|
+
window.removeEventListener("mousemove", move);
|
|
15362
|
+
window.removeEventListener("mouseup", up);
|
|
15363
|
+
};
|
|
15364
|
+
window.addEventListener("mousemove", move);
|
|
15365
|
+
window.addEventListener("mouseup", up);
|
|
15366
|
+
}
|
|
15367
|
+
}
|
|
15368
|
+
function rulerLabelFormat(f) {
|
|
15369
|
+
if (f % 30 === 0) {
|
|
15370
|
+
const m = Math.floor(f / 30 / 60);
|
|
15371
|
+
const s = Math.floor(f / 30) % 60;
|
|
15372
|
+
const mm = String(m).padStart(2, "0");
|
|
15373
|
+
const ss = String(s).padStart(2, "0");
|
|
15374
|
+
return `${mm}:${ss}`;
|
|
15375
|
+
}
|
|
15376
|
+
return `${Math.floor(f % 30)}f`;
|
|
15377
|
+
}
|
|
15378
|
+
let requestId;
|
|
15379
|
+
function play() {
|
|
15380
|
+
paused.value = false;
|
|
15381
|
+
let prevTime;
|
|
15382
|
+
function loop(time) {
|
|
15383
|
+
if (prevTime !== void 0 && time !== void 0) {
|
|
15384
|
+
timeline.value.addTime(time - prevTime);
|
|
15615
15385
|
}
|
|
15616
|
-
|
|
15617
|
-
|
|
15386
|
+
prevTime = time;
|
|
15387
|
+
requestId = requestAnimationFrame(loop);
|
|
15388
|
+
}
|
|
15389
|
+
loop();
|
|
15390
|
+
}
|
|
15391
|
+
function pause() {
|
|
15392
|
+
paused.value = true;
|
|
15393
|
+
if (requestId !== void 0) {
|
|
15394
|
+
cancelAnimationFrame(requestId);
|
|
15395
|
+
requestId = void 0;
|
|
15396
|
+
}
|
|
15397
|
+
}
|
|
15398
|
+
function toggle() {
|
|
15399
|
+
if (paused.value) {
|
|
15400
|
+
play();
|
|
15401
|
+
} else {
|
|
15402
|
+
pause();
|
|
15403
|
+
}
|
|
15404
|
+
}
|
|
15405
|
+
onBeforeUnmount(pause);
|
|
15406
|
+
return (_ctx, _cache) => {
|
|
15407
|
+
return openBlock(), createElementBlock("div", {
|
|
15408
|
+
class: "mce-timeline",
|
|
15409
|
+
onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
15410
|
+
}, ["prevent"]))
|
|
15411
|
+
}, [
|
|
15412
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
15413
|
+
createElementVNode("div", {
|
|
15414
|
+
class: "mce-timeline__play",
|
|
15415
|
+
onClick: toggle
|
|
15416
|
+
}, [
|
|
15417
|
+
createVNode(unref(_sfc_main$D), {
|
|
15418
|
+
icon: paused.value ? "$play" : "$pause"
|
|
15419
|
+
}, null, 8, ["icon"])
|
|
15420
|
+
])
|
|
15421
|
+
]),
|
|
15422
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
15423
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
15424
|
+
createElementVNode("div", _hoisted_4, [
|
|
15425
|
+
createElementVNode("div", {
|
|
15426
|
+
style: normalizeStyle$1({
|
|
15427
|
+
transform: `translateY(${offset2.value[1]}px)`
|
|
15428
|
+
})
|
|
15429
|
+
}, [
|
|
15430
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
15431
|
+
return openBlock(), createBlock(_sfc_main$d, {
|
|
15432
|
+
key: index,
|
|
15433
|
+
node
|
|
15434
|
+
}, null, 8, ["node"]);
|
|
15435
|
+
}), 128))
|
|
15436
|
+
], 4)
|
|
15437
|
+
])
|
|
15438
|
+
]),
|
|
15439
|
+
createElementVNode("div", {
|
|
15440
|
+
class: "mce-timeline__right",
|
|
15441
|
+
onWheel,
|
|
15442
|
+
onMousedown
|
|
15443
|
+
}, [
|
|
15444
|
+
createElementVNode("div", _hoisted_5, [
|
|
15445
|
+
createElementVNode("div", _hoisted_6, [
|
|
15446
|
+
createVNode(_sfc_main$q, {
|
|
15447
|
+
ref: "rulerTpl",
|
|
15448
|
+
zoom: 1 / unref(msPerPx) * fps.value,
|
|
15449
|
+
unit: 100,
|
|
15450
|
+
"unit-fractions": [1, 3],
|
|
15451
|
+
style: { "position": "relative" },
|
|
15452
|
+
position: -offset2.value[0],
|
|
15453
|
+
"label-format": rulerLabelFormat
|
|
15454
|
+
}, null, 8, ["zoom", "position"])
|
|
15455
|
+
]),
|
|
15456
|
+
createElementVNode("div", _hoisted_7, [
|
|
15457
|
+
createElementVNode("div", {
|
|
15458
|
+
style: normalizeStyle$1({
|
|
15459
|
+
width: `${unref(endTime) / unref(msPerPx)}px`,
|
|
15460
|
+
transform: `translate(${offset2.value[0]}px, ${offset2.value[1]}px)`
|
|
15461
|
+
})
|
|
15462
|
+
}, [
|
|
15463
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
|
|
15464
|
+
return openBlock(), createBlock(_sfc_main$e, { key: index }, {
|
|
15465
|
+
default: withCtx(() => [
|
|
15466
|
+
createVNode(_sfc_main$f, {
|
|
15467
|
+
node,
|
|
15468
|
+
"ms-per-px": unref(msPerPx),
|
|
15469
|
+
active: unref(selection).some((v) => v.equal(node)),
|
|
15470
|
+
onMousedown: withModifiers(($event) => selection.value = [node], ["stop"])
|
|
15471
|
+
}, null, 8, ["node", "ms-per-px", "active", "onMousedown"])
|
|
15472
|
+
]),
|
|
15473
|
+
_: 2
|
|
15474
|
+
}, 1024);
|
|
15475
|
+
}), 128))
|
|
15476
|
+
], 4)
|
|
15477
|
+
]),
|
|
15478
|
+
createVNode(_sfc_main$g, {
|
|
15479
|
+
style: normalizeStyle$1({
|
|
15480
|
+
transform: `translate(${offset2.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
|
|
15481
|
+
})
|
|
15482
|
+
}, null, 8, ["style"])
|
|
15483
|
+
])
|
|
15484
|
+
], 32)
|
|
15485
|
+
])
|
|
15486
|
+
], 32);
|
|
15487
|
+
};
|
|
15488
|
+
}
|
|
15489
|
+
});
|
|
15490
|
+
const _timeline = definePlugin((editor) => {
|
|
15491
|
+
const {
|
|
15492
|
+
registerConfig
|
|
15493
|
+
} = editor;
|
|
15494
|
+
registerConfig("timeline", false);
|
|
15495
|
+
return {
|
|
15496
|
+
name: "mce:timeline",
|
|
15497
|
+
components: [
|
|
15498
|
+
{
|
|
15499
|
+
name: "timeline",
|
|
15500
|
+
type: "panel",
|
|
15501
|
+
position: "bottom",
|
|
15502
|
+
size: 160,
|
|
15503
|
+
component: _sfc_main$c
|
|
15504
|
+
}
|
|
15505
|
+
],
|
|
15506
|
+
hotkeys: [
|
|
15507
|
+
{ command: "panels:timeline", key: "Alt+2" }
|
|
15508
|
+
]
|
|
15509
|
+
};
|
|
15510
|
+
});
|
|
15511
|
+
const _hoisted_1$5 = { class: "mce-toolbelt" };
|
|
15512
|
+
const _hoisted_2$1 = { key: 0 };
|
|
15513
|
+
const _hoisted_3$1 = { key: 1 };
|
|
15514
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
15515
|
+
__name: "Toolbelt",
|
|
15516
|
+
setup(__props) {
|
|
15517
|
+
const {
|
|
15518
|
+
state,
|
|
15519
|
+
t,
|
|
15520
|
+
setActiveDrawingTool,
|
|
15521
|
+
activeDrawingTool,
|
|
15522
|
+
hotkeys,
|
|
15523
|
+
getKbd
|
|
15524
|
+
} = useEditor();
|
|
15525
|
+
const activeShape = ref(0);
|
|
15526
|
+
const activePen = ref(0);
|
|
15527
|
+
const shapeItems = computed(() => {
|
|
15528
|
+
const keys = [
|
|
15529
|
+
"rectangle",
|
|
15530
|
+
"line",
|
|
15531
|
+
"arrow",
|
|
15532
|
+
"ellipse",
|
|
15533
|
+
"polygon",
|
|
15534
|
+
"star"
|
|
15535
|
+
];
|
|
15536
|
+
return [
|
|
15537
|
+
...keys.map((key, index) => {
|
|
15538
|
+
return {
|
|
15539
|
+
key,
|
|
15540
|
+
handle: () => {
|
|
15541
|
+
activeShape.value = index;
|
|
15542
|
+
setActiveDrawingTool(key);
|
|
15543
|
+
},
|
|
15544
|
+
checked: activeDrawingTool.value?.name === key
|
|
15545
|
+
};
|
|
15546
|
+
}),
|
|
15547
|
+
{
|
|
15548
|
+
key: "image",
|
|
15549
|
+
handle: () => setActiveDrawingTool("image"),
|
|
15550
|
+
checked: activeDrawingTool.value?.name === "image"
|
|
15618
15551
|
}
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15552
|
+
];
|
|
15553
|
+
});
|
|
15554
|
+
const penItems = computed(() => {
|
|
15555
|
+
const keys = [
|
|
15556
|
+
"pen",
|
|
15557
|
+
"pencil"
|
|
15558
|
+
];
|
|
15559
|
+
return [
|
|
15560
|
+
...keys.map((key, index) => {
|
|
15561
|
+
return {
|
|
15562
|
+
key,
|
|
15563
|
+
handle: () => {
|
|
15564
|
+
activePen.value = index;
|
|
15565
|
+
setActiveDrawingTool(key);
|
|
15566
|
+
},
|
|
15567
|
+
checked: activeDrawingTool.value?.name === key
|
|
15568
|
+
};
|
|
15569
|
+
})
|
|
15570
|
+
];
|
|
15571
|
+
});
|
|
15572
|
+
const items = computed(() => {
|
|
15573
|
+
return [
|
|
15574
|
+
{
|
|
15575
|
+
key: ["hand"].includes(state.value || "") ? "hand" : "move",
|
|
15576
|
+
active: state.value !== "drawing",
|
|
15577
|
+
handle: () => {
|
|
15578
|
+
if (["hand"].includes(state.value || "")) ;
|
|
15579
|
+
else {
|
|
15580
|
+
setActiveDrawingTool(void 0);
|
|
15581
|
+
}
|
|
15582
|
+
},
|
|
15583
|
+
children: [
|
|
15584
|
+
{ key: "move", handle: () => setActiveDrawingTool(void 0) },
|
|
15585
|
+
{ key: "hand", handle: () => state.value = "hand" }
|
|
15586
|
+
]
|
|
15587
|
+
},
|
|
15588
|
+
{
|
|
15589
|
+
key: activeDrawingTool.value?.name === "slice" ? "slice" : "frame",
|
|
15590
|
+
active: ["frame", "slice"].includes(activeDrawingTool.value?.name),
|
|
15591
|
+
handle: () => setActiveDrawingTool("frame"),
|
|
15592
|
+
children: [
|
|
15593
|
+
{ key: "frame", handle: () => setActiveDrawingTool("frame") },
|
|
15594
|
+
{ key: "slice", handle: () => setActiveDrawingTool("slice") }
|
|
15595
|
+
]
|
|
15596
|
+
},
|
|
15597
|
+
{
|
|
15598
|
+
...shapeItems.value.find((v) => v.checked) ?? shapeItems.value[activeShape.value],
|
|
15599
|
+
children: shapeItems.value
|
|
15600
|
+
},
|
|
15601
|
+
{
|
|
15602
|
+
key: "text",
|
|
15603
|
+
active: activeDrawingTool.value?.name === "text",
|
|
15604
|
+
handle: () => setActiveDrawingTool("text")
|
|
15605
|
+
},
|
|
15606
|
+
{
|
|
15607
|
+
...penItems.value.find((v) => v.checked) ?? penItems.value[activePen.value],
|
|
15608
|
+
children: penItems.value
|
|
15624
15609
|
}
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15610
|
+
];
|
|
15611
|
+
});
|
|
15612
|
+
return (_ctx, _cache) => {
|
|
15613
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
15614
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (tool, key) => {
|
|
15615
|
+
return openBlock(), createElementBlock("div", {
|
|
15616
|
+
key,
|
|
15617
|
+
class: "mce-toolbelt__group"
|
|
15618
|
+
}, [
|
|
15619
|
+
createVNode(_sfc_main$r, {
|
|
15620
|
+
location: "top",
|
|
15621
|
+
offset: 12,
|
|
15622
|
+
"show-arrow": ""
|
|
15623
|
+
}, {
|
|
15624
|
+
activator: withCtx(({ props: slotProps }) => [
|
|
15625
|
+
createVNode(_sfc_main$z, mergeProps({
|
|
15626
|
+
icon: "",
|
|
15627
|
+
class: "mce-toolbelt__btn",
|
|
15628
|
+
active: tool.active || tool.checked || false
|
|
15629
|
+
}, { ref_for: true }, slotProps, {
|
|
15630
|
+
onClick: tool.handle
|
|
15631
|
+
}), {
|
|
15632
|
+
default: withCtx(() => [
|
|
15633
|
+
createVNode(unref(_sfc_main$D), {
|
|
15634
|
+
icon: `$${tool.key}`
|
|
15635
|
+
}, null, 8, ["icon"])
|
|
15636
|
+
]),
|
|
15637
|
+
_: 2
|
|
15638
|
+
}, 1040, ["active", "onClick"])
|
|
15639
|
+
]),
|
|
15640
|
+
default: withCtx(() => [
|
|
15641
|
+
createElementVNode("span", null, toDisplayString(unref(t)(tool.key)), 1)
|
|
15642
|
+
]),
|
|
15643
|
+
kbd: withCtx(() => [
|
|
15644
|
+
unref(hotkeys).has(`setState:${tool.key}`) ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(unref(getKbd)(`setState:${tool.key}`)), 1)) : unref(hotkeys).has(`setActiveDrawingTool:${tool.key}`) ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(unref(getKbd)(`setActiveDrawingTool:${tool.key}`)), 1)) : createCommentVNode("", true)
|
|
15645
|
+
]),
|
|
15646
|
+
_: 2
|
|
15647
|
+
}, 1024),
|
|
15648
|
+
tool.children?.length ? (openBlock(), createBlock(_sfc_main$u, {
|
|
15649
|
+
key: 0,
|
|
15650
|
+
items: tool.children,
|
|
15651
|
+
offset: 12,
|
|
15652
|
+
location: "top-start"
|
|
15653
|
+
}, {
|
|
15654
|
+
activator: withCtx(({ props }) => [
|
|
15655
|
+
createVNode(_sfc_main$z, mergeProps({
|
|
15656
|
+
icon: "",
|
|
15657
|
+
class: "mce-toolbelt__arrow"
|
|
15658
|
+
}, { ref_for: true }, props), {
|
|
15659
|
+
default: withCtx(() => [
|
|
15660
|
+
createVNode(unref(_sfc_main$D), { icon: "$arrowDown" })
|
|
15661
|
+
]),
|
|
15662
|
+
_: 1
|
|
15663
|
+
}, 16)
|
|
15664
|
+
]),
|
|
15665
|
+
title: withCtx(({ item }) => [
|
|
15666
|
+
createTextVNode(toDisplayString(unref(t)(item.key)), 1)
|
|
15667
|
+
]),
|
|
15668
|
+
kbd: withCtx(({ item }) => [
|
|
15669
|
+
unref(hotkeys).has(`setState:${item.key}`) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
15670
|
+
createTextVNode(toDisplayString(unref(getKbd)(`setState:${item.key}`)), 1)
|
|
15671
|
+
], 64)) : unref(hotkeys).has(`setActiveDrawingTool:${item.key}`) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
15672
|
+
createTextVNode(toDisplayString(unref(getKbd)(`setActiveDrawingTool:${item.key}`)), 1)
|
|
15673
|
+
], 64)) : createCommentVNode("", true)
|
|
15674
|
+
]),
|
|
15675
|
+
prepend: withCtx(({ item }) => [
|
|
15676
|
+
createVNode(unref(_sfc_main$D), {
|
|
15677
|
+
class: "mce-toolbelt__icon",
|
|
15678
|
+
icon: `$${item.key}`
|
|
15679
|
+
}, null, 8, ["icon"])
|
|
15680
|
+
]),
|
|
15681
|
+
_: 2
|
|
15682
|
+
}, 1032, ["items"])) : createCommentVNode("", true)
|
|
15683
|
+
]);
|
|
15684
|
+
}), 128))
|
|
15685
|
+
]);
|
|
15686
|
+
};
|
|
15687
|
+
}
|
|
15688
|
+
});
|
|
15689
|
+
const _toolbelt = definePlugin((editor) => {
|
|
15690
|
+
const {
|
|
15691
|
+
registerConfig
|
|
15692
|
+
} = editor;
|
|
15693
|
+
const toolbelt = registerConfig("toolbelt", false);
|
|
15694
|
+
return {
|
|
15695
|
+
name: "mce:toolbelt",
|
|
15696
|
+
components: [
|
|
15697
|
+
{
|
|
15698
|
+
name: "toolbelt",
|
|
15699
|
+
type: "overlay",
|
|
15700
|
+
component: _sfc_main$b,
|
|
15701
|
+
ignore: () => !toolbelt.value
|
|
15629
15702
|
}
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15703
|
+
]
|
|
15704
|
+
};
|
|
15705
|
+
});
|
|
15706
|
+
const _transform = definePlugin((editor) => {
|
|
15707
|
+
const {
|
|
15708
|
+
elementSelection,
|
|
15709
|
+
exec
|
|
15710
|
+
} = editor;
|
|
15711
|
+
async function _enter() {
|
|
15712
|
+
if (elementSelection.value.length === 1) {
|
|
15713
|
+
const element = elementSelection.value[0];
|
|
15714
|
+
if (element.text.isValid()) {
|
|
15715
|
+
await exec("startTyping");
|
|
15636
15716
|
}
|
|
15637
|
-
window.addEventListener("pointermove", _onPointerMove);
|
|
15638
|
-
window.addEventListener("pointerup", _onPointerUp, true);
|
|
15639
|
-
return true;
|
|
15640
15717
|
}
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15718
|
+
}
|
|
15719
|
+
const when = () => Boolean(elementSelection.value.length > 0);
|
|
15720
|
+
function flip2(target) {
|
|
15721
|
+
switch (target) {
|
|
15722
|
+
case "horizontal":
|
|
15723
|
+
elementSelection.value.forEach((el) => {
|
|
15724
|
+
el.style.scaleX = -el.style.scaleX;
|
|
15725
|
+
});
|
|
15726
|
+
break;
|
|
15727
|
+
case "vertical":
|
|
15728
|
+
elementSelection.value.forEach((el) => {
|
|
15729
|
+
el.style.scaleY = -el.style.scaleY;
|
|
15730
|
+
});
|
|
15731
|
+
break;
|
|
15732
|
+
}
|
|
15733
|
+
}
|
|
15734
|
+
return {
|
|
15735
|
+
name: "mce:transform",
|
|
15736
|
+
commands: [
|
|
15737
|
+
{ command: "enter", handle: _enter },
|
|
15738
|
+
{ command: "flip", handle: flip2 },
|
|
15739
|
+
{ command: "flipHorizontal", handle: () => flip2("horizontal") },
|
|
15740
|
+
{ command: "flipVertical", handle: () => flip2("vertical") }
|
|
15741
|
+
],
|
|
15742
|
+
hotkeys: [
|
|
15743
|
+
{ command: "enter", key: ["Enter"], when },
|
|
15744
|
+
{ command: "flipHorizontal", key: "Shift+H" },
|
|
15745
|
+
{ command: "flipVertical", key: "Shift+V" }
|
|
15746
|
+
]
|
|
15747
|
+
};
|
|
15748
|
+
});
|
|
15749
|
+
const _ui = definePlugin((editor) => {
|
|
15750
|
+
return {
|
|
15751
|
+
name: "mce:ui",
|
|
15752
|
+
setup: () => {
|
|
15753
|
+
const {
|
|
15754
|
+
drawboardDom,
|
|
15755
|
+
drawboardAabb,
|
|
15756
|
+
drawboardPointer
|
|
15757
|
+
} = editor;
|
|
15758
|
+
useResizeObserver$1(drawboardDom, (entries) => {
|
|
15759
|
+
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
15760
|
+
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
15761
|
+
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
15762
|
+
});
|
|
15763
|
+
document.addEventListener("mousemove", (event) => {
|
|
15764
|
+
drawboardPointer.value = new Vector2$1(
|
|
15765
|
+
event.clientX - drawboardAabb.value.left,
|
|
15766
|
+
event.clientY - drawboardAabb.value.top
|
|
15767
|
+
);
|
|
15768
|
+
});
|
|
15649
15769
|
}
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15770
|
+
};
|
|
15771
|
+
});
|
|
15772
|
+
const _url = definePlugin((editor) => {
|
|
15773
|
+
const {
|
|
15774
|
+
load,
|
|
15775
|
+
http
|
|
15776
|
+
} = editor;
|
|
15777
|
+
return {
|
|
15778
|
+
name: "mce:url",
|
|
15779
|
+
loaders: [
|
|
15780
|
+
{
|
|
15781
|
+
name: "url",
|
|
15782
|
+
test: (source) => {
|
|
15783
|
+
return typeof source === "string";
|
|
15784
|
+
},
|
|
15785
|
+
load: async (url) => {
|
|
15786
|
+
const blob = await http.request({ url, responseType: "blob" });
|
|
15787
|
+
const file = new File([blob], url, { type: blob.type });
|
|
15788
|
+
try {
|
|
15789
|
+
return await load(file);
|
|
15790
|
+
} catch (error) {
|
|
15791
|
+
throw new Error(`Failed to load source "${url}", ${error}`);
|
|
15792
|
+
}
|
|
15793
|
+
}
|
|
15657
15794
|
}
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15795
|
+
]
|
|
15796
|
+
};
|
|
15797
|
+
});
|
|
15798
|
+
const _view = definePlugin((editor) => {
|
|
15799
|
+
const {
|
|
15800
|
+
config
|
|
15801
|
+
} = editor;
|
|
15802
|
+
return {
|
|
15803
|
+
name: "mce:view",
|
|
15804
|
+
commands: [
|
|
15805
|
+
{ command: "view", handle: (view) => config.value[view] = !config.value[view] }
|
|
15806
|
+
],
|
|
15807
|
+
hotkeys: [
|
|
15808
|
+
{ command: "view:pixelGrid", key: 'Shift+"' },
|
|
15809
|
+
{ command: "view:ruler", key: "Shift+R" }
|
|
15810
|
+
]
|
|
15811
|
+
};
|
|
15812
|
+
});
|
|
15813
|
+
const _zoom = definePlugin((editor) => {
|
|
15814
|
+
const {
|
|
15815
|
+
registerConfig,
|
|
15816
|
+
camera,
|
|
15817
|
+
zoomTo,
|
|
15818
|
+
exec,
|
|
15819
|
+
config,
|
|
15820
|
+
findFrame,
|
|
15821
|
+
selection
|
|
15822
|
+
} = editor;
|
|
15823
|
+
registerConfig("zoomToFit", "contain");
|
|
15824
|
+
function zoomToFrame(type, options) {
|
|
15825
|
+
const value = findFrame(type);
|
|
15826
|
+
if (value) {
|
|
15827
|
+
selection.value = [value];
|
|
15828
|
+
zoomTo(value, options);
|
|
15668
15829
|
}
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
}
|
|
15830
|
+
}
|
|
15831
|
+
return {
|
|
15832
|
+
name: "mce:zoom",
|
|
15833
|
+
commands: [
|
|
15834
|
+
{ command: "zoomIn", handle: () => camera.value.addZoom(0.25) },
|
|
15835
|
+
{ command: "zoomOut", handle: () => camera.value.addZoom(-0.25) },
|
|
15836
|
+
{ command: "zoomTo100", handle: () => camera.value.setZoom(1) },
|
|
15837
|
+
{ command: "zoomToFit", handle: () => zoomTo("root", { mode: config.value.zoomToFit }) },
|
|
15838
|
+
{ command: "zoomToSelection", handle: (options) => zoomTo("selection", options) },
|
|
15839
|
+
{ command: "zoomToNextFrame", handle: (options) => zoomToFrame("next", options) },
|
|
15840
|
+
{ command: "zoomToPreviousFrame", handle: (options) => zoomToFrame("previous", options) }
|
|
15841
|
+
],
|
|
15842
|
+
hotkeys: [
|
|
15843
|
+
{ command: "zoomIn", key: "CmdOrCtrl+=" },
|
|
15844
|
+
{ command: "zoomOut", key: "CmdOrCtrl+-" },
|
|
15845
|
+
{ command: "zoomTo100", key: "CmdOrCtrl+0" },
|
|
15846
|
+
{ command: "zoomToFit", key: "Shift+1" },
|
|
15847
|
+
{ command: "zoomToSelection", key: "Shift+2" },
|
|
15848
|
+
{ command: "zoomToNextFrame", key: "N" },
|
|
15849
|
+
{ command: "zoomToPreviousFrame", key: "Shift+N" }
|
|
15850
|
+
],
|
|
15851
|
+
events: {
|
|
15852
|
+
setDoc: () => exec("zoomToFit")
|
|
15674
15853
|
}
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15854
|
+
};
|
|
15855
|
+
});
|
|
15856
|
+
const plugins = [
|
|
15857
|
+
_arrange,
|
|
15858
|
+
_autoNest,
|
|
15859
|
+
_copyAs,
|
|
15860
|
+
_drawingTool,
|
|
15861
|
+
_edit,
|
|
15862
|
+
_frame,
|
|
15863
|
+
_gif,
|
|
15864
|
+
_history,
|
|
15865
|
+
_hover,
|
|
15866
|
+
_html,
|
|
15867
|
+
_image,
|
|
15868
|
+
_import,
|
|
15869
|
+
_json,
|
|
15870
|
+
_layers,
|
|
15871
|
+
_madeWith,
|
|
15872
|
+
_menu,
|
|
15873
|
+
_move,
|
|
15874
|
+
_new,
|
|
15875
|
+
_node,
|
|
15876
|
+
_open,
|
|
15877
|
+
_panels,
|
|
15878
|
+
_pen,
|
|
15879
|
+
_rotate,
|
|
15880
|
+
_ruler,
|
|
15881
|
+
_saveAs,
|
|
15882
|
+
_scroll,
|
|
15883
|
+
_selection,
|
|
15884
|
+
_shape,
|
|
15885
|
+
_slice,
|
|
15886
|
+
_smartGuides,
|
|
15887
|
+
_smartSelection,
|
|
15888
|
+
_state,
|
|
15889
|
+
_statusbar,
|
|
15890
|
+
_text,
|
|
15891
|
+
_timeline,
|
|
15892
|
+
_toolbelt,
|
|
15893
|
+
_transform,
|
|
15894
|
+
_ui,
|
|
15895
|
+
_url,
|
|
15896
|
+
_view,
|
|
15897
|
+
_zoom
|
|
15898
|
+
];
|
|
15899
|
+
class Editor extends Observable {
|
|
15900
|
+
static injectionKey = /* @__PURE__ */ Symbol.for("EditorKey");
|
|
15901
|
+
debug = ref(false);
|
|
15902
|
+
onEmit;
|
|
15903
|
+
plugins = /* @__PURE__ */ new Map();
|
|
15904
|
+
pluginsComponents = computed(() => {
|
|
15905
|
+
return {
|
|
15906
|
+
overlay: this.getPlugins("overlay"),
|
|
15907
|
+
panel: this.getPlugins("panel")
|
|
15908
|
+
};
|
|
15909
|
+
});
|
|
15910
|
+
_setups = [];
|
|
15911
|
+
constructor(options = {}) {
|
|
15912
|
+
super();
|
|
15913
|
+
this._setupObservable();
|
|
15914
|
+
this._setupOptions(options);
|
|
15915
|
+
}
|
|
15916
|
+
_setupObservable() {
|
|
15917
|
+
this.on = this.on.bind(this);
|
|
15918
|
+
this.once = this.once.bind(this);
|
|
15919
|
+
this.off = this.off.bind(this);
|
|
15920
|
+
this.emit = this.emit.bind(this);
|
|
15921
|
+
}
|
|
15922
|
+
getPlugins = (type) => {
|
|
15923
|
+
return Array.from(this.plugins.values()).flatMap((p) => p.components?.filter((c) => {
|
|
15924
|
+
return c.type === type && c.ignore?.() !== true;
|
|
15925
|
+
}) ?? []);
|
|
15926
|
+
};
|
|
15927
|
+
log = (...args) => {
|
|
15928
|
+
if (this.debug.value) {
|
|
15929
|
+
console.warn(`[mce][${(/* @__PURE__ */ new Date()).toLocaleTimeString()}]`, ...args);
|
|
15679
15930
|
}
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15931
|
+
};
|
|
15932
|
+
emit = (event, ...args) => {
|
|
15933
|
+
this.onEmit?.(event, ...args);
|
|
15934
|
+
return super.emit(event, ...args);
|
|
15935
|
+
};
|
|
15936
|
+
_setupOptions(options) {
|
|
15937
|
+
const {
|
|
15938
|
+
debug = false,
|
|
15939
|
+
plugins: plugins$1 = [],
|
|
15940
|
+
configCacheInLocal
|
|
15941
|
+
} = options;
|
|
15942
|
+
this.debug.value = debug;
|
|
15943
|
+
this.config = configCacheInLocal ? useLocalStorage("config", () => ({})) : ref({});
|
|
15944
|
+
this._setups = [];
|
|
15945
|
+
this._useMixins(
|
|
15946
|
+
mixins,
|
|
15947
|
+
options
|
|
15948
|
+
);
|
|
15949
|
+
this.use([
|
|
15950
|
+
...plugins,
|
|
15951
|
+
...plugins$1
|
|
15952
|
+
], options);
|
|
15953
|
+
}
|
|
15954
|
+
_useMixins(mixins2, options) {
|
|
15955
|
+
const use = (mixin) => {
|
|
15956
|
+
const result = mixin(this, options);
|
|
15957
|
+
switch (typeof result) {
|
|
15958
|
+
case "object":
|
|
15959
|
+
if (Array.isArray(result)) {
|
|
15960
|
+
result.map((v) => use(v));
|
|
15961
|
+
} else {
|
|
15962
|
+
Object.assign(this, result);
|
|
15963
|
+
}
|
|
15964
|
+
break;
|
|
15965
|
+
case "function":
|
|
15966
|
+
default:
|
|
15967
|
+
if (result) {
|
|
15968
|
+
this._setups.push(result);
|
|
15969
|
+
}
|
|
15970
|
+
break;
|
|
15971
|
+
}
|
|
15972
|
+
};
|
|
15973
|
+
mixins2.forEach(use);
|
|
15974
|
+
}
|
|
15975
|
+
use(plugins2, options) {
|
|
15976
|
+
const use = (plugin) => {
|
|
15977
|
+
let result;
|
|
15978
|
+
if (typeof plugin === "function") {
|
|
15979
|
+
result = plugin(this, options);
|
|
15980
|
+
} else {
|
|
15981
|
+
result = plugin;
|
|
15982
|
+
}
|
|
15983
|
+
this.plugins.set(result.name, result);
|
|
15984
|
+
const {
|
|
15985
|
+
events,
|
|
15986
|
+
commands = [],
|
|
15987
|
+
hotkeys = [],
|
|
15988
|
+
loaders = [],
|
|
15989
|
+
exporters = [],
|
|
15990
|
+
drawingTools = []
|
|
15991
|
+
} = result;
|
|
15992
|
+
this.registerCommand(commands);
|
|
15993
|
+
this.registerHotkey(hotkeys);
|
|
15994
|
+
this.registerLoader(loaders);
|
|
15995
|
+
this.registerExporter(exporters);
|
|
15996
|
+
this.registerDrawingTool(drawingTools);
|
|
15997
|
+
if (events) {
|
|
15998
|
+
for (const k in events) {
|
|
15999
|
+
this.on(k, events[k]);
|
|
15708
16000
|
}
|
|
15709
16001
|
}
|
|
15710
|
-
}
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
function Diagonal() {
|
|
15717
|
-
const handle = activeHandle.value;
|
|
15718
|
-
if (!handle || !handle.startsWith("resize")) {
|
|
15719
|
-
return void 0;
|
|
16002
|
+
};
|
|
16003
|
+
plugins2.forEach((p) => {
|
|
16004
|
+
try {
|
|
16005
|
+
use(p);
|
|
16006
|
+
} catch (err) {
|
|
16007
|
+
console.error(`Failed to use plugin`, err);
|
|
15720
16008
|
}
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
16009
|
+
});
|
|
16010
|
+
}
|
|
16011
|
+
_setuped = false;
|
|
16012
|
+
setup = async () => {
|
|
16013
|
+
if (!this._setuped) {
|
|
16014
|
+
this._setuped = true;
|
|
16015
|
+
await Promise.all([
|
|
16016
|
+
...this._setups.map(async (setup) => {
|
|
16017
|
+
try {
|
|
16018
|
+
await setup();
|
|
16019
|
+
} catch (err) {
|
|
16020
|
+
console.error(`Failed to setup mixin`, err);
|
|
15727
16021
|
}
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
16022
|
+
}),
|
|
16023
|
+
...[...this.plugins.values()].map(async (p) => {
|
|
16024
|
+
try {
|
|
16025
|
+
await p.setup?.();
|
|
16026
|
+
} catch (err) {
|
|
16027
|
+
console.error(`Failed to setup ${p.name} plugin`, err);
|
|
16028
|
+
}
|
|
16029
|
+
})
|
|
16030
|
+
]);
|
|
16031
|
+
this.emit("ready");
|
|
16032
|
+
}
|
|
16033
|
+
};
|
|
16034
|
+
install = (app) => {
|
|
16035
|
+
app.provide(Editor.injectionKey, this);
|
|
16036
|
+
};
|
|
16037
|
+
}
|
|
16038
|
+
function useEditor() {
|
|
16039
|
+
let editor = inject(Editor.injectionKey, null);
|
|
16040
|
+
if (!editor) {
|
|
16041
|
+
const _editor = getCurrentInstance()?.proxy?.editor;
|
|
16042
|
+
if (_editor instanceof Editor) {
|
|
16043
|
+
editor = _editor;
|
|
16044
|
+
}
|
|
16045
|
+
}
|
|
16046
|
+
return editor;
|
|
16047
|
+
}
|
|
16048
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
16049
|
+
__name: "Floatbar",
|
|
16050
|
+
props: {
|
|
16051
|
+
...makeMceOverlayProps({
|
|
16052
|
+
offset: 8
|
|
16053
|
+
})
|
|
16054
|
+
},
|
|
16055
|
+
setup(__props, { expose: __expose }) {
|
|
16056
|
+
const props = __props;
|
|
16057
|
+
const {
|
|
16058
|
+
elementSelection,
|
|
16059
|
+
selectionAabbInDrawboard,
|
|
16060
|
+
inEditorIs
|
|
16061
|
+
} = useEditor();
|
|
16062
|
+
const overlay = useTemplateRef("overlayTpl");
|
|
16063
|
+
const style = computed(() => {
|
|
16064
|
+
const location = props.location;
|
|
16065
|
+
const aabb = selectionAabbInDrawboard.value;
|
|
16066
|
+
if (location?.startsWith("top") || location?.startsWith("bottom")) {
|
|
16067
|
+
return {
|
|
16068
|
+
"--height": "auto",
|
|
16069
|
+
"--width": `${aabb.width}px`
|
|
16070
|
+
};
|
|
16071
|
+
} else if (location?.startsWith("left") || location?.startsWith("right")) {
|
|
16072
|
+
return {
|
|
16073
|
+
"--height": `${aabb.height}px`,
|
|
16074
|
+
"--width": "auto"
|
|
16075
|
+
};
|
|
15731
16076
|
}
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
x2: "0",
|
|
15738
|
-
y2: "100%"
|
|
15739
|
-
});
|
|
15740
|
-
} else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
|
|
15741
|
-
return h("line", {
|
|
15742
|
-
class: "mce-transform-controls__diagonal",
|
|
15743
|
-
x1: "0",
|
|
15744
|
-
y1: "0",
|
|
15745
|
-
x2: "100%",
|
|
15746
|
-
y2: "100%"
|
|
15747
|
-
});
|
|
16077
|
+
return {};
|
|
16078
|
+
});
|
|
16079
|
+
const offset2 = computed(() => {
|
|
16080
|
+
if (elementSelection.value.some((v) => inEditorIs(v, "Frame")) || props.location?.startsWith("bottom")) {
|
|
16081
|
+
return 32;
|
|
15748
16082
|
}
|
|
15749
|
-
return
|
|
16083
|
+
return 8;
|
|
16084
|
+
});
|
|
16085
|
+
function updateLocation() {
|
|
16086
|
+
overlay.value?.updateLocation();
|
|
15750
16087
|
}
|
|
16088
|
+
watch(selectionAabbInDrawboard, updateLocation, { deep: true });
|
|
16089
|
+
__expose({
|
|
16090
|
+
updateLocation
|
|
16091
|
+
});
|
|
15751
16092
|
return (_ctx, _cache) => {
|
|
15752
|
-
return openBlock(), createBlock(
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
]]),
|
|
15763
|
-
style: normalizeStyle$1(style.value)
|
|
16093
|
+
return openBlock(), createBlock(_sfc_main$v, {
|
|
16094
|
+
ref: "overlayTpl",
|
|
16095
|
+
"content-style": style.value,
|
|
16096
|
+
class: "mce-floatbar",
|
|
16097
|
+
location: props.location,
|
|
16098
|
+
middlewares: props.middlewares,
|
|
16099
|
+
offset: offset2.value,
|
|
16100
|
+
target: props.target,
|
|
16101
|
+
attach: false,
|
|
16102
|
+
"model-value": true
|
|
15764
16103
|
}, {
|
|
15765
16104
|
default: withCtx(() => [
|
|
15766
|
-
renderSlot(_ctx.$slots, "default", {
|
|
15767
|
-
value: unref(modelValue),
|
|
15768
|
-
props: {
|
|
15769
|
-
onPointerdown: start
|
|
15770
|
-
},
|
|
15771
|
-
start
|
|
15772
|
-
}),
|
|
15773
|
-
(openBlock(), createElementBlock("svg", _hoisted_1$4, [
|
|
15774
|
-
_cache[1] || (_cache[1] = createElementVNode("rect", {
|
|
15775
|
-
width: "100%",
|
|
15776
|
-
height: "100%",
|
|
15777
|
-
fill: "none",
|
|
15778
|
-
class: "mce-transform-controls__rect"
|
|
15779
|
-
}, null, -1)),
|
|
15780
|
-
createElementVNode("rect", {
|
|
15781
|
-
class: "mce-transform-controls__rect",
|
|
15782
|
-
width: "100%",
|
|
15783
|
-
height: "100%",
|
|
15784
|
-
fill: "none",
|
|
15785
|
-
rx: model.value.borderRadius,
|
|
15786
|
-
ry: model.value.borderRadius
|
|
15787
|
-
}, null, 8, _hoisted_2$1),
|
|
15788
|
-
createVNode(Diagonal),
|
|
15789
|
-
createElementVNode("g", _hoisted_3$1, [
|
|
15790
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15791
|
-
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
15792
|
-
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
15793
|
-
handle.shape === "rect" ? (openBlock(), createElementBlock("rect", {
|
|
15794
|
-
key: 0,
|
|
15795
|
-
x: handle.x,
|
|
15796
|
-
y: handle.y,
|
|
15797
|
-
width: handle.width,
|
|
15798
|
-
height: handle.height,
|
|
15799
|
-
"aria-label": handle.type,
|
|
15800
|
-
class: "mce-transform-controls__handle"
|
|
15801
|
-
}, null, 8, _hoisted_4)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
|
|
15802
|
-
key: 1,
|
|
15803
|
-
cx: handle.x + handle.width / 2,
|
|
15804
|
-
cy: handle.y + handle.width / 2,
|
|
15805
|
-
r: handle.width / 2,
|
|
15806
|
-
"aria-label": handle.type,
|
|
15807
|
-
class: "mce-transform-controls__handle"
|
|
15808
|
-
}, null, 8, _hoisted_5)) : (openBlock(), createElementBlock("rect", {
|
|
15809
|
-
key: 2,
|
|
15810
|
-
x: handle.x,
|
|
15811
|
-
y: handle.y,
|
|
15812
|
-
width: handle.width,
|
|
15813
|
-
height: handle.height,
|
|
15814
|
-
"aria-label": handle.type,
|
|
15815
|
-
rx: handle.width / 4,
|
|
15816
|
-
ry: handle.height / 4,
|
|
15817
|
-
class: "mce-transform-controls__handle"
|
|
15818
|
-
}, null, 8, _hoisted_6))
|
|
15819
|
-
], 64)) : createCommentVNode("", true)
|
|
15820
|
-
], 64);
|
|
15821
|
-
}), 128)),
|
|
15822
|
-
__props.rotator ? (openBlock(), createElementBlock("g", {
|
|
15823
|
-
key: 0,
|
|
15824
|
-
transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
|
|
15825
|
-
class: "mce-transform-controls__rotator"
|
|
15826
|
-
}, [..._cache[0] || (_cache[0] = [
|
|
15827
|
-
createElementVNode("path", { d: "M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" }, null, -1)
|
|
15828
|
-
])], 8, _hoisted_7)) : createCommentVNode("", true)
|
|
15829
|
-
]),
|
|
15830
|
-
createElementVNode("g", _hoisted_8, [
|
|
15831
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15832
|
-
return openBlock(), createElementBlock("rect", {
|
|
15833
|
-
key: index,
|
|
15834
|
-
ref_for: true,
|
|
15835
|
-
ref_key: "handlesRef",
|
|
15836
|
-
ref: handlesRef,
|
|
15837
|
-
x: handle.x,
|
|
15838
|
-
y: handle.y,
|
|
15839
|
-
width: handle.width,
|
|
15840
|
-
height: handle.height,
|
|
15841
|
-
"aria-label": handle.type,
|
|
15842
|
-
class: "mce-transform-controls__handle-rect",
|
|
15843
|
-
cursor: transforming.value ? "auto" : getCursor(handle.type),
|
|
15844
|
-
onPointerdown: (event) => start(event, index)
|
|
15845
|
-
}, null, 40, _hoisted_9);
|
|
15846
|
-
}), 128))
|
|
15847
|
-
]),
|
|
15848
|
-
createElementVNode("g", _hoisted_10, [
|
|
15849
|
-
renderSlot(_ctx.$slots, "svg", { box: model.value })
|
|
15850
|
-
])
|
|
15851
|
-
])),
|
|
15852
|
-
tip.value ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(tip.value), 1)) : createCommentVNode("", true)
|
|
16105
|
+
unref(elementSelection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
|
|
15853
16106
|
]),
|
|
15854
16107
|
_: 3
|
|
15855
|
-
}, 8, ["
|
|
16108
|
+
}, 8, ["content-style", "location", "middlewares", "offset", "target"]);
|
|
15856
16109
|
};
|
|
15857
16110
|
}
|
|
15858
16111
|
});
|
|
15859
|
-
const _hoisted_1$
|
|
16112
|
+
const _hoisted_1$4 = { class: "mce-cropper" };
|
|
15860
16113
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
15861
16114
|
__name: "Cropper",
|
|
15862
16115
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -15995,7 +16248,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
15995
16248
|
ok();
|
|
15996
16249
|
}
|
|
15997
16250
|
return (_ctx, _cache) => {
|
|
15998
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
16251
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
15999
16252
|
createElementVNode("div", {
|
|
16000
16253
|
class: "mce-cropper__source",
|
|
16001
16254
|
style: normalizeStyle$1(sourceStyle.value)
|
|
@@ -16005,7 +16258,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
16005
16258
|
ref: canvasRef
|
|
16006
16259
|
}, null, 512)
|
|
16007
16260
|
], 4),
|
|
16008
|
-
createVNode(_sfc_main$
|
|
16261
|
+
createVNode(_sfc_main$k, {
|
|
16009
16262
|
modelValue: sourceTransform.value,
|
|
16010
16263
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
|
|
16011
16264
|
class: "mce-cropper__transformable",
|
|
@@ -16050,6 +16303,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
16050
16303
|
};
|
|
16051
16304
|
}
|
|
16052
16305
|
});
|
|
16306
|
+
const _hoisted_1$3 = { class: "mce-selector" };
|
|
16053
16307
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
16054
16308
|
...{
|
|
16055
16309
|
inheritAttrs: false
|
|
@@ -16303,11 +16557,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16303
16557
|
transformable
|
|
16304
16558
|
});
|
|
16305
16559
|
return (_ctx, _cache) => {
|
|
16306
|
-
return openBlock(), createElementBlock(
|
|
16560
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
16307
16561
|
(openBlock(true), createElementBlock(Fragment, null, renderList(parentObbStyles.value, (style, index) => {
|
|
16308
16562
|
return openBlock(), createElementBlock("div", {
|
|
16309
16563
|
key: index,
|
|
16310
|
-
class: "mce-selector__parent
|
|
16564
|
+
class: "mce-selector__parent",
|
|
16311
16565
|
style: normalizeStyle$1({
|
|
16312
16566
|
borderColor: "currentColor",
|
|
16313
16567
|
...style
|
|
@@ -16317,7 +16571,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16317
16571
|
unref(state) !== "transforming" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selectionObbStyles.value, (style, index) => {
|
|
16318
16572
|
return openBlock(), createElementBlock("div", {
|
|
16319
16573
|
key: index,
|
|
16320
|
-
class: "mce-
|
|
16574
|
+
class: "mce-selector__node",
|
|
16321
16575
|
style: normalizeStyle$1({
|
|
16322
16576
|
borderColor: "currentcolor",
|
|
16323
16577
|
...style
|
|
@@ -16326,13 +16580,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16326
16580
|
}), 128)) : createCommentVNode("", true),
|
|
16327
16581
|
unref(state) === "selecting" ? (openBlock(), createElementBlock("div", {
|
|
16328
16582
|
key: 1,
|
|
16329
|
-
class: "mce-
|
|
16583
|
+
class: "mce-selector__area",
|
|
16330
16584
|
style: normalizeStyle$1({
|
|
16331
16585
|
borderColor: "currentcolor",
|
|
16332
16586
|
...props.selectedArea.toCssStyle()
|
|
16333
16587
|
})
|
|
16334
16588
|
}, null, 4)) : createCommentVNode("", true),
|
|
16335
|
-
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$
|
|
16589
|
+
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
16336
16590
|
key: 2,
|
|
16337
16591
|
ref: "transformableTpl"
|
|
16338
16592
|
}, unref(config).transformControls, {
|
|
@@ -16364,7 +16618,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16364
16618
|
}, [
|
|
16365
16619
|
renderSlot(_ctx.$slots, "default", { box: transform.value })
|
|
16366
16620
|
], 4)) : createCommentVNode("", true)
|
|
16367
|
-
]
|
|
16621
|
+
]);
|
|
16368
16622
|
};
|
|
16369
16623
|
}
|
|
16370
16624
|
});
|
|
@@ -16396,7 +16650,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
16396
16650
|
isActive
|
|
16397
16651
|
};
|
|
16398
16652
|
return (_ctx, _cache) => {
|
|
16399
|
-
return openBlock(), createBlock(_sfc_main$
|
|
16653
|
+
return openBlock(), createBlock(_sfc_main$k, {
|
|
16400
16654
|
modelValue: transform.value,
|
|
16401
16655
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
|
|
16402
16656
|
class: "mce-float-panel",
|
|
@@ -16408,12 +16662,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
16408
16662
|
createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
|
|
16409
16663
|
__props.title ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
16410
16664
|
createElementVNode("div", null, toDisplayString(__props.title), 1),
|
|
16411
|
-
createVNode(_sfc_main$
|
|
16665
|
+
createVNode(_sfc_main$z, {
|
|
16412
16666
|
icon: "",
|
|
16413
16667
|
onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
|
|
16414
16668
|
}, {
|
|
16415
16669
|
default: withCtx(() => [
|
|
16416
|
-
createVNode(unref(_sfc_main$
|
|
16670
|
+
createVNode(unref(_sfc_main$D), { icon: "$close" })
|
|
16417
16671
|
]),
|
|
16418
16672
|
_: 1
|
|
16419
16673
|
})
|
|
@@ -17037,7 +17291,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
17037
17291
|
_: 3
|
|
17038
17292
|
}, 8, ["selected-area", "resize-strategy"]),
|
|
17039
17293
|
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
17040
|
-
slots.floatbar ? (openBlock(), createBlock(_sfc_main$
|
|
17294
|
+
slots.floatbar ? (openBlock(), createBlock(_sfc_main$a, {
|
|
17041
17295
|
key: 0,
|
|
17042
17296
|
location: "top-start",
|
|
17043
17297
|
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
@@ -17048,7 +17302,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
17048
17302
|
]),
|
|
17049
17303
|
_: 3
|
|
17050
17304
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
17051
|
-
slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$
|
|
17305
|
+
slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$a, {
|
|
17052
17306
|
key: 1,
|
|
17053
17307
|
location: "top-start",
|
|
17054
17308
|
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
@@ -17059,7 +17313,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
17059
17313
|
]),
|
|
17060
17314
|
_: 3
|
|
17061
17315
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
17062
|
-
slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$
|
|
17316
|
+
slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$a, {
|
|
17063
17317
|
key: 2,
|
|
17064
17318
|
location: "bottom-start",
|
|
17065
17319
|
target: selector.value?.transformable?.$el,
|
|
@@ -17157,7 +17411,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
17157
17411
|
updateLocation
|
|
17158
17412
|
});
|
|
17159
17413
|
return (_ctx, _cache) => {
|
|
17160
|
-
return openBlock(), createBlock(_sfc_main$
|
|
17414
|
+
return openBlock(), createBlock(_sfc_main$v, {
|
|
17161
17415
|
ref: "overlayTpl",
|
|
17162
17416
|
modelValue: isActive.value,
|
|
17163
17417
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
@@ -17185,10 +17439,10 @@ export {
|
|
|
17185
17439
|
_sfc_main as Dialog,
|
|
17186
17440
|
Doc,
|
|
17187
17441
|
Editor,
|
|
17188
|
-
_sfc_main$
|
|
17442
|
+
_sfc_main$x as EditorLayers,
|
|
17189
17443
|
_sfc_main$1 as EditorLayout,
|
|
17190
17444
|
_sfc_main$4 as EditorLayoutItem,
|
|
17191
|
-
_sfc_main$
|
|
17445
|
+
_sfc_main$b as EditorToolbelt,
|
|
17192
17446
|
IconsSymbol,
|
|
17193
17447
|
MceLayerItemKey,
|
|
17194
17448
|
MceLayerKey,
|
|
@@ -17196,12 +17450,12 @@ export {
|
|
|
17196
17450
|
MceLayoutKey,
|
|
17197
17451
|
MceMenuSymbol,
|
|
17198
17452
|
MceOverlaySymbol,
|
|
17199
|
-
_sfc_main$
|
|
17453
|
+
_sfc_main$u as Menu,
|
|
17200
17454
|
Model,
|
|
17201
|
-
_sfc_main$
|
|
17455
|
+
_sfc_main$q as Ruler,
|
|
17202
17456
|
SUPPORTS_CLIPBOARD,
|
|
17203
|
-
_sfc_main$
|
|
17204
|
-
_sfc_main$
|
|
17457
|
+
_sfc_main$o as Scrollbar,
|
|
17458
|
+
_sfc_main$k as TransformControls,
|
|
17205
17459
|
USER_AGENT,
|
|
17206
17460
|
boundingBoxToStyle,
|
|
17207
17461
|
consoleError,
|