mce 0.16.6 → 0.16.7
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/Selection.vue.d.ts +6 -6
- package/dist/components/shared/TransformControls.vue.d.ts +1 -1
- package/dist/index.css +49 -13
- package/dist/index.js +391 -128
- package/dist/typed-global.d.ts +1 -0
- package/dist/utils/dnd.d.ts +10 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -98,8 +98,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
98
98
|
movable: boolean;
|
|
99
99
|
rotatable: boolean;
|
|
100
100
|
resizable: boolean;
|
|
101
|
-
tag: string | any;
|
|
102
101
|
threshold: number;
|
|
102
|
+
tag: string | any;
|
|
103
103
|
handleShape: "rect" | "circle";
|
|
104
104
|
handles: ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br")[];
|
|
105
105
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
@@ -128,8 +128,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
128
128
|
movable: boolean;
|
|
129
129
|
rotatable: boolean;
|
|
130
130
|
resizable: boolean;
|
|
131
|
-
tag: string | any;
|
|
132
131
|
threshold: number;
|
|
132
|
+
tag: string | any;
|
|
133
133
|
handleShape: "rect" | "circle";
|
|
134
134
|
handles: ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br")[];
|
|
135
135
|
}> & Omit<Readonly<{
|
|
@@ -159,7 +159,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
159
159
|
onStart?: ((args_0: import("./shared/TransformControls.vue").TransformValue) => any) | undefined;
|
|
160
160
|
onEnd?: ((args_0: import("./shared/TransformControls.vue").TransformValue) => any) | undefined;
|
|
161
161
|
"onUpdate:modelValue"?: ((value: Partial<import("./shared/TransformControls.vue").TransformValue> | undefined) => any) | undefined;
|
|
162
|
-
}>, "transforming" | "start" | "activeHandle" | ("offset" | "scale" | "movable" | "rotatable" | "resizable" | "
|
|
162
|
+
}>, "transforming" | "start" | "activeHandle" | ("offset" | "scale" | "movable" | "rotatable" | "resizable" | "threshold" | "tag" | "handleShape" | "handles")> & import("vue").ShallowUnwrapRef<{
|
|
163
163
|
start: (event?: MouseEvent, index?: number) => boolean;
|
|
164
164
|
activeHandle: import("vue").Ref<("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br") | undefined, ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br") | undefined>;
|
|
165
165
|
transforming: import("vue").Ref<boolean, boolean>;
|
|
@@ -276,8 +276,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
276
276
|
movable: boolean;
|
|
277
277
|
rotatable: boolean;
|
|
278
278
|
resizable: boolean;
|
|
279
|
-
tag: string | any;
|
|
280
279
|
threshold: number;
|
|
280
|
+
tag: string | any;
|
|
281
281
|
handleShape: "rect" | "circle";
|
|
282
282
|
handles: ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br")[];
|
|
283
283
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
@@ -306,8 +306,8 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
306
306
|
movable: boolean;
|
|
307
307
|
rotatable: boolean;
|
|
308
308
|
resizable: boolean;
|
|
309
|
-
tag: string | any;
|
|
310
309
|
threshold: number;
|
|
310
|
+
tag: string | any;
|
|
311
311
|
handleShape: "rect" | "circle";
|
|
312
312
|
handles: ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br")[];
|
|
313
313
|
}> & Omit<Readonly<{
|
|
@@ -337,7 +337,7 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
|
|
|
337
337
|
onStart?: ((args_0: import("./shared/TransformControls.vue").TransformValue) => any) | undefined;
|
|
338
338
|
onEnd?: ((args_0: import("./shared/TransformControls.vue").TransformValue) => any) | undefined;
|
|
339
339
|
"onUpdate:modelValue"?: ((value: Partial<import("./shared/TransformControls.vue").TransformValue> | undefined) => any) | undefined;
|
|
340
|
-
}>, "transforming" | "start" | "activeHandle" | ("offset" | "scale" | "movable" | "rotatable" | "resizable" | "
|
|
340
|
+
}>, "transforming" | "start" | "activeHandle" | ("offset" | "scale" | "movable" | "rotatable" | "resizable" | "threshold" | "tag" | "handleShape" | "handles")> & import("vue").ShallowUnwrapRef<{
|
|
341
341
|
start: (event?: MouseEvent, index?: number) => boolean;
|
|
342
342
|
activeHandle: import("vue").Ref<("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br") | undefined, ("move" | "resize-t" | "resize-l" | "resize-r" | "resize-b" | "resize-tl" | "resize-tr" | "resize-bl" | "resize-br" | "rotate-tl" | "rotate-tr" | "rotate-bl" | "rotate-br" | "round-tl" | "round-tr" | "round-bl" | "round-br") | undefined>;
|
|
343
343
|
transforming: import("vue").Ref<boolean, boolean>;
|
|
@@ -81,8 +81,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
81
81
|
movable: boolean;
|
|
82
82
|
rotatable: boolean;
|
|
83
83
|
resizable: boolean;
|
|
84
|
-
tag: string | any;
|
|
85
84
|
threshold: number;
|
|
85
|
+
tag: string | any;
|
|
86
86
|
handleShape: "rect" | "circle";
|
|
87
87
|
handles: Handle[];
|
|
88
88
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist/index.css
CHANGED
|
@@ -842,29 +842,65 @@
|
|
|
842
842
|
top: 0;
|
|
843
843
|
bottom: 0;
|
|
844
844
|
}
|
|
845
|
-
.mce-smart-
|
|
845
|
+
.mce-smart-selection__node {
|
|
846
846
|
position: absolute;
|
|
847
847
|
display: flex;
|
|
848
848
|
align-items: center;
|
|
849
849
|
justify-content: center;
|
|
850
|
-
pointer-events: auto;
|
|
851
850
|
}
|
|
852
|
-
.mce-smart-
|
|
851
|
+
.mce-smart-selection__node--active .mce-smart-selection__ring {
|
|
852
|
+
background: #FF24BD;
|
|
853
|
+
}
|
|
854
|
+
.mce-smart-selection__ghost {
|
|
855
|
+
position: absolute;
|
|
856
|
+
border: 1px solid rgb(var(--mce-theme-primary));
|
|
857
|
+
}
|
|
858
|
+
.mce-smart-selection__ring {
|
|
853
859
|
width: 1px;
|
|
854
860
|
height: 1px;
|
|
855
861
|
border-radius: 100%;
|
|
856
862
|
border: 1px solid #FF24BD;
|
|
857
863
|
outline: 1px solid #FFFFFF;
|
|
864
|
+
pointer-events: auto;
|
|
858
865
|
}
|
|
859
|
-
.mce-smart-
|
|
866
|
+
.mce-smart-selection__ring:hover {
|
|
860
867
|
background: #FF24BD;
|
|
861
868
|
}
|
|
862
|
-
.mce-smart-
|
|
869
|
+
.mce-smart-selection__spacing {
|
|
870
|
+
position: absolute;
|
|
871
|
+
height: 10px;
|
|
872
|
+
width: 10px;
|
|
873
|
+
visibility: hidden;
|
|
874
|
+
pointer-events: auto;
|
|
875
|
+
display: flex;
|
|
876
|
+
align-items: center;
|
|
877
|
+
justify-content: center;
|
|
878
|
+
}
|
|
879
|
+
.mce-smart-selection__spacing-line {
|
|
880
|
+
width: 100%;
|
|
881
|
+
height: 100%;
|
|
882
|
+
background-color: #FF24BD;
|
|
883
|
+
}
|
|
884
|
+
.mce-smart-selection--hover .mce-smart-selection__ring {
|
|
863
885
|
width: 10px;
|
|
864
886
|
height: 10px;
|
|
865
887
|
}
|
|
866
|
-
.mce-smart-selection
|
|
867
|
-
|
|
888
|
+
.mce-smart-selection--hover .mce-smart-selection__spacing {
|
|
889
|
+
visibility: visible;
|
|
890
|
+
}
|
|
891
|
+
.mce-smart-selection--vertical .mce-smart-selection__spacing {
|
|
892
|
+
height: 4px;
|
|
893
|
+
cursor: row-resize;
|
|
894
|
+
}
|
|
895
|
+
.mce-smart-selection--vertical .mce-smart-selection__spacing-line {
|
|
896
|
+
height: 1px;
|
|
897
|
+
}
|
|
898
|
+
.mce-smart-selection--horizontal .mce-smart-selection__spacing {
|
|
899
|
+
width: 4px;
|
|
900
|
+
cursor: col-resize;
|
|
901
|
+
}
|
|
902
|
+
.mce-smart-selection--horizontal .mce-smart-selection__spacing-line {
|
|
903
|
+
width: 1px;
|
|
868
904
|
}.progress-indicator[data-v-3b286483] {
|
|
869
905
|
display: flex;
|
|
870
906
|
align-items: center;
|
|
@@ -906,7 +942,7 @@
|
|
|
906
942
|
100% {
|
|
907
943
|
left: 100%;
|
|
908
944
|
}
|
|
909
|
-
}.mce-statusbar[data-v-
|
|
945
|
+
}.mce-statusbar[data-v-c3c7d56a] {
|
|
910
946
|
user-select: none;
|
|
911
947
|
position: relative;
|
|
912
948
|
display: flex;
|
|
@@ -923,29 +959,29 @@
|
|
|
923
959
|
white-space: nowrap;
|
|
924
960
|
overflow-x: auto;
|
|
925
961
|
}
|
|
926
|
-
.mce-statusbar__main[data-v-
|
|
962
|
+
.mce-statusbar__main[data-v-c3c7d56a] {
|
|
927
963
|
flex: 1;
|
|
928
964
|
display: flex;
|
|
929
965
|
align-items: center;
|
|
930
966
|
gap: 4px;
|
|
931
967
|
height: 100%;
|
|
932
968
|
}
|
|
933
|
-
.mce-statusbar__item[data-v-
|
|
969
|
+
.mce-statusbar__item[data-v-c3c7d56a] {
|
|
934
970
|
display: flex;
|
|
935
971
|
align-items: center;
|
|
936
972
|
gap: 4px;
|
|
937
973
|
}
|
|
938
|
-
.mce-statusbar__item > svg[data-v-
|
|
974
|
+
.mce-statusbar__item > svg[data-v-c3c7d56a] {
|
|
939
975
|
width: 1em;
|
|
940
976
|
height: 1em;
|
|
941
977
|
}
|
|
942
|
-
.mce-statusbar__divider[data-v-
|
|
978
|
+
.mce-statusbar__divider[data-v-c3c7d56a] {
|
|
943
979
|
width: 0;
|
|
944
980
|
height: 60%;
|
|
945
981
|
border-right: 1px solid rgba(var(--mce-theme-on-surface), 0.1);
|
|
946
982
|
margin: 0 8px;
|
|
947
983
|
}
|
|
948
|
-
.mce-statusbar__kbd[data-v-
|
|
984
|
+
.mce-statusbar__kbd[data-v-c3c7d56a] {
|
|
949
985
|
outline: 1px solid rgba(var(--mce-theme-on-surface), 0.1);
|
|
950
986
|
border-radius: 4px;
|
|
951
987
|
display: flex;
|
package/dist/index.js
CHANGED
|
@@ -1485,6 +1485,37 @@ async function createImageElement(image) {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
};
|
|
1487
1487
|
}
|
|
1488
|
+
function handleDrag(downEvent, options = {}) {
|
|
1489
|
+
const {
|
|
1490
|
+
start,
|
|
1491
|
+
move,
|
|
1492
|
+
end,
|
|
1493
|
+
threshold = 3
|
|
1494
|
+
} = options;
|
|
1495
|
+
let dragging = false;
|
|
1496
|
+
let currentPos = { x: downEvent.clientX, y: downEvent.clientY };
|
|
1497
|
+
function onMouseMove(moveEvent) {
|
|
1498
|
+
const movePos = { x: moveEvent.clientX, y: moveEvent.clientY };
|
|
1499
|
+
const offsetPos = { x: movePos.x - currentPos.x, y: movePos.y - currentPos.y };
|
|
1500
|
+
if (!dragging && (Math.abs(offsetPos.x) >= threshold || Math.abs(offsetPos.y) >= threshold)) {
|
|
1501
|
+
dragging = true;
|
|
1502
|
+
start?.(moveEvent);
|
|
1503
|
+
}
|
|
1504
|
+
if (dragging) {
|
|
1505
|
+
currentPos = { ...movePos };
|
|
1506
|
+
move?.(offsetPos, moveEvent);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
function onMouseUp(upEvent) {
|
|
1510
|
+
if (dragging) {
|
|
1511
|
+
end?.(upEvent);
|
|
1512
|
+
}
|
|
1513
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
1514
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
1515
|
+
}
|
|
1516
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
1517
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
1518
|
+
}
|
|
1488
1519
|
function noop(..._args) {
|
|
1489
1520
|
}
|
|
1490
1521
|
function isClickInsideElement(event, targetDiv) {
|
|
@@ -5958,7 +5989,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
5958
5989
|
}
|
|
5959
5990
|
});
|
|
5960
5991
|
const _hoisted_1$p = ["data-id"];
|
|
5961
|
-
const _hoisted_2$
|
|
5992
|
+
const _hoisted_2$c = { class: "mce-layer__content" };
|
|
5962
5993
|
const _hoisted_3$b = { class: "mce-layer__prepend" };
|
|
5963
5994
|
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
5964
5995
|
...{
|
|
@@ -6182,7 +6213,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6182
6213
|
}, [
|
|
6183
6214
|
_cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
|
|
6184
6215
|
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
6185
|
-
createElementVNode("div", _hoisted_2$
|
|
6216
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
6186
6217
|
createElementVNode("div", _hoisted_3$b, [
|
|
6187
6218
|
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$E), {
|
|
6188
6219
|
key: 0,
|
|
@@ -6291,7 +6322,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6291
6322
|
}
|
|
6292
6323
|
});
|
|
6293
6324
|
const _hoisted_1$o = { class: "mce-layers" };
|
|
6294
|
-
const _hoisted_2$
|
|
6325
|
+
const _hoisted_2$b = { class: "mce-layers__wrapper" };
|
|
6295
6326
|
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6296
6327
|
__name: "Layers",
|
|
6297
6328
|
setup(__props) {
|
|
@@ -6337,7 +6368,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6337
6368
|
});
|
|
6338
6369
|
return (_ctx, _cache) => {
|
|
6339
6370
|
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
6340
|
-
createElementVNode("div", _hoisted_2$
|
|
6371
|
+
createElementVNode("div", _hoisted_2$b, [
|
|
6341
6372
|
createVNode(_sfc_main$z, {
|
|
6342
6373
|
root: true,
|
|
6343
6374
|
node: unref(root),
|
|
@@ -6571,7 +6602,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
6571
6602
|
}
|
|
6572
6603
|
});
|
|
6573
6604
|
const _hoisted_1$l = ["onMouseenter"];
|
|
6574
|
-
const _hoisted_2$
|
|
6605
|
+
const _hoisted_2$a = ["onClick"];
|
|
6575
6606
|
const _hoisted_3$a = {
|
|
6576
6607
|
key: 0,
|
|
6577
6608
|
class: "mce-list-item__checked"
|
|
@@ -6742,7 +6773,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6742
6773
|
icon: "$arrowRight"
|
|
6743
6774
|
})) : createCommentVNode("", true)
|
|
6744
6775
|
])) : createCommentVNode("", true)
|
|
6745
|
-
], 10, _hoisted_2$
|
|
6776
|
+
], 10, _hoisted_2$a)
|
|
6746
6777
|
], 40, _hoisted_1$l))
|
|
6747
6778
|
], 64);
|
|
6748
6779
|
}), 128)),
|
|
@@ -7237,7 +7268,7 @@ const _new = definePlugin((editor) => {
|
|
|
7237
7268
|
};
|
|
7238
7269
|
});
|
|
7239
7270
|
const _hoisted_1$k = { class: "mce-node-creator" };
|
|
7240
|
-
const _hoisted_2$
|
|
7271
|
+
const _hoisted_2$9 = { class: "mce-node-creator__tree" };
|
|
7241
7272
|
const _hoisted_3$9 = { class: "mce-node-creator__actions" };
|
|
7242
7273
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
7243
7274
|
__name: "NodeCreator",
|
|
@@ -7321,7 +7352,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7321
7352
|
}
|
|
7322
7353
|
return (_ctx, _cache) => {
|
|
7323
7354
|
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
7324
|
-
createElementVNode("div", _hoisted_2$
|
|
7355
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
7325
7356
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tree.value, (node, index) => {
|
|
7326
7357
|
return openBlock(), createBlock(CreatorNode, {
|
|
7327
7358
|
key: index,
|
|
@@ -11493,7 +11524,7 @@ const _hoisted_1$j = {
|
|
|
11493
11524
|
key: 0,
|
|
11494
11525
|
class: "mce-tooltip__arrow"
|
|
11495
11526
|
};
|
|
11496
|
-
const _hoisted_2$
|
|
11527
|
+
const _hoisted_2$8 = { class: "mce-tooltip__content" };
|
|
11497
11528
|
const _hoisted_3$8 = {
|
|
11498
11529
|
key: 0,
|
|
11499
11530
|
class: "mce-tooltip__kbd"
|
|
@@ -11543,7 +11574,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
11543
11574
|
default: withCtx(() => [
|
|
11544
11575
|
isActive.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
11545
11576
|
__props.showArrow ? (openBlock(), createElementBlock("div", _hoisted_1$j)) : createCommentVNode("", true),
|
|
11546
|
-
createElementVNode("div", _hoisted_2$
|
|
11577
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
11547
11578
|
renderSlot(_ctx.$slots, "default"),
|
|
11548
11579
|
_ctx.$slots.kbd ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
|
|
11549
11580
|
renderSlot(_ctx.$slots, "kbd")
|
|
@@ -11571,7 +11602,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
11571
11602
|
}
|
|
11572
11603
|
});
|
|
11573
11604
|
const _hoisted_1$i = ["width", "height"];
|
|
11574
|
-
const _hoisted_2$
|
|
11605
|
+
const _hoisted_2$7 = ["onDblclick", "onMousedown", "onMousemove"];
|
|
11575
11606
|
const _hoisted_3$7 = { style: { "font-size": "0.75rem", "text-wrap": "nowrap" } };
|
|
11576
11607
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
11577
11608
|
...{
|
|
@@ -11871,7 +11902,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11871
11902
|
onMousedown: ($event) => onReflineMousedown($event, index),
|
|
11872
11903
|
onMousemove: () => tipText.value = `${item}`,
|
|
11873
11904
|
onMouseleave: onLeave
|
|
11874
|
-
}, null, 46, _hoisted_2$
|
|
11905
|
+
}, null, 46, _hoisted_2$7);
|
|
11875
11906
|
}), 128)),
|
|
11876
11907
|
createVNode(_sfc_main$r, {
|
|
11877
11908
|
"model-value": !!tipText.value,
|
|
@@ -12317,7 +12348,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
12317
12348
|
}
|
|
12318
12349
|
});
|
|
12319
12350
|
const _hoisted_1$e = ["rx", "ry"];
|
|
12320
|
-
const _hoisted_2$
|
|
12351
|
+
const _hoisted_2$6 = { "pointer-events": "none" };
|
|
12321
12352
|
const _hoisted_3$6 = ["x", "y", "width", "height", "aria-label"];
|
|
12322
12353
|
const _hoisted_4$3 = ["cx", "cy", "r", "aria-label"];
|
|
12323
12354
|
const _hoisted_5$2 = ["x", "y", "width", "height", "aria-label", "rx", "ry"];
|
|
@@ -12915,7 +12946,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
12915
12946
|
ry: model.value.borderRadius
|
|
12916
12947
|
}, null, 8, _hoisted_1$e),
|
|
12917
12948
|
createVNode(Diagonal),
|
|
12918
|
-
createElementVNode("g", _hoisted_2$
|
|
12949
|
+
createElementVNode("g", _hoisted_2$6, [
|
|
12919
12950
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
12920
12951
|
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
12921
12952
|
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -13242,6 +13273,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13242
13273
|
} = useEditor();
|
|
13243
13274
|
const transformControls = useTemplateRef("transformControlsTpl");
|
|
13244
13275
|
const startEvent = ref();
|
|
13276
|
+
const activeHandle = computed(() => transformControls.value?.activeHandle ?? "move");
|
|
13245
13277
|
const resizeStrategy = computed(() => {
|
|
13246
13278
|
if (elementSelection.value.length === 1) {
|
|
13247
13279
|
const el = elementSelection.value[0];
|
|
@@ -13294,7 +13326,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13294
13326
|
function createTransformContext() {
|
|
13295
13327
|
return {
|
|
13296
13328
|
startEvent: startEvent.value,
|
|
13297
|
-
handle:
|
|
13329
|
+
handle: activeHandle.value
|
|
13298
13330
|
};
|
|
13299
13331
|
}
|
|
13300
13332
|
function onStart() {
|
|
@@ -13302,11 +13334,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13302
13334
|
}
|
|
13303
13335
|
function onMove() {
|
|
13304
13336
|
if (!state.value) {
|
|
13305
|
-
state.value = "transforming";
|
|
13337
|
+
state.value = activeHandle.value === "move" ? "moving" : "transforming";
|
|
13306
13338
|
}
|
|
13307
13339
|
}
|
|
13308
13340
|
function onEnd() {
|
|
13309
|
-
if (state.value === "transforming") {
|
|
13341
|
+
if (state.value === "moving" || state.value === "transforming") {
|
|
13310
13342
|
state.value = void 0;
|
|
13311
13343
|
}
|
|
13312
13344
|
emit("selectionTransformEnd", createTransformContext());
|
|
@@ -13358,7 +13390,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13358
13390
|
style: normalizeStyle$1(style)
|
|
13359
13391
|
}, null, 4);
|
|
13360
13392
|
}), 128)),
|
|
13361
|
-
unref(state) !== "transforming" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selectionObbStyles.value, (style, index) => {
|
|
13393
|
+
unref(state) !== "moving" && unref(state) !== "transforming" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selectionObbStyles.value, (style, index) => {
|
|
13362
13394
|
return openBlock(), createElementBlock("div", {
|
|
13363
13395
|
key: index,
|
|
13364
13396
|
class: "mce-selection__node",
|
|
@@ -13394,6 +13426,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13394
13426
|
rotatable: rotatable.value,
|
|
13395
13427
|
roundable: roundable.value,
|
|
13396
13428
|
"resize-strategy": resizeStrategy.value,
|
|
13429
|
+
"hide-ui": unref(state) === "moving",
|
|
13397
13430
|
class: "mce-selection__transform",
|
|
13398
13431
|
tip,
|
|
13399
13432
|
scale: [unref(camera).zoom.x, unref(camera).zoom.y],
|
|
@@ -13409,7 +13442,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13409
13442
|
]),
|
|
13410
13443
|
key: "0"
|
|
13411
13444
|
} : void 0
|
|
13412
|
-
]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "scale", "offset"])) : createCommentVNode("", true)
|
|
13445
|
+
]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "hide-ui", "scale", "offset"])) : createCommentVNode("", true)
|
|
13413
13446
|
]);
|
|
13414
13447
|
};
|
|
13415
13448
|
}
|
|
@@ -13899,15 +13932,21 @@ const _slice = definePlugin((editor) => {
|
|
|
13899
13932
|
]
|
|
13900
13933
|
};
|
|
13901
13934
|
});
|
|
13902
|
-
const _hoisted_1$b = {
|
|
13935
|
+
const _hoisted_1$b = {
|
|
13936
|
+
key: 0,
|
|
13937
|
+
class: "mce-smart-guides"
|
|
13938
|
+
};
|
|
13903
13939
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
13904
13940
|
__name: "SmartGuides",
|
|
13905
13941
|
props: {
|
|
13906
13942
|
snapLines: {}
|
|
13907
13943
|
},
|
|
13908
13944
|
setup(__props) {
|
|
13945
|
+
const {
|
|
13946
|
+
state
|
|
13947
|
+
} = useEditor();
|
|
13909
13948
|
return (_ctx, _cache) => {
|
|
13910
|
-
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
13949
|
+
return unref(state) === "transforming" || unref(state) === "moving" ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
13911
13950
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.snapLines, (item, key) => {
|
|
13912
13951
|
return openBlock(), createElementBlock("div", {
|
|
13913
13952
|
key,
|
|
@@ -13920,7 +13959,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
13920
13959
|
})
|
|
13921
13960
|
}, null, 6);
|
|
13922
13961
|
}), 128))
|
|
13923
|
-
]);
|
|
13962
|
+
])) : createCommentVNode("", true);
|
|
13924
13963
|
};
|
|
13925
13964
|
}
|
|
13926
13965
|
});
|
|
@@ -14865,7 +14904,6 @@ const _smartGuides = definePlugin((editor) => {
|
|
|
14865
14904
|
isElement,
|
|
14866
14905
|
elementSelection,
|
|
14867
14906
|
selectionAabb,
|
|
14868
|
-
state,
|
|
14869
14907
|
getAabb,
|
|
14870
14908
|
root,
|
|
14871
14909
|
camera,
|
|
@@ -15090,8 +15128,6 @@ const _smartGuides = definePlugin((editor) => {
|
|
|
15090
15128
|
linePairs.value = _linePairs;
|
|
15091
15129
|
}
|
|
15092
15130
|
const snapLines = computed(() => {
|
|
15093
|
-
if (state.value !== "transforming")
|
|
15094
|
-
return [];
|
|
15095
15131
|
const { zoom, position } = camera.value;
|
|
15096
15132
|
const scaleX = (v) => v * zoom.x;
|
|
15097
15133
|
const scaleY = (v) => v * zoom.y;
|
|
@@ -15269,11 +15305,7 @@ function flipType(type) {
|
|
|
15269
15305
|
function isLeftTopLine(line) {
|
|
15270
15306
|
return ["vt", "hl"].includes(line.type);
|
|
15271
15307
|
}
|
|
15272
|
-
const _hoisted_1$a =
|
|
15273
|
-
key: 0,
|
|
15274
|
-
class: "mce-smart-selection"
|
|
15275
|
-
};
|
|
15276
|
-
const _hoisted_2$6 = ["onMousedown"];
|
|
15308
|
+
const _hoisted_1$a = ["onMousedown"];
|
|
15277
15309
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
15278
15310
|
__name: "SmartSelection",
|
|
15279
15311
|
props: {
|
|
@@ -15287,92 +15319,94 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
15287
15319
|
isPointerInSelection,
|
|
15288
15320
|
elementSelection,
|
|
15289
15321
|
getObb,
|
|
15290
|
-
getAabb,
|
|
15291
15322
|
state,
|
|
15292
15323
|
camera,
|
|
15293
15324
|
resizeElement,
|
|
15294
15325
|
inEditorIs,
|
|
15295
|
-
|
|
15326
|
+
aabbToDrawboardAabb
|
|
15296
15327
|
} = useEditor();
|
|
15297
|
-
const info = ref(
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
xItems: [],
|
|
15302
|
-
yItems: []
|
|
15303
|
-
});
|
|
15304
|
-
function update() {
|
|
15305
|
-
if (currentElement.value) {
|
|
15328
|
+
const info = ref();
|
|
15329
|
+
const disableUpdate = ref(false);
|
|
15330
|
+
function _update() {
|
|
15331
|
+
if (disableUpdate.value) {
|
|
15306
15332
|
return;
|
|
15307
15333
|
}
|
|
15308
|
-
const
|
|
15309
|
-
let
|
|
15310
|
-
let direction;
|
|
15334
|
+
const _selection2 = elementSelection.value;
|
|
15335
|
+
let direction = "vertical";
|
|
15311
15336
|
let spacing;
|
|
15312
|
-
let
|
|
15313
|
-
|
|
15314
|
-
if (state.value !== "transforming" && els.length > 1) {
|
|
15337
|
+
let items = [];
|
|
15338
|
+
if (_selection2.length > 1) {
|
|
15315
15339
|
let prev;
|
|
15316
|
-
const
|
|
15317
|
-
active = true;
|
|
15318
|
-
const sorted = [...items].sort((a, b) => a.aabb.y - b.aabb.y);
|
|
15340
|
+
const sorted = [..._selection2].sort((a, b) => a.globalAabb.y - b.globalAabb.y);
|
|
15319
15341
|
for (let i = 0; i < sorted.length; i++) {
|
|
15320
15342
|
const cur = sorted[i];
|
|
15321
15343
|
if (prev) {
|
|
15322
|
-
if (!cur.
|
|
15323
|
-
|
|
15344
|
+
if (!cur.globalAabb.overlap(prev.globalAabb, "x")) {
|
|
15345
|
+
spacing = void 0;
|
|
15324
15346
|
break;
|
|
15325
15347
|
}
|
|
15326
|
-
const _spacing = cur.
|
|
15348
|
+
const _spacing = cur.globalAabb.top - prev.globalAabb.bottom;
|
|
15327
15349
|
if (spacing !== void 0 && Math.abs(spacing - _spacing) >= 1) {
|
|
15328
|
-
|
|
15350
|
+
spacing = void 0;
|
|
15329
15351
|
break;
|
|
15330
15352
|
}
|
|
15331
15353
|
spacing = _spacing;
|
|
15332
15354
|
}
|
|
15333
15355
|
prev = cur;
|
|
15334
15356
|
}
|
|
15335
|
-
if (
|
|
15336
|
-
|
|
15357
|
+
if (spacing !== void 0) {
|
|
15358
|
+
items = sorted;
|
|
15337
15359
|
direction = "vertical";
|
|
15338
15360
|
} else {
|
|
15339
|
-
active = true;
|
|
15340
15361
|
prev = void 0;
|
|
15341
|
-
|
|
15342
|
-
const sorted2 = [...items].sort((a, b) => a.aabb.x - b.aabb.x);
|
|
15362
|
+
const sorted2 = [..._selection2].sort((a, b) => a.globalAabb.x - b.globalAabb.x);
|
|
15343
15363
|
for (let i = 0; i < sorted2.length; i++) {
|
|
15344
15364
|
const cur = sorted2[i];
|
|
15345
15365
|
if (prev) {
|
|
15346
|
-
if (!cur.
|
|
15347
|
-
|
|
15366
|
+
if (!cur.globalAabb.overlap(prev.globalAabb, "y")) {
|
|
15367
|
+
spacing = void 0;
|
|
15348
15368
|
break;
|
|
15349
15369
|
}
|
|
15350
|
-
const _spacing = cur.
|
|
15370
|
+
const _spacing = cur.globalAabb.left - prev.globalAabb.right;
|
|
15351
15371
|
if (spacing !== void 0 && Math.abs(spacing - _spacing) >= 1) {
|
|
15352
|
-
|
|
15372
|
+
spacing = void 0;
|
|
15353
15373
|
break;
|
|
15354
15374
|
}
|
|
15355
15375
|
spacing = _spacing;
|
|
15356
15376
|
}
|
|
15357
15377
|
prev = cur;
|
|
15358
15378
|
}
|
|
15359
|
-
if (
|
|
15360
|
-
|
|
15379
|
+
if (spacing !== void 0) {
|
|
15380
|
+
items = sorted2;
|
|
15361
15381
|
direction = "horizontal";
|
|
15362
15382
|
}
|
|
15363
15383
|
}
|
|
15364
15384
|
}
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
}
|
|
15385
|
+
if (spacing !== void 0) {
|
|
15386
|
+
info.value = {
|
|
15387
|
+
direction,
|
|
15388
|
+
spacing,
|
|
15389
|
+
items
|
|
15390
|
+
};
|
|
15391
|
+
} else {
|
|
15392
|
+
info.value = void 0;
|
|
15393
|
+
}
|
|
15372
15394
|
}
|
|
15373
|
-
watch(() =>
|
|
15374
|
-
|
|
15375
|
-
|
|
15395
|
+
watch(() => {
|
|
15396
|
+
return elementSelection.value.map((el) => {
|
|
15397
|
+
return {
|
|
15398
|
+
left: el.style.left,
|
|
15399
|
+
top: el.style.top,
|
|
15400
|
+
width: el.style.width,
|
|
15401
|
+
height: el.style.height,
|
|
15402
|
+
rotate: el.style.rotate
|
|
15403
|
+
};
|
|
15404
|
+
});
|
|
15405
|
+
}, _update);
|
|
15406
|
+
watch(() => {
|
|
15407
|
+
return elementSelection.value.map((el) => el.instanceId);
|
|
15408
|
+
}, () => currentElement.value = void 0);
|
|
15409
|
+
const boxes = computed(() => {
|
|
15376
15410
|
return elementSelection.value.map((el) => {
|
|
15377
15411
|
return {
|
|
15378
15412
|
el,
|
|
@@ -15380,13 +15414,61 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
15380
15414
|
};
|
|
15381
15415
|
});
|
|
15382
15416
|
});
|
|
15383
|
-
const
|
|
15417
|
+
const spacingHandles = computed(() => {
|
|
15418
|
+
const handles = [];
|
|
15419
|
+
if (!info.value) {
|
|
15420
|
+
return handles;
|
|
15421
|
+
}
|
|
15422
|
+
const { direction, spacing = 0, items } = info.value;
|
|
15423
|
+
const { zoom, position } = camera.value;
|
|
15424
|
+
const toScreen = (pos) => {
|
|
15425
|
+
pos.x *= zoom.x;
|
|
15426
|
+
pos.y *= zoom.y;
|
|
15427
|
+
pos.x -= position.x;
|
|
15428
|
+
pos.y -= position.y;
|
|
15429
|
+
};
|
|
15430
|
+
for (let i = 0; i < items.length; i++) {
|
|
15431
|
+
const cur = items[i];
|
|
15432
|
+
const next = items[i + 1];
|
|
15433
|
+
if (!next) {
|
|
15434
|
+
break;
|
|
15435
|
+
}
|
|
15436
|
+
const axis = direction === "horizontal" ? "y" : "x";
|
|
15437
|
+
const min = Math.max(cur.globalAabb.min[axis], next.globalAabb.min[axis]);
|
|
15438
|
+
const max = Math.min(cur.globalAabb.max[axis], next.globalAabb.max[axis]);
|
|
15439
|
+
let pos;
|
|
15440
|
+
switch (direction) {
|
|
15441
|
+
case "horizontal":
|
|
15442
|
+
pos = {
|
|
15443
|
+
x: cur.globalAabb.x + cur.globalAabb.width + spacing / 2,
|
|
15444
|
+
y: min + (max - min) / 2
|
|
15445
|
+
};
|
|
15446
|
+
break;
|
|
15447
|
+
case "vertical":
|
|
15448
|
+
pos = {
|
|
15449
|
+
x: min + (max - min) / 2,
|
|
15450
|
+
y: cur.globalAabb.y + cur.globalAabb.height + spacing / 2
|
|
15451
|
+
};
|
|
15452
|
+
break;
|
|
15453
|
+
}
|
|
15454
|
+
toScreen(pos);
|
|
15455
|
+
pos[axis] -= 2;
|
|
15456
|
+
handles.push({
|
|
15457
|
+
el: cur,
|
|
15458
|
+
style: {
|
|
15459
|
+
transform: `matrix(1, 0, 0, 1, ${pos.x}, ${pos.y})`
|
|
15460
|
+
}
|
|
15461
|
+
});
|
|
15462
|
+
}
|
|
15463
|
+
return handles;
|
|
15464
|
+
});
|
|
15465
|
+
const currentTransform = computed({
|
|
15384
15466
|
get: () => {
|
|
15385
15467
|
const { left, top, width, height, rotationDegrees: rotate } = getObb(currentElement.value);
|
|
15386
15468
|
return { left, top, width, height, rotate };
|
|
15387
15469
|
},
|
|
15388
15470
|
set: (val) => {
|
|
15389
|
-
const oldTransform =
|
|
15471
|
+
const oldTransform = currentTransform.value;
|
|
15390
15472
|
const offsetStyle = {
|
|
15391
15473
|
left: val.left - oldTransform.left,
|
|
15392
15474
|
top: val.top - oldTransform.top,
|
|
@@ -15422,63 +15504,244 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
15422
15504
|
right: aabb.right - right,
|
|
15423
15505
|
bottom: aabb.bottom - bottom
|
|
15424
15506
|
};
|
|
15507
|
+
const _info = info.value;
|
|
15508
|
+
if (!_info) {
|
|
15509
|
+
return;
|
|
15510
|
+
}
|
|
15511
|
+
const { direction, items } = _info;
|
|
15425
15512
|
let after = false;
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15513
|
+
switch (direction) {
|
|
15514
|
+
case "horizontal":
|
|
15515
|
+
items.forEach((item) => {
|
|
15516
|
+
if (item.equal(el)) {
|
|
15517
|
+
after = true;
|
|
15518
|
+
} else if (after) {
|
|
15519
|
+
item.style.left += offset2.right;
|
|
15520
|
+
} else {
|
|
15521
|
+
item.style.left += offset2.left;
|
|
15522
|
+
}
|
|
15523
|
+
});
|
|
15524
|
+
break;
|
|
15525
|
+
case "vertical":
|
|
15526
|
+
items.forEach((item) => {
|
|
15527
|
+
if (item.equal(el)) {
|
|
15528
|
+
after = true;
|
|
15529
|
+
} else if (after) {
|
|
15530
|
+
item.style.top += offset2.bottom;
|
|
15531
|
+
} else {
|
|
15532
|
+
item.style.top += offset2.top;
|
|
15533
|
+
}
|
|
15534
|
+
});
|
|
15535
|
+
break;
|
|
15536
|
+
}
|
|
15445
15537
|
}
|
|
15446
15538
|
});
|
|
15447
|
-
|
|
15539
|
+
const globalAabb = ref();
|
|
15540
|
+
const _globalAabb = computed(() => {
|
|
15541
|
+
return globalAabb.value ? aabbToDrawboardAabb(globalAabb.value) : void 0;
|
|
15542
|
+
});
|
|
15543
|
+
function onRingMouseDown(event, item) {
|
|
15448
15544
|
const el = item.el;
|
|
15449
15545
|
currentElement.value = el;
|
|
15450
|
-
|
|
15546
|
+
const _info = info.value;
|
|
15547
|
+
if (!_info) {
|
|
15548
|
+
return;
|
|
15549
|
+
}
|
|
15550
|
+
const { direction, spacing } = _info;
|
|
15551
|
+
globalAabb.value = el.globalAabb.clone();
|
|
15552
|
+
const elAabb = globalAabb.value;
|
|
15553
|
+
handleDrag(event, {
|
|
15554
|
+
start: () => {
|
|
15555
|
+
disableUpdate.value = true;
|
|
15556
|
+
state.value = "moving";
|
|
15557
|
+
},
|
|
15558
|
+
move: (offset2) => {
|
|
15559
|
+
const { zoom } = camera.value;
|
|
15560
|
+
el.position.set(
|
|
15561
|
+
el.position.x + offset2.x / zoom.x,
|
|
15562
|
+
el.position.y + offset2.y / zoom.y
|
|
15563
|
+
);
|
|
15564
|
+
const fixedCenter = elAabb.getCenter();
|
|
15565
|
+
const center = el.globalAabb.getCenter();
|
|
15566
|
+
switch (direction) {
|
|
15567
|
+
case "horizontal": {
|
|
15568
|
+
const diff = center.x - fixedCenter.x;
|
|
15569
|
+
const absDiff = Math.abs(diff);
|
|
15570
|
+
if (absDiff > spacing + elAabb.height / 2) {
|
|
15571
|
+
const sorted = [...elementSelection.value].sort((a, b) => {
|
|
15572
|
+
if (a.equal(el))
|
|
15573
|
+
return elAabb.x - b.globalAabb.x;
|
|
15574
|
+
if (b.equal(el))
|
|
15575
|
+
return a.globalAabb.x - elAabb.x;
|
|
15576
|
+
return a.globalAabb.x - b.globalAabb.x;
|
|
15577
|
+
});
|
|
15578
|
+
const index = sorted.findIndex((v) => v.equal(el));
|
|
15579
|
+
if (diff > 0) {
|
|
15580
|
+
const target = sorted[index + 1];
|
|
15581
|
+
if (target) {
|
|
15582
|
+
const left = target.globalAabb.right - elAabb.width;
|
|
15583
|
+
let _left = elAabb.left;
|
|
15584
|
+
const parentAabb = target.getParent()?.globalAabb;
|
|
15585
|
+
if (parentAabb) {
|
|
15586
|
+
_left -= parentAabb.x;
|
|
15587
|
+
}
|
|
15588
|
+
target.style.left = _left;
|
|
15589
|
+
elAabb.x = left;
|
|
15590
|
+
target.updateGlobalTransform();
|
|
15591
|
+
}
|
|
15592
|
+
} else {
|
|
15593
|
+
const target = sorted[index - 1];
|
|
15594
|
+
if (target) {
|
|
15595
|
+
let left = elAabb.right - target.globalAabb.width;
|
|
15596
|
+
elAabb.x = target.globalAabb.left;
|
|
15597
|
+
const parentAabb = target.getParent()?.globalAabb;
|
|
15598
|
+
if (parentAabb) {
|
|
15599
|
+
left -= parentAabb.x;
|
|
15600
|
+
}
|
|
15601
|
+
target.style.left = left;
|
|
15602
|
+
target.updateGlobalTransform();
|
|
15603
|
+
}
|
|
15604
|
+
}
|
|
15605
|
+
}
|
|
15606
|
+
break;
|
|
15607
|
+
}
|
|
15608
|
+
case "vertical": {
|
|
15609
|
+
const diff = center.y - fixedCenter.y;
|
|
15610
|
+
const absDiff = Math.abs(diff);
|
|
15611
|
+
if (absDiff > spacing + elAabb.height / 2) {
|
|
15612
|
+
const sorted = [...elementSelection.value].sort((a, b) => {
|
|
15613
|
+
if (a.equal(el))
|
|
15614
|
+
return elAabb.y - b.globalAabb.y;
|
|
15615
|
+
if (b.equal(el))
|
|
15616
|
+
return a.globalAabb.y - elAabb.y;
|
|
15617
|
+
return a.globalAabb.y - b.globalAabb.y;
|
|
15618
|
+
});
|
|
15619
|
+
const index = sorted.findIndex((v) => v.equal(el));
|
|
15620
|
+
if (diff > 0) {
|
|
15621
|
+
const target = sorted[index + 1];
|
|
15622
|
+
if (target) {
|
|
15623
|
+
const top = target.globalAabb.bottom - elAabb.height;
|
|
15624
|
+
let _top = elAabb.top;
|
|
15625
|
+
const parentAabb = target.getParent()?.globalAabb;
|
|
15626
|
+
if (parentAabb) {
|
|
15627
|
+
_top -= parentAabb.y;
|
|
15628
|
+
}
|
|
15629
|
+
target.style.top = _top;
|
|
15630
|
+
elAabb.y = top;
|
|
15631
|
+
target.updateGlobalTransform();
|
|
15632
|
+
}
|
|
15633
|
+
} else {
|
|
15634
|
+
const target = sorted[index - 1];
|
|
15635
|
+
if (target) {
|
|
15636
|
+
let top = elAabb.bottom - target.globalAabb.height;
|
|
15637
|
+
elAabb.y = target.globalAabb.top;
|
|
15638
|
+
const parentAabb = target.getParent()?.globalAabb;
|
|
15639
|
+
if (parentAabb) {
|
|
15640
|
+
top -= parentAabb.y;
|
|
15641
|
+
}
|
|
15642
|
+
target.style.top = top;
|
|
15643
|
+
target.updateGlobalTransform();
|
|
15644
|
+
}
|
|
15645
|
+
}
|
|
15646
|
+
}
|
|
15647
|
+
break;
|
|
15648
|
+
}
|
|
15649
|
+
}
|
|
15650
|
+
},
|
|
15651
|
+
end: () => {
|
|
15652
|
+
let x = elAabb.x;
|
|
15653
|
+
let y = elAabb.y;
|
|
15654
|
+
const parentAabb = el.getParent()?.globalAabb;
|
|
15655
|
+
if (parentAabb) {
|
|
15656
|
+
x -= parentAabb.x;
|
|
15657
|
+
y -= parentAabb.y;
|
|
15658
|
+
}
|
|
15659
|
+
el.style.left = x;
|
|
15660
|
+
el.style.top = y;
|
|
15661
|
+
el.updateGlobalTransform();
|
|
15662
|
+
globalAabb.value = void 0;
|
|
15663
|
+
state.value = void 0;
|
|
15664
|
+
disableUpdate.value = false;
|
|
15665
|
+
}
|
|
15666
|
+
});
|
|
15667
|
+
}
|
|
15668
|
+
function onSpacingMouseDown(event) {
|
|
15669
|
+
const _info = info.value;
|
|
15670
|
+
if (!_info) {
|
|
15671
|
+
return;
|
|
15672
|
+
}
|
|
15673
|
+
const { direction, items } = _info;
|
|
15674
|
+
handleDrag(event, {
|
|
15675
|
+
start: () => state.value = "moving",
|
|
15676
|
+
move: (offset2) => {
|
|
15677
|
+
const { zoom } = camera.value;
|
|
15678
|
+
offset2.x /= zoom.x;
|
|
15679
|
+
offset2.y /= zoom.y;
|
|
15680
|
+
switch (direction) {
|
|
15681
|
+
case "horizontal":
|
|
15682
|
+
items.forEach((item, index) => {
|
|
15683
|
+
item.style.left += index * offset2.x;
|
|
15684
|
+
});
|
|
15685
|
+
break;
|
|
15686
|
+
case "vertical":
|
|
15687
|
+
items.forEach((item, index) => {
|
|
15688
|
+
item.style.top += index * offset2.y;
|
|
15689
|
+
});
|
|
15690
|
+
break;
|
|
15691
|
+
}
|
|
15692
|
+
},
|
|
15693
|
+
end: () => state.value = void 0
|
|
15694
|
+
});
|
|
15451
15695
|
}
|
|
15452
15696
|
return (_ctx, _cache) => {
|
|
15453
|
-
return info.value
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
class: normalizeClass(["mce-smart-
|
|
15465
|
-
"mce-smart-
|
|
15697
|
+
return info.value ? (openBlock(), createElementBlock("div", {
|
|
15698
|
+
key: 0,
|
|
15699
|
+
class: normalizeClass(["mce-smart-selection", {
|
|
15700
|
+
"mce-smart-selection--hover": unref(isPointerInSelection),
|
|
15701
|
+
[`mce-smart-selection--${info.value.direction}`]: true
|
|
15702
|
+
}])
|
|
15703
|
+
}, [
|
|
15704
|
+
unref(state) !== "moving" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
15705
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(boxes.value, (item, index) => {
|
|
15706
|
+
return openBlock(), createElementBlock("div", {
|
|
15707
|
+
key: index,
|
|
15708
|
+
class: normalizeClass(["mce-smart-selection__node", {
|
|
15709
|
+
"mce-smart-selection__node--active": item.el.equal(currentElement.value)
|
|
15466
15710
|
}]),
|
|
15467
|
-
|
|
15468
|
-
},
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15711
|
+
style: normalizeStyle$1(item.style)
|
|
15712
|
+
}, [
|
|
15713
|
+
createElementVNode("div", {
|
|
15714
|
+
class: "mce-smart-selection__ring",
|
|
15715
|
+
onMousedown: ($event) => onRingMouseDown($event, item)
|
|
15716
|
+
}, null, 40, _hoisted_1$a)
|
|
15717
|
+
], 6);
|
|
15718
|
+
}), 128)),
|
|
15719
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(spacingHandles.value, (item, index) => {
|
|
15720
|
+
return openBlock(), createElementBlock("div", {
|
|
15721
|
+
key: index,
|
|
15722
|
+
class: "mce-smart-selection__spacing",
|
|
15723
|
+
style: normalizeStyle$1(item.style),
|
|
15724
|
+
onMousedown: _cache[0] || (_cache[0] = ($event) => onSpacingMouseDown($event))
|
|
15725
|
+
}, [..._cache[2] || (_cache[2] = [
|
|
15726
|
+
createElementVNode("div", { class: "mce-smart-selection__spacing-line" }, null, -1)
|
|
15727
|
+
])], 36);
|
|
15728
|
+
}), 128)),
|
|
15729
|
+
currentTransform.value.width && currentTransform.value.height ? (openBlock(), createBlock(_sfc_main$l, {
|
|
15730
|
+
key: 0,
|
|
15731
|
+
modelValue: currentTransform.value,
|
|
15732
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentTransform.value = $event),
|
|
15733
|
+
handles: ["resize-l", "resize-r", "resize-t", "resize-b"],
|
|
15734
|
+
class: "mce-smart-selection__transform",
|
|
15735
|
+
color: "#FF24BD",
|
|
15736
|
+
scale: [unref(camera).zoom.x, unref(camera).zoom.y],
|
|
15737
|
+
offset: [-unref(camera).position.x, -unref(camera).position.y]
|
|
15738
|
+
}, null, 8, ["modelValue", "scale", "offset"])) : createCommentVNode("", true)
|
|
15739
|
+
], 64)) : _globalAabb.value ? (openBlock(), createElementBlock("div", {
|
|
15740
|
+
key: 1,
|
|
15741
|
+
class: "mce-smart-selection__ghost",
|
|
15742
|
+
style: normalizeStyle$1(_globalAabb.value.toCssStyle())
|
|
15743
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
15744
|
+
], 2)) : createCommentVNode("", true);
|
|
15482
15745
|
};
|
|
15483
15746
|
}
|
|
15484
15747
|
});
|
|
@@ -15603,7 +15866,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
15603
15866
|
createElementVNode("span", _hoisted_7, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
15604
15867
|
createElementVNode("span", null, toDisplayString(unref(t)("commitChanges")), 1)
|
|
15605
15868
|
])
|
|
15606
|
-
], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
15869
|
+
], 64)) : unref(state) === "transforming" || unref(state) === "moving" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
15607
15870
|
createElementVNode("div", _hoisted_8, [
|
|
15608
15871
|
createVNode(unref(_sfc_main$E), { icon: "$mouseRightClick" })
|
|
15609
15872
|
]),
|
|
@@ -15663,7 +15926,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
15663
15926
|
};
|
|
15664
15927
|
}
|
|
15665
15928
|
});
|
|
15666
|
-
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
15929
|
+
const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-c3c7d56a"]]);
|
|
15667
15930
|
const _statusbar = definePlugin((editor) => {
|
|
15668
15931
|
const {
|
|
15669
15932
|
registerConfig
|
package/dist/typed-global.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface HandleDragOptions {
|
|
2
|
+
threshold?: number;
|
|
3
|
+
start?: (event: MouseEvent) => void;
|
|
4
|
+
move?: (offset: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}, event: MouseEvent) => void;
|
|
8
|
+
end?: (event: MouseEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function handleDrag(downEvent: MouseEvent, options?: HandleDragOptions): void;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.7",
|
|
5
5
|
"description": "A headless infinite canvas editor framework built on WebGL rendering, supports exporting to image, video, and PPT. Only the ESM.",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|