mce 0.15.25 → 0.15.27
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/Scrollbars.vue.d.ts +0 -2
- 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 +642 -292
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/zh-Hans.d.ts +1 -0
- package/dist/mixins/0.config/base.d.ts +8 -4
- package/dist/mixins/0.context.d.ts +2 -0
- package/dist/mixins/1.screen.d.ts +2 -1
- package/dist/mixins/http.d.ts +23 -0
- package/dist/mixins/scroll.d.ts +4 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugins/slice.d.ts +2 -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 +2 -1
- package/package.json +2 -2
- 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 () => {
|
|
@@ -938,8 +938,11 @@ const _0_context = defineMixin((editor) => {
|
|
|
938
938
|
function isElement(value) {
|
|
939
939
|
return value instanceof Element2D;
|
|
940
940
|
}
|
|
941
|
+
function inEditorIs(value, inEditorIs2) {
|
|
942
|
+
return value.meta.inEditorIs === inEditorIs2;
|
|
943
|
+
}
|
|
941
944
|
function isFrame(value) {
|
|
942
|
-
return isElement(value) && value
|
|
945
|
+
return isElement(value) && inEditorIs(value, "Frame");
|
|
943
946
|
}
|
|
944
947
|
function isTopFrame(value) {
|
|
945
948
|
return isFrame(value) && Boolean(value.parent?.equal(root.value));
|
|
@@ -984,6 +987,7 @@ const _0_context = defineMixin((editor) => {
|
|
|
984
987
|
isNode,
|
|
985
988
|
isRoot,
|
|
986
989
|
isElement,
|
|
990
|
+
inEditorIs,
|
|
987
991
|
isFrame,
|
|
988
992
|
isTopFrame,
|
|
989
993
|
isVisible,
|
|
@@ -1079,6 +1083,7 @@ const en = {
|
|
|
1079
1083
|
"move": "Move",
|
|
1080
1084
|
"hand": "Hand",
|
|
1081
1085
|
"frame": "Frame",
|
|
1086
|
+
"slice": "Slice",
|
|
1082
1087
|
"group": "Group",
|
|
1083
1088
|
"text": "Text",
|
|
1084
1089
|
"doubleClickEditText": "DoubleClickEditText",
|
|
@@ -1191,6 +1196,7 @@ const zhHans = {
|
|
|
1191
1196
|
"move": "移动",
|
|
1192
1197
|
"hand": "抓手",
|
|
1193
1198
|
"frame": "画板",
|
|
1199
|
+
"slice": "切片",
|
|
1194
1200
|
"group": "组合",
|
|
1195
1201
|
"text": "文字",
|
|
1196
1202
|
"doubleClickEditText": "双击编辑文字",
|
|
@@ -1815,22 +1821,36 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1815
1821
|
config,
|
|
1816
1822
|
drawboardAabb
|
|
1817
1823
|
} = editor;
|
|
1818
|
-
const
|
|
1824
|
+
const screenControlsOffset = computed(() => {
|
|
1819
1825
|
const offset2 = {
|
|
1820
1826
|
left: 0,
|
|
1821
1827
|
top: 0,
|
|
1822
1828
|
bottom: 0,
|
|
1823
|
-
right: 0
|
|
1824
|
-
...config.value.screenCenterOffset
|
|
1829
|
+
right: 0
|
|
1825
1830
|
};
|
|
1826
|
-
if (config.value.scrollbar) {
|
|
1827
|
-
offset2.right += 8;
|
|
1828
|
-
offset2.bottom += 8;
|
|
1829
|
-
}
|
|
1830
1831
|
if (config.value.ruler) {
|
|
1831
1832
|
offset2.left += 16;
|
|
1832
1833
|
offset2.top += 16;
|
|
1833
1834
|
}
|
|
1835
|
+
if (config.value.scrollbar) {
|
|
1836
|
+
offset2.right += 8;
|
|
1837
|
+
offset2.bottom += 8;
|
|
1838
|
+
}
|
|
1839
|
+
return offset2;
|
|
1840
|
+
});
|
|
1841
|
+
const screenCenterOffset = computed(() => {
|
|
1842
|
+
const _screenControlsOffset = screenControlsOffset.value;
|
|
1843
|
+
const offset2 = {
|
|
1844
|
+
left: 0,
|
|
1845
|
+
top: 0,
|
|
1846
|
+
bottom: 0,
|
|
1847
|
+
right: 0,
|
|
1848
|
+
...config.value.screenCenterOffset
|
|
1849
|
+
};
|
|
1850
|
+
offset2.left += _screenControlsOffset.left;
|
|
1851
|
+
offset2.top += _screenControlsOffset.top;
|
|
1852
|
+
offset2.right += _screenControlsOffset.right;
|
|
1853
|
+
offset2.bottom += _screenControlsOffset.bottom;
|
|
1834
1854
|
return offset2;
|
|
1835
1855
|
});
|
|
1836
1856
|
const screenCenter = computed(() => {
|
|
@@ -1841,6 +1861,7 @@ const _1_screen = defineMixin((editor) => {
|
|
|
1841
1861
|
};
|
|
1842
1862
|
});
|
|
1843
1863
|
Object.assign(editor, {
|
|
1864
|
+
screenControlsOffset,
|
|
1844
1865
|
screenCenterOffset,
|
|
1845
1866
|
screenCenter
|
|
1846
1867
|
});
|
|
@@ -1937,7 +1958,8 @@ const _2_box = defineMixin((editor) => {
|
|
|
1937
1958
|
root,
|
|
1938
1959
|
selection,
|
|
1939
1960
|
getAncestorFrame,
|
|
1940
|
-
drawboardAabb
|
|
1961
|
+
drawboardAabb,
|
|
1962
|
+
screenControlsOffset
|
|
1941
1963
|
} = editor;
|
|
1942
1964
|
function obbToFit(element) {
|
|
1943
1965
|
const min = {
|
|
@@ -2120,15 +2142,18 @@ const _2_box = defineMixin((editor) => {
|
|
|
2120
2142
|
return _aabb;
|
|
2121
2143
|
}
|
|
2122
2144
|
const viewportAabb = computed(() => {
|
|
2145
|
+
const _camera = camera.value;
|
|
2146
|
+
const { position, zoom } = _camera;
|
|
2123
2147
|
noop(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2148
|
+
position.x,
|
|
2149
|
+
position.y,
|
|
2150
|
+
zoom.x,
|
|
2151
|
+
zoom.y
|
|
2128
2152
|
);
|
|
2153
|
+
const { left, top, right, bottom } = screenControlsOffset.value;
|
|
2129
2154
|
const { width, height } = drawboardAabb.value;
|
|
2130
|
-
const p1 =
|
|
2131
|
-
const p2 =
|
|
2155
|
+
const p1 = _camera.toGlobal({ x: left, y: top });
|
|
2156
|
+
const p2 = _camera.toGlobal({ x: width - (right + left), y: height - (bottom + top) });
|
|
2132
2157
|
return new Aabb2D({
|
|
2133
2158
|
x: p1.x,
|
|
2134
2159
|
y: p1.y,
|
|
@@ -3467,22 +3492,20 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3467
3492
|
continue;
|
|
3468
3493
|
}
|
|
3469
3494
|
const aabb2 = frame2.getGlobalAabb();
|
|
3470
|
-
if (aabb2) {
|
|
3471
|
-
if (
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
index = options.index;
|
|
3476
|
-
}
|
|
3477
|
-
frame2.moveChild(element, index);
|
|
3478
|
-
element.style.left = aabb1.x - aabb2.x;
|
|
3479
|
-
element.style.top = aabb1.y - aabb2.y;
|
|
3480
|
-
element.updateGlobalTransform();
|
|
3481
|
-
exec("layerScrollIntoView");
|
|
3495
|
+
if (pointer ? aabb2.contains(pointer) : aabb1 && aabb1.getIntersectionRect(aabb2).getArea() > area1 * 0.5) {
|
|
3496
|
+
if (!frame2.equal(frame1)) {
|
|
3497
|
+
let index = frame2.children.length;
|
|
3498
|
+
if (frame2.equal(options?.parent)) {
|
|
3499
|
+
index = options.index;
|
|
3482
3500
|
}
|
|
3483
|
-
|
|
3484
|
-
|
|
3501
|
+
frame2.moveChild(element, index);
|
|
3502
|
+
element.style.left = aabb1.x - aabb2.x;
|
|
3503
|
+
element.style.top = aabb1.y - aabb2.y;
|
|
3504
|
+
element.updateGlobalTransform();
|
|
3505
|
+
exec("layerScrollIntoView");
|
|
3485
3506
|
}
|
|
3507
|
+
flag = false;
|
|
3508
|
+
break;
|
|
3486
3509
|
}
|
|
3487
3510
|
}
|
|
3488
3511
|
if (flag && frame1) {
|
|
@@ -3506,8 +3529,11 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3506
3529
|
on,
|
|
3507
3530
|
getGlobalPointer
|
|
3508
3531
|
} = editor;
|
|
3509
|
-
|
|
3532
|
+
let startFrame;
|
|
3533
|
+
let startContext = {};
|
|
3510
3534
|
on("selectionTransformStart", ({ elements }) => {
|
|
3535
|
+
const pointer = getGlobalPointer();
|
|
3536
|
+
startFrame = frames.value.find((frame) => frame.getGlobalAabb().contains(pointer));
|
|
3511
3537
|
const ctx = {};
|
|
3512
3538
|
elements.forEach((el) => {
|
|
3513
3539
|
ctx[el.instanceId] = {
|
|
@@ -3515,16 +3541,19 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3515
3541
|
index: el.getIndex()
|
|
3516
3542
|
};
|
|
3517
3543
|
});
|
|
3518
|
-
startContext
|
|
3544
|
+
startContext = ctx;
|
|
3519
3545
|
});
|
|
3520
3546
|
on("selectionTransforming", ({ handle, startEvent, elements }) => {
|
|
3521
3547
|
if (handle === "move" && !startEvent?.__FROM__) {
|
|
3522
3548
|
const idSet = /* @__PURE__ */ new Set();
|
|
3523
3549
|
elements.forEach((el) => {
|
|
3524
|
-
|
|
3525
|
-
|
|
3550
|
+
const frame = isTopFrame(el) ? el : el.findAncestor(isTopFrame);
|
|
3551
|
+
if (frame) {
|
|
3552
|
+
if (frame.equal(startFrame)) {
|
|
3553
|
+
idSet.add(frame.instanceId);
|
|
3554
|
+
}
|
|
3526
3555
|
} else {
|
|
3527
|
-
idSet.add(
|
|
3556
|
+
idSet.add(0);
|
|
3528
3557
|
}
|
|
3529
3558
|
});
|
|
3530
3559
|
if (idSet.size === 1) {
|
|
@@ -3532,7 +3561,7 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3532
3561
|
handleDragOutReparent(
|
|
3533
3562
|
element,
|
|
3534
3563
|
{
|
|
3535
|
-
...startContext
|
|
3564
|
+
...startContext[element.instanceId],
|
|
3536
3565
|
pointer: getGlobalPointer()
|
|
3537
3566
|
}
|
|
3538
3567
|
);
|
|
@@ -3541,7 +3570,8 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3541
3570
|
}
|
|
3542
3571
|
});
|
|
3543
3572
|
on("selectionTransformEnd", () => {
|
|
3544
|
-
startContext
|
|
3573
|
+
startContext = {};
|
|
3574
|
+
startFrame = void 0;
|
|
3545
3575
|
});
|
|
3546
3576
|
};
|
|
3547
3577
|
});
|
|
@@ -3917,6 +3947,72 @@ const _drawingTool$1 = defineMixin((editor) => {
|
|
|
3917
3947
|
});
|
|
3918
3948
|
};
|
|
3919
3949
|
});
|
|
3950
|
+
function createHttp() {
|
|
3951
|
+
async function request(config) {
|
|
3952
|
+
const {
|
|
3953
|
+
url,
|
|
3954
|
+
method = "GET",
|
|
3955
|
+
data,
|
|
3956
|
+
responseType
|
|
3957
|
+
} = config;
|
|
3958
|
+
const fetchConfig = {
|
|
3959
|
+
method: method.toUpperCase(),
|
|
3960
|
+
headers: new Headers()
|
|
3961
|
+
};
|
|
3962
|
+
if (data !== void 0) {
|
|
3963
|
+
if (data instanceof FormData || data instanceof URLSearchParams || data instanceof Blob) {
|
|
3964
|
+
fetchConfig.body = data;
|
|
3965
|
+
} else if (typeof data === "object") {
|
|
3966
|
+
fetchConfig.body = JSON.stringify(data);
|
|
3967
|
+
fetchConfig.headers.set("Content-Type", "application/json");
|
|
3968
|
+
} else {
|
|
3969
|
+
fetchConfig.body = String(data);
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
const response = await fetch(url, fetchConfig);
|
|
3973
|
+
if (!response.ok) {
|
|
3974
|
+
const error = new Error(`HTTP Error: ${response.status} ${response.statusText}`);
|
|
3975
|
+
error.response = {
|
|
3976
|
+
status: response.status,
|
|
3977
|
+
statusText: response.statusText,
|
|
3978
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
3979
|
+
data: await response.text().catch(() => null)
|
|
3980
|
+
};
|
|
3981
|
+
throw error;
|
|
3982
|
+
}
|
|
3983
|
+
let _responseType = responseType;
|
|
3984
|
+
if (!_responseType) {
|
|
3985
|
+
const repContentType = response.headers.get("content-type");
|
|
3986
|
+
if (repContentType) {
|
|
3987
|
+
if (repContentType.includes("application/json")) {
|
|
3988
|
+
_responseType = "json";
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
switch (_responseType ?? "text") {
|
|
3993
|
+
case "arraybuffer":
|
|
3994
|
+
return await response.arrayBuffer();
|
|
3995
|
+
case "blob":
|
|
3996
|
+
return await response.blob();
|
|
3997
|
+
case "json":
|
|
3998
|
+
return await response.json();
|
|
3999
|
+
case "document":
|
|
4000
|
+
case "stream":
|
|
4001
|
+
case "formdata":
|
|
4002
|
+
case "text":
|
|
4003
|
+
default:
|
|
4004
|
+
return await response.text();
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
return {
|
|
4008
|
+
request
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
const _http = defineMixin((editor, options) => {
|
|
4012
|
+
Object.assign(editor, {
|
|
4013
|
+
http: options.http ?? createHttp()
|
|
4014
|
+
});
|
|
4015
|
+
});
|
|
3920
4016
|
const _scroll$1 = defineMixin((editor) => {
|
|
3921
4017
|
const {
|
|
3922
4018
|
camera,
|
|
@@ -3924,7 +4020,8 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3924
4020
|
selectionAabb,
|
|
3925
4021
|
rootAabb,
|
|
3926
4022
|
viewportAabb,
|
|
3927
|
-
screenCenter
|
|
4023
|
+
screenCenter,
|
|
4024
|
+
screenCenterOffset
|
|
3928
4025
|
} = editor;
|
|
3929
4026
|
const scrollTo = async (target, options = {}) => {
|
|
3930
4027
|
const {
|
|
@@ -3933,12 +4030,20 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3933
4030
|
duration = 500
|
|
3934
4031
|
} = options;
|
|
3935
4032
|
const _camera = camera.value;
|
|
4033
|
+
const { position: _position, zoom } = _camera;
|
|
4034
|
+
const oldPosition = { x: _position.x, y: _position.y };
|
|
3936
4035
|
const _screenCenter = screenCenter.value;
|
|
3937
4036
|
const offset2 = { x: 0, y: 0 };
|
|
3938
|
-
let
|
|
3939
|
-
if (typeof target === "object"
|
|
3940
|
-
|
|
3941
|
-
|
|
4037
|
+
let targetPosition = {};
|
|
4038
|
+
if (typeof target === "object") {
|
|
4039
|
+
if ("x" in target) {
|
|
4040
|
+
targetPosition.x = target.x;
|
|
4041
|
+
offset2.x = -screenCenterOffset.value.left;
|
|
4042
|
+
}
|
|
4043
|
+
if ("y" in target) {
|
|
4044
|
+
targetPosition.y = target.y;
|
|
4045
|
+
offset2.y = -screenCenterOffset.value.top;
|
|
4046
|
+
}
|
|
3942
4047
|
} else {
|
|
3943
4048
|
let aabb;
|
|
3944
4049
|
if (Array.isArray(target)) {
|
|
@@ -3957,15 +4062,22 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3957
4062
|
if (intoView && viewportAabb.value.contains(aabb)) {
|
|
3958
4063
|
return;
|
|
3959
4064
|
}
|
|
3960
|
-
|
|
4065
|
+
targetPosition = { x: aabb.left + aabb.width / 2, y: aabb.top + aabb.height / 2 };
|
|
3961
4066
|
offset2.x += -_screenCenter.x;
|
|
3962
4067
|
offset2.y = -_screenCenter.y;
|
|
3963
4068
|
}
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
4069
|
+
if (targetPosition.x !== void 0) {
|
|
4070
|
+
targetPosition.x *= zoom.x;
|
|
4071
|
+
targetPosition.x += offset2.x;
|
|
4072
|
+
}
|
|
4073
|
+
if (targetPosition.y !== void 0) {
|
|
4074
|
+
targetPosition.y *= zoom.y;
|
|
4075
|
+
targetPosition.y += offset2.y;
|
|
4076
|
+
}
|
|
4077
|
+
const position = {
|
|
4078
|
+
...oldPosition,
|
|
4079
|
+
...targetPosition
|
|
4080
|
+
};
|
|
3969
4081
|
switch (behavior) {
|
|
3970
4082
|
case "smooth":
|
|
3971
4083
|
await new Promise((resolve) => {
|
|
@@ -3978,7 +4090,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3978
4090
|
const elapsed = now - startTime;
|
|
3979
4091
|
const progress = Math.min(elapsed / duration, 1);
|
|
3980
4092
|
const ease = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
|
|
3981
|
-
|
|
4093
|
+
_position.set(
|
|
3982
4094
|
oldPosition.x + positionDistance.x * ease,
|
|
3983
4095
|
oldPosition.y + positionDistance.y * ease
|
|
3984
4096
|
);
|
|
@@ -3993,7 +4105,7 @@ const _scroll$1 = defineMixin((editor) => {
|
|
|
3993
4105
|
break;
|
|
3994
4106
|
case "instant":
|
|
3995
4107
|
default:
|
|
3996
|
-
|
|
4108
|
+
_position.set(position.x, position.y);
|
|
3997
4109
|
break;
|
|
3998
4110
|
}
|
|
3999
4111
|
};
|
|
@@ -4237,6 +4349,7 @@ const mixins = [
|
|
|
4237
4349
|
_4_3_element,
|
|
4238
4350
|
_4_4_doc,
|
|
4239
4351
|
_drawingTool$1,
|
|
4352
|
+
_http,
|
|
4240
4353
|
_scroll$1,
|
|
4241
4354
|
_snapshot,
|
|
4242
4355
|
_zoom$1
|
|
@@ -4722,33 +4835,6 @@ const _edit = definePlugin((editor, options) => {
|
|
|
4722
4835
|
}
|
|
4723
4836
|
};
|
|
4724
4837
|
});
|
|
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
4838
|
function makeIconProps() {
|
|
4753
4839
|
return {
|
|
4754
4840
|
icon: {
|
|
@@ -4837,7 +4923,9 @@ const aliases = {
|
|
|
4837
4923
|
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
4924
|
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
4925
|
check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
|
|
4926
|
+
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
4927
|
frame: "M17 9v6H7V9zm2-6h-2v3h2zM7 3H5v3h2zm16 4h-3v2h3zm-4 0H5v10h14zM4 7H1v2h3zm19 8h-3v2h3zM4 15H1v2h3zm15 3h-2v3h2zM7 18H5v3h2z",
|
|
4928
|
+
slice: "M20.802 4.221a2.166 2.166 0 0 0-3.062 0L2.24 19.72l.001.001A.75.75 0 0 0 2.773 21h8.125a2.25 2.25 0 0 0 2.25-2.25v-3.812l7.654-7.654a2.166 2.166 0 0 0 0-3.063m-7.654 8.596v-1.883L18.8 5.282a.665.665 0 1 1 .941.941zM4.584 19.5l7.064-7.064v6.314a.75.75 0 0 1-.75.75z",
|
|
4841
4929
|
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
4930
|
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",
|
|
4843
4931
|
text: "m18.5 4l1.16 4.35l-.96.26c-.45-.87-.91-1.74-1.44-2.18C16.73 6 16.11 6 15.5 6H13v10.5c0 .5 0 1 .33 1.25c.34.25 1 .25 1.67.25v1H9v-1c.67 0 1.33 0 1.67-.25c.33-.25.33-.75.33-1.25V6H8.5c-.61 0-1.23 0-1.76.43c-.53.44-.99 1.31-1.44 2.18l-.96-.26L5.5 4z",
|
|
@@ -4937,6 +5025,7 @@ function createLayer() {
|
|
|
4937
5025
|
}
|
|
4938
5026
|
provide(MceLayerKey, {
|
|
4939
5027
|
selecting,
|
|
5028
|
+
openedItems,
|
|
4940
5029
|
dragging,
|
|
4941
5030
|
droppingItemId,
|
|
4942
5031
|
register: (vm, item) => {
|
|
@@ -5318,7 +5407,9 @@ const makeMceOverlayProps = propsFactory({
|
|
|
5318
5407
|
attach: {
|
|
5319
5408
|
type: [String, Boolean, Object],
|
|
5320
5409
|
default: void 0
|
|
5321
|
-
}
|
|
5410
|
+
},
|
|
5411
|
+
contentClass: Object,
|
|
5412
|
+
contentStyle: Object
|
|
5322
5413
|
}, "makeMceOverlayProps");
|
|
5323
5414
|
let globalOverlayRoot;
|
|
5324
5415
|
function getGlobalOverlayRoot() {
|
|
@@ -5513,9 +5604,6 @@ const _frame = definePlugin((editor) => {
|
|
|
5513
5604
|
} = editor;
|
|
5514
5605
|
return {
|
|
5515
5606
|
name: "mce:frame",
|
|
5516
|
-
components: [
|
|
5517
|
-
{ type: "overlay", component: _sfc_main$A }
|
|
5518
|
-
],
|
|
5519
5607
|
drawingTools: [
|
|
5520
5608
|
{
|
|
5521
5609
|
name: "frame",
|
|
@@ -5555,6 +5643,9 @@ const _frame = definePlugin((editor) => {
|
|
|
5555
5643
|
],
|
|
5556
5644
|
hotkeys: [
|
|
5557
5645
|
{ command: "setActiveDrawingTool:frame", key: "F" }
|
|
5646
|
+
],
|
|
5647
|
+
components: [
|
|
5648
|
+
{ type: "overlay", component: _sfc_main$A, order: "before" }
|
|
5558
5649
|
]
|
|
5559
5650
|
};
|
|
5560
5651
|
});
|
|
@@ -6091,13 +6182,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6091
6182
|
dragging,
|
|
6092
6183
|
dropping,
|
|
6093
6184
|
onMousedown,
|
|
6094
|
-
id
|
|
6185
|
+
id,
|
|
6186
|
+
openedItems
|
|
6095
6187
|
} = useLayerItem({
|
|
6096
6188
|
opened,
|
|
6097
6189
|
node: computed(() => props.node),
|
|
6098
6190
|
dom: computed(() => dom.value)
|
|
6099
6191
|
});
|
|
6100
|
-
const
|
|
6192
|
+
const selected = computed(() => selection.value.some((v) => v.equal(props.node)));
|
|
6101
6193
|
const children = computed(() => props.node.children);
|
|
6102
6194
|
const childrenLength = computed(() => children.value.length);
|
|
6103
6195
|
const inputDom = ref();
|
|
@@ -6250,7 +6342,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6250
6342
|
ref: dom,
|
|
6251
6343
|
class: normalizeClass(["mce-layer", [
|
|
6252
6344
|
props.root && "mce-layer--root",
|
|
6253
|
-
(__props.active ||
|
|
6345
|
+
(__props.active || selected.value) && "mce-layer--active",
|
|
6346
|
+
selected.value && "mce-layer--selected",
|
|
6254
6347
|
opened.value && "mce-layer--open",
|
|
6255
6348
|
isHoverElement.value && "mce-layer--hover",
|
|
6256
6349
|
unref(dropping) && "mce-layer--dropping"
|
|
@@ -6264,12 +6357,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6264
6357
|
onMouseleave,
|
|
6265
6358
|
onContextmenu
|
|
6266
6359
|
}, [
|
|
6267
|
-
_cache[
|
|
6268
|
-
_cache[
|
|
6360
|
+
_cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
|
|
6361
|
+
_cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
|
|
6269
6362
|
createElementVNode("div", _hoisted_2$c, [
|
|
6270
6363
|
createElementVNode("div", _hoisted_3$b, [
|
|
6271
6364
|
childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
|
|
6272
6365
|
key: 0,
|
|
6366
|
+
class: "mce-layer__arrow",
|
|
6273
6367
|
icon: "$arrowRight",
|
|
6274
6368
|
onClick: onClickExpand,
|
|
6275
6369
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
@@ -6312,13 +6406,29 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6312
6406
|
"mce-layer__action--show": hovering.value || unref(isLock)(props.node) || !unref(isVisible)(props.node)
|
|
6313
6407
|
}])
|
|
6314
6408
|
}, [
|
|
6315
|
-
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6409
|
+
props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6410
|
+
Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$y, {
|
|
6411
|
+
key: 0,
|
|
6412
|
+
icon: "",
|
|
6413
|
+
class: "mce-layer__btn mce-layer__btn--show",
|
|
6414
|
+
onMousedown: _cache[2] || (_cache[2] = withModifiers(($event) => unref(openedItems).forEach((item, _id) => {
|
|
6415
|
+
if (_id !== unref(id)) {
|
|
6416
|
+
item.value = false;
|
|
6417
|
+
}
|
|
6418
|
+
}), ["prevent", "stop"]))
|
|
6419
|
+
}, {
|
|
6420
|
+
default: withCtx(() => [
|
|
6421
|
+
createVNode(unref(_sfc_main$C), { icon: "$collapse" })
|
|
6422
|
+
]),
|
|
6423
|
+
_: 1
|
|
6424
|
+
})) : createCommentVNode("", true)
|
|
6425
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6316
6426
|
createVNode(_sfc_main$y, {
|
|
6317
6427
|
icon: "",
|
|
6318
6428
|
class: normalizeClass(["mce-layer__btn", {
|
|
6319
6429
|
"mce-layer__btn--show": unref(isLock)(props.node)
|
|
6320
6430
|
}]),
|
|
6321
|
-
onClick: _cache[
|
|
6431
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
|
|
6322
6432
|
}, {
|
|
6323
6433
|
default: withCtx(() => [
|
|
6324
6434
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6332,7 +6442,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6332
6442
|
class: normalizeClass(["mce-layer__btn", {
|
|
6333
6443
|
"mce-layer__btn--show": !unref(isVisible)(props.node)
|
|
6334
6444
|
}]),
|
|
6335
|
-
onClick: _cache[
|
|
6445
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
|
|
6336
6446
|
}, {
|
|
6337
6447
|
default: withCtx(() => [
|
|
6338
6448
|
createVNode(unref(_sfc_main$C), {
|
|
@@ -6350,7 +6460,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6350
6460
|
key: i,
|
|
6351
6461
|
node: children.value[childrenLength.value - i],
|
|
6352
6462
|
indent: __props.root ? props.indent : props.indent + 1,
|
|
6353
|
-
active: __props.active ||
|
|
6463
|
+
active: __props.active || selected.value
|
|
6354
6464
|
}, null, 8, ["node", "indent", "active"]);
|
|
6355
6465
|
}), 128)) : createCommentVNode("", true)
|
|
6356
6466
|
], 64);
|
|
@@ -6513,7 +6623,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6513
6623
|
}
|
|
6514
6624
|
};
|
|
6515
6625
|
const target = computed(() => {
|
|
6516
|
-
if (typeof props.target === "object" && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6626
|
+
if (typeof props.target === "object" && !("getBoundingClientRect" in props.target) && !(props.target instanceof Element) && "x" in props.target && "y" in props.target) {
|
|
6517
6627
|
return virtualElement;
|
|
6518
6628
|
}
|
|
6519
6629
|
return props.target ?? activatorEl.value;
|
|
@@ -6527,15 +6637,20 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6527
6637
|
middleware: [
|
|
6528
6638
|
middlewares.has("offset") && offset(() => props.offset ?? 0),
|
|
6529
6639
|
middlewares.has("flip") && flip(),
|
|
6530
|
-
middlewares.has("shift") && shift({ padding: 20 })
|
|
6640
|
+
middlewares.has("shift") && shift({ crossAxis: true, padding: 20 })
|
|
6531
6641
|
].filter(Boolean)
|
|
6532
6642
|
});
|
|
6533
6643
|
const style = computed(() => {
|
|
6534
6644
|
return {
|
|
6535
|
-
...floatingStyles.value,
|
|
6536
6645
|
zIndex: 1500 + overlayItem.index.value
|
|
6537
6646
|
};
|
|
6538
6647
|
});
|
|
6648
|
+
const contentStyle = computed(() => {
|
|
6649
|
+
return {
|
|
6650
|
+
...floatingStyles.value,
|
|
6651
|
+
...props.contentStyle
|
|
6652
|
+
};
|
|
6653
|
+
});
|
|
6539
6654
|
const activatorProps = computed(() => {
|
|
6540
6655
|
return {
|
|
6541
6656
|
ref: (el) => activatorEl.value = el
|
|
@@ -6583,11 +6698,16 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6583
6698
|
}, [
|
|
6584
6699
|
isActive.value ? (openBlock(), createElementBlock("div", mergeProps({
|
|
6585
6700
|
key: 0,
|
|
6586
|
-
ref: "contentElTpl",
|
|
6587
6701
|
class: "mce-overlay",
|
|
6588
6702
|
style: style.value
|
|
6589
6703
|
}, _ctx.$attrs), [
|
|
6590
|
-
|
|
6704
|
+
createElementVNode("div", {
|
|
6705
|
+
ref: "contentElTpl",
|
|
6706
|
+
style: normalizeStyle$1(contentStyle.value),
|
|
6707
|
+
class: normalizeClass(["mce-overlay-content", props.contentClass])
|
|
6708
|
+
}, [
|
|
6709
|
+
renderSlot(_ctx.$slots, "default")
|
|
6710
|
+
], 6)
|
|
6591
6711
|
], 16)) : createCommentVNode("", true)
|
|
6592
6712
|
], 8, ["disabled", "to"]))
|
|
6593
6713
|
], 64);
|
|
@@ -6690,6 +6810,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6690
6810
|
}
|
|
6691
6811
|
__expose({
|
|
6692
6812
|
isActive,
|
|
6813
|
+
activatorEl: computed(() => overlay.value?.activatorEl),
|
|
6814
|
+
contentEl: computed(() => overlay.value?.contentEl),
|
|
6693
6815
|
updateLocation
|
|
6694
6816
|
});
|
|
6695
6817
|
return (_ctx, _cache) => {
|
|
@@ -6843,6 +6965,24 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6843
6965
|
const isActive = useModel(__props, "modelValue");
|
|
6844
6966
|
const position = useModel(__props, "position");
|
|
6845
6967
|
const menuRef = useTemplateRef("menuTplRef");
|
|
6968
|
+
const target = {
|
|
6969
|
+
getBoundingClientRect() {
|
|
6970
|
+
const box = menuRef.value?.contentEl?.getBoundingClientRect();
|
|
6971
|
+
const { x, y } = position.value;
|
|
6972
|
+
const width = 0;
|
|
6973
|
+
const height = box?.height ?? 0;
|
|
6974
|
+
return {
|
|
6975
|
+
x,
|
|
6976
|
+
y,
|
|
6977
|
+
left: x,
|
|
6978
|
+
top: y,
|
|
6979
|
+
bottom: x + height,
|
|
6980
|
+
right: y + width,
|
|
6981
|
+
width,
|
|
6982
|
+
height
|
|
6983
|
+
};
|
|
6984
|
+
}
|
|
6985
|
+
};
|
|
6846
6986
|
onBeforeMount(() => {
|
|
6847
6987
|
registerCommand({ command: "openContextMenu", handle: onContextmenu });
|
|
6848
6988
|
});
|
|
@@ -6888,14 +7028,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6888
7028
|
ref: "menuTplRef",
|
|
6889
7029
|
modelValue: isActive.value,
|
|
6890
7030
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
6891
|
-
offset: 10,
|
|
6892
7031
|
class: "mce-context-menu",
|
|
6893
|
-
|
|
6894
|
-
|
|
7032
|
+
offset: 10,
|
|
7033
|
+
target,
|
|
7034
|
+
location: "right-start",
|
|
6895
7035
|
items: unref(contextMenu),
|
|
6896
7036
|
style: normalizeStyle$1({
|
|
6897
|
-
|
|
7037
|
+
"--max-height": `${unref(drawboardAabb).height * 0.8}px`
|
|
6898
7038
|
}),
|
|
7039
|
+
middlewares: ["offset", "shift"],
|
|
6899
7040
|
"onClick:item": onClickItem
|
|
6900
7041
|
}, {
|
|
6901
7042
|
title: withCtx(({ item }) => [
|
|
@@ -6907,7 +7048,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6907
7048
|
], 64)) : createCommentVNode("", true)
|
|
6908
7049
|
]),
|
|
6909
7050
|
_: 1
|
|
6910
|
-
}, 8, ["modelValue", "
|
|
7051
|
+
}, 8, ["modelValue", "items", "style"]);
|
|
6911
7052
|
};
|
|
6912
7053
|
}
|
|
6913
7054
|
});
|
|
@@ -11514,7 +11655,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11514
11655
|
const props = __props;
|
|
11515
11656
|
const isActive = useModel(__props, "modelValue");
|
|
11516
11657
|
const overlay = useTemplateRef("overlayTpl");
|
|
11517
|
-
const
|
|
11658
|
+
const contentClass = computed(() => {
|
|
11518
11659
|
const [side, align = "center"] = props.location.split("-");
|
|
11519
11660
|
return [
|
|
11520
11661
|
`mce-tooltip--side-${side}`,
|
|
@@ -11532,7 +11673,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11532
11673
|
ref: "overlayTpl",
|
|
11533
11674
|
modelValue: isActive.value,
|
|
11534
11675
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
11535
|
-
class:
|
|
11676
|
+
class: "mce-tooltip",
|
|
11677
|
+
"content-class": contentClass.value,
|
|
11536
11678
|
location: props.location,
|
|
11537
11679
|
offset: props.offset,
|
|
11538
11680
|
target: props.target,
|
|
@@ -11564,7 +11706,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
11564
11706
|
]),
|
|
11565
11707
|
key: "0"
|
|
11566
11708
|
} : void 0
|
|
11567
|
-
]), 1032, ["modelValue", "class", "location", "offset", "target", "attach"]);
|
|
11709
|
+
]), 1032, ["modelValue", "content-class", "location", "offset", "target", "attach"]);
|
|
11568
11710
|
};
|
|
11569
11711
|
}
|
|
11570
11712
|
});
|
|
@@ -12065,7 +12207,6 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
12065
12207
|
},
|
|
12066
12208
|
__name: "Scrollbars",
|
|
12067
12209
|
props: {
|
|
12068
|
-
infinite: { type: Boolean, default: true },
|
|
12069
12210
|
offset: { default: 0 },
|
|
12070
12211
|
size: { default: 8 }
|
|
12071
12212
|
},
|
|
@@ -12111,6 +12252,36 @@ const _scroll = definePlugin((editor) => {
|
|
|
12111
12252
|
ignore: () => !config.value.scrollbar
|
|
12112
12253
|
}
|
|
12113
12254
|
]
|
|
12255
|
+
// setup: () => {
|
|
12256
|
+
// const {
|
|
12257
|
+
// viewportAabb,
|
|
12258
|
+
// getGlobalPointer,
|
|
12259
|
+
// state,
|
|
12260
|
+
// camera,
|
|
12261
|
+
// } = editor
|
|
12262
|
+
//
|
|
12263
|
+
// setInterval(() => {
|
|
12264
|
+
// if (state.value === 'transforming' || state.value === 'selecting') {
|
|
12265
|
+
// const _camera = camera.value
|
|
12266
|
+
// const { min, max } = viewportAabb.value
|
|
12267
|
+
// const { zoom } = _camera
|
|
12268
|
+
// const dist = 10 / zoom.x
|
|
12269
|
+
// const pointer = getGlobalPointer()
|
|
12270
|
+
// if (pointer.x - dist <= min.x) {
|
|
12271
|
+
// scrollTo({ x: min.x })
|
|
12272
|
+
// }
|
|
12273
|
+
// if (pointer.x + dist >= max.x) {
|
|
12274
|
+
// scrollTo({ x: max.x })
|
|
12275
|
+
// }
|
|
12276
|
+
// if (pointer.y - dist <= min.y) {
|
|
12277
|
+
// scrollTo({ y: min.y })
|
|
12278
|
+
// }
|
|
12279
|
+
// if (pointer.y + dist >= max.y) {
|
|
12280
|
+
// scrollTo({ y: max.y })
|
|
12281
|
+
// }
|
|
12282
|
+
// }
|
|
12283
|
+
// }, 100)
|
|
12284
|
+
// },
|
|
12114
12285
|
};
|
|
12115
12286
|
});
|
|
12116
12287
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
@@ -12367,6 +12538,102 @@ const _shape = definePlugin((editor) => {
|
|
|
12367
12538
|
]
|
|
12368
12539
|
};
|
|
12369
12540
|
});
|
|
12541
|
+
const _slice = definePlugin((editor) => {
|
|
12542
|
+
const {
|
|
12543
|
+
setActiveDrawingTool,
|
|
12544
|
+
addElement,
|
|
12545
|
+
t,
|
|
12546
|
+
elementSelection,
|
|
12547
|
+
inEditorIs,
|
|
12548
|
+
to,
|
|
12549
|
+
fonts,
|
|
12550
|
+
drawboardEffect
|
|
12551
|
+
} = editor;
|
|
12552
|
+
async function exportSlice(options) {
|
|
12553
|
+
const el = elementSelection.value[0];
|
|
12554
|
+
if (!el || !inEditorIs(el, "Slice")) {
|
|
12555
|
+
return;
|
|
12556
|
+
}
|
|
12557
|
+
const aabb = el.getGlobalAabb();
|
|
12558
|
+
const doc = to("json", {
|
|
12559
|
+
...options,
|
|
12560
|
+
selected: el.parent?.children.filter((node) => !node.equal(el)) ?? []
|
|
12561
|
+
});
|
|
12562
|
+
doc.children.unshift({
|
|
12563
|
+
position: {
|
|
12564
|
+
x: aabb.left,
|
|
12565
|
+
y: aabb.top
|
|
12566
|
+
},
|
|
12567
|
+
meta: {
|
|
12568
|
+
inCanvasIs: "Camera2D"
|
|
12569
|
+
}
|
|
12570
|
+
});
|
|
12571
|
+
return await render({
|
|
12572
|
+
data: doc,
|
|
12573
|
+
fonts,
|
|
12574
|
+
width: aabb.width,
|
|
12575
|
+
height: aabb.height,
|
|
12576
|
+
onBefore: (engine) => {
|
|
12577
|
+
engine.root.append(
|
|
12578
|
+
new DrawboardEffect({
|
|
12579
|
+
...drawboardEffect.value.getProperties(),
|
|
12580
|
+
internalMode: "back",
|
|
12581
|
+
effectMode: "before",
|
|
12582
|
+
checkerboard: false,
|
|
12583
|
+
pixelGrid: false
|
|
12584
|
+
})
|
|
12585
|
+
);
|
|
12586
|
+
}
|
|
12587
|
+
});
|
|
12588
|
+
}
|
|
12589
|
+
return {
|
|
12590
|
+
name: "mce:slice",
|
|
12591
|
+
drawingTools: [
|
|
12592
|
+
{
|
|
12593
|
+
name: "slice",
|
|
12594
|
+
handle: (start) => {
|
|
12595
|
+
const el = addElement({
|
|
12596
|
+
name: t("slice"),
|
|
12597
|
+
outline: {
|
|
12598
|
+
color: "#d9d9d9",
|
|
12599
|
+
width: 1,
|
|
12600
|
+
style: "dashed"
|
|
12601
|
+
},
|
|
12602
|
+
meta: {
|
|
12603
|
+
inPptIs: "Shape",
|
|
12604
|
+
inEditorIs: "Slice",
|
|
12605
|
+
inCanvasIs: "Element2D"
|
|
12606
|
+
}
|
|
12607
|
+
}, {
|
|
12608
|
+
position: start,
|
|
12609
|
+
active: true
|
|
12610
|
+
});
|
|
12611
|
+
return {
|
|
12612
|
+
move: (move) => {
|
|
12613
|
+
const minX = Math.min(move.x, start.x);
|
|
12614
|
+
const minY = Math.min(move.y, start.y);
|
|
12615
|
+
const maxX = Math.max(move.x, start.x);
|
|
12616
|
+
const maxY = Math.max(move.y, start.y);
|
|
12617
|
+
el.style.left = minX;
|
|
12618
|
+
el.style.top = minY;
|
|
12619
|
+
el.style.width = maxX - minX;
|
|
12620
|
+
el.style.height = maxY - minY;
|
|
12621
|
+
},
|
|
12622
|
+
end: () => {
|
|
12623
|
+
setActiveDrawingTool(void 0);
|
|
12624
|
+
}
|
|
12625
|
+
};
|
|
12626
|
+
}
|
|
12627
|
+
}
|
|
12628
|
+
],
|
|
12629
|
+
hotkeys: [
|
|
12630
|
+
{ command: "setActiveDrawingTool:slice", key: "S" }
|
|
12631
|
+
],
|
|
12632
|
+
commands: [
|
|
12633
|
+
{ command: "exportSlice", handle: exportSlice }
|
|
12634
|
+
]
|
|
12635
|
+
};
|
|
12636
|
+
});
|
|
12370
12637
|
const _hoisted_1$c = { class: "mce-smart-guides" };
|
|
12371
12638
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
12372
12639
|
__name: "SmartGuides",
|
|
@@ -13760,9 +14027,9 @@ const _hoisted_5$2 = { class: "mce-statusbar__kbd" };
|
|
|
13760
14027
|
const _hoisted_6$2 = { class: "mce-statusbar__item" };
|
|
13761
14028
|
const _hoisted_7$2 = { class: "mce-statusbar__kbd" };
|
|
13762
14029
|
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" };
|
|
14030
|
+
const _hoisted_9$1 = { class: "mce-statusbar__item" };
|
|
14031
|
+
const _hoisted_10$1 = { class: "mce-statusbar__kbd" };
|
|
14032
|
+
const _hoisted_11$1 = { class: "mce-statusbar__item" };
|
|
13766
14033
|
const _hoisted_12 = { class: "mce-statusbar__kbd" };
|
|
13767
14034
|
const _hoisted_13 = { key: 2 };
|
|
13768
14035
|
const _hoisted_14 = { class: "mce-statusbar__item" };
|
|
@@ -13804,12 +14071,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13804
14071
|
createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
|
|
13805
14072
|
]),
|
|
13806
14073
|
_cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
|
|
13807
|
-
createElementVNode("div", _hoisted_9, [
|
|
13808
|
-
createElementVNode("span", _hoisted_10, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
14074
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
14075
|
+
createElementVNode("span", _hoisted_10$1, toDisplayString(unref(getKbd)("Escape")), 1),
|
|
13809
14076
|
createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
|
|
13810
14077
|
]),
|
|
13811
14078
|
_cache[3] || (_cache[3] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
|
|
13812
|
-
createElementVNode("div", _hoisted_11, [
|
|
14079
|
+
createElementVNode("div", _hoisted_11$1, [
|
|
13813
14080
|
createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
|
|
13814
14081
|
createElementVNode("span", null, toDisplayString(unref(t)("constrainToAxis")), 1)
|
|
13815
14082
|
])
|
|
@@ -14355,9 +14622,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
14355
14622
|
]
|
|
14356
14623
|
},
|
|
14357
14624
|
{
|
|
14358
|
-
key: "frame",
|
|
14359
|
-
active: activeDrawingTool.value?.name
|
|
14360
|
-
handle: () => setActiveDrawingTool("frame")
|
|
14625
|
+
key: activeDrawingTool.value?.name === "slice" ? "slice" : "frame",
|
|
14626
|
+
active: ["frame", "slice"].includes(activeDrawingTool.value?.name),
|
|
14627
|
+
handle: () => setActiveDrawingTool("frame"),
|
|
14628
|
+
children: [
|
|
14629
|
+
{ key: "frame", handle: () => setActiveDrawingTool("frame") },
|
|
14630
|
+
{ key: "slice", handle: () => setActiveDrawingTool("slice") }
|
|
14631
|
+
]
|
|
14361
14632
|
},
|
|
14362
14633
|
{
|
|
14363
14634
|
...shapeItems.value.find((v) => v.checked) ?? shapeItems.value[activeShape.value],
|
|
@@ -14470,8 +14741,18 @@ const _toolbelt = definePlugin((editor) => {
|
|
|
14470
14741
|
});
|
|
14471
14742
|
const _transform = definePlugin((editor) => {
|
|
14472
14743
|
const {
|
|
14473
|
-
elementSelection
|
|
14744
|
+
elementSelection,
|
|
14745
|
+
exec
|
|
14474
14746
|
} = editor;
|
|
14747
|
+
async function _enter() {
|
|
14748
|
+
if (elementSelection.value.length === 1) {
|
|
14749
|
+
const element = elementSelection.value[0];
|
|
14750
|
+
if (element.text.isValid()) {
|
|
14751
|
+
await exec("startTyping");
|
|
14752
|
+
}
|
|
14753
|
+
}
|
|
14754
|
+
}
|
|
14755
|
+
const when = () => Boolean(elementSelection.value.length > 0);
|
|
14475
14756
|
function flipHorizontal() {
|
|
14476
14757
|
elementSelection.value.forEach((el) => {
|
|
14477
14758
|
el.style.scaleX = -el.style.scaleX;
|
|
@@ -14485,23 +14766,46 @@ const _transform = definePlugin((editor) => {
|
|
|
14485
14766
|
return {
|
|
14486
14767
|
name: "mce:transform",
|
|
14487
14768
|
commands: [
|
|
14769
|
+
{ command: "enter", handle: _enter },
|
|
14488
14770
|
{ command: "flipHorizontal", handle: flipHorizontal },
|
|
14489
14771
|
{ command: "flipVertical", handle: flipVertical }
|
|
14490
14772
|
],
|
|
14491
14773
|
hotkeys: [
|
|
14774
|
+
{ command: "enter", key: ["Enter"], when },
|
|
14492
14775
|
{ command: "flipHorizontal", key: "Shift+H" },
|
|
14493
14776
|
{ command: "flipVertical", key: "Shift+V" }
|
|
14494
14777
|
]
|
|
14495
14778
|
};
|
|
14496
14779
|
});
|
|
14497
|
-
const _ui = definePlugin(() => {
|
|
14780
|
+
const _ui = definePlugin((editor) => {
|
|
14498
14781
|
return {
|
|
14499
|
-
name: "mce:ui"
|
|
14782
|
+
name: "mce:ui",
|
|
14783
|
+
setup: () => {
|
|
14784
|
+
const {
|
|
14785
|
+
drawboardDom,
|
|
14786
|
+
drawboardAabb,
|
|
14787
|
+
drawboardPointer,
|
|
14788
|
+
exec
|
|
14789
|
+
} = editor;
|
|
14790
|
+
useResizeObserver$1(drawboardDom, (entries) => {
|
|
14791
|
+
const { left: _left, top: _top, width, height } = entries[0].contentRect;
|
|
14792
|
+
const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
|
|
14793
|
+
drawboardAabb.value = new Aabb2D(left, top, width, height);
|
|
14794
|
+
exec("zoomToFit");
|
|
14795
|
+
});
|
|
14796
|
+
document.addEventListener("mousemove", (event) => {
|
|
14797
|
+
drawboardPointer.value = new Vector2$1(
|
|
14798
|
+
event.clientX - drawboardAabb.value.left,
|
|
14799
|
+
event.clientY - drawboardAabb.value.top
|
|
14800
|
+
);
|
|
14801
|
+
});
|
|
14802
|
+
}
|
|
14500
14803
|
};
|
|
14501
14804
|
});
|
|
14502
14805
|
const _url = definePlugin((editor) => {
|
|
14503
14806
|
const {
|
|
14504
|
-
load
|
|
14807
|
+
load,
|
|
14808
|
+
http
|
|
14505
14809
|
} = editor;
|
|
14506
14810
|
return {
|
|
14507
14811
|
name: "mce:url",
|
|
@@ -14512,7 +14816,7 @@ const _url = definePlugin((editor) => {
|
|
|
14512
14816
|
return typeof source === "string";
|
|
14513
14817
|
},
|
|
14514
14818
|
load: async (url) => {
|
|
14515
|
-
const blob = await
|
|
14819
|
+
const blob = await http.request({ url, responseType: "blob" });
|
|
14516
14820
|
const file = new File([blob], url, { type: blob.type });
|
|
14517
14821
|
try {
|
|
14518
14822
|
return await load(file);
|
|
@@ -14576,7 +14880,6 @@ const _zoom = definePlugin((editor) => {
|
|
|
14576
14880
|
const {
|
|
14577
14881
|
registerConfig,
|
|
14578
14882
|
camera,
|
|
14579
|
-
drawboardAabb,
|
|
14580
14883
|
zoomTo,
|
|
14581
14884
|
exec,
|
|
14582
14885
|
config,
|
|
@@ -14613,17 +14916,6 @@ const _zoom = definePlugin((editor) => {
|
|
|
14613
14916
|
],
|
|
14614
14917
|
events: {
|
|
14615
14918
|
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
14919
|
}
|
|
14628
14920
|
};
|
|
14629
14921
|
});
|
|
@@ -14634,7 +14926,6 @@ const plugins = [
|
|
|
14634
14926
|
_delete,
|
|
14635
14927
|
_drawingTool,
|
|
14636
14928
|
_edit,
|
|
14637
|
-
_enter,
|
|
14638
14929
|
_frame,
|
|
14639
14930
|
_gif,
|
|
14640
14931
|
_group,
|
|
@@ -14660,6 +14951,7 @@ const plugins = [
|
|
|
14660
14951
|
_scroll,
|
|
14661
14952
|
_selection,
|
|
14662
14953
|
_shape,
|
|
14954
|
+
_slice,
|
|
14663
14955
|
_smartGuides,
|
|
14664
14956
|
_state,
|
|
14665
14957
|
_statusbar,
|
|
@@ -14826,7 +15118,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14826
15118
|
__name: "Floatbar",
|
|
14827
15119
|
props: {
|
|
14828
15120
|
...makeMceOverlayProps({
|
|
14829
|
-
middlewares: ["offset", "shift"],
|
|
14830
15121
|
offset: 8
|
|
14831
15122
|
})
|
|
14832
15123
|
},
|
|
@@ -14843,11 +15134,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14843
15134
|
const aabb = selectionAabbInDrawboard.value;
|
|
14844
15135
|
if (location?.startsWith("top") || location?.startsWith("bottom")) {
|
|
14845
15136
|
return {
|
|
14846
|
-
|
|
15137
|
+
minWidth: `${aabb.width}px`
|
|
14847
15138
|
};
|
|
14848
15139
|
} else if (location?.startsWith("left") || location?.startsWith("right")) {
|
|
14849
15140
|
return {
|
|
14850
|
-
|
|
15141
|
+
minHeight: `${aabb.height}px`
|
|
14851
15142
|
};
|
|
14852
15143
|
}
|
|
14853
15144
|
return {};
|
|
@@ -14868,7 +15159,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14868
15159
|
return (_ctx, _cache) => {
|
|
14869
15160
|
return openBlock(), createBlock(_sfc_main$u, {
|
|
14870
15161
|
ref: "overlayTpl",
|
|
14871
|
-
style:
|
|
15162
|
+
"content-style": style.value,
|
|
14872
15163
|
class: "mce-floatbar",
|
|
14873
15164
|
location: props.location,
|
|
14874
15165
|
middlewares: props.middlewares,
|
|
@@ -14881,33 +15172,37 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
14881
15172
|
unref(elementSelection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
|
|
14882
15173
|
]),
|
|
14883
15174
|
_: 3
|
|
14884
|
-
}, 8, ["style", "location", "middlewares", "offset", "target"]);
|
|
15175
|
+
}, 8, ["content-style", "location", "middlewares", "offset", "target"]);
|
|
14885
15176
|
};
|
|
14886
15177
|
}
|
|
14887
15178
|
});
|
|
14888
|
-
const _hoisted_1$4 = { class: "mce-
|
|
15179
|
+
const _hoisted_1$4 = { class: "mce-transform-controls__svg" };
|
|
14889
15180
|
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 =
|
|
15181
|
+
const _hoisted_3$1 = { "pointer-events": "none" };
|
|
15182
|
+
const _hoisted_4 = ["x", "y", "width", "height", "aria-label"];
|
|
15183
|
+
const _hoisted_5 = ["cx", "cy", "r", "aria-label"];
|
|
15184
|
+
const _hoisted_6 = ["x", "y", "width", "height", "aria-label", "rx", "ry"];
|
|
15185
|
+
const _hoisted_7 = ["transform"];
|
|
15186
|
+
const _hoisted_8 = { "pointer-events": "all" };
|
|
15187
|
+
const _hoisted_9 = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"];
|
|
15188
|
+
const _hoisted_10 = {
|
|
14895
15189
|
"pointer-events": "all",
|
|
14896
|
-
class: "mce-
|
|
15190
|
+
class: "mce-transform-controls__svg-slot"
|
|
14897
15191
|
};
|
|
14898
|
-
const
|
|
15192
|
+
const _hoisted_11 = {
|
|
14899
15193
|
key: 0,
|
|
14900
|
-
class: "mce-
|
|
15194
|
+
class: "mce-transform-controls__tip"
|
|
14901
15195
|
};
|
|
14902
15196
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
14903
|
-
__name: "
|
|
15197
|
+
__name: "TransformControls",
|
|
14904
15198
|
props: {
|
|
14905
15199
|
tag: { default: "div" },
|
|
14906
15200
|
modelValue: {},
|
|
14907
15201
|
movable: { type: Boolean, default: true },
|
|
14908
15202
|
rotatable: { type: Boolean, default: true },
|
|
15203
|
+
rotator: { type: Boolean },
|
|
14909
15204
|
resizable: { type: Boolean, default: true },
|
|
14910
|
-
|
|
15205
|
+
roundable: { type: Boolean },
|
|
14911
15206
|
threshold: { default: 0 },
|
|
14912
15207
|
resizeStrategy: {},
|
|
14913
15208
|
handleStrategy: {},
|
|
@@ -14916,24 +15211,24 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14916
15211
|
handles: { default: () => [
|
|
14917
15212
|
"move",
|
|
14918
15213
|
// resize
|
|
14919
|
-
"resize-
|
|
14920
|
-
"resize-
|
|
14921
|
-
"resize-
|
|
14922
|
-
"resize-
|
|
14923
|
-
"resize-
|
|
14924
|
-
"resize-
|
|
14925
|
-
"resize-
|
|
14926
|
-
"resize-
|
|
14927
|
-
//
|
|
14928
|
-
"
|
|
14929
|
-
"
|
|
14930
|
-
"
|
|
14931
|
-
"
|
|
15214
|
+
"resize-l",
|
|
15215
|
+
"resize-t",
|
|
15216
|
+
"resize-r",
|
|
15217
|
+
"resize-b",
|
|
15218
|
+
"resize-tl",
|
|
15219
|
+
"resize-tr",
|
|
15220
|
+
"resize-br",
|
|
15221
|
+
"resize-bl",
|
|
15222
|
+
// round
|
|
15223
|
+
"round-tl",
|
|
15224
|
+
"round-tr",
|
|
15225
|
+
"round-bl",
|
|
15226
|
+
"round-br",
|
|
14932
15227
|
// rotate
|
|
14933
|
-
"rotate-
|
|
14934
|
-
"rotate-
|
|
14935
|
-
"rotate-
|
|
14936
|
-
"rotate-
|
|
15228
|
+
"rotate-tl",
|
|
15229
|
+
"rotate-tr",
|
|
15230
|
+
"rotate-bl",
|
|
15231
|
+
"rotate-br"
|
|
14937
15232
|
] },
|
|
14938
15233
|
initialSize: { type: Boolean },
|
|
14939
15234
|
borderStyle: {},
|
|
@@ -14944,18 +15239,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14944
15239
|
const props = __props;
|
|
14945
15240
|
const emit = __emit;
|
|
14946
15241
|
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-
|
|
15242
|
+
"rotate-tl": (angle) => createCursor("rotate", 360 + angle),
|
|
15243
|
+
"rotate-tr": (angle) => createCursor("rotate", 90 + angle),
|
|
15244
|
+
"rotate-bl": (angle) => createCursor("rotate", 270 + angle),
|
|
15245
|
+
"rotate-br": (angle) => createCursor("rotate", 180 + angle),
|
|
15246
|
+
"resize-l": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15247
|
+
"resize-t": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15248
|
+
"resize-r": (angle) => createCursor("resizeXy", 180 + angle),
|
|
15249
|
+
"resize-b": (angle) => createCursor("resizeXy", 90 + angle),
|
|
15250
|
+
"resize-tl": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15251
|
+
"resize-tr": (angle) => createCursor("resizeBevel", 180 + angle),
|
|
15252
|
+
"resize-br": (angle) => createCursor("resizeBevel", 90 + angle),
|
|
15253
|
+
"resize-bl": (angle) => createCursor("resizeBevel", 180 + angle)
|
|
14959
15254
|
};
|
|
14960
15255
|
const modelValue = useModel(props, "modelValue");
|
|
14961
15256
|
const model = computed({
|
|
@@ -14972,25 +15267,25 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14972
15267
|
const transforming = ref(false);
|
|
14973
15268
|
const activeHandle = ref();
|
|
14974
15269
|
const computedHandles = computed(() => {
|
|
14975
|
-
const
|
|
15270
|
+
const shape = props.handleShape;
|
|
15271
|
+
const size = shape === "rect" ? 8 : 10;
|
|
14976
15272
|
const { width = 0, height = 0, borderRadius } = model.value;
|
|
14977
15273
|
const center = { x: width / 2, y: height / 2 };
|
|
14978
|
-
const shape = props.handleShape;
|
|
14979
15274
|
const lines = [
|
|
14980
|
-
{ type: "
|
|
14981
|
-
{ type: "
|
|
14982
|
-
{ type: "
|
|
14983
|
-
{ type: "
|
|
15275
|
+
{ type: "t", points: [[0, 0], [1, 0]] },
|
|
15276
|
+
{ type: "r", points: [[1, 0], [1, 1]] },
|
|
15277
|
+
{ type: "b", points: [[0, 1], [1, 1]] },
|
|
15278
|
+
{ type: "l", points: [[0, 0], [0, 1]] }
|
|
14984
15279
|
];
|
|
14985
15280
|
const points = [
|
|
14986
|
-
{ type: "
|
|
14987
|
-
{ type: "
|
|
14988
|
-
{ type: "
|
|
14989
|
-
{ type: "
|
|
14990
|
-
{ type: "
|
|
14991
|
-
{ type: "
|
|
14992
|
-
{ type: "
|
|
14993
|
-
{ type: "
|
|
15281
|
+
{ type: "t", point: [0.5, 0], width: 1.4, height: 0.6 },
|
|
15282
|
+
{ type: "r", point: [1, 0.5], width: 0.6, height: 1.4 },
|
|
15283
|
+
{ type: "b", point: [0.5, 1], width: 1.4, height: 0.6 },
|
|
15284
|
+
{ type: "l", point: [0, 0.5], width: 0.6, height: 1.4 },
|
|
15285
|
+
{ type: "tl", point: [0, 0] },
|
|
15286
|
+
{ type: "tr", point: [1, 0] },
|
|
15287
|
+
{ type: "bl", point: [0, 1] },
|
|
15288
|
+
{ type: "br", point: [1, 1] }
|
|
14994
15289
|
];
|
|
14995
15290
|
const lineHandles = lines.map((item) => {
|
|
14996
15291
|
const [p1, p2] = item.points;
|
|
@@ -15007,31 +15302,47 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15007
15302
|
};
|
|
15008
15303
|
});
|
|
15009
15304
|
const pointHandles = points.map((item) => {
|
|
15305
|
+
const _w = size * (item.width ?? 1);
|
|
15306
|
+
const _h = size * (item.height ?? 1);
|
|
15010
15307
|
return {
|
|
15011
15308
|
type: item.type,
|
|
15012
15309
|
shape,
|
|
15013
|
-
x: item.point[0] * width -
|
|
15014
|
-
y: item.point[1] * height -
|
|
15015
|
-
width:
|
|
15016
|
-
height:
|
|
15310
|
+
x: item.point[0] * width - _w / 2,
|
|
15311
|
+
y: item.point[1] * height - _h / 2,
|
|
15312
|
+
width: _w,
|
|
15313
|
+
height: _h
|
|
15017
15314
|
};
|
|
15018
15315
|
});
|
|
15019
|
-
const diagonalPointHandles = pointHandles.filter((item) => item.type.
|
|
15316
|
+
const diagonalPointHandles = pointHandles.filter((item) => item.type.length === 2);
|
|
15020
15317
|
const rotateHandles = diagonalPointHandles.map((item) => {
|
|
15021
|
-
const
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15318
|
+
const _w = item.width * 1.5;
|
|
15319
|
+
const _h = item.height * 1.5;
|
|
15320
|
+
let x = item.x;
|
|
15321
|
+
let y = item.y;
|
|
15322
|
+
if (center.x > item.x) {
|
|
15323
|
+
x -= _w;
|
|
15324
|
+
} else {
|
|
15325
|
+
x += item.width;
|
|
15326
|
+
}
|
|
15327
|
+
if (center.y > item.y) {
|
|
15328
|
+
y -= _h;
|
|
15329
|
+
} else {
|
|
15330
|
+
y += item.height;
|
|
15331
|
+
}
|
|
15025
15332
|
return {
|
|
15026
15333
|
...item,
|
|
15027
15334
|
shape: void 0,
|
|
15028
15335
|
type: `rotate-${item.type}`,
|
|
15029
|
-
x
|
|
15030
|
-
y
|
|
15336
|
+
x,
|
|
15337
|
+
y,
|
|
15338
|
+
width: _w,
|
|
15339
|
+
height: _h
|
|
15031
15340
|
};
|
|
15032
15341
|
});
|
|
15033
15342
|
const minSize = Math.min(width, height);
|
|
15034
|
-
const
|
|
15343
|
+
const roundedHandles = props.roundable ? diagonalPointHandles.map((item) => {
|
|
15344
|
+
const _w = item.width * 0.8;
|
|
15345
|
+
const _h = item.height * 0.8;
|
|
15035
15346
|
const sign2 = {
|
|
15036
15347
|
x: center.x - item.x > 0 ? 1 : -1,
|
|
15037
15348
|
y: center.y - item.y > 0 ? 1 : -1
|
|
@@ -15042,9 +15353,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15042
15353
|
return {
|
|
15043
15354
|
...item,
|
|
15044
15355
|
shape: "circle",
|
|
15045
|
-
type: `
|
|
15356
|
+
type: `round-${item.type}`,
|
|
15046
15357
|
x: item.x + sign2.x * width / 2 * ws,
|
|
15047
|
-
y: item.y + sign2.y * height / 2 * hs
|
|
15358
|
+
y: item.y + sign2.y * height / 2 * hs,
|
|
15359
|
+
width: _w,
|
|
15360
|
+
height: _h
|
|
15048
15361
|
};
|
|
15049
15362
|
}) : [];
|
|
15050
15363
|
let handles;
|
|
@@ -15054,8 +15367,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15054
15367
|
...lineHandles.map((item) => ({ ...item, type: "move" })),
|
|
15055
15368
|
// resize
|
|
15056
15369
|
...pointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15057
|
-
//
|
|
15058
|
-
...
|
|
15370
|
+
// round
|
|
15371
|
+
...roundedHandles,
|
|
15059
15372
|
// rotate
|
|
15060
15373
|
...rotateHandles
|
|
15061
15374
|
];
|
|
@@ -15064,8 +15377,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15064
15377
|
// resize
|
|
15065
15378
|
...lineHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15066
15379
|
...diagonalPointHandles.map((item) => ({ ...item, type: `resize-${item.type}` })),
|
|
15067
|
-
//
|
|
15068
|
-
...
|
|
15380
|
+
// round
|
|
15381
|
+
...roundedHandles,
|
|
15069
15382
|
// rotate
|
|
15070
15383
|
...rotateHandles
|
|
15071
15384
|
];
|
|
@@ -15113,11 +15426,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15113
15426
|
}
|
|
15114
15427
|
const handle = index === void 0 ? { type: "move", x: 0, y: 0, width: 0, height: 0 } : computedHandles.value[index];
|
|
15115
15428
|
activeHandle.value = handle.type;
|
|
15116
|
-
const
|
|
15117
|
-
const
|
|
15118
|
-
const
|
|
15119
|
-
const
|
|
15120
|
-
const
|
|
15429
|
+
const handleArr = handle.type.split("-");
|
|
15430
|
+
const last = handleArr.length > 1 ? handleArr.pop() || "" : "";
|
|
15431
|
+
const key = handleArr.join("-");
|
|
15432
|
+
const isMove = key === "move";
|
|
15433
|
+
const isRotate = key === "rotate";
|
|
15434
|
+
const isRound = key === "round";
|
|
15435
|
+
const isHorizontal = last === "l" || last === "r";
|
|
15436
|
+
const isHorizontalVertical = last.length === 1;
|
|
15121
15437
|
const centerPoint = {
|
|
15122
15438
|
x: left + width / 2,
|
|
15123
15439
|
y: top + height / 2
|
|
@@ -15151,7 +15467,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15151
15467
|
if (!props.threshold && !transforming.value) {
|
|
15152
15468
|
startTransform();
|
|
15153
15469
|
}
|
|
15154
|
-
function
|
|
15470
|
+
function _onPointerMove(event2) {
|
|
15155
15471
|
const updated = {};
|
|
15156
15472
|
if (!startClientPoint) {
|
|
15157
15473
|
startClientPoint = { x: event2.clientX, y: event2.clientY };
|
|
@@ -15183,7 +15499,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15183
15499
|
) / (Math.PI / 180);
|
|
15184
15500
|
updated.rotate = (rotate + endAngle - startAngle + 360) % 360;
|
|
15185
15501
|
}
|
|
15186
|
-
} else if (
|
|
15502
|
+
} else if (isRound) {
|
|
15187
15503
|
const offset2 = rotatePoint2(rotatedOffset, { x: 0, y: 0 }, -rotate);
|
|
15188
15504
|
const dx = -sign2.x * offset2.x;
|
|
15189
15505
|
const dy = -sign2.y * offset2.y;
|
|
@@ -15260,15 +15576,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15260
15576
|
model.value = newValue;
|
|
15261
15577
|
emit("move", newValue, oldValue);
|
|
15262
15578
|
}
|
|
15263
|
-
function
|
|
15264
|
-
window.removeEventListener("pointermove",
|
|
15265
|
-
window.removeEventListener("pointerup",
|
|
15579
|
+
function _onPointerUp() {
|
|
15580
|
+
window.removeEventListener("pointermove", _onPointerMove);
|
|
15581
|
+
window.removeEventListener("pointerup", _onPointerUp, true);
|
|
15266
15582
|
transforming.value = false;
|
|
15267
15583
|
activeHandle.value = void 0;
|
|
15268
15584
|
emit("end", model.value);
|
|
15269
15585
|
}
|
|
15270
|
-
window.addEventListener("pointermove",
|
|
15271
|
-
window.addEventListener("pointerup",
|
|
15586
|
+
window.addEventListener("pointermove", _onPointerMove);
|
|
15587
|
+
window.addEventListener("pointerup", _onPointerUp, true);
|
|
15272
15588
|
return true;
|
|
15273
15589
|
}
|
|
15274
15590
|
const cursorMap = {
|
|
@@ -15362,17 +15678,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15362
15678
|
default:
|
|
15363
15679
|
return void 0;
|
|
15364
15680
|
}
|
|
15365
|
-
if (handle === "resize-
|
|
15681
|
+
if (handle === "resize-t" || handle === "resize-r" || handle === "resize-tr" || handle === "resize-bl") {
|
|
15366
15682
|
return h("line", {
|
|
15367
|
-
class: "mce-
|
|
15683
|
+
class: "mce-transform-controls__diagonal",
|
|
15368
15684
|
x1: "100%",
|
|
15369
15685
|
y1: "0",
|
|
15370
15686
|
x2: "0",
|
|
15371
15687
|
y2: "100%"
|
|
15372
15688
|
});
|
|
15373
|
-
} else if (handle === "resize-
|
|
15689
|
+
} else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
|
|
15374
15690
|
return h("line", {
|
|
15375
|
-
class: "mce-
|
|
15691
|
+
class: "mce-transform-controls__diagonal",
|
|
15376
15692
|
x1: "0",
|
|
15377
15693
|
y1: "0",
|
|
15378
15694
|
x2: "100%",
|
|
@@ -15383,15 +15699,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15383
15699
|
}
|
|
15384
15700
|
return (_ctx, _cache) => {
|
|
15385
15701
|
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-
|
|
15702
|
+
class: normalizeClass(["mce-transform-controls", [
|
|
15703
|
+
transforming.value && "mce-transform-controls--transforming",
|
|
15704
|
+
props.hideUi && "mce-transform-controls--hide-ui",
|
|
15705
|
+
__props.resizeStrategy && `mce-transform-controls--${__props.resizeStrategy}`,
|
|
15706
|
+
activeHandle.value && `mce-transform-controls--${activeHandle.value}`,
|
|
15707
|
+
activeHandle.value === "move" && "mce-transform-controls--moving",
|
|
15708
|
+
activeHandle.value?.startsWith("resize") && "mce-transform-controls--resizing",
|
|
15709
|
+
activeHandle.value?.startsWith("rotate") && "mce-transform-controls--rotateing",
|
|
15710
|
+
props.borderStyle && `mce-transform-controls--${props.borderStyle}`
|
|
15395
15711
|
]]),
|
|
15396
15712
|
style: normalizeStyle$1(style.value)
|
|
15397
15713
|
}, {
|
|
@@ -15404,14 +15720,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15404
15720
|
start
|
|
15405
15721
|
}),
|
|
15406
15722
|
(openBlock(), createElementBlock("svg", _hoisted_1$4, [
|
|
15407
|
-
_cache[
|
|
15723
|
+
_cache[1] || (_cache[1] = createElementVNode("rect", {
|
|
15408
15724
|
width: "100%",
|
|
15409
15725
|
height: "100%",
|
|
15410
15726
|
fill: "none",
|
|
15411
|
-
class: "mce-
|
|
15727
|
+
class: "mce-transform-controls__rect"
|
|
15412
15728
|
}, null, -1)),
|
|
15413
15729
|
createElementVNode("rect", {
|
|
15414
|
-
class: "mce-
|
|
15730
|
+
class: "mce-transform-controls__rect",
|
|
15415
15731
|
width: "100%",
|
|
15416
15732
|
height: "100%",
|
|
15417
15733
|
fill: "none",
|
|
@@ -15419,7 +15735,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15419
15735
|
ry: model.value.borderRadius
|
|
15420
15736
|
}, null, 8, _hoisted_2$1),
|
|
15421
15737
|
createVNode(Diagonal),
|
|
15422
|
-
createElementVNode("g",
|
|
15738
|
+
createElementVNode("g", _hoisted_3$1, [
|
|
15423
15739
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15424
15740
|
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
15425
15741
|
handle.shape ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -15430,20 +15746,37 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15430
15746
|
width: handle.width,
|
|
15431
15747
|
height: handle.height,
|
|
15432
15748
|
"aria-label": handle.type,
|
|
15433
|
-
class: "mce-
|
|
15434
|
-
}, null, 8,
|
|
15749
|
+
class: "mce-transform-controls__handle"
|
|
15750
|
+
}, null, 8, _hoisted_4)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
|
|
15435
15751
|
key: 1,
|
|
15436
15752
|
cx: handle.x + handle.width / 2,
|
|
15437
15753
|
cy: handle.y + handle.width / 2,
|
|
15438
15754
|
r: handle.width / 2,
|
|
15439
15755
|
"aria-label": handle.type,
|
|
15440
|
-
class: "mce-
|
|
15441
|
-
}, null, 8,
|
|
15756
|
+
class: "mce-transform-controls__handle"
|
|
15757
|
+
}, null, 8, _hoisted_5)) : (openBlock(), createElementBlock("rect", {
|
|
15758
|
+
key: 2,
|
|
15759
|
+
x: handle.x,
|
|
15760
|
+
y: handle.y,
|
|
15761
|
+
width: handle.width,
|
|
15762
|
+
height: handle.height,
|
|
15763
|
+
"aria-label": handle.type,
|
|
15764
|
+
rx: handle.width / 4,
|
|
15765
|
+
ry: handle.height / 4,
|
|
15766
|
+
class: "mce-transform-controls__handle"
|
|
15767
|
+
}, null, 8, _hoisted_6))
|
|
15442
15768
|
], 64)) : createCommentVNode("", true)
|
|
15443
15769
|
], 64);
|
|
15444
|
-
}), 128))
|
|
15770
|
+
}), 128)),
|
|
15771
|
+
__props.rotator ? (openBlock(), createElementBlock("g", {
|
|
15772
|
+
key: 0,
|
|
15773
|
+
transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
|
|
15774
|
+
class: "mce-transform-controls__rotator"
|
|
15775
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
15776
|
+
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)
|
|
15777
|
+
])], 8, _hoisted_7)) : createCommentVNode("", true)
|
|
15445
15778
|
]),
|
|
15446
|
-
createElementVNode("g",
|
|
15779
|
+
createElementVNode("g", _hoisted_8, [
|
|
15447
15780
|
(openBlock(true), createElementBlock(Fragment, null, renderList(computedHandles.value, (handle, index) => {
|
|
15448
15781
|
return openBlock(), createElementBlock("rect", {
|
|
15449
15782
|
key: index,
|
|
@@ -15455,17 +15788,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
15455
15788
|
width: handle.width,
|
|
15456
15789
|
height: handle.height,
|
|
15457
15790
|
"aria-label": handle.type,
|
|
15458
|
-
class: "mce-
|
|
15791
|
+
class: "mce-transform-controls__handle-rect",
|
|
15459
15792
|
cursor: transforming.value ? "auto" : getCursor(handle.type),
|
|
15460
15793
|
onPointerdown: (event) => start(event, index)
|
|
15461
|
-
}, null, 40,
|
|
15794
|
+
}, null, 40, _hoisted_9);
|
|
15462
15795
|
}), 128))
|
|
15463
15796
|
]),
|
|
15464
|
-
createElementVNode("g",
|
|
15797
|
+
createElementVNode("g", _hoisted_10, [
|
|
15465
15798
|
renderSlot(_ctx.$slots, "svg", { box: model.value })
|
|
15466
15799
|
])
|
|
15467
15800
|
])),
|
|
15468
|
-
tip.value ? (openBlock(), createElementBlock("div",
|
|
15801
|
+
tip.value ? (openBlock(), createElementBlock("div", _hoisted_11, toDisplayString(tip.value), 1)) : createCommentVNode("", true)
|
|
15469
15802
|
]),
|
|
15470
15803
|
_: 3
|
|
15471
15804
|
}, 8, ["class", "style"]);
|
|
@@ -15695,7 +16028,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15695
16028
|
isLock,
|
|
15696
16029
|
config,
|
|
15697
16030
|
snapThreshold,
|
|
15698
|
-
getSnapPoints
|
|
16031
|
+
getSnapPoints,
|
|
16032
|
+
hoverElement
|
|
15699
16033
|
} = useEditor();
|
|
15700
16034
|
const transformable = useTemplateRef("transformableTpl");
|
|
15701
16035
|
const startEvent = ref();
|
|
@@ -15810,8 +16144,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15810
16144
|
rotate: transform2.rotate - (oldTransform.rotate ?? 0),
|
|
15811
16145
|
borderRadius: transform2.borderRadius - (oldTransform.borderRadius ?? 0) / zoom.y
|
|
15812
16146
|
};
|
|
15813
|
-
|
|
15814
|
-
elements.forEach((element) => {
|
|
16147
|
+
elementSelection.value.forEach((element) => {
|
|
15815
16148
|
const style = element.style;
|
|
15816
16149
|
const newStyle = {
|
|
15817
16150
|
left: style.left + offsetStyle.left,
|
|
@@ -15832,7 +16165,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15832
16165
|
element,
|
|
15833
16166
|
newStyle.width / element.style.width,
|
|
15834
16167
|
newStyle.height / element.style.height,
|
|
15835
|
-
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-").length >
|
|
16168
|
+
isFrame(element) ? void 0 : shape.isValid() ? { deep: true } : handle.split("-")[1].length > 1 ? { deep: true, textFontSizeToFit: true } : { deep: true, textToFit: true }
|
|
15836
16169
|
);
|
|
15837
16170
|
newStyle.width = element.style.width;
|
|
15838
16171
|
newStyle.height = element.style.height;
|
|
@@ -15864,9 +16197,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15864
16197
|
return !isLock(element) && element.meta.rotatable !== false && element.meta.transformable !== false;
|
|
15865
16198
|
});
|
|
15866
16199
|
});
|
|
15867
|
-
const
|
|
15868
|
-
|
|
15869
|
-
|
|
16200
|
+
const roundable = computed(() => {
|
|
16201
|
+
if (elementSelection.value.length === 1) {
|
|
16202
|
+
const element = elementSelection.value[0];
|
|
16203
|
+
return hoverElement.value?.equal(element) && !isLock(element) && element.foreground.isValid();
|
|
16204
|
+
}
|
|
16205
|
+
return false;
|
|
15870
16206
|
});
|
|
15871
16207
|
function onStart() {
|
|
15872
16208
|
emit("selectionTransformStart", createSelectionTransformContext());
|
|
@@ -15919,24 +16255,24 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15919
16255
|
})
|
|
15920
16256
|
}, null, 4);
|
|
15921
16257
|
}), 128)),
|
|
15922
|
-
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, {
|
|
16258
|
+
transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$a, mergeProps({
|
|
15923
16259
|
key: 1,
|
|
15924
|
-
ref: "transformableTpl"
|
|
16260
|
+
ref: "transformableTpl"
|
|
16261
|
+
}, unref(config).transformControls, {
|
|
15925
16262
|
modelValue: transform.value,
|
|
15926
16263
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
|
|
15927
16264
|
movable: unref(state) !== "typing" && movable.value,
|
|
15928
16265
|
resizable: unref(state) !== "typing" && resizable.value,
|
|
15929
16266
|
rotatable: unref(state) !== "typing" && rotatable.value,
|
|
15930
|
-
"
|
|
16267
|
+
roundable: unref(state) !== "typing" && roundable.value,
|
|
15931
16268
|
"resize-strategy": props.resizeStrategy,
|
|
15932
|
-
"handle-shape": unref(config).handleShape,
|
|
15933
16269
|
class: "mce-selector__transform",
|
|
15934
16270
|
"border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
|
|
15935
16271
|
"tip-format": tipFormat,
|
|
15936
16272
|
onStart,
|
|
15937
16273
|
onMove,
|
|
15938
16274
|
onEnd
|
|
15939
|
-
}, createSlots({ _: 2 }, [
|
|
16275
|
+
}), createSlots({ _: 2 }, [
|
|
15940
16276
|
_ctx.$slots.transformable ? {
|
|
15941
16277
|
name: "svg",
|
|
15942
16278
|
fn: withCtx((slotProps) => [
|
|
@@ -15944,7 +16280,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
15944
16280
|
]),
|
|
15945
16281
|
key: "0"
|
|
15946
16282
|
} : void 0
|
|
15947
|
-
]),
|
|
16283
|
+
]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "border-style"])) : createCommentVNode("", true),
|
|
15948
16284
|
transform.value.width && transform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
|
|
15949
16285
|
key: 2,
|
|
15950
16286
|
class: "mce-selector__slot",
|
|
@@ -16237,7 +16573,7 @@ const _hoisted_2 = {
|
|
|
16237
16573
|
};
|
|
16238
16574
|
const _hoisted_3 = {
|
|
16239
16575
|
ref: "overlayContainerTpl",
|
|
16240
|
-
class: "mce-
|
|
16576
|
+
class: "mce-overlay-container"
|
|
16241
16577
|
};
|
|
16242
16578
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
16243
16579
|
__name: "EditorLayout",
|
|
@@ -16310,17 +16646,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16310
16646
|
renderEngine.value.resize(width, height);
|
|
16311
16647
|
});
|
|
16312
16648
|
onBeforeMount(() => {
|
|
16313
|
-
renderEngine.value.on("pointerdown",
|
|
16314
|
-
renderEngine.value.on("pointermove",
|
|
16315
|
-
renderEngine.value.on("pointerover",
|
|
16649
|
+
renderEngine.value.on("pointerdown", onEnginePointerDown);
|
|
16650
|
+
renderEngine.value.on("pointermove", onEnginePointerMove);
|
|
16651
|
+
renderEngine.value.on("pointerover", onEnginePointerOver);
|
|
16316
16652
|
});
|
|
16317
16653
|
onMounted(() => {
|
|
16318
16654
|
bindRenderCanvas(canvas.value, drawboardDom.value);
|
|
16319
16655
|
});
|
|
16320
16656
|
onBeforeUnmount(() => {
|
|
16321
|
-
renderEngine.value.off("pointerdown",
|
|
16322
|
-
renderEngine.value.off("pointermove",
|
|
16323
|
-
renderEngine.value.off("pointerover",
|
|
16657
|
+
renderEngine.value.off("pointerdown", onEnginePointerDown);
|
|
16658
|
+
renderEngine.value.off("pointermove", onEnginePointerMove);
|
|
16659
|
+
renderEngine.value.off("pointerover", onEnginePointerOver);
|
|
16324
16660
|
});
|
|
16325
16661
|
function onHover(event) {
|
|
16326
16662
|
let cursor;
|
|
@@ -16351,7 +16687,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16351
16687
|
hoverElement.value = hovered;
|
|
16352
16688
|
setCursor(cursor);
|
|
16353
16689
|
}
|
|
16354
|
-
function
|
|
16690
|
+
function onEnginePointerDown(downEvent, options = {}) {
|
|
16355
16691
|
if (downEvent.srcElement && downEvent.srcElement !== drawboardDom.value && downEvent.srcElement.dataset?.pointerdown_to_drawboard === void 0 || camera.value.spaceKey || ![0, 2].includes(downEvent.button)) {
|
|
16356
16692
|
return;
|
|
16357
16693
|
}
|
|
@@ -16456,7 +16792,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16456
16792
|
function canStartDrag() {
|
|
16457
16793
|
return !dragging && (Math.abs(current.x - start.x) >= 3 || Math.abs(current.y - start.y) >= 3);
|
|
16458
16794
|
}
|
|
16459
|
-
function
|
|
16795
|
+
function _onEnginePointerMove(moveEvent) {
|
|
16460
16796
|
if (drawing || hand) ;
|
|
16461
16797
|
else {
|
|
16462
16798
|
if (inSelection) {
|
|
@@ -16479,7 +16815,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16479
16815
|
}
|
|
16480
16816
|
}
|
|
16481
16817
|
}
|
|
16482
|
-
function
|
|
16818
|
+
function _onPointerMove(moveEvent) {
|
|
16483
16819
|
current = { x: moveEvent.clientX, y: moveEvent.clientY };
|
|
16484
16820
|
if (drawing) {
|
|
16485
16821
|
drawingTool?.move?.(
|
|
@@ -16502,7 +16838,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16502
16838
|
}
|
|
16503
16839
|
prev = { ...current };
|
|
16504
16840
|
}
|
|
16505
|
-
async function
|
|
16841
|
+
async function _onPointerUp(upEvent) {
|
|
16506
16842
|
current = { x: upEvent.clientX, y: upEvent.clientY };
|
|
16507
16843
|
if (drawing) {
|
|
16508
16844
|
drawingTool?.end?.(
|
|
@@ -16535,30 +16871,26 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16535
16871
|
onHover(downEvent);
|
|
16536
16872
|
}
|
|
16537
16873
|
}
|
|
16538
|
-
renderEngine.value.off("pointermove",
|
|
16539
|
-
document.removeEventListener("pointermove",
|
|
16540
|
-
document.removeEventListener("pointerup",
|
|
16874
|
+
renderEngine.value.off("pointermove", _onEnginePointerMove);
|
|
16875
|
+
document.removeEventListener("pointermove", _onPointerMove);
|
|
16876
|
+
document.removeEventListener("pointerup", _onPointerUp);
|
|
16541
16877
|
isUp = true;
|
|
16542
16878
|
}
|
|
16543
|
-
renderEngine.value.on("pointermove",
|
|
16544
|
-
document.addEventListener("pointermove",
|
|
16545
|
-
document.addEventListener("pointerup",
|
|
16879
|
+
renderEngine.value.on("pointermove", _onEnginePointerMove);
|
|
16880
|
+
document.addEventListener("pointermove", _onPointerMove);
|
|
16881
|
+
document.addEventListener("pointerup", _onPointerUp);
|
|
16546
16882
|
}
|
|
16547
|
-
editor.registerCommand({ command: "pointerDown", handle:
|
|
16548
|
-
function
|
|
16883
|
+
editor.registerCommand({ command: "pointerDown", handle: onEnginePointerDown });
|
|
16884
|
+
function onEnginePointerMove(event) {
|
|
16549
16885
|
if (event.srcElement !== drawboardDom.value) {
|
|
16550
16886
|
return;
|
|
16551
16887
|
}
|
|
16552
|
-
drawboardPointer.value = new Vector2$1(
|
|
16553
|
-
event.clientX - drawboardAabb.value.left,
|
|
16554
|
-
event.clientY - drawboardAabb.value.top
|
|
16555
|
-
);
|
|
16556
16888
|
if (camera.value.grabbing || event.button === 1 || state.value && state.value !== "typing") {
|
|
16557
16889
|
return;
|
|
16558
16890
|
}
|
|
16559
16891
|
onHover(event);
|
|
16560
16892
|
}
|
|
16561
|
-
function
|
|
16893
|
+
function onEnginePointerOver(event) {
|
|
16562
16894
|
if (event.srcElement !== drawboardDom.value) {
|
|
16563
16895
|
return;
|
|
16564
16896
|
}
|
|
@@ -16611,7 +16943,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16611
16943
|
}, ["prevent"]))
|
|
16612
16944
|
}, [
|
|
16613
16945
|
createElementVNode("canvas", _hoisted_2, null, 512),
|
|
16614
|
-
|
|
16946
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order === "before"), (p, key) => {
|
|
16947
|
+
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16948
|
+
}), 128)),
|
|
16615
16949
|
createVNode(_sfc_main$7, {
|
|
16616
16950
|
ref: "selectorTpl",
|
|
16617
16951
|
"selected-area": selectedArea.value,
|
|
@@ -16626,28 +16960,44 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16626
16960
|
]),
|
|
16627
16961
|
_: 3
|
|
16628
16962
|
}, 8, ["selected-area", "resize-strategy"]),
|
|
16629
|
-
|
|
16963
|
+
createVNode(_sfc_main$2, { ref: "textEditorTpl" }, null, 512),
|
|
16964
|
+
slots.floatbar ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16630
16965
|
key: 0,
|
|
16631
16966
|
location: "top-start",
|
|
16632
|
-
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
|
|
16967
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16968
|
+
middlewares: ["offset", "shift"]
|
|
16969
|
+
}, {
|
|
16970
|
+
default: withCtx(() => [
|
|
16971
|
+
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps)))
|
|
16972
|
+
]),
|
|
16973
|
+
_: 3
|
|
16974
|
+
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16975
|
+
slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16976
|
+
key: 1,
|
|
16977
|
+
location: "top-start",
|
|
16978
|
+
target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el,
|
|
16979
|
+
middlewares: ["offset", "shift"]
|
|
16633
16980
|
}, {
|
|
16634
16981
|
default: withCtx(() => [
|
|
16635
|
-
renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps))),
|
|
16636
16982
|
renderSlot(_ctx.$slots, "floatbar-top", normalizeProps(guardReactiveProps(slotProps)))
|
|
16637
16983
|
]),
|
|
16638
16984
|
_: 3
|
|
16639
16985
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16640
16986
|
slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$b, {
|
|
16641
|
-
key:
|
|
16987
|
+
key: 2,
|
|
16642
16988
|
location: "bottom-start",
|
|
16643
|
-
target: selector.value?.transformable?.$el
|
|
16989
|
+
target: selector.value?.transformable?.$el,
|
|
16990
|
+
middlewares: ["offset", "shift"]
|
|
16644
16991
|
}, {
|
|
16645
16992
|
default: withCtx(() => [
|
|
16646
16993
|
renderSlot(_ctx.$slots, "floatbar-bottom", normalizeProps(guardReactiveProps(slotProps)))
|
|
16647
16994
|
]),
|
|
16648
16995
|
_: 3
|
|
16649
16996
|
}, 8, ["target"])) : createCommentVNode("", true),
|
|
16650
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay, (p, key) => {
|
|
16997
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order !== "before" && v.order !== "after"), (p, key) => {
|
|
16998
|
+
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16999
|
+
}), 128)),
|
|
17000
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pluginsComponents).overlay.filter((v) => v.order === "after"), (p, key) => {
|
|
16651
17001
|
return openBlock(), createBlock(resolveDynamicComponent(p.component), { key });
|
|
16652
17002
|
}), 128)),
|
|
16653
17003
|
renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
|
|
@@ -16775,7 +17125,7 @@ export {
|
|
|
16775
17125
|
_sfc_main$p as Ruler,
|
|
16776
17126
|
SUPPORTS_CLIPBOARD,
|
|
16777
17127
|
_sfc_main$n as Scrollbar,
|
|
16778
|
-
_sfc_main$a as
|
|
17128
|
+
_sfc_main$a as TransformControls,
|
|
16779
17129
|
USER_AGENT,
|
|
16780
17130
|
boundingBoxToStyle,
|
|
16781
17131
|
consoleError,
|