mce 0.15.25 → 0.15.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Floatbar.vue.d.ts +7 -9
- package/dist/components/Selector.vue.d.ts +33 -31
- package/dist/components/shared/Dialog.vue.d.ts +4 -0
- package/dist/components/shared/Menu.vue.d.ts +6 -0
- package/dist/components/shared/Overlay.vue.d.ts +4 -0
- package/dist/components/shared/Tooltip.vue.d.ts +4 -0
- package/dist/components/shared/{Transformable.vue.d.ts → TransformControls.vue.d.ts} +4 -4
- package/dist/composables/icons.d.ts +20 -0
- package/dist/composables/layer.d.ts +2 -0
- package/dist/composables/overlay.d.ts +11 -1
- package/dist/index.css +64 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.js +436 -272
- package/dist/mixins/0.config/base.d.ts +8 -4
- package/dist/mixins/1.screen.d.ts +2 -1
- package/dist/mixins/scroll.d.ts +4 -0
- package/dist/plugins/transform.d.ts +6 -0
- package/dist/plugins/ui.d.ts +2 -1
- package/dist/plugins/zoom.d.ts +0 -2
- package/dist/typed-plugins.d.ts +0 -1
- package/package.json +1 -1
- package/dist/plugins/enter.d.ts +0 -12
package/dist/index.js
CHANGED
|
@@ -123,7 +123,7 @@ const _0_config_base = defineMixin((editor, options) => {
|
|
|
123
123
|
registerConfig("frameOutline", false);
|
|
124
124
|
registerConfig("frameGap", 48);
|
|
125
125
|
registerConfig("typographyStrategy", "autoHeight");
|
|
126
|
-
registerConfig("
|
|
126
|
+
registerConfig("transformControls", {});
|
|
127
127
|
registerConfig("screenCenterOffset", { left: 0, top: 0, bottom: 0, right: 0 });
|
|
128
128
|
registerConfig("localDb", false);
|
|
129
129
|
return () => {
|
|
@@ -1815,22 +1815,36 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1815
1815
|
config,
|
|
1816
1816
|
drawboardAabb
|
|
1817
1817
|
} = editor;
|
|
1818
|
-
const
|
|
1818
|
+
const screenControlsOffset = computed(() => {
|
|
1819
1819
|
const offset2 = {
|
|
1820
1820
|
left: 0,
|
|
1821
1821
|
top: 0,
|
|
1822
1822
|
bottom: 0,
|
|
1823
|
-
right: 0
|
|
1824
|
-
...config.value.screenCenterOffset
|
|
1823
|
+
right: 0
|
|
1825
1824
|
};
|
|
1826
|
-
if (config.value.scrollbar) {
|
|
1827
|
-
offset2.right += 8;
|
|
1828
|
-
offset2.bottom += 8;
|
|
1829
|
-
}
|
|
1830
1825
|
if (config.value.ruler) {
|
|
1831
1826
|
offset2.left += 16;
|
|
1832
1827
|
offset2.top += 16;
|
|
1833
1828
|
}
|
|
1829
|
+
if (config.value.scrollbar) {
|
|
1830
|
+
offset2.right += 8;
|
|
1831
|
+
offset2.bottom += 8;
|
|
1832
|
+
}
|
|
1833
|
+
return offset2;
|
|
1834
|
+
});
|
|
1835
|
+
const screenCenterOffset = computed(() => {
|
|
1836
|
+
const _screenControlsOffset = screenControlsOffset.value;
|
|
1837
|
+
const offset2 = {
|
|
1838
|
+
left: 0,
|
|
1839
|
+
top: 0,
|
|
1840
|
+
bottom: 0,
|
|
1841
|
+
right: 0,
|
|
1842
|
+
...config.value.screenCenterOffset
|
|
1843
|
+
};
|
|
1844
|
+
offset2.left += _screenControlsOffset.left;
|
|
1845
|
+
offset2.top += _screenControlsOffset.top;
|
|
1846
|
+
offset2.right += _screenControlsOffset.right;
|
|
1847
|
+
offset2.bottom += _screenControlsOffset.bottom;
|
|
1834
1848
|
return offset2;
|
|
1835
1849
|
});
|
|
1836
1850
|
const screenCenter = computed(() => {
|
|
@@ -1841,6 +1855,7 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1841
1855
|
};
|
|
1842
1856
|
});
|
|
1843
1857
|
Object.assign(editor, {
|
|
1858
|
+
screenControlsOffset,
|
|
1844
1859
|
screenCenterOffset,
|
|
1845
1860
|
screenCenter
|
|
1846
1861
|
});
|
|
@@ -1937,7 +1952,8 @@ const _2_box = defineMixin((editor) => {
|
|
|
1937
1952
|
root,
|
|
1938
1953
|
selection,
|
|
1939
1954
|
getAncestorFrame,
|
|
1940
|
-
drawboardAabb
|
|
1955
|
+
drawboardAabb,
|
|
1956
|
+
screenControlsOffset
|
|
1941
1957
|
} = editor;
|
|
1942
1958
|
function obbToFit(element) {
|
|
1943
1959
|
const min = {
|
|
@@ -2120,15 +2136,18 @@ const _2_box = defineMixin((editor) => {
|
|
|
2120
2136
|
return _aabb;
|
|
2121
2137
|
}
|
|
2122
2138
|
const viewportAabb = computed(() => {
|
|
2139
|
+
const _camera = camera.value;
|
|
2140
|
+
const { position, zoom } = _camera;
|
|
2123
2141
|
noop(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2142
|
+
position.x,
|
|
2143
|
+
position.y,
|
|
2144
|
+
zoom.x,
|
|
2145
|
+
zoom.y
|
|
2128
2146
|
);
|
|
2147
|
+
const { left, top, right, bottom } = screenControlsOffset.value;
|
|
2129
2148
|
const { width, height } = drawboardAabb.value;
|
|
2130
|
-
const p1 =
|
|
2131
|
-
const p2 =
|
|
2149
|
+
const p1 = _camera.toGlobal({ x: left, y: top });
|
|
2150
|
+
const p2 = _camera.toGlobal({ x: width - (right + left), y: height - (bottom + top) });
|
|
2132
2151
|
return new Aabb2D({
|
|
2133
2152
|
x: p1.x,
|
|
2134
2153
|
y: p1.y,
|
|
@@ -3924,7 +3943,8 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3924
3943
|
selectionAabb,
|
|
3925
3944
|
rootAabb,
|
|
3926
3945
|
viewportAabb,
|
|
3927
|
-
screenCenter
|
|
3946
|
+
screenCenter,
|
|
3947
|
+
screenCenterOffset
|
|
3928
3948
|
} = editor;
|
|
3929
3949
|
const scrollTo = async (target, options = {}) => {
|
|
3930
3950
|
const {
|
|
@@ -3933,12 +3953,20 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3933
3953
|
duration = 500
|
|
3934
3954
|
} = options;
|
|
3935
3955
|
const _camera = camera.value;
|
|
3956
|
+
const { position: _position, zoom } = _camera;
|
|
3957
|
+
const oldPosition = { x: _position.x, y: _position.y };
|
|
3936
3958
|
const _screenCenter = screenCenter.value;
|
|
3937
3959
|
const offset2 = { x: 0, y: 0 };
|
|
3938
|
-
let
|
|
3939
|
-
if (typeof target === "object"
|
|
3940
|
-
|
|
3941
|
-
|
|
3960
|
+
let targetPosition = {};
|
|
3961
|
+
if (typeof target === "object") {
|
|
3962
|
+
if ("x" in target) {
|
|
3963
|
+
targetPosition.x = target.x;
|
|
3964
|
+
offset2.x = -screenCenterOffset.value.left;
|
|
3965
|
+
}
|
|
3966
|
+
if ("y" in target) {
|
|
3967
|
+
targetPosition.y = target.y;
|
|
3968
|
+
offset2.y = -screenCenterOffset.value.top;
|
|
3969
|
+
}
|
|
3942
3970
|
} else {
|
|
3943
3971
|
let aabb;
|
|
3944
3972
|
if (Array.isArray(target)) {
|
|
@@ -3957,15 +3985,22 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3957
3985
|
if (intoView && viewportAabb.value.contains(aabb)) {
|
|
3958
3986
|
return;
|
|
3959
3987
|
}
|
|
3960
|
-
|
|
3988
|
+
targetPosition = { x: aabb.left + aabb.width / 2, y: aabb.top + aabb.height / 2 };
|
|
3961
3989
|
offset2.x += -_screenCenter.x;
|
|
3962
3990
|
offset2.y = -_screenCenter.y;
|
|
3963
3991
|
}
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3992
|
+
if (targetPosition.x !== void 0) {
|
|
3993
|
+
targetPosition.x *= zoom.x;
|
|
3994
|
+
targetPosition.x += offset2.x;
|
|
3995
|
+
}
|
|
3996
|
+
if (targetPosition.y !== void 0) {
|
|
3997
|
+
targetPosition.y *= zoom.y;
|
|
3998
|
+
targetPosition.y += offset2.y;
|
|
3999
|
+
}
|
|
4000
|
+
const position = {
|
|
4001
|
+
...oldPosition,
|
|
4002
|
+
...targetPosition
|
|
4003
|
+
};
|
|
3969
4004
|
switch (behavior) {
|
|
3970
4005
|
case "smooth":
|
|
3971
4006
|
await new Promise((resolve) => {
|
|
@@ -3978,7 +4013,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3978
4013
|
const elapsed = now - startTime;
|
|
3979
4014
|
const progress = Math.min(elapsed / duration, 1);
|
|
3980
4015
|
const ease = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
|
|
3981
|
-
|
|
4016
|
+
_position.set(
|
|
3982
4017
|
oldPosition.x + positionDistance.x * ease,
|
|
3983
4018
|
oldPosition.y + positionDistance.y * ease
|
|
3984
4019
|
);
|
|
@@ -3993,7 +4028,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3993
4028
|
break;
|
|
3994
4029
|
case "instant":
|
|
3995
4030
|
default:
|
|
3996
|
-
|
|
4031
|
+
_position.set(position.x, position.y);
|
|
3997
4032
|
break;
|
|
3998
4033
|
}
|
|
3999
4034
|
};
|
|
@@ -4722,33 +4757,6 @@ const _edit = definePlugin((editor, options) => {
|
|
|
4722
4757
|
}
|
|
4723
4758
|
};
|
|
4724
4759
|
});
|
|
4725
|
-
const _enter = definePlugin((editor) => {
|
|
4726
|
-
const {
|
|
4727
|
-
selection,
|
|
4728
|
-
isElement,
|
|
4729
|
-
exec
|
|
4730
|
-
} = editor;
|
|
4731
|
-
async function _enter2() {
|
|
4732
|
-
if (selection.value.length === 1) {
|
|
4733
|
-
const node = selection.value[0];
|
|
4734
|
-
if (isElement(node)) {
|
|
4735
|
-
if (node.text.isValid()) {
|
|
4736
|
-
await exec("startTyping");
|
|
4737
|
-
}
|
|
4738
|
-
}
|
|
4739
|
-
}
|
|
4740
|
-
}
|
|
4741
|
-
const when = () => Boolean(selection.value.length > 0);
|
|
4742
|
-
return {
|
|
4743
|
-
name: "mce:enter",
|
|
4744
|
-
commands: [
|
|
4745
|
-
{ command: "enter", handle: _enter2 }
|
|
4746
|
-
],
|
|
4747
|
-
hotkeys: [
|
|
4748
|
-
{ command: "enter", key: ["Enter"], when }
|
|
4749
|
-
]
|
|
4750
|
-
};
|
|
4751
|
-
});
|
|
4752
4760
|
function makeIconProps() {
|
|
4753
4761
|
return {
|
|
4754
4762
|
icon: {
|
|
@@ -4837,6 +4845,7 @@ const aliases = {
|
|
|
4837
4845
|
mouseLeftClick: "M13 9V1.07A8.01 8.01 0 0 1 19.75 7c.16.64.25 1.31.25 2zm4.66-2c-.48-1.35-1.43-2.5-2.66-3.19V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4zm7-6V1.07C7.06 1.56 4 4.92 4 9z",
|
|
4838
4846
|
mouseRightClick: "M13 9V1.07c3.94.49 7 3.85 7 7.93zm-2 0V1.07A8.01 8.01 0 0 0 4.25 7C4.09 7.64 4 8.31 4 9zM6.34 7C6.82 5.65 7.78 4.5 9 3.81V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4z",
|
|
4839
4847
|
check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
|
|
4848
|
+
collapse: "m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z",
|
|
4840
4849
|
frame: "M17 9v6H7V9zm2-6h-2v3h2zM7 3H5v3h2zm16 4h-3v2h3zm-4 0H5v10h14zM4 7H1v2h3zm19 8h-3v2h3zM4 15H1v2h3zm15 3h-2v3h2zM7 18H5v3h2z",
|
|
4841
4850
|
group: "M10 22q-.825 0-1.412-.587T8 20v-4H4q-.825 0-1.412-.587T2 14V4q0-.825.588-1.412T4 2h10q.825 0 1.413.588T16 4v4h4q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22zm0-2h10V10h-6V4H4v10h6zm2-8",
|
|
4842
4851
|
shape: "M8 17.95q.25.025.488.038T9 18t.513-.012t.487-.038V20h10V10h-2.05q.025-.25.038-.488T18 9t-.012-.513T17.95 8H20q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22H10q-.825 0-1.412-.587T8 20zM9 16q-2.925 0-4.962-2.037T2 9t2.038-4.962T9 2t4.963 2.038T16 9t-2.037 4.963T9 16m0-2q2.075 0 3.538-1.463T14 9t-1.463-3.537T9 4T5.463 5.463T4 9t1.463 3.538T9 14m0-5",
|
|
@@ -4937,6 +4946,7 @@ function createLayer() {
|
|
|
4937
4946
|
}
|
|
4938
4947
|
provide(MceLayerKey, {
|
|
4939
4948
|
selecting,
|
|
4949
|
+
openedItems,
|
|
4940
4950
|
dragging,
|
|
4941
4951
|
droppingItemId,
|
|
4942
4952
|
register: (vm, item) => {
|
|
@@ -5318,7 +5328,9 @@ const makeMceOverlayProps = propsFactory({
|
|
|
5318
5328
|
attach: {
|
|
5319
5329
|
type: [String, Boolean, Object],
|
|
5320
5330
|
default: void 0
|
|
5321
|
-
}
|
|
5331
|
+
},
|
|
5332
|
+
contentClass: Object,
|
|
5333
|
+
contentStyle: Object
|
|
5322
5334
|
}, "makeMceOverlayProps");
|
|
5323
5335
|
let globalOverlayRoot;
|
|
5324
5336
|
function getGlobalOverlayRoot() {
|
|
@@ -6091,13 +6103,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6091
6103
|
dragging,
|
|
6092
6104
|
dropping,
|
|
6093
6105
|
onMousedown,
|
|
6094
|
-
id
|
|
6106
|
+
id,
|
|
6107
|
+
openedItems
|
|
6095
6108
|
} = useLayerItem({
|
|
6096
6109
|
opened,
|
|
6097
6110
|
node: computed(() => props.node),
|
|
6098
6111
|
dom: computed(() => dom.value)
|
|
6099
6112
|
});
|
|
6100
|
-
const
|
|
6113
|
+
const selected = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
6101
6114
|
const children = computed(() => props.node.children);
|
|
6102
6115
|
const childrenLength = computed(() => children.value.length);
|
|
6103
6116
|
const inputDom = ref();
|
|
@@ -6250,7 +6263,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6250
6263
|
ref: dom,
|
|
6251
6264
|
class: normalizeClass(["mce-layer", [
|
|
6252
6265
|
props.root && "mce-layer--root",
|
|
6253
|
-
(__props.active ||
|
|
6266
|
+
(__props.active || selected.value) && "mce-layer--active",
|
|
6267
|
+
selected.value && "mce-layer--selected",
|
|
6254
6268
|
opened.value && "mce-layer--open",
|
|
6255
6269
|
isHoverElement.value && "mce-layer--hover",
|
|
6256
6270
|
unref(dropping) && "mce-layer--dropping"
|
|
@@ -6264,12 +6278,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6264
6278
|
onMouseleave,
|
|
6265
6279
|
onContextmenu
|
|
6266
6280
|
}, [
|
|
6267
|
-
_cache[
|
|
6268
|
-
_cache[
|
|
6281
|
+
_cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
|
|
6282
|
+
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
6269
6283
|
createElementVNode("div", _hoisted_2$c, [
|
|
6270
6284
|
createElementVNode("div", _hoisted_3$b, [
|
|
6271
6285
|
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
|
|
6272
6286
|
key: 0,
|
|
6287
|
+
class: "mce-layer__arrow",
|
|
6273
6288
|
icon: "$arrowRight",
|
|
6274
6289
|
onClick: onClickExpand,
|
|
6275
6290
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
@@ -6312,13 +6327,29 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6312
6327
|
"mce-layer__action--show": hovering.value || unref(isLock)(props.node) || !unref(isVisible)(props.node)
|
|
6313
6328
|
}])
|
|
6314
6329
|
}, [
|
|
6315
|
-
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6330
|
+
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6331
|
+
Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$y, {
|
|
6332
|
+
key: 0,
|
|
6333
|
+
icon: "",
|
|
6334
|
+
class: "mce-layer__btn mce-layer__btn--show",
|
|
6335
|
+
onMousedown: _cache[2] || (_cache[2] = withModifiers(($event) => unref(openedItems).forEach((item, _id) => {
|
|
6336
|
+
if (_id !== unref(id)) {
|
|
6337
|
+
item.value = false;
|
|
6338
|
+
}
|
|
6339
|
+
}), ["prevent", "stop"]))
|
|
6340
|
+
}, {
|
|
6341
|
+
default: withCtx(() => [
|
|
6342
|
+
createVNode(unref(_sfc_main$C), { icon: "$collapse" })
|
|
6343
|
+
]),
|
|
6344
|
+
_: 1
|
|
6345
|
+
})) : createCommentVNode("", true)
|
|
6346
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6316
6347
|
createVNode(_sfc_main$y, {
|
|
6317
6348
|
icon: "",
|
|
6318
6349
|
class: normalizeClass(["mce-layer__btn", {
|
|
6319
6350
|
"mce-layer__btn--show": unref(isLock)(props.node)
|
|
6320
6351
|
}]),
|
|
6321
|
-
onClick: _cache[
|
|
6352
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
6322
6353
|
}, {
|
|
6323
6354
|
default: withCtx(() => [
|
|
6324
6355
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6332,7 +6363,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6332
6363
|
class: normalizeClass(["mce-layer__btn", {
|
|
6333
6364
|
"mce-layer__btn--show": !unref(isVisible)(props.node)
|
|
6334
6365
|
}]),
|
|
6335
|
-
onClick: _cache[
|
|
6366
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
6336
6367
|
}, {
|
|
6337
6368
|
default: withCtx(() => [
|
|
6338
6369
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6350,7 +6381,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6350
6381
|
key: i,
|
|
6351
6382
|
node: children.value[childrenLength.value - i],
|
|
6352
6383
|
indent: __props.root ? props.indent : props.indent + 1,
|
|
6353
|
-
active: __props.active ||
|
|
6384
|
+
active: __props.active || selected.value
|
|
6354
6385
|
}, null, 8, ["node", "indent", "active"]);
|
|
6355
6386
|
}), 128)) : createCommentVNode("", true)
|
|
6356
6387
|
], 64);
|
|
@@ -6513,7 +6544,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6513
6544
|
}
|
|
6514
6545
|
};
|
|
6515
6546
|
const target = computed(() => {
|
|
6516
|
-
if (typeof props.target === "object" && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6547
|
+
if (typeof props.target === "object" && !("getBoundingClientRect" in props.target) && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6517
6548
|
return virtualElement;
|
|
6518
6549
|
}
|
|
6519
6550
|
return props.target ?? activatorEl.value;
|
|
@@ -6527,15 +6558,20 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6527
6558
|
middleware: [
|
|
6528
6559
|
middlewares.has("offset") && offset(() => props.offset ?? 0),
|
|
6529
6560
|
middlewares.has("flip") && flip(),
|
|
6530
|
-
middlewares.has("shift") && shift({ padding: 20 })
|
|
6561
|
+
middlewares.has("shift") && shift({ crossAxis: true, padding: 20 })
|
|
6531
6562
|
].filter(Boolean)
|
|
6532
6563
|
});
|
|
6533
6564
|
const style = computed(() => {
|
|
6534
6565
|
return {
|
|
6535
|
-
...floatingStyles.value,
|
|
6536
6566
|
zIndex: 1500 + overlayItem.index.value
|
|
6537
6567
|
};
|
|
6538
6568
|
});
|
|
6569
|
+
const contentStyle = computed(() => {
|
|
6570
|
+
return {
|
|
6571
|
+
...floatingStyles.value,
|
|
6572
|
+
...props.contentStyle
|
|
6573
|
+
};
|
|
6574
|
+
});
|
|
6539
6575
|
const activatorProps = computed(() => {
|
|
6540
6576
|
return {
|
|
6541
6577
|
ref: (el) => activatorEl.value = el
|
|
@@ -6583,11 +6619,16 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6583
6619
|
}, [
|
|
6584
6620
|
isActive.value ? (openBlock(), createElementBlock("div", mergeProps({
|
|
6585
6621
|
key: 0,
|
|
6586
|
-
ref: "contentElTpl",
|
|
6587
6622
|
class: "mce-overlay",
|
|
6588
6623
|
style: style.value
|
|
6589
6624
|
}, _ctx.$attrs), [
|
|
6590
|
-
|
|
6625
|
+
createElementVNode("div", {
|
|
6626
|
+
ref: "contentElTpl",
|
|
6627
|
+
style: normalizeStyle$1(contentStyle.value),
|
|
6628
|
+
class: normalizeClass(["mce-overlay-content", props.contentClass])
|
|
6629
|
+
}, [
|
|
6630
|
+
renderSlot(_ctx.$slots, "default")
|
|
6631
|
+
], 6)
|
|
6591
6632
|
], 16)) : createCommentVNode("", true)
|
|
6592
6633
|
], 8, ["disabled", "to"]))
|
|
6593
6634
|
], 64);
|
|
@@ -6690,6 +6731,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6690
6731
|
}
|
|
6691
6732
|
__expose({
|
|
6692
6733
|
isActive,
|
|
6734
|
+
activatorEl: computed(() => overlay.value?.activatorEl),
|
|
6735
|
+
contentEl: computed(() => overlay.value?.contentEl),
|
|
6693
6736
|
updateLocation
|
|
6694
6737
|
});
|
|
6695
6738
|
return (_ctx, _cache) => {
|
|
@@ -6843,6 +6886,24 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6843
6886
|
const isActive = useModel(__props, "modelValue");
|
|
6844
6887
|
const position = useModel(__props, "position");
|
|
6845
6888
|
const menuRef = useTemplateRef("menuTplRef");
|
|
6889
|
+
const target = {
|
|
6890
|
+
getBoundingClientRect() {
|
|
6891
|
+
const box = menuRef.value?.contentEl?.getBoundingClientRect();
|
|
6892
|
+
const { x, y } = position.value;
|
|
6893
|
+
const width = 0;
|
|
6894
|
+
const height = box?.height ?? 0;
|
|
6895
|
+
return {
|
|
6896
|
+
x,
|
|
6897
|
+
y,
|
|
6898
|
+
left: x,
|
|
6899
|
+
top: y,
|
|
6900
|
+
bottom: x + height,
|
|
6901
|
+
right: y + width,
|
|
6902
|
+
width,
|
|
6903
|
+
height
|
|
6904
|
+
};
|
|
6905
|
+
}
|
|
6906
|
+
};
|
|
6846
6907
|
onBeforeMount(() => {
|
|
6847
6908
|
registerCommand({ command: "openContextMenu", handle: onContextmenu });
|
|
6848
6909
|
});
|
|
@@ -6888,14 +6949,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6888
6949
|
ref: "menuTplRef",
|
|
6889
6950
|
modelValue: isActive.value,
|
|
6890
6951
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
6891
|
-
offset: 10,
|
|
6892
6952
|
class: "mce-context-menu",
|
|
6893
|
-
|
|
6894
|
-
|
|
6953
|
+
offset: 10,
|
|
6954
|
+
target,
|
|
6955
|
+
location: "right-start",
|
|
6895
6956
|
items: unref(contextMenu),
|
|
6896
6957
|
style: normalizeStyle$1({
|
|
6897
|
-
|
|
6958
|
+
"--max-height": `${unref(drawboardAabb).height * 0.8}px`
|
|
6898
6959
|
}),
|
|
6960
|
+
middlewares: ["offset", "shift"],
|
|
6899
6961
|
"onClick:item": onClickItem
|
|
6900
6962
|
}, {
|
|
6901
6963
|
title: withCtx(({ item }) => [
|
|
@@ -6907,7 +6969,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6907
6969
|
], 64)) : createCommentVNode("", true)
|
|
6908
6970
|
]),
|
|
6909
6971
|
_: 1
|
|
6910
|
-
}, 8, ["modelValue", "
|
|
6972
|
+
}, 8, ["modelValue", "items", "style"]);
|
|
6911
6973
|
};
|
|
6912
6974
|
}
|
|
6913
6975
|
});
|
|
@@ -11514,7 +11576,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11514
11576
|
const props = __props;
|
|
11515
11577
|
const isActive = useModel(__props, "modelValue");
|
|
11516
11578
|
const overlay = useTemplateRef("overlayTpl");
|
|
11517
|
-
const
|
|
11579
|
+
const contentClass = computed(() => {
|
|
11518
11580
|
const [side, align = "center"] = props.location.split("-");
|
|
11519
11581
|
return [
|
|
11520
11582
|
`mce-tooltip--side-${side}`,
|
|
@@ -11532,7 +11594,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11532
11594
|
ref: "overlayTpl",
|
|
11533
11595
|
modelValue: isActive.value,
|
|
11534
11596
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
11535
|
-
class:
|
|
11597
|
+
class: "mce-tooltip",
|
|
11598
|
+
"content-class": contentClass.value,
|
|
11536
11599
|
location: props.location,
|
|
11537
11600
|
offset: props.offset,
|
|
11538
11601
|
target: props.target,
|
|
@@ -11564,7 +11627,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11564
11627
|
]),
|
|
11565
11628
|
key: "0"
|
|
11566
11629
|
} : void 0
|
|
11567
|
-
]), 1032, ["modelValue", "class", "location", "offset", "target", "attach"]);
|
|
11630
|
+
]), 1032, ["modelValue", "content-class", "location", "offset", "target", "attach"]);
|
|
11568
11631
|
};
|
|
11569
11632
|
}
|
|
11570
11633
|
});
|
|
@@ -12111,6 +12174,36 @@ const _scroll = definePlugin((editor) => {
|
|
|
12111
12174
|
ignore: () => !config.value.scrollbar
|
|
12112
12175
|
}
|
|
12113
12176
|
]
|
|
12177
|
+
// setup: () => {
|
|
12178
|
+
// const {
|
|
12179
|
+
// viewportAabb,
|
|
12180
|
+
// getGlobalPointer,
|
|
12181
|
+
// state,
|
|
12182
|
+
// camera,
|
|
12183
|
+
// } = editor
|
|
12184
|
+
//
|
|
12185
|
+
// setInterval(() => {
|
|
12186
|
+
// if (state.value === 'transforming' || state.value === 'selecting') {
|
|
12187
|
+
// const _camera = camera.value
|
|
12188
|
+
// const { min, max } = viewportAabb.value
|
|
12189
|
+
// const { zoom } = _camera
|
|
12190
|
+
// const dist = 10 / zoom.x
|
|
12191
|
+
// const pointer = getGlobalPointer()
|
|
12192
|
+
// if (pointer.x - dist <= min.x) {
|
|
12193
|
+
// scrollTo({ x: min.x })
|
|
12194
|
+
// }
|
|
12195
|
+
// if (pointer.x + dist >= max.x) {
|
|
12196
|
+
// scrollTo({ x: max.x })
|
|
12197
|
+
// }
|
|
12198
|
+
// if (pointer.y - dist <= min.y) {
|
|
12199
|
+
// scrollTo({ y: min.y })
|
|
12200
|
+
// }
|
|
12201
|
+
// if (pointer.y + dist >= max.y) {
|
|
12202
|
+
// scrollTo({ y: max.y })
|
|
12203
|
+
// }
|
|
12204
|
+
// }
|
|
12205
|
+
// }, 100)
|
|
12206
|
+
// },
|
|
12114
12207
|
};
|
|
12115
12208
|
});
|
|
12116
12209
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
@@ -13760,9 +13853,9 @@ const _hoisted_5$2 = { class: "mce-statusbar__kbd" };
|
|
|
13760
13853
|
const _hoisted_6$2 = { class: "mce-statusbar__item" };
|
|
13761
13854
|
const _hoisted_7$2 = { class: "mce-statusbar__kbd" };
|
|
13762
13855
|
const _hoisted_8$1 = { class: "mce-statusbar__item" };
|
|
13763
|
-
const _hoisted_9 = { class: "mce-statusbar__item" };
|
|
13764
|
-
const _hoisted_10 = { class: "mce-statusbar__kbd" };
|
|
13765
|
-
const _hoisted_11 = { class: "mce-statusbar__item" };
|
|
13856
|
+
const _hoisted_9$1 = { class: "mce-statusbar__item" };
|
|
13857
|
+
const _hoisted_10$1 = { class: "mce-statusbar__kbd" };
|
|
13858
|
+
const _hoisted_11$1 = { class: "mce-statusbar__item" };
|
|
13766
13859
|
const _hoisted_12 = { class: "mce-statusbar__kbd" };
|
|
13767
13860
|
const _hoisted_13 = { key: 2 };
|
|
13768
13861
|
const _hoisted_14 = { class: "mce-statusbar__item" };
|
|
@@ -13804,12 +13897,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13804
13897
|
createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
|
|
13805
13898
|
]),
|
|
13806
13899
|
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
13807
|
-
createElementVNode("div", _hoisted_9, [
|
|
13808
|
-
createElementVNode("span", _hoisted_10, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
13900
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
13901
|
+
createElementVNode("span", _hoisted_10$1, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
13809
13902
|
createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
|
|
13810
13903
|
]),
|
|
13811
13904
|
_cache[3] || (_cache[3] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
13812
|
-
createElementVNode("div", _hoisted_11, [
|
|
13905
|
+
createElementVNode("div", _hoisted_11$1, [
|
|
13813
13906
|
createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
13814
13907
|
createElementVNode("span", null, toDisplayString(unref(t)("constrainToAxis")), 1)
|
|
13815
13908
|
])
|
|
@@ -14470,8 +14563,18 @@ const _toolbelt = definePlugin((editor) => {
|
|
|
14470
14563
|
});
|
|
14471
14564
|
const _transform = definePlugin((editor) => {
|
|
14472
14565
|
const {
|
|
14473
|
-
elementSelection
|
|
14566
|
+
elementSelection,
|
|
14567
|
+
exec
|
|
14474
14568
|
} = editor;
|
|
14569
|
+
async function _enter() {
|
|
14570
|
+
if (elementSelection.value.length === 1) {
|
|
14571
|
+
const element = elementSelection.value[0];
|
|
14572
|
+
if (element.text.isValid()) {
|
|
14573
|
+
await exec("startTyping");
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
}
|
|
14577
|
+
const when = () => Boolean(elementSelection.value.length > 0);
|
|
14475
14578
|
function flipHorizontal() {
|
|
14476
14579
|
elementSelection.value.forEach((el) => {
|
|
14477
14580
|
el.style.scaleX = -el.style.scaleX;
|
|
@@ -14485,18 +14588,40 @@ const _transform = definePlugin((editor) => {
|
|
|
14485
14588
|
return {
|
|
14486
14589
|
name: "mce:transform",
|
|
14487
14590
|
commands: [
|
|
14591
|
+
{ command: "enter", handle: _enter },
|
|
14488
14592
|
{ command: "flipHorizontal", handle: flipHorizontal },
|
|
14489
14593
|
{ command: "flipVertical", handle: flipVertical }
|
|
14490
14594
|
],
|
|
14491
14595
|
hotkeys: [
|
|
14596
|
+
{ command: "enter", key: ["Enter"], when },
|
|
14492
14597
|
{ command: "flipHorizontal", key: "Shift+H" },
|
|
14493
14598
|
{ command: "flipVertical", key: "Shift+V" }
|
|
14494
14599
|
]
|
|
14495
14600
|
};
|
|
14496
14601
|
});
|
|
14497
|
-
const _ui = definePlugin(() => {
|
|
14602
|
+
const _ui = definePlugin((editor) => {
|
|
14498
14603
|
return {
|
|
14499
|
-
name: "mce:ui"
|
|
14604
|
+
name: "mce:ui",
|
|
14605
|
+
setup: () => {
|
|
14606
|
+
const {
|
|
14607
|
+
drawboardDom,
|
|
14608
|
+
drawboardAabb,
|
|
14609
|
+
drawboardPointer,
|
|
14610
|
+
exec
|
|
14611
|
+
} = editor;
|
|
14612
|
+
useResizeObserver$1(drawboardDom, (entries) => {
|
|
14613
|
+
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
14614
|
+
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
14615
|
+
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
14616
|
+
exec("zoomToFit");
|
|
14617
|
+
});
|
|
14618
|
+
document.addEventListener("mousemove", (event) => {
|
|
14619
|
+
drawboardPointer.value = new Vector2$1(
|
|
14620
|
+
event.clientX - drawboardAabb.value.left,
|
|
14621
|
+
event.clientY - drawboardAabb.value.top
|
|
14622
|
+
);
|
|
14623
|
+
});
|
|
14624
|
+
}
|
|
14500
14625
|
};
|
|
14501
14626
|
});
|
|
14502
14627
|
const _url = definePlugin((editor) => {
|
|
@@ -14576,7 +14701,6 @@ const _zoom = definePlugin((editor) => {
|
|
|
14576
14701
|
const {
|
|
14577
14702
|
registerConfig,
|
|
14578
14703
|
camera,
|
|
14579
|
-
drawboardAabb,
|
|
14580
14704
|
zoomTo,
|
|
14581
14705
|
exec,
|
|
14582
14706
|
config,
|
|
@@ -14613,17 +14737,6 @@ const _zoom = definePlugin((editor) => {
|
|
|
14613
14737
|
],
|
|
14614
14738
|
events: {
|
|
14615
14739
|
setDoc: () => exec("zoomToFit")
|
|
14616
|
-
},
|
|
14617
|
-
setup: () => {
|
|
14618
|
-
const {
|
|
14619
|
-
drawboardDom
|
|
14620
|
-
} = editor;
|
|
14621
|
-
useResizeObserver$1(drawboardDom, (entries) => {
|
|
14622
|
-
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
14623
|
-
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
14624
|
-
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
14625
|
-
exec("zoomToFit");
|
|
14626
|
-
});
|
|
14627
14740
|
}
|
|
14628
14741
|
};
|
|
14629
14742
|
});
|
|
@@ -14634,7 +14747,6 @@ const plugins = [
|
|
|
14634
14747
|
_delete,
|
|
14635
14748
|
_drawingTool,
|
|
14636
14749
|
_edit,
|
|
14637
|
-
_enter,
|
|
14638
14750
|
_frame,
|
|
14639
14751
|
_gif,
|
|
14640
14752
|
_group,
|
|
@@ -14826,7 +14938,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14826
14938
|
__name: "Floatbar",
|
|
14827
14939
|
props: {
|
|
14828
14940
|
...makeMceOverlayProps({
|
|
14829
|
-
middlewares: ["offset", "shift"],
|
|
14830
14941
|
offset: 8
|
|
14831
14942
|
})
|
|
14832
14943
|
},
|
|
@@ -14843,11 +14954,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14843
14954
|
const aabb = selectionAabbInDrawboard.value;
|
|
14844
14955
|
if (location?.startsWith("top") || location?.startsWith("bottom")) {
|
|
14845
14956
|
return {
|
|
14846
|
-
|
|
14957
|
+
minWidth: `${aabb.width}px`
|
|
14847
14958
|
};
|
|
14848
14959
|
} else if (location?.startsWith("left") || location?.startsWith("right")) {
|
|
14849
14960
|
return {
|
|
14850
|
-
|
|
14961
|
+
minHeight: `${aabb.height}px`
|
|
14851
14962
|
};
|
|
14852
14963
|
}
|
|
14853
14964
|
return {};
|
|
@@ -14868,7 +14979,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14868
14979
|
return (_ctx, _cache) => {
|
|
14869
14980
|
return openBlock(), createBlock(_sfc_main$u, {
|
|
14870
14981
|
ref: "overlayTpl",
|
|
14871
|
-
style:
|
|
14982
|
+
"content-style": style.value,
|
|
14872
14983
|
class: "mce-floatbar",
|
|
14873
14984
|
location: props.location,
|
|
14874
14985
|
middlewares: props.middlewares,
|
|
@@ -14881,33 +14992,37 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14881
14992
|
unref(elementSelection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
|
|
14882
14993
|
]),
|
|
14883
14994
|
_: 3
|
|
14884
|
-
}, 8, ["style", "location", "middlewares", "offset", "target"]);
|
|
14995
|
+
}, 8, ["content-style", "location", "middlewares", "offset", "target"]);
|
|
14885
14996
|
};
|
|
14886
14997
|
}
|
|
14887
14998
|
});
|
|
14888
|
-
const _hoisted_1$4 = { class: "mce-
|
|
14999
|
+
const _hoisted_1$4 = { class: "mce-transform-controls__svg" };
|
|
14889
15000
|
const _hoisted_2$1 = ["rx", "ry"];
|
|
14890
|
-
const _hoisted_3$1 =
|
|
14891
|
-
const _hoisted_4 = ["
|
|
14892
|
-
const _hoisted_5 =
|
|
14893
|
-
const _hoisted_6 = ["x", "y", "width", "height", "aria-label", "
|
|
14894
|
-
const _hoisted_7 =
|
|
15001
|
+
const _hoisted_3$1 = { "pointer-events": "none" };
|
|
15002
|
+
const _hoisted_4 = ["x", "y", "width", "height", "aria-label"];
|
|
15003
|
+
const _hoisted_5 = ["cx", "cy", "r", "aria-label"];
|
|
15004
|
+
const _hoisted_6 = ["x", "y", "width", "height", "aria-label", "rx", "ry"];
|
|
15005
|
+
const _hoisted_7 = ["transform"];
|
|
15006
|
+
const _hoisted_8 = { "pointer-events": "all" };
|
|
15007
|
+
const _hoisted_9 = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"];
|
|
15008
|
+
const _hoisted_10 = {
|
|
14895
15009
|
"pointer-events": "all",
|
|
14896
|
-
class: "mce-
|
|
15010
|
+
class: "mce-transform-controls__svg-slot"
|
|
14897
15011
|
};
|
|
14898
|
-
const
|
|
15012
|
+
const _hoisted_11 = {
|
|
14899
15013
|
key: 0,
|
|
14900
|
-
class: "mce-
|
|
15014
|
+
class: "mce-transform-controls__tip"
|
|
14901
15015
|
};
|
|
14902
15016
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
14903
|
-
__name: "
|
|
15017
|
+
__name: "TransformControls",
|
|
14904
15018
|
props: {
|
|
14905
15019
|
tag: { default: "div" },
|
|
14906
15020
|
modelValue: {},
|
|
14907
15021
|
movable: { type: Boolean, default: true },
|
|
14908
15022
|
rotatable: { type: Boolean, default: true },
|
|
15023
|
+
rotator: { type: Boolean },
|
|
14909
15024
|
resizable: { type: Boolean, default: true },
|
|
14910
|
-
|
|
15025
|
+
roundable: { type: Boolean },
|
|
14911
15026
|
threshold: { default: 0 },
|
|
14912
15027
|
resizeStrategy: {},
|
|
14913
15028
|
handleStrategy: {},
|
|
@@ -14916,24 +15031,24 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14916
15031
|
handles: { default: () => [
|
|
14917
15032
|
"move",
|
|
14918
15033
|
// resize
|
|
14919
|
-
"resize-
|
|
14920
|
-
"resize-
|
|
14921
|
-
"resize-
|
|
14922
|
-
"resize-
|
|
14923
|
-
"resize-
|
|
14924
|
-
"resize-
|
|
14925
|
-
"resize-
|
|
14926
|
-
"resize-
|
|
14927
|
-
//
|
|
14928
|
-
"
|
|
14929
|
-
"
|
|
14930
|
-
"
|
|
14931
|
-
"
|
|
15034
|
+
"resize-l",
|
|
15035
|
+
"resize-t",
|
|
15036
|
+
"resize-r",
|
|
15037
|
+
"resize-b",
|
|
15038
|
+
"resize-tl",
|
|
15039
|
+
"resize-tr",
|
|
15040
|
+
"resize-br",
|
|
15041
|
+
"resize-bl",
|
|
15042
|
+
// round
|
|
15043
|
+
"round-tl",
|
|
15044
|
+
"round-tr",
|
|
15045
|
+
"round-bl",
|
|
15046
|
+
"round-br",
|
|
14932
15047
|
// rotate
|
|
14933
|
-
"rotate-
|
|
14934
|
-
"rotate-
|
|
14935
|
-
"rotate-
|
|
14936
|
-
"rotate-
|
|
15048
|
+
"rotate-tl",
|
|
15049
|
+
"rotate-tr",
|
|
15050
|
+
"rotate-bl",
|
|
15051
|
+
"rotate-br"
|
|
14937
15052
|
] },
|
|
14938
15053
|
initialSize: { type: Boolean },
|
|
14939
15054
|
borderStyle: {},
|
|
@@ -14944,18 +15059,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14944
15059
|
const props = __props;
|
|
14945
15060
|
const emit = __emit;
|
|
14946
15061
|
const cursors = {
|
|
14947
|
-
"rotate-
|
|
14948
|
-
"rotate-
|
|
14949
|
-
"rotate-
|
|
14950
|
-
"rotate-
|
|
14951
|
-
"resize-
|
|
14952
|
-
"resize-
|
|
14953
|
-
"resize-
|
|
14954
|
-
"resize-
|
|
14955
|
-
"resize-
|
|
14956
|
-
"resize-
|
|
14957
|
-
"resize-
|
|
14958
|
-
"resize-
|
|
15062
|
+
"rotate-tl": (angle) => createCursor("rotate", 360 + angle),
|
|
15063
|
+
"rotate-tr": (angle) => createCursor("rotate", 90 + angle),
|
|
15064
|
+
"rotate-bl": (angle) => createCursor("rotate", 270 + angle),
|
|
15065
|
+
"rotate-br": (angle) => createCursor("rotate", 180 + angle),
|
|
15066
|
+
"resize-l": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15067
|
+
"resize-t": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15068
|
+
"resize-r": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15069
|
+
"resize-b": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15070
|
+
"resize-tl": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15071
|
+
"resize-tr": (angle) => createCursor("resizeBevel", 180 + angle),
|
|
15072
|
+
"resize-br": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15073
|
+
"resize-bl": (angle) => createCursor("resizeBevel", 180 + angle)
|
|
14959
15074
|
};
|
|
14960
15075
|
const modelValue = useModel(props, "modelValue");
|
|
14961
15076
|
const model = computed({
|
|
@@ -14972,25 +15087,25 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14972
15087
|
const transforming = ref(false);
|
|
14973
15088
|
const activeHandle = ref();
|
|
14974
15089
|
const computedHandles = computed(() => {
|
|
14975
|
-
const
|
|
15090
|
+
const shape = props.handleShape;
|
|
15091
|
+
const size = shape === "rect" ? 8 : 10;
|
|
14976
15092
|
const { width = 0, height = 0, borderRadius } = model.value;
|
|
14977
15093
|
const center = { x: width / 2, y: height / 2 };
|
|
14978
|
-
const shape = props.handleShape;
|
|
14979
15094
|
const lines = [
|
|
14980
|
-
{ type: "
|
|
14981
|
-
{ type: "
|
|
14982
|
-
{ type: "
|
|
14983
|
-
{ type: "
|
|
15095
|
+
{ type: "t", points: [[0, 0], [1, 0]] },
|
|
15096
|
+
{ type: "r", points: [[1, 0], [1, 1]] },
|
|
15097
|
+
{ type: "b", points: [[0, 1], [1, 1]] },
|
|
15098
|
+
{ type: "l", points: [[0, 0], [0, 1]] }
|
|
14984
15099
|
];
|
|
14985
15100
|
const points = [
|
|
14986
|
-
{ type: "
|
|
14987
|
-
{ type: "
|
|
14988
|
-
{ type: "
|
|
14989
|
-
{ type: "
|
|
14990
|
-
{ type: "
|
|
14991
|
-
{ type: "
|
|
14992
|
-
{ type: "
|
|
14993
|
-
{ type: "
|
|
15101
|
+
{ type: "t", point: [0.5, 0], width: 1.4, height: 0.6 },
|
|
15102
|
+
{ type: "r", point: [1, 0.5], width: 0.6, height: 1.4 },
|
|
15103
|
+
{ type: "b", point: [0.5, 1], width: 1.4, height: 0.6 },
|
|
15104
|
+
{ type: "l", point: [0, 0.5], width: 0.6, height: 1.4 },
|
|
15105
|
+
{ type: "tl", point: [0, 0] },
|
|
15106
|
+
{ type: "tr", point: [1, 0] },
|
|
15107
|
+
{ type: "bl", point: [0, 1] },
|
|
15108
|
+
{ type: "br", point: [1, 1] }
|
|
14994
15109
|
];
|
|
14995
15110
|
const lineHandles = lines.map((item) => {
|
|
14996
15111
|
const [p1, p2] = item.points;
|
|
@@ -15007,31 +15122,47 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15007
15122
|
};
|
|
15008
15123
|
});
|
|
15009
15124
|
const pointHandles = points.map((item) => {
|
|
15125
|
+
const _w = size * (item.width ?? 1);
|
|
15126
|
+
const _h = size * (item.height ?? 1);
|
|
15010
15127
|
return {
|
|
15011
15128
|
type: item.type,
|
|
15012
15129
|
shape,
|
|
15013
|
-
x: item.point[0] * width -
|
|
15014
|
-
y: item.point[1] * height -
|
|
15015
|
-
width:
|
|
15016
|
-
height:
|
|
15130
|
+
x: item.point[0] * width - _w / 2,
|
|
15131
|
+
y: item.point[1] * height - _h / 2,
|
|
15132
|
+
width: _w,
|
|
15133
|
+
height: _h
|
|
15017
15134
|
};
|
|
15018
15135
|
});
|
|
15019
|
-
const diagonalPointHandles = pointHandles.filter((item) => item.type.
|
|
15136
|
+
const diagonalPointHandles = pointHandles.filter((item) => item.type.length === 2);
|
|
15020
15137
|
const rotateHandles = diagonalPointHandles.map((item) => {
|
|
15021
|
-
const
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15138
|
+
const _w = item.width * 1.5;
|
|
15139
|
+
const _h = item.height * 1.5;
|
|
15140
|
+
let x = item.x;
|
|
15141
|
+
let y = item.y;
|
|
15142
|
+
if (center.x > item.x) {
|
|
15143
|
+
x -= _w;
|
|
15144
|
+
} else {
|
|
15145
|
+
x += item.width;
|
|
15146
|
+
}
|
|
15147
|
+
if (center.y > item.y) {
|
|
15148
|
+
y -= _h;
|
|
15149
|
+
} else {
|
|
15150
|
+
y += item.height;
|
|
15151
|
+
}
|
|
15025
15152
|
return {
|
|
15026
15153
|
...item,
|
|
15027
15154
|
shape: void 0,
|
|
15028
15155
|
type: `rotate-${item.type}`,
|
|
15029
|
-
x
|
|
15030
|
-
y
|
|
15156
|
+
x,
|
|
15157
|
+
y,
|
|
15158
|
+
width: _w,
|
|
15159
|
+
height: _h
|
|
15031
15160
|
};
|
|
15032
15161
|
});
|
|
15033
15162
|
const minSize = Math.min(width, height);
|
|
15034
|
-
const
|
|
15163
|
+
const roundedHandles = props.roundable ? diagonalPointHandles.map((item) => {
|
|
15164
|
+
const _w = item.width * 0.8;
|
|
15165
|
+
const _h = item.height * 0.8;
|
|
15035
15166
|
const sign2 = {
|
|
15036
15167
|
x: center.x - item.x > 0 ? 1 : -1,
|
|
15037
15168
|
y: center.y - item.y > 0 ? 1 : -1
|
|
@@ -15042,9 +15173,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15042
15173
|
return {
|
|
15043
15174
|
...item,
|
|
15044
15175
|
shape: "circle",
|
|
15045
|
-
type: `
|
|
15176
|
+
type: `round-${item.type}`,
|
|
15046
15177
|
x: item.x + sign2.x * width / 2 * ws,
|
|
15047
|
-
y: item.y + sign2.y * height / 2 * hs
|
|
15178
|
+
y: item.y + sign2.y * height / 2 * hs,
|
|
15179
|
+
width: _w,
|
|
15180
|
+
height: _h
|
|
15048
15181
|
};
|
|
15049
15182
|
}) : [];
|
|
15050
15183
|
let handles;
|
|
@@ -15054,8 +15187,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15054
15187
|
...lineHandles.map((item) => ({ ...item, type: "move" })),
|
|
15055
15188
|
// resize
|
|
15056
15189
|
...pointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15057
|
-
//
|
|
15058
|
-
...
|
|
15190
|
+
// round
|
|
15191
|
+
...roundedHandles,
|
|
15059
15192
|
// rotate
|
|
15060
15193
|
...rotateHandles
|
|
15061
15194
|
];
|
|
@@ -15064,8 +15197,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15064
15197
|
// resize
|
|
15065
15198
|
...lineHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15066
15199
|
...diagonalPointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15067
|
-
//
|
|
15068
|
-
...
|
|
15200
|
+
// round
|
|
15201
|
+
...roundedHandles,
|
|
15069
15202
|
// rotate
|
|
15070
15203
|
...rotateHandles
|
|
15071
15204
|
];
|
|
@@ -15113,11 +15246,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15113
15246
|
}
|
|
15114
15247
|
const handle = index === void 0 ? { type: "move", x: 0, y: 0, width: 0, height: 0 } : computedHandles.value[index];
|
|
15115
15248
|
activeHandle.value = handle.type;
|
|
15116
|
-
const
|
|
15117
|
-
const
|
|
15118
|
-
const
|
|
15119
|
-
const
|
|
15120
|
-
const
|
|
15249
|
+
const handleArr = handle.type.split("-");
|
|
15250
|
+
const last = handleArr.length > 1 ? handleArr.pop() || "" : "";
|
|
15251
|
+
const key = handleArr.join("-");
|
|
15252
|
+
const isMove = key === "move";
|
|
15253
|
+
const isRotate = key === "rotate";
|
|
15254
|
+
const isRound = key === "round";
|
|
15255
|
+
const isHorizontal = last === "l" || last === "r";
|
|
15256
|
+
const isHorizontalVertical = last.length === 1;
|
|
15121
15257
|
const centerPoint = {
|
|
15122
15258
|
x: left + width / 2,
|
|
15123
15259
|
y: top + height / 2
|
|
@@ -15151,7 +15287,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15151
15287
|
if (!props.threshold && !transforming.value) {
|
|
15152
15288
|
startTransform();
|
|
15153
15289
|
}
|
|
15154
|
-
function
|
|
15290
|
+
function _onPointerMove(event2) {
|
|
15155
15291
|
const updated = {};
|
|
15156
15292
|
if (!startClientPoint) {
|
|
15157
15293
|
startClientPoint = { x: event2.clientX, y: event2.clientY };
|
|
@@ -15183,7 +15319,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15183
15319
|
) / (Math.PI / 180);
|
|
15184
15320
|
updated.rotate = (rotate + endAngle - startAngle + 360) % 360;
|
|
15185
15321
|
}
|
|
15186
|
-
} else if (
|
|
15322
|
+
} else if (isRound) {
|
|
15187
15323
|
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
15188
15324
|
const dx = -sign2.x * offset2.x;
|
|
15189
15325
|
const dy = -sign2.y * offset2.y;
|
|
@@ -15260,15 +15396,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15260
15396
|
model.value = newValue;
|
|
15261
15397
|
emit("move", newValue, oldValue);
|
|
15262
15398
|
}
|
|
15263
|
-
function
|
|
15264
|
-
window.removeEventListener("pointermove",
|
|
15265
|
-
window.removeEventListener("pointerup",
|
|
15399
|
+
function _onPointerUp() {
|
|
15400
|
+
window.removeEventListener("pointermove", _onPointerMove);
|
|
15401
|
+
window.removeEventListener("pointerup", _onPointerUp, true);
|
|
15266
15402
|
transforming.value = false;
|
|
15267
15403
|
activeHandle.value = void 0;
|
|
15268
15404
|
emit("end", model.value);
|
|
15269
15405
|
}
|
|
15270
|
-
window.addEventListener("pointermove",
|
|
15271
|
-
window.addEventListener("pointerup",
|
|
15406
|
+
window.addEventListener("pointermove", _onPointerMove);
|
|
15407
|
+
window.addEventListener("pointerup", _onPointerUp, true);
|
|
15272
15408
|
return true;
|
|
15273
15409
|
}
|
|
15274
15410
|
const cursorMap = {
|
|
@@ -15362,17 +15498,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15362
15498
|
default:
|
|
15363
15499
|
return void 0;
|
|
15364
15500
|
}
|
|
15365
|
-
if (handle === "resize-
|
|
15501
|
+
if (handle === "resize-t" || handle === "resize-r" || handle === "resize-tr" || handle === "resize-bl") {
|
|
15366
15502
|
return h("line", {
|
|
15367
|
-
class: "mce-
|
|
15503
|
+
class: "mce-transform-controls__diagonal",
|
|
15368
15504
|
x1: "100%",
|
|
15369
15505
|
y1: "0",
|
|
15370
15506
|
x2: "0",
|
|
15371
15507
|
y2: "100%"
|
|
15372
15508
|
});
|
|
15373
|
-
} else if (handle === "resize-
|
|
15509
|
+
} else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
|
|
15374
15510
|
return h("line", {
|
|
15375
|
-
class: "mce-
|
|
15511
|
+
class: "mce-transform-controls__diagonal",
|
|
15376
15512
|
x1: "0",
|
|
15377
15513
|
y1: "0",
|
|
15378
15514
|
x2: "100%",
|
|
@@ -15383,15 +15519,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15383
15519
|
}
|
|
15384
15520
|
return (_ctx, _cache) => {
|
|
15385
15521
|
return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
|
|
15386
|
-
class: normalizeClass(["mce-
|
|
15387
|
-
transforming.value && "mce-
|
|
15388
|
-
props.hideUi && "mce-
|
|
15389
|
-
__props.resizeStrategy && `mce-
|
|
15390
|
-
activeHandle.value && `mce-
|
|
15391
|
-
activeHandle.value === "move" && "mce-
|
|
15392
|
-
activeHandle.value?.startsWith("resize") && "mce-
|
|
15393
|
-
activeHandle.value?.startsWith("rotate") && "mce-
|
|
15394
|
-
props.borderStyle && `mce-
|
|
15522
|
+
class: normalizeClass(["mce-transform-controls", [
|
|
15523
|
+
transforming.value && "mce-transform-controls--transforming",
|
|
15524
|
+
props.hideUi && "mce-transform-controls--hide-ui",
|
|
15525
|
+
__props.resizeStrategy && `mce-transform-controls--${__props.resizeStrategy}`,
|
|
15526
|
+
activeHandle.value && `mce-transform-controls--${activeHandle.value}`,
|
|
15527
|
+
activeHandle.value === "move" && "mce-transform-controls--moving",
|
|
15528
|
+
activeHandle.value?.startsWith("resize") && "mce-transform-controls--resizing",
|
|
15529
|
+
activeHandle.value?.startsWith("rotate") && "mce-transform-controls--rotateing",
|
|
15530
|
+
props.borderStyle && `mce-transform-controls--${props.borderStyle}`
|
|
15395
15531
|
]]),
|
|
15396
15532
|
style: normalizeStyle$1(style.value)
|
|
15397
15533
|
}, {
|
|
@@ -15404,14 +15540,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15404
15540
|
start
|
|
15405
15541
|
}),
|
|
15406
15542
|
(openBlock(), createElementBlock("svg", _hoisted_1$4, [
|
|
15407
|
-
_cache[
|
|
15543
|
+
_cache[1] || (_cache[1] = createElementVNode("rect", {
|
|
15408
15544
|
width: "100%",
|
|
15409
15545
|
height: "100%",
|
|
15410
15546
|
fill: "none",
|
|
15411
|
-
class: "mce-
|
|
15547
|
+
class: "mce-transform-controls__rect"
|
|
15412
15548
|
}, null, -1)),
|
|
15413
15549
|
createElementVNode("rect", {
|
|
15414
|
-
class: "mce-
|
|
15550
|
+
class: "mce-transform-controls__rect",
|
|
15415
15551
|
width: "100%",
|
|
15416
15552
|
height: "100%",
|
|
15417
15553
|
fill: "none",
|
|
@@ -15419,7 +15555,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15419
15555
|
ry: model.value.borderRadius
|
|
15420
15556
|
}, null, 8, _hoisted_2$1),
|
|
15421
15557
|
createVNode(Diagonal),
|
|
15422
|
-
createElementVNode("g",
|
|
15558
|
+
createElementVNode("g", _hoisted_3$1, [
|
|
15423
15559
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15424
15560
|
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
15425
15561
|
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -15430,20 +15566,37 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15430
15566
|
width: handle.width,
|
|
15431
15567
|
height: handle.height,
|
|
15432
15568
|
"aria-label": handle.type,
|
|
15433
|
-
class: "mce-
|
|
15434
|
-
}, null, 8,
|
|
15569
|
+
class: "mce-transform-controls__handle"
|
|
15570
|
+
}, null, 8, _hoisted_4)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
|
|
15435
15571
|
key: 1,
|
|
15436
15572
|
cx: handle.x + handle.width / 2,
|
|
15437
15573
|
cy: handle.y + handle.width / 2,
|
|
15438
15574
|
r: handle.width / 2,
|
|
15439
15575
|
"aria-label": handle.type,
|
|
15440
|
-
class: "mce-
|
|
15441
|
-
}, null, 8,
|
|
15576
|
+
class: "mce-transform-controls__handle"
|
|
15577
|
+
}, null, 8, _hoisted_5)) : (openBlock(), createElementBlock("rect", {
|
|
15578
|
+
key: 2,
|
|
15579
|
+
x: handle.x,
|
|
15580
|
+
y: handle.y,
|
|
15581
|
+
width: handle.width,
|
|
15582
|
+
height: handle.height,
|
|
15583
|
+
"aria-label": handle.type,
|
|
15584
|
+
rx: handle.width / 4,
|
|
15585
|
+
ry: handle.height / 4,
|
|
15586
|
+
class: "mce-transform-controls__handle"
|
|
15587
|
+
}, null, 8, _hoisted_6))
|
|
15442
15588
|
], 64)) : createCommentVNode("", true)
|
|
15443
15589
|
], 64);
|
|
15444
|
-
}), 128))
|
|
15590
|
+
}), 128)),
|
|
15591
|
+
__props.rotator ? (openBlock(), createElementBlock("g", {
|
|
15592
|
+
key: 0,
|
|
15593
|
+
transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
|
|
15594
|
+
class: "mce-transform-controls__rotator"
|
|
15595
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
15596
|
+
createElementVNode("path", { d: "M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" }, null, -1)
|
|
15597
|
+
])], 8, _hoisted_7)) : createCommentVNode("", true)
|
|
15445
15598
|
]),
|
|
15446
|
-
createElementVNode("g",
|
|
15599
|
+
createElementVNode("g", _hoisted_8, [
|
|
15447
15600
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15448
15601
|
return openBlock(), createElementBlock("rect", {
|
|
15449
15602
|
key: index,
|
|
@@ -15455,17 +15608,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15455
15608
|
width: handle.width,
|
|
15456
15609
|
height: handle.height,
|
|
15457
15610
|
"aria-label": handle.type,
|
|
15458
|
-
class: "mce-
|
|
15611
|
+
class: "mce-transform-controls__handle-rect",
|
|
15459
15612
|
cursor: transforming.value ? "auto" : getCursor(handle.type),
|
|
15460
15613
|
onPointerdown: (event) => start(event, index)
|
|
15461
|
-
}, null, 40,
|
|
15614
|
+
}, null, 40, _hoisted_9);
|
|
15462
15615
|
}), 128))
|
|
15463
15616
|
]),
|
|
15464
|
-
createElementVNode("g",
|
|
15617
|
+
createElementVNode("g", _hoisted_10, [
|
|
15465
15618
|
renderSlot(_ctx.$slots, "svg", { box: model.value })
|
|
15466
15619
|
])
|
|
15467
15620
|
])),
|
|
15468
|
-
tip.value ? (openBlock(), createElementBlock("div",
|
|
15621
|
+
tip.value ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(tip.value), 1)) : createCommentVNode("", true)
|
|
15469
15622
|
]),
|
|
15470
15623
|
_: 3
|
|
15471
15624
|
}, 8, ["class", "style"]);
|
|
@@ -15695,7 +15848,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15695
15848
|
isLock,
|
|
15696
15849
|
config,
|
|
15697
15850
|
snapThreshold,
|
|
15698
|
-
getSnapPoints
|
|
15851
|
+
getSnapPoints,
|
|
15852
|
+
hoverElement
|
|
15699
15853
|
} = useEditor();
|
|
15700
15854
|
const transformable = useTemplateRef("transformableTpl");
|
|
15701
15855
|
const startEvent = ref();
|
|
@@ -15810,8 +15964,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15810
15964
|
rotate: transform2.rotate - (oldTransform.rotate ?? 0),
|
|
15811
15965
|
borderRadius: transform2.borderRadius - (oldTransform.borderRadius ?? 0) / zoom.y
|
|
15812
15966
|
};
|
|
15813
|
-
|
|
15814
|
-
elements.forEach((element) => {
|
|
15967
|
+
elementSelection.value.forEach((element) => {
|
|
15815
15968
|
const style = element.style;
|
|
15816
15969
|
const newStyle = {
|
|
15817
15970
|
left: style.left + offsetStyle.left,
|
|
@@ -15832,7 +15985,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15832
15985
|
element,
|
|
15833
15986
|
newStyle.width / element.style.width,
|
|
15834
15987
|
newStyle.height / element.style.height,
|
|
15835
|
-
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-").length >
|
|
15988
|
+
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-")[1].length > 1 ? { deep: true, textFontSizeToFit: true } : { deep: true, textToFit: true }
|
|
15836
15989
|
);
|
|
15837
15990
|
newStyle.width = element.style.width;
|
|
15838
15991
|
newStyle.height = element.style.height;
|
|
@@ -15864,9 +16017,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15864
16017
|
return !isLock(element) && element.meta.rotatable !== false && element.meta.transformable !== false;
|
|
15865
16018
|
});
|
|
15866
16019
|
});
|
|
15867
|
-
const
|
|
15868
|
-
|
|
15869
|
-
|
|
16020
|
+
const roundable = computed(() => {
|
|
16021
|
+
if (elementSelection.value.length === 1) {
|
|
16022
|
+
const element = elementSelection.value[0];
|
|
16023
|
+
return hoverElement.value?.equal(element) && !isLock(element) && element.foreground.isValid();
|
|
16024
|
+
}
|
|
16025
|
+
return false;
|
|
15870
16026
|
});
|
|
15871
16027
|
function onStart() {
|
|
15872
16028
|
emit("selectionTransformStart", createSelectionTransformContext());
|
|
@@ -15919,24 +16075,24 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15919
16075
|
})
|
|
15920
16076
|
}, null, 4);
|
|
15921
16077
|
}), 128)),
|
|
15922
|
-
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, {
|
|
16078
|
+
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, mergeProps({
|
|
15923
16079
|
key: 1,
|
|
15924
|
-
ref: "transformableTpl"
|
|
16080
|
+
ref: "transformableTpl"
|
|
16081
|
+
}, unref(config).transformControls, {
|
|
15925
16082
|
modelValue: transform.value,
|
|
15926
16083
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
|
|
15927
16084
|
movable: unref(state) !== "typing" && movable.value,
|
|
15928
16085
|
resizable: unref(state) !== "typing" && resizable.value,
|
|
15929
16086
|
rotatable: unref(state) !== "typing" && rotatable.value,
|
|
15930
|
-
"
|
|
16087
|
+
roundable: unref(state) !== "typing" && roundable.value,
|
|
15931
16088
|
"resize-strategy": props.resizeStrategy,
|
|
15932
|
-
"handle-shape": unref(config).handleShape,
|
|
15933
16089
|
class: "mce-selector__transform",
|
|
15934
16090
|
"border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
|
|
15935
16091
|
"tip-format": tipFormat,
|
|
15936
16092
|
onStart,
|
|
15937
16093
|
onMove,
|
|
15938
16094
|
onEnd
|
|
15939
|
-
}, createSlots({ _: 2 }, [
|
|
16095
|
+
}), createSlots({ _: 2 }, [
|
|
15940
16096
|
_ctx.$slots.transformable ? {
|
|
15941
16097
|
name: "svg",
|
|
15942
16098
|
fn: withCtx((slotProps) => [
|
|
@@ -15944,7 +16100,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15944
16100
|
]),
|
|
15945
16101
|
key: "0"
|
|
15946
16102
|
} : void 0
|
|
15947
|
-
]),
|
|
16103
|
+
]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "border-style"])) : createCommentVNode("", true),
|
|
15948
16104
|
transform.value.width && transform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
|
|
15949
16105
|
key: 2,
|
|
15950
16106
|
class: "mce-selector__slot",
|
|
@@ -16237,7 +16393,7 @@ const _hoisted_2 = {
|
|
|
16237
16393
|
};
|
|
16238
16394
|
const _hoisted_3 = {
|
|
16239
16395
|
ref: "overlayContainerTpl",
|
|
16240
|
-
class: "mce-
|
|
16396
|
+
class: "mce-overlay-container"
|
|
16241
16397
|
};
|
|
16242
16398
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
16243
16399
|
__name: "EditorLayout",
|
|
@@ -16310,17 +16466,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16310
16466
|
renderEngine.value.resize(width, height);
|
|
16311
16467
|
});
|
|
16312
16468
|
onBeforeMount(() => {
|
|
16313
|
-
renderEngine.value.on("pointerdown",
|
|
16314
|
-
renderEngine.value.on("pointermove",
|
|
16315
|
-
renderEngine.value.on("pointerover",
|
|
16469
|
+
renderEngine.value.on("pointerdown", onEnginePointerDown);
|
|
16470
|
+
renderEngine.value.on("pointermove", onEnginePointerMove);
|
|
16471
|
+
renderEngine.value.on("pointerover", onEnginePointerOver);
|
|
16316
16472
|
});
|
|
16317
16473
|
onMounted(() => {
|
|
16318
16474
|
bindRenderCanvas(canvas.value, drawboardDom.value);
|
|
16319
16475
|
});
|
|
16320
16476
|
onBeforeUnmount(() => {
|
|
16321
|
-
renderEngine.value.off("pointerdown",
|
|
16322
|
-
renderEngine.value.off("pointermove",
|
|
16323
|
-
renderEngine.value.off("pointerover",
|
|
16477
|
+
renderEngine.value.off("pointerdown", onEnginePointerDown);
|
|
16478
|
+
renderEngine.value.off("pointermove", onEnginePointerMove);
|
|
16479
|
+
renderEngine.value.off("pointerover", onEnginePointerOver);
|
|
16324
16480
|
});
|
|
16325
16481
|
function onHover(event) {
|
|
16326
16482
|
let cursor;
|
|
@@ -16351,7 +16507,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16351
16507
|
hoverElement.value = hovered;
|
|
16352
16508
|
setCursor(cursor);
|
|
16353
16509
|
}
|
|
16354
|
-
function
|
|
16510
|
+
function onEnginePointerDown(downEvent, options = {}) {
|
|
16355
16511
|
if (downEvent.srcElement && downEvent.srcElement !== drawboardDom.value && downEvent.srcElement.dataset?.pointerdown_to_drawboard === void 0 || camera.value.spaceKey || ![0, 2].includes(downEvent.button)) {
|
|
16356
16512
|
return;
|
|
16357
16513
|
}
|
|
@@ -16456,7 +16612,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16456
16612
|
function canStartDrag() {
|
|
16457
16613
|
return !dragging && (Math.abs(current.x - start.x) >= 3 || Math.abs(current.y - start.y) >= 3);
|
|
16458
16614
|
}
|
|
16459
|
-
function
|
|
16615
|
+
function _onEnginePointerMove(moveEvent) {
|
|
16460
16616
|
if (drawing || hand) ;
|
|
16461
16617
|
else {
|
|
16462
16618
|
if (inSelection) {
|
|
@@ -16479,7 +16635,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16479
16635
|
}
|
|
16480
16636
|
}
|
|
16481
16637
|
}
|
|
16482
|
-
function
|
|
16638
|
+
function _onPointerMove(moveEvent) {
|
|
16483
16639
|
current = { x: moveEvent.clientX, y: moveEvent.clientY };
|
|
16484
16640
|
if (drawing) {
|
|
16485
16641
|
drawingTool?.move?.(
|
|
@@ -16502,7 +16658,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16502
16658
|
}
|
|
16503
16659
|
prev = { ...current };
|
|
16504
16660
|
}
|
|
16505
|
-
async function
|
|
16661
|
+
async function _onPointerUp(upEvent) {
|
|
16506
16662
|
current = { x: upEvent.clientX, y: upEvent.clientY };
|
|
16507
16663
|
if (drawing) {
|
|
16508
16664
|
drawingTool?.end?.(
|
|
@@ -16535,30 +16691,26 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16535
16691
|
onHover(downEvent);
|
|
16536
16692
|
}
|
|
16537
16693
|
}
|
|
16538
|
-
renderEngine.value.off("pointermove",
|
|
16539
|
-
document.removeEventListener("pointermove",
|
|
16540
|
-
document.removeEventListener("pointerup",
|
|
16694
|
+
renderEngine.value.off("pointermove", _onEnginePointerMove);
|
|
16695
|
+
document.removeEventListener("pointermove", _onPointerMove);
|
|
16696
|
+
document.removeEventListener("pointerup", _onPointerUp);
|
|
16541
16697
|
isUp = true;
|
|
16542
16698
|
}
|
|
16543
|
-
renderEngine.value.on("pointermove",
|
|
16544
|
-
document.addEventListener("pointermove",
|
|
16545
|
-
document.addEventListener("pointerup",
|
|
16699
|
+
renderEngine.value.on("pointermove", _onEnginePointerMove);
|
|
16700
|
+
document.addEventListener("pointermove", _onPointerMove);
|
|
16701
|
+
document.addEventListener("pointerup", _onPointerUp);
|
|
16546
16702
|
}
|
|
16547
|
-
editor.registerCommand({ command: "pointerDown", handle:
|
|
16548
|
-
function
|
|
16703
|
+
editor.registerCommand({ command: "pointerDown", handle: onEnginePointerDown });
|
|
16704
|
+
function onEnginePointerMove(event) {
|
|
16549
16705
|
if (event.srcElement !== drawboardDom.value) {
|
|
16550
16706
|
return;
|
|
16551
16707
|
}
|
|
16552
|
-
drawboardPointer.value = new Vector2$1(
|
|
16553
|
-
event.clientX - drawboardAabb.value.left,
|
|
16554
|
-
event.clientY - drawboardAabb.value.top
|
|
16555
|
-
);
|
|
16556
16708
|
if (camera.value.grabbing || event.button === 1 || state.value && state.value !== "typing") {
|
|
16557
16709
|
return;
|
|
16558
16710
|
}
|
|
16559
16711
|
onHover(event);
|
|
16560
16712
|
}
|
|
16561
|
-
function
|
|
16713
|
+
function onEnginePointerOver(event) {
|
|
16562
16714
|
if (event.srcElement !== drawboardDom.value) {
|
|
16563
16715
|
return;
|
|
16564
16716
|
}
|
|
@@ -16611,36 +16763,33 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16611
16763
|
}, ["prevent"]))
|
|
16612
16764
|
}, [
|
|
16613
16765
|
createElementVNode("canvas", _hoisted_2, null, 512),
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
"
|
|
16618
|
-
"
|
|
16766
|
+
slots.floatbar ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16767
|
+
key: 0,
|
|
16768
|
+
location: "top-start",
|
|
16769
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16770
|
+
middlewares: ["offset", "shift"]
|
|
16619
16771
|
}, {
|
|
16620
|
-
|
|
16621
|
-
renderSlot(_ctx.$slots, "
|
|
16622
|
-
]),
|
|
16623
|
-
default: withCtx(({ box }) => [
|
|
16624
|
-
createVNode(_sfc_main$8),
|
|
16625
|
-
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16772
|
+
default: withCtx(() => [
|
|
16773
|
+
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps)))
|
|
16626
16774
|
]),
|
|
16627
16775
|
_: 3
|
|
16628
|
-
}, 8, ["
|
|
16629
|
-
slots
|
|
16630
|
-
key:
|
|
16776
|
+
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16777
|
+
slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16778
|
+
key: 1,
|
|
16631
16779
|
location: "top-start",
|
|
16632
|
-
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
|
|
16780
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16781
|
+
middlewares: ["offset", "shift"]
|
|
16633
16782
|
}, {
|
|
16634
16783
|
default: withCtx(() => [
|
|
16635
|
-
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps))),
|
|
16636
16784
|
renderSlot(_ctx.$slots, "floatbar-top", normalizeProps(guardReactiveProps(slotProps)))
|
|
16637
16785
|
]),
|
|
16638
16786
|
_: 3
|
|
16639
16787
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16640
16788
|
slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16641
|
-
key:
|
|
16789
|
+
key: 2,
|
|
16642
16790
|
location: "bottom-start",
|
|
16643
|
-
target: selector.value?.transformable?.$el
|
|
16791
|
+
target: selector.value?.transformable?.$el,
|
|
16792
|
+
middlewares: ["offset", "shift"]
|
|
16644
16793
|
}, {
|
|
16645
16794
|
default: withCtx(() => [
|
|
16646
16795
|
renderSlot(_ctx.$slots, "floatbar-bottom", normalizeProps(guardReactiveProps(slotProps)))
|
|
@@ -16650,6 +16799,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16650
16799
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay, (p, key) => {
|
|
16651
16800
|
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16652
16801
|
}), 128)),
|
|
16802
|
+
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
16803
|
+
createVNode(_sfc_main$7, {
|
|
16804
|
+
ref: "selectorTpl",
|
|
16805
|
+
"selected-area": selectedArea.value,
|
|
16806
|
+
"resize-strategy": resizeStrategy.value
|
|
16807
|
+
}, {
|
|
16808
|
+
transformable: withCtx(({ box }) => [
|
|
16809
|
+
renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
|
|
16810
|
+
]),
|
|
16811
|
+
default: withCtx(({ box }) => [
|
|
16812
|
+
createVNode(_sfc_main$8),
|
|
16813
|
+
renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
|
|
16814
|
+
]),
|
|
16815
|
+
_: 3
|
|
16816
|
+
}, 8, ["selected-area", "resize-strategy"]),
|
|
16653
16817
|
renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
|
|
16654
16818
|
], 40, _hoisted_1)
|
|
16655
16819
|
]),
|
|
@@ -16775,7 +16939,7 @@ export {
|
|
|
16775
16939
|
_sfc_main$p as Ruler,
|
|
16776
16940
|
SUPPORTS_CLIPBOARD,
|
|
16777
16941
|
_sfc_main$n as Scrollbar,
|
|
16778
|
-
_sfc_main$a as
|
|
16942
|
+
_sfc_main$a as TransformControls,
|
|
16779
16943
|
USER_AGENT,
|
|
16780
16944
|
boundingBoxToStyle,
|
|
16781
16945
|
consoleError,
|