mce 0.15.30 → 0.15.32
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 +1 -1
- package/dist/components/shared/Dialog.vue.d.ts +1 -1
- package/dist/components/shared/Menu.vue.d.ts +1 -1
- package/dist/components/shared/Overlay.vue.d.ts +1 -1
- package/dist/components/shared/Tooltip.vue.d.ts +1 -1
- package/dist/composables/overlay.d.ts +2 -2
- package/dist/index.js +276 -261
- package/dist/locale/en.d.ts +5 -4
- package/dist/locale/zh-Hans.d.ts +5 -4
- package/dist/mixins/0.context.d.ts +3 -3
- package/dist/plugins/arrange.d.ts +24 -2
- package/dist/plugins/selection.d.ts +24 -9
- package/dist/plugins/transform.d.ts +2 -0
- package/dist/typed-plugins.d.ts +0 -3
- package/package.json +1 -1
- package/dist/plugins/group.d.ts +0 -16
- package/dist/plugins/lock.d.ts +0 -14
- package/dist/plugins/visibility.d.ts +0 -14
|
@@ -48,7 +48,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
48
48
|
}>> & Readonly<{}>, {
|
|
49
49
|
offset: number;
|
|
50
50
|
attach: string | boolean | Element | null | undefined;
|
|
51
|
-
middlewares: ("
|
|
51
|
+
middlewares: ("flip" | "shift" | "offset")[];
|
|
52
52
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
53
53
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
54
54
|
declare const _default: typeof __VLS_export;
|
|
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
59
59
|
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
60
60
|
}>, {
|
|
61
61
|
attach: string | boolean | Element | null | undefined;
|
|
62
|
-
middlewares: ("
|
|
62
|
+
middlewares: ("flip" | "shift" | "offset")[];
|
|
63
63
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
64
64
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
@@ -82,7 +82,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
82
82
|
"onClick:item"?: ((item: MenuItem, event: MouseEvent) => any) | undefined;
|
|
83
83
|
}>, {
|
|
84
84
|
attach: string | boolean | Element | null | undefined;
|
|
85
|
-
middlewares: ("
|
|
85
|
+
middlewares: ("flip" | "shift" | "offset")[];
|
|
86
86
|
openOnHover: boolean;
|
|
87
87
|
persistent: boolean;
|
|
88
88
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -58,7 +58,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
58
58
|
"onClick:outside"?: ((event: MouseEvent) => any) | undefined;
|
|
59
59
|
}>, {
|
|
60
60
|
attach: string | boolean | Element | null | undefined;
|
|
61
|
-
middlewares: ("
|
|
61
|
+
middlewares: ("flip" | "shift" | "offset")[];
|
|
62
62
|
modelValue: boolean;
|
|
63
63
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
64
64
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -78,7 +78,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
78
78
|
offset: number;
|
|
79
79
|
location: import("@floating-ui/vue").Side | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
|
|
80
80
|
attach: string | boolean | Element | null | undefined;
|
|
81
|
-
middlewares: ("
|
|
81
|
+
middlewares: ("flip" | "shift" | "offset")[];
|
|
82
82
|
showArrow: boolean;
|
|
83
83
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
84
84
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -36,8 +36,8 @@ export declare const makeMceOverlayProps: <Defaults extends {
|
|
|
36
36
|
type: PropType<("offset" | "flip" | "shift")[]>;
|
|
37
37
|
default: () => string[];
|
|
38
38
|
}, "type" | "default"> & {
|
|
39
|
-
type: PropType<unknown extends Defaults["middlewares"] ? ("
|
|
40
|
-
default: unknown extends Defaults["middlewares"] ? ("
|
|
39
|
+
type: PropType<unknown extends Defaults["middlewares"] ? ("flip" | "shift" | "offset")[] : ("flip" | "shift" | "offset")[] | Defaults["middlewares"]>;
|
|
40
|
+
default: unknown extends Defaults["middlewares"] ? ("flip" | "shift" | "offset")[] : ("flip" | "shift" | "offset")[] | Defaults["middlewares"];
|
|
41
41
|
};
|
|
42
42
|
target: unknown extends Defaults["target"] ? PropType<{
|
|
43
43
|
x: number;
|
package/dist/index.js
CHANGED
|
@@ -1125,7 +1125,8 @@ const en = {
|
|
|
1125
1125
|
"duplicate": "Duplicate",
|
|
1126
1126
|
"delete": "Delete",
|
|
1127
1127
|
"selectAll": "Select all",
|
|
1128
|
-
"
|
|
1128
|
+
"selectInverse": "Deselect all",
|
|
1129
|
+
"selectNone": "Select none",
|
|
1129
1130
|
"selectChildren": "Select children",
|
|
1130
1131
|
"selectParent": "Select parent",
|
|
1131
1132
|
"selectPreviousSibling": "Select previous sibling",
|
|
@@ -1158,12 +1159,12 @@ const en = {
|
|
|
1158
1159
|
"object": "Object",
|
|
1159
1160
|
"groupSelection": "Group Selection",
|
|
1160
1161
|
"frameSelection": "Frame selection",
|
|
1161
|
-
"
|
|
1162
|
+
"ungroupSelection": "ungroupSelection",
|
|
1162
1163
|
"flip": "Flip",
|
|
1163
1164
|
"flipHorizontal": "Flip horizontal",
|
|
1164
1165
|
"flipVertical": "Flip vertical",
|
|
1165
|
-
"
|
|
1166
|
-
"
|
|
1166
|
+
"showOrHideSelection": "Show/Hide",
|
|
1167
|
+
"lockOrUnlockSelection": "Lock/Unlock",
|
|
1167
1168
|
"layerOrder": "Layer order",
|
|
1168
1169
|
"bringToFront": "Bring to front",
|
|
1169
1170
|
"bringForward": "Bring forward",
|
|
@@ -1238,7 +1239,8 @@ const zhHans = {
|
|
|
1238
1239
|
"duplicate": "创建副本",
|
|
1239
1240
|
"delete": "删除",
|
|
1240
1241
|
"selectAll": "选择全部",
|
|
1241
|
-
"
|
|
1242
|
+
"selectInverse": "反选全部",
|
|
1243
|
+
"selectNone": "取消选择",
|
|
1242
1244
|
"selectChildren": "选择子元素",
|
|
1243
1245
|
"selectParent": "选择父元素",
|
|
1244
1246
|
"selectPreviousSibling": "选择前一个",
|
|
@@ -1271,12 +1273,12 @@ const zhHans = {
|
|
|
1271
1273
|
"object": "对象",
|
|
1272
1274
|
"groupSelection": "组合选区",
|
|
1273
1275
|
"frameSelection": "组合选区为画板",
|
|
1274
|
-
"
|
|
1276
|
+
"ungroupSelection": "解组",
|
|
1275
1277
|
"flip": "翻转",
|
|
1276
1278
|
"flipHorizontal": "水平翻转",
|
|
1277
1279
|
"flipVertical": "垂直翻转",
|
|
1278
|
-
"
|
|
1279
|
-
"
|
|
1280
|
+
"showOrHideSelection": "显示/隐藏",
|
|
1281
|
+
"lockOrUnlockSelection": "锁/解锁",
|
|
1280
1282
|
"layerOrder": "图层顺序",
|
|
1281
1283
|
"bringToFront": "移到顶层",
|
|
1282
1284
|
"bringForward": "上移一层",
|
|
@@ -3450,6 +3452,7 @@ const _4_1_text = defineMixin((editor) => {
|
|
|
3450
3452
|
const _4_2_frame = defineMixin((editor) => {
|
|
3451
3453
|
const {
|
|
3452
3454
|
frames,
|
|
3455
|
+
isElement,
|
|
3453
3456
|
isTopFrame,
|
|
3454
3457
|
selection,
|
|
3455
3458
|
getAncestorFrame
|
|
@@ -3458,7 +3461,7 @@ const _4_2_frame = defineMixin((editor) => {
|
|
|
3458
3461
|
let current;
|
|
3459
3462
|
const node = selection.value[0];
|
|
3460
3463
|
if (node) {
|
|
3461
|
-
current = isTopFrame(node) ? node : getAncestorFrame(node, true);
|
|
3464
|
+
current = isElement(node) && isTopFrame(node) ? node : getAncestorFrame(node, true);
|
|
3462
3465
|
}
|
|
3463
3466
|
const last = frames.value.length - 1;
|
|
3464
3467
|
let index = frames.value.findIndex((node2) => node2.equal(current));
|
|
@@ -4300,19 +4303,24 @@ const _arrange = definePlugin((editor) => {
|
|
|
4300
4303
|
});
|
|
4301
4304
|
}
|
|
4302
4305
|
function align(direction) {
|
|
4306
|
+
const len = elementSelection.value.length;
|
|
4307
|
+
if (!len) {
|
|
4308
|
+
return;
|
|
4309
|
+
}
|
|
4303
4310
|
let targetAabb;
|
|
4304
|
-
if (
|
|
4305
|
-
targetAabb = getAabb(elementSelection.value);
|
|
4306
|
-
} else {
|
|
4311
|
+
if (len === 1) {
|
|
4307
4312
|
const parent = elementSelection.value[0]?.parent;
|
|
4308
4313
|
if (parent && isElement(parent)) {
|
|
4309
4314
|
targetAabb = parent.getGlobalAabb();
|
|
4310
4315
|
}
|
|
4316
|
+
} else {
|
|
4317
|
+
targetAabb = getAabb(elementSelection.value);
|
|
4311
4318
|
}
|
|
4312
4319
|
if (!targetAabb) {
|
|
4313
4320
|
return;
|
|
4314
4321
|
}
|
|
4315
4322
|
elementSelection.value.forEach((el) => {
|
|
4323
|
+
const parentAabb = el.getParent()?.getGlobalAabb?.() ?? new Aabb2D();
|
|
4316
4324
|
const hw = el.size.x / 2;
|
|
4317
4325
|
const hh = el.size.y / 2;
|
|
4318
4326
|
const cos = Math.cos(el.rotation);
|
|
@@ -4321,22 +4329,22 @@ const _arrange = definePlugin((editor) => {
|
|
|
4321
4329
|
const dy = Math.abs(hw * sin) + Math.abs(hh * cos);
|
|
4322
4330
|
switch (direction) {
|
|
4323
4331
|
case "left":
|
|
4324
|
-
el.style.left = targetAabb.left + dx - hw;
|
|
4332
|
+
el.style.left = targetAabb.left - parentAabb.left + dx - hw;
|
|
4325
4333
|
break;
|
|
4326
4334
|
case "horizontal-center":
|
|
4327
|
-
el.style.left = targetAabb.left + targetAabb.width / 2 - hw;
|
|
4335
|
+
el.style.left = targetAabb.left - parentAabb.left + targetAabb.width / 2 - hw;
|
|
4328
4336
|
break;
|
|
4329
4337
|
case "right":
|
|
4330
|
-
el.style.left = targetAabb.left + targetAabb.width - dx - hw;
|
|
4338
|
+
el.style.left = targetAabb.left - parentAabb.left + targetAabb.width - dx - hw;
|
|
4331
4339
|
break;
|
|
4332
4340
|
case "top":
|
|
4333
|
-
el.style.top = targetAabb.top + dy - hh;
|
|
4341
|
+
el.style.top = targetAabb.top - parentAabb.top + dy - hh;
|
|
4334
4342
|
break;
|
|
4335
4343
|
case "vertical-center":
|
|
4336
|
-
el.style.top = targetAabb.top + targetAabb.height / 2 - hh;
|
|
4344
|
+
el.style.top = targetAabb.top - parentAabb.top + targetAabb.height / 2 - hh;
|
|
4337
4345
|
break;
|
|
4338
4346
|
case "bottom":
|
|
4339
|
-
el.style.top = targetAabb.top + targetAabb.height - dy - hh;
|
|
4347
|
+
el.style.top = targetAabb.top - parentAabb.top + targetAabb.height - dy - hh;
|
|
4340
4348
|
break;
|
|
4341
4349
|
}
|
|
4342
4350
|
});
|
|
@@ -4353,9 +4361,14 @@ const _arrange = definePlugin((editor) => {
|
|
|
4353
4361
|
function sendToBack(target = selection.value) {
|
|
4354
4362
|
target && zOrder2(target, "sendToBack");
|
|
4355
4363
|
}
|
|
4364
|
+
function distributeSpacing(_direction) {
|
|
4365
|
+
}
|
|
4366
|
+
function tidyUp() {
|
|
4367
|
+
}
|
|
4356
4368
|
return {
|
|
4357
4369
|
name: "mce:arrange",
|
|
4358
4370
|
commands: [
|
|
4371
|
+
{ command: "zOrder", handle: zOrder2 },
|
|
4359
4372
|
{ command: "bringForward", handle: bringForward },
|
|
4360
4373
|
{ command: "sendBackward", handle: sendBackward },
|
|
4361
4374
|
{ command: "bringToFront", handle: bringToFront },
|
|
@@ -4366,7 +4379,11 @@ const _arrange = definePlugin((editor) => {
|
|
|
4366
4379
|
{ command: "alignTop", handle: () => align("top") },
|
|
4367
4380
|
{ command: "alignBottom", handle: () => align("bottom") },
|
|
4368
4381
|
{ command: "alignHorizontalCenter", handle: () => align("horizontal-center") },
|
|
4369
|
-
{ command: "alignVerticalCenter", handle: () => align("vertical-center") }
|
|
4382
|
+
{ command: "alignVerticalCenter", handle: () => align("vertical-center") },
|
|
4383
|
+
{ command: "distributeSpacing", handle: distributeSpacing },
|
|
4384
|
+
{ command: "distributeHorizontalSpacing", handle: () => distributeSpacing() },
|
|
4385
|
+
{ command: "distributeVerticalSpacing", handle: () => distributeSpacing() },
|
|
4386
|
+
{ command: "tidyUp", handle: tidyUp }
|
|
4370
4387
|
],
|
|
4371
4388
|
hotkeys: [
|
|
4372
4389
|
{ command: "bringForward", key: "CmdOrCtrl+]" },
|
|
@@ -4378,7 +4395,10 @@ const _arrange = definePlugin((editor) => {
|
|
|
4378
4395
|
{ command: "alignTop", key: "Alt+W" },
|
|
4379
4396
|
{ command: "alignBottom", key: "Alt+S" },
|
|
4380
4397
|
{ command: "alignHorizontalCenter", key: "Alt+H" },
|
|
4381
|
-
{ command: "alignVerticalCenter", key: "Alt+V" }
|
|
4398
|
+
{ command: "alignVerticalCenter", key: "Alt+V" },
|
|
4399
|
+
{ command: "distributeHorizontalSpacing", key: "Ctrl+Alt+H" },
|
|
4400
|
+
{ command: "distributeVerticalSpacing", key: "Ctrl+Alt+V" },
|
|
4401
|
+
{ command: "tidyUp", key: "Ctrl+Alt+T" }
|
|
4382
4402
|
]
|
|
4383
4403
|
};
|
|
4384
4404
|
});
|
|
@@ -4390,17 +4410,16 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4390
4410
|
exec,
|
|
4391
4411
|
root
|
|
4392
4412
|
} = editor;
|
|
4393
|
-
let startFrame;
|
|
4394
4413
|
let startContext = {};
|
|
4395
|
-
function nestIntoFrame(
|
|
4414
|
+
function nestIntoFrame(el, options) {
|
|
4396
4415
|
const pointer = options?.pointer;
|
|
4397
|
-
const frame1 =
|
|
4398
|
-
const aabb1 =
|
|
4416
|
+
const frame1 = el.findAncestor((node) => isTopFrame(node));
|
|
4417
|
+
const aabb1 = el.getGlobalAabb();
|
|
4399
4418
|
const area1 = aabb1.getArea();
|
|
4400
4419
|
let flag = true;
|
|
4401
4420
|
for (let i = 0, len = frames.value.length; i < len; i++) {
|
|
4402
4421
|
const frame2 = frames.value[i];
|
|
4403
|
-
if (frame2.equal(
|
|
4422
|
+
if (frame2.equal(el)) {
|
|
4404
4423
|
continue;
|
|
4405
4424
|
}
|
|
4406
4425
|
const aabb2 = frame2.getGlobalAabb();
|
|
@@ -4410,10 +4429,10 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4410
4429
|
if (frame2.equal(options?.parent)) {
|
|
4411
4430
|
index = options.index;
|
|
4412
4431
|
}
|
|
4413
|
-
frame2.moveChild(
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4432
|
+
frame2.moveChild(el, index);
|
|
4433
|
+
el.style.left = aabb1.x - aabb2.x;
|
|
4434
|
+
el.style.top = aabb1.y - aabb2.y;
|
|
4435
|
+
el.updateGlobalTransform();
|
|
4417
4436
|
exec("layerScrollIntoView");
|
|
4418
4437
|
}
|
|
4419
4438
|
flag = false;
|
|
@@ -4425,10 +4444,10 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4425
4444
|
if (root.value.equal(options?.parent)) {
|
|
4426
4445
|
index = options.index;
|
|
4427
4446
|
}
|
|
4428
|
-
root.value.moveChild(
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4447
|
+
root.value.moveChild(el, index);
|
|
4448
|
+
el.style.left = aabb1.x;
|
|
4449
|
+
el.style.top = aabb1.y;
|
|
4450
|
+
el.updateGlobalTransform();
|
|
4432
4451
|
exec("layerScrollIntoView");
|
|
4433
4452
|
}
|
|
4434
4453
|
}
|
|
@@ -4438,20 +4457,10 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4438
4457
|
{ command: "nestIntoFrame", handle: nestIntoFrame }
|
|
4439
4458
|
],
|
|
4440
4459
|
events: {
|
|
4441
|
-
selectionTransformStart: ({ elements }) => {
|
|
4442
|
-
const pointer = getGlobalPointer();
|
|
4443
|
-
startFrame = frames.value.find((frame) => frame.getGlobalAabb().contains(pointer));
|
|
4444
|
-
const ctx = {};
|
|
4445
|
-
elements.forEach((el) => {
|
|
4446
|
-
ctx[el.instanceId] = {
|
|
4447
|
-
parent: el.getParent(),
|
|
4448
|
-
index: el.getIndex()
|
|
4449
|
-
};
|
|
4450
|
-
});
|
|
4451
|
-
startContext = ctx;
|
|
4452
|
-
},
|
|
4453
|
-
selectionTransforming: ({ handle, startEvent, elements }) => {
|
|
4460
|
+
selectionTransformStart: ({ handle, startEvent, elements }) => {
|
|
4454
4461
|
if (handle === "move" && !startEvent?.__FROM__) {
|
|
4462
|
+
const pointer = getGlobalPointer();
|
|
4463
|
+
const startFrame = frames.value.find((frame) => frame.getGlobalAabb().contains(pointer));
|
|
4455
4464
|
const idSet = /* @__PURE__ */ new Set();
|
|
4456
4465
|
elements.forEach((el) => {
|
|
4457
4466
|
const frame = isTopFrame(el) ? el : el.findAncestor(isTopFrame);
|
|
@@ -4464,11 +4473,25 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4464
4473
|
}
|
|
4465
4474
|
});
|
|
4466
4475
|
if (idSet.size === 1) {
|
|
4467
|
-
|
|
4476
|
+
const ctx = {};
|
|
4477
|
+
elements.forEach((el) => {
|
|
4478
|
+
ctx[el.instanceId] = {
|
|
4479
|
+
parent: el.getParent(),
|
|
4480
|
+
index: el.getIndex()
|
|
4481
|
+
};
|
|
4482
|
+
});
|
|
4483
|
+
startContext = ctx;
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4486
|
+
},
|
|
4487
|
+
selectionTransforming: ({ handle, startEvent, elements }) => {
|
|
4488
|
+
if (handle === "move" && !startEvent?.__FROM__) {
|
|
4489
|
+
if (Object.keys(startContext).length > 0) {
|
|
4490
|
+
elements.forEach((el) => {
|
|
4468
4491
|
nestIntoFrame(
|
|
4469
|
-
|
|
4492
|
+
el,
|
|
4470
4493
|
{
|
|
4471
|
-
...startContext[
|
|
4494
|
+
...startContext[el.instanceId],
|
|
4472
4495
|
pointer: getGlobalPointer()
|
|
4473
4496
|
}
|
|
4474
4497
|
);
|
|
@@ -4478,7 +4501,6 @@ const _autoNest = definePlugin((editor) => {
|
|
|
4478
4501
|
},
|
|
4479
4502
|
selectionTransformEnd: () => {
|
|
4480
4503
|
startContext = {};
|
|
4481
|
-
startFrame = void 0;
|
|
4482
4504
|
}
|
|
4483
4505
|
}
|
|
4484
4506
|
};
|
|
@@ -5613,6 +5635,8 @@ const _frame = definePlugin((editor) => {
|
|
|
5613
5635
|
position: start,
|
|
5614
5636
|
active: true
|
|
5615
5637
|
});
|
|
5638
|
+
el.style.width = 1;
|
|
5639
|
+
el.style.height = 1;
|
|
5616
5640
|
el.style.backgroundColor = "#ffffff";
|
|
5617
5641
|
return {
|
|
5618
5642
|
move: (move) => {
|
|
@@ -5622,8 +5646,8 @@ const _frame = definePlugin((editor) => {
|
|
|
5622
5646
|
const maxY = Math.max(move.y, start.y);
|
|
5623
5647
|
el.style.left = minX;
|
|
5624
5648
|
el.style.top = minY;
|
|
5625
|
-
el.style.width = maxX - minX;
|
|
5626
|
-
el.style.height = maxY - minY;
|
|
5649
|
+
el.style.width = Math.max(1, maxX - minX);
|
|
5650
|
+
el.style.height = Math.max(1, maxY - minY);
|
|
5627
5651
|
},
|
|
5628
5652
|
end: () => {
|
|
5629
5653
|
setActiveDrawingTool(void 0);
|
|
@@ -5678,103 +5702,6 @@ const _gif = definePlugin((editor, options) => {
|
|
|
5678
5702
|
]
|
|
5679
5703
|
};
|
|
5680
5704
|
});
|
|
5681
|
-
const _group = definePlugin((editor) => {
|
|
5682
|
-
const {
|
|
5683
|
-
getObb,
|
|
5684
|
-
getAabb,
|
|
5685
|
-
elementSelection,
|
|
5686
|
-
addElement,
|
|
5687
|
-
addElements,
|
|
5688
|
-
doc,
|
|
5689
|
-
isElement,
|
|
5690
|
-
inEditorIs,
|
|
5691
|
-
obbToFit
|
|
5692
|
-
} = editor;
|
|
5693
|
-
function group(inEditorIs2) {
|
|
5694
|
-
const elements = elementSelection.value;
|
|
5695
|
-
if (!elements.length) {
|
|
5696
|
-
return;
|
|
5697
|
-
}
|
|
5698
|
-
const element = elements[0];
|
|
5699
|
-
const parent = element.parent;
|
|
5700
|
-
const aabb = getAabb(elements, "parent");
|
|
5701
|
-
const children = elements.map((child) => {
|
|
5702
|
-
const cloned = child.toJSON();
|
|
5703
|
-
cloned.style.left = child.style.left - aabb.left;
|
|
5704
|
-
cloned.style.top = child.style.top - aabb.top;
|
|
5705
|
-
return cloned;
|
|
5706
|
-
});
|
|
5707
|
-
doc.value.transact(() => {
|
|
5708
|
-
addElement({
|
|
5709
|
-
name: inEditorIs2 === "Frame" ? "Frame" : "Group",
|
|
5710
|
-
style: {
|
|
5711
|
-
left: aabb.left,
|
|
5712
|
-
top: aabb.top,
|
|
5713
|
-
width: aabb.width,
|
|
5714
|
-
height: aabb.height
|
|
5715
|
-
},
|
|
5716
|
-
children,
|
|
5717
|
-
meta: {
|
|
5718
|
-
inPptIs: "GroupShape",
|
|
5719
|
-
inEditorIs: inEditorIs2
|
|
5720
|
-
}
|
|
5721
|
-
}, {
|
|
5722
|
-
parent,
|
|
5723
|
-
index: parent ? element.getIndex() : void 0,
|
|
5724
|
-
active: true,
|
|
5725
|
-
regenId: true
|
|
5726
|
-
});
|
|
5727
|
-
elements.forEach((node) => node.remove());
|
|
5728
|
-
});
|
|
5729
|
-
}
|
|
5730
|
-
function ungroup() {
|
|
5731
|
-
const element = elementSelection.value[0];
|
|
5732
|
-
if (!element || !element.children.length)
|
|
5733
|
-
return;
|
|
5734
|
-
const parent = getObb(element, "parent");
|
|
5735
|
-
const items = element.children.map((child) => {
|
|
5736
|
-
const obb = getObb(child, "parent");
|
|
5737
|
-
const cloned = child.toJSON();
|
|
5738
|
-
cloned.style.left = obb.left + parent.left;
|
|
5739
|
-
cloned.style.top = obb.top + parent.top;
|
|
5740
|
-
return cloned;
|
|
5741
|
-
});
|
|
5742
|
-
doc.value.transact(() => {
|
|
5743
|
-
addElements(items, {
|
|
5744
|
-
parent: element.parent,
|
|
5745
|
-
index: element.getIndex(),
|
|
5746
|
-
active: true,
|
|
5747
|
-
regenId: true
|
|
5748
|
-
});
|
|
5749
|
-
element.remove();
|
|
5750
|
-
});
|
|
5751
|
-
}
|
|
5752
|
-
return {
|
|
5753
|
-
name: "mce:group",
|
|
5754
|
-
commands: [
|
|
5755
|
-
{ command: "groupSelection", handle: () => group("Element") },
|
|
5756
|
-
{ command: "frameSelection", handle: () => group("Frame") },
|
|
5757
|
-
{ command: "ungroup", handle: ungroup }
|
|
5758
|
-
],
|
|
5759
|
-
hotkeys: [
|
|
5760
|
-
{ command: "groupSelection", key: "CmdOrCtrl+G" },
|
|
5761
|
-
{ command: "frameSelection", key: "Alt+CmdOrCtrl+G" },
|
|
5762
|
-
{ command: "ungroup", key: "CmdOrCtrl+Backspace" }
|
|
5763
|
-
],
|
|
5764
|
-
events: {
|
|
5765
|
-
selectionTransforming: ({ elements }) => {
|
|
5766
|
-
elements.forEach((el) => {
|
|
5767
|
-
el.findAncestor((ancestor) => {
|
|
5768
|
-
if (isElement(ancestor) && !inEditorIs(ancestor, "Frame")) {
|
|
5769
|
-
obbToFit(ancestor);
|
|
5770
|
-
}
|
|
5771
|
-
return false;
|
|
5772
|
-
});
|
|
5773
|
-
});
|
|
5774
|
-
}
|
|
5775
|
-
}
|
|
5776
|
-
};
|
|
5777
|
-
});
|
|
5778
5705
|
const _history = definePlugin((editor) => {
|
|
5779
5706
|
const {
|
|
5780
5707
|
doc,
|
|
@@ -6539,24 +6466,6 @@ const _layers = definePlugin(() => {
|
|
|
6539
6466
|
]
|
|
6540
6467
|
};
|
|
6541
6468
|
});
|
|
6542
|
-
const _lock = definePlugin((editor) => {
|
|
6543
|
-
const {
|
|
6544
|
-
selection,
|
|
6545
|
-
isLock,
|
|
6546
|
-
setLock
|
|
6547
|
-
} = editor;
|
|
6548
|
-
return {
|
|
6549
|
-
name: "mce:lock",
|
|
6550
|
-
commands: [
|
|
6551
|
-
{ command: "lock", handle: () => selection.value.forEach((el) => setLock(el, true)) },
|
|
6552
|
-
{ command: "unlock", handle: () => selection.value.forEach((el) => setLock(el, false)) },
|
|
6553
|
-
{ command: "lock/unlock", handle: () => selection.value.forEach((el) => setLock(el, !isLock(el))) }
|
|
6554
|
-
],
|
|
6555
|
-
hotkeys: [
|
|
6556
|
-
{ command: "lock/unlock", key: "Shift+CmdOrCtrl+L" }
|
|
6557
|
-
]
|
|
6558
|
-
};
|
|
6559
|
-
});
|
|
6560
6469
|
const _export_sfc = (sfc, props) => {
|
|
6561
6470
|
const target = sfc.__vccOpts || sfc;
|
|
6562
6471
|
for (const [key, val] of props) {
|
|
@@ -7111,7 +7020,8 @@ const _menu = definePlugin((editor, options) => {
|
|
|
7111
7020
|
key: "select",
|
|
7112
7021
|
children: [
|
|
7113
7022
|
{ key: "selectAll" },
|
|
7114
|
-
{ key: "
|
|
7023
|
+
{ key: "selectInverse", disabled: !hasSelected.value },
|
|
7024
|
+
{ key: "selectNone", disabled: !hasSelected.value },
|
|
7115
7025
|
{ key: "selectChildren", disabled: !hasSelected.value },
|
|
7116
7026
|
{ key: "selectParent", disabled: !hasSelected.value },
|
|
7117
7027
|
{ key: "selectPreviousSibling", disabled: !hasSelected.value },
|
|
@@ -7211,7 +7121,7 @@ const _menu = definePlugin((editor, options) => {
|
|
|
7211
7121
|
const objectMenu1 = computed(() => [
|
|
7212
7122
|
{ key: "groupSelection", disabled: !hasSelected.value },
|
|
7213
7123
|
{ key: "frameSelection", disabled: !hasSelected.value },
|
|
7214
|
-
{ key: "
|
|
7124
|
+
{ key: "ungroupSelection", disabled: !(hasSelected.value && selection.value[0]?.children.length) }
|
|
7215
7125
|
]);
|
|
7216
7126
|
const layerOrderMenu = computed(() => ({
|
|
7217
7127
|
key: "layerOrder",
|
|
@@ -7230,8 +7140,8 @@ const _menu = definePlugin((editor, options) => {
|
|
|
7230
7140
|
]
|
|
7231
7141
|
}));
|
|
7232
7142
|
const objectMenu2 = computed(() => [
|
|
7233
|
-
{ key: "
|
|
7234
|
-
{ key: "
|
|
7143
|
+
{ key: "showOrHideSelection", disabled: !hasSelected.value },
|
|
7144
|
+
{ key: "lockOrUnlockSelection", disabled: !hasSelected.value }
|
|
7235
7145
|
]);
|
|
7236
7146
|
const objectMenu = computed(() => ({
|
|
7237
7147
|
key: "object",
|
|
@@ -12318,59 +12228,199 @@ const _selection = definePlugin((editor) => {
|
|
|
12318
12228
|
const {
|
|
12319
12229
|
isElement,
|
|
12320
12230
|
selection,
|
|
12231
|
+
elementSelection,
|
|
12232
|
+
getObb,
|
|
12233
|
+
getAabb,
|
|
12234
|
+
doc,
|
|
12321
12235
|
root,
|
|
12322
12236
|
zoomTo,
|
|
12323
|
-
findSibling
|
|
12237
|
+
findSibling,
|
|
12238
|
+
inEditorIs,
|
|
12239
|
+
addElement,
|
|
12240
|
+
addElements,
|
|
12241
|
+
obbToFit,
|
|
12242
|
+
setVisible,
|
|
12243
|
+
isVisible,
|
|
12244
|
+
setLock,
|
|
12245
|
+
isLock
|
|
12324
12246
|
} = editor;
|
|
12325
|
-
function
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12247
|
+
function select(target) {
|
|
12248
|
+
switch (target) {
|
|
12249
|
+
case "none":
|
|
12250
|
+
selection.value = [];
|
|
12251
|
+
break;
|
|
12252
|
+
case "all":
|
|
12253
|
+
selection.value = [...root.value.children];
|
|
12254
|
+
break;
|
|
12255
|
+
case "inverse":
|
|
12256
|
+
selection.value = [];
|
|
12257
|
+
break;
|
|
12258
|
+
case "children": {
|
|
12259
|
+
const children = selection.value[0]?.children;
|
|
12260
|
+
if (children?.length) {
|
|
12261
|
+
selection.value = [...children];
|
|
12262
|
+
}
|
|
12263
|
+
break;
|
|
12264
|
+
}
|
|
12265
|
+
case "parent": {
|
|
12266
|
+
const parent = selection.value[0]?.parent;
|
|
12267
|
+
if (isElement(parent)) {
|
|
12268
|
+
selection.value = [parent];
|
|
12269
|
+
}
|
|
12270
|
+
break;
|
|
12271
|
+
}
|
|
12272
|
+
case "previousSibling":
|
|
12273
|
+
case "nextSibling": {
|
|
12274
|
+
const value = findSibling(target === "previousSibling" ? "previous" : "next");
|
|
12275
|
+
if (value) {
|
|
12276
|
+
selection.value = [value];
|
|
12277
|
+
zoomTo("selection", {
|
|
12278
|
+
intoView: true,
|
|
12279
|
+
behavior: "smooth"
|
|
12280
|
+
});
|
|
12281
|
+
}
|
|
12282
|
+
break;
|
|
12283
|
+
}
|
|
12284
|
+
default:
|
|
12285
|
+
selection.value = target;
|
|
12286
|
+
break;
|
|
12335
12287
|
}
|
|
12336
12288
|
}
|
|
12337
|
-
function
|
|
12338
|
-
const
|
|
12339
|
-
if (
|
|
12340
|
-
|
|
12289
|
+
function groupSelection(inEditorIs2) {
|
|
12290
|
+
const elements = elementSelection.value;
|
|
12291
|
+
if (!elements.length) {
|
|
12292
|
+
return;
|
|
12341
12293
|
}
|
|
12294
|
+
const element = elements[0];
|
|
12295
|
+
const parent = element.parent;
|
|
12296
|
+
const aabb = getAabb(elements, "parent");
|
|
12297
|
+
const children = elements.map((child) => {
|
|
12298
|
+
const cloned = child.toJSON();
|
|
12299
|
+
cloned.style.left = child.style.left - aabb.left;
|
|
12300
|
+
cloned.style.top = child.style.top - aabb.top;
|
|
12301
|
+
return cloned;
|
|
12302
|
+
});
|
|
12303
|
+
doc.value.transact(() => {
|
|
12304
|
+
addElement({
|
|
12305
|
+
name: inEditorIs2 === "Frame" ? "Frame" : "Group",
|
|
12306
|
+
style: {
|
|
12307
|
+
left: aabb.left,
|
|
12308
|
+
top: aabb.top,
|
|
12309
|
+
width: aabb.width,
|
|
12310
|
+
height: aabb.height
|
|
12311
|
+
},
|
|
12312
|
+
children,
|
|
12313
|
+
meta: {
|
|
12314
|
+
inPptIs: "GroupShape",
|
|
12315
|
+
inEditorIs: inEditorIs2
|
|
12316
|
+
}
|
|
12317
|
+
}, {
|
|
12318
|
+
parent,
|
|
12319
|
+
index: parent ? element.getIndex() : void 0,
|
|
12320
|
+
active: true,
|
|
12321
|
+
regenId: true
|
|
12322
|
+
});
|
|
12323
|
+
elements.forEach((node) => node.remove());
|
|
12324
|
+
});
|
|
12342
12325
|
}
|
|
12343
|
-
function
|
|
12344
|
-
const
|
|
12345
|
-
if (
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12326
|
+
function ungroupSelection() {
|
|
12327
|
+
const element = elementSelection.value[0];
|
|
12328
|
+
if (!element || !element.children.length)
|
|
12329
|
+
return;
|
|
12330
|
+
const parent = getObb(element, "parent");
|
|
12331
|
+
const items = element.children.map((child) => {
|
|
12332
|
+
const obb = getObb(child, "parent");
|
|
12333
|
+
const cloned = child.toJSON();
|
|
12334
|
+
cloned.style.left = obb.left + parent.left;
|
|
12335
|
+
cloned.style.top = obb.top + parent.top;
|
|
12336
|
+
return cloned;
|
|
12337
|
+
});
|
|
12338
|
+
doc.value.transact(() => {
|
|
12339
|
+
addElements(items, {
|
|
12340
|
+
parent: element.parent,
|
|
12341
|
+
index: element.getIndex(),
|
|
12342
|
+
active: true,
|
|
12343
|
+
regenId: true
|
|
12350
12344
|
});
|
|
12351
|
-
|
|
12345
|
+
element.remove();
|
|
12346
|
+
});
|
|
12347
|
+
}
|
|
12348
|
+
function showOrHideSelection(target) {
|
|
12349
|
+
elementSelection.value.forEach((el) => {
|
|
12350
|
+
switch (target) {
|
|
12351
|
+
case "show":
|
|
12352
|
+
setVisible(el, true);
|
|
12353
|
+
break;
|
|
12354
|
+
case "hide":
|
|
12355
|
+
setVisible(el, false);
|
|
12356
|
+
break;
|
|
12357
|
+
default:
|
|
12358
|
+
setVisible(el, !isVisible(el));
|
|
12359
|
+
break;
|
|
12360
|
+
}
|
|
12361
|
+
});
|
|
12362
|
+
}
|
|
12363
|
+
function lockOrUnlockSelection(target) {
|
|
12364
|
+
selection.value.forEach((el) => {
|
|
12365
|
+
switch (target) {
|
|
12366
|
+
case "lock":
|
|
12367
|
+
setLock(el, true);
|
|
12368
|
+
break;
|
|
12369
|
+
case "unlock":
|
|
12370
|
+
setLock(el, false);
|
|
12371
|
+
break;
|
|
12372
|
+
default:
|
|
12373
|
+
setLock(el, !isLock(el));
|
|
12374
|
+
break;
|
|
12375
|
+
}
|
|
12376
|
+
});
|
|
12352
12377
|
}
|
|
12353
12378
|
return {
|
|
12354
12379
|
name: "mce:selection",
|
|
12355
12380
|
commands: [
|
|
12356
|
-
{ command: "
|
|
12357
|
-
{ command: "
|
|
12358
|
-
{ command: "
|
|
12359
|
-
{ command: "
|
|
12360
|
-
{ command: "
|
|
12361
|
-
{ command: "
|
|
12381
|
+
{ command: "select", handle: select },
|
|
12382
|
+
{ command: "selectAll", handle: () => select("all") },
|
|
12383
|
+
{ command: "selectInverse", handle: () => select("inverse") },
|
|
12384
|
+
{ command: "selectNone", handle: () => select("none") },
|
|
12385
|
+
{ command: "selectChildren", handle: () => select("children") },
|
|
12386
|
+
{ command: "selectParent", handle: () => select("parent") },
|
|
12387
|
+
{ command: "selectPreviousSibling", handle: () => select("previousSibling") },
|
|
12388
|
+
{ command: "selectNextSibling", handle: () => select("nextSibling") },
|
|
12389
|
+
{ command: "groupSelection", handle: () => groupSelection("Element") },
|
|
12390
|
+
{ command: "ungroupSelection", handle: ungroupSelection },
|
|
12391
|
+
{ command: "frameSelection", handle: () => groupSelection("Frame") },
|
|
12392
|
+
{ command: "showOrHideSelection", handle: showOrHideSelection },
|
|
12393
|
+
{ command: "lockOrUnlockSelection", handle: lockOrUnlockSelection }
|
|
12362
12394
|
],
|
|
12363
12395
|
hotkeys: [
|
|
12364
12396
|
{ command: "selectAll", key: "CmdOrCtrl+A" },
|
|
12365
|
-
{ command: "
|
|
12397
|
+
{ command: "selectInverse", key: "Shift+CmdOrCtrl+A" },
|
|
12398
|
+
{ command: "selectNone", key: "Esc" },
|
|
12366
12399
|
{ command: "selectChildren", key: "Enter" },
|
|
12367
12400
|
{ command: "selectParent", key: "\\" },
|
|
12368
12401
|
{ command: "selectPreviousSibling", key: "Shift+Tab" },
|
|
12369
|
-
{ command: "selectNextSibling", key: "Tab" }
|
|
12402
|
+
{ command: "selectNextSibling", key: "Tab" },
|
|
12403
|
+
{ command: "groupSelection", key: "CmdOrCtrl+G" },
|
|
12404
|
+
{ command: "ungroupSelection", key: "CmdOrCtrl+Backspace" },
|
|
12405
|
+
{ command: "frameSelection", key: "Alt+CmdOrCtrl+G" },
|
|
12406
|
+
{ command: "showOrHideSelection", key: "Shift+CmdOrCtrl+H" },
|
|
12407
|
+
{ command: "lockOrUnlockSelection", key: "Shift+CmdOrCtrl+L" }
|
|
12370
12408
|
],
|
|
12371
12409
|
components: [
|
|
12372
12410
|
{ type: "overlay", component: _sfc_main$l }
|
|
12373
|
-
]
|
|
12411
|
+
],
|
|
12412
|
+
events: {
|
|
12413
|
+
selectionTransforming: ({ elements }) => {
|
|
12414
|
+
elements.forEach((el) => {
|
|
12415
|
+
el.findAncestor((ancestor) => {
|
|
12416
|
+
if (isElement(ancestor) && !inEditorIs(ancestor, "Frame")) {
|
|
12417
|
+
obbToFit(ancestor);
|
|
12418
|
+
}
|
|
12419
|
+
return false;
|
|
12420
|
+
});
|
|
12421
|
+
});
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12374
12424
|
};
|
|
12375
12425
|
});
|
|
12376
12426
|
function rotatePoint(center, point, angleRad) {
|
|
@@ -12616,6 +12666,8 @@ const _slice = definePlugin((editor) => {
|
|
|
12616
12666
|
position: start,
|
|
12617
12667
|
active: true
|
|
12618
12668
|
});
|
|
12669
|
+
el.style.width = 1;
|
|
12670
|
+
el.style.height = 1;
|
|
12619
12671
|
return {
|
|
12620
12672
|
move: (move) => {
|
|
12621
12673
|
const minX = Math.min(move.x, start.x);
|
|
@@ -12624,8 +12676,8 @@ const _slice = definePlugin((editor) => {
|
|
|
12624
12676
|
const maxY = Math.max(move.y, start.y);
|
|
12625
12677
|
el.style.left = minX;
|
|
12626
12678
|
el.style.top = minY;
|
|
12627
|
-
el.style.width = maxX - minX;
|
|
12628
|
-
el.style.height = maxY - minY;
|
|
12679
|
+
el.style.width = Math.max(1, maxX - minX);
|
|
12680
|
+
el.style.height = Math.max(1, maxY - minY);
|
|
12629
12681
|
},
|
|
12630
12682
|
end: () => {
|
|
12631
12683
|
setActiveDrawingTool(void 0);
|
|
@@ -14783,22 +14835,27 @@ const _transform = definePlugin((editor) => {
|
|
|
14783
14835
|
}
|
|
14784
14836
|
}
|
|
14785
14837
|
const when = () => Boolean(elementSelection.value.length > 0);
|
|
14786
|
-
function
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14838
|
+
function flip2(target) {
|
|
14839
|
+
switch (target) {
|
|
14840
|
+
case "horizontal":
|
|
14841
|
+
elementSelection.value.forEach((el) => {
|
|
14842
|
+
el.style.scaleX = -el.style.scaleX;
|
|
14843
|
+
});
|
|
14844
|
+
break;
|
|
14845
|
+
case "vertical":
|
|
14846
|
+
elementSelection.value.forEach((el) => {
|
|
14847
|
+
el.style.scaleY = -el.style.scaleY;
|
|
14848
|
+
});
|
|
14849
|
+
break;
|
|
14850
|
+
}
|
|
14795
14851
|
}
|
|
14796
14852
|
return {
|
|
14797
14853
|
name: "mce:transform",
|
|
14798
14854
|
commands: [
|
|
14799
14855
|
{ command: "enter", handle: _enter },
|
|
14800
|
-
{ command: "
|
|
14801
|
-
{ command: "
|
|
14856
|
+
{ command: "flip", handle: flip2 },
|
|
14857
|
+
{ command: "flipHorizontal", handle: () => flip2("horizontal") },
|
|
14858
|
+
{ command: "flipVertical", handle: () => flip2("vertical") }
|
|
14802
14859
|
],
|
|
14803
14860
|
hotkeys: [
|
|
14804
14861
|
{ command: "enter", key: ["Enter"], when },
|
|
@@ -14871,39 +14928,6 @@ const _view = definePlugin((editor) => {
|
|
|
14871
14928
|
]
|
|
14872
14929
|
};
|
|
14873
14930
|
});
|
|
14874
|
-
const _visibility = definePlugin((editor) => {
|
|
14875
|
-
const {
|
|
14876
|
-
elementSelection,
|
|
14877
|
-
setVisible,
|
|
14878
|
-
isVisible
|
|
14879
|
-
} = editor;
|
|
14880
|
-
function show() {
|
|
14881
|
-
elementSelection.value.forEach((el) => {
|
|
14882
|
-
setVisible(el, true);
|
|
14883
|
-
});
|
|
14884
|
-
}
|
|
14885
|
-
function hide() {
|
|
14886
|
-
elementSelection.value.forEach((el) => {
|
|
14887
|
-
setVisible(el, false);
|
|
14888
|
-
});
|
|
14889
|
-
}
|
|
14890
|
-
function hideOrShow() {
|
|
14891
|
-
elementSelection.value.forEach((el) => {
|
|
14892
|
-
setVisible(el, !isVisible(el));
|
|
14893
|
-
});
|
|
14894
|
-
}
|
|
14895
|
-
return {
|
|
14896
|
-
name: "mce:visibility",
|
|
14897
|
-
commands: [
|
|
14898
|
-
{ command: "hide", handle: hide },
|
|
14899
|
-
{ command: "show", handle: show },
|
|
14900
|
-
{ command: "hide/show", handle: hideOrShow }
|
|
14901
|
-
],
|
|
14902
|
-
hotkeys: [
|
|
14903
|
-
{ command: "hide/show", key: "Shift+CmdOrCtrl+H" }
|
|
14904
|
-
]
|
|
14905
|
-
};
|
|
14906
|
-
});
|
|
14907
14931
|
const _zoom = definePlugin((editor) => {
|
|
14908
14932
|
const {
|
|
14909
14933
|
registerConfig,
|
|
@@ -14955,7 +14979,6 @@ const plugins = [
|
|
|
14955
14979
|
_edit,
|
|
14956
14980
|
_frame,
|
|
14957
14981
|
_gif,
|
|
14958
|
-
_group,
|
|
14959
14982
|
_history,
|
|
14960
14983
|
_hover,
|
|
14961
14984
|
_html,
|
|
@@ -14963,7 +14986,6 @@ const plugins = [
|
|
|
14963
14986
|
_import,
|
|
14964
14987
|
_json,
|
|
14965
14988
|
_layers,
|
|
14966
|
-
_lock,
|
|
14967
14989
|
_madeWith,
|
|
14968
14990
|
_menu,
|
|
14969
14991
|
_move,
|
|
@@ -14990,7 +15012,6 @@ const plugins = [
|
|
|
14990
15012
|
_ui,
|
|
14991
15013
|
_url,
|
|
14992
15014
|
_view,
|
|
14993
|
-
_visibility,
|
|
14994
15015
|
_zoom
|
|
14995
15016
|
];
|
|
14996
15017
|
class Editor extends Observable {
|
|
@@ -16242,16 +16263,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16242
16263
|
if (handle.startsWith("resize")) {
|
|
16243
16264
|
const selectionAabb2 = getAabb(els);
|
|
16244
16265
|
els.forEach((el) => {
|
|
16245
|
-
const
|
|
16266
|
+
const parentAabb = el.getParent()?.getGlobalAabb?.() ?? new Aabb2D();
|
|
16246
16267
|
const { x, y } = startContext.offsetMap[el.instanceId];
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
if (pAabb) {
|
|
16250
|
-
left -= pAabb.left;
|
|
16251
|
-
top -= pAabb.top;
|
|
16252
|
-
}
|
|
16253
|
-
el.style.left = left;
|
|
16254
|
-
el.style.top = top;
|
|
16268
|
+
el.style.left = selectionAabb2.left - parentAabb.left + selectionAabb2.width * x;
|
|
16269
|
+
el.style.top = selectionAabb2.top - parentAabb.left + selectionAabb2.height * y;
|
|
16255
16270
|
});
|
|
16256
16271
|
}
|
|
16257
16272
|
}
|
package/dist/locale/en.d.ts
CHANGED
|
@@ -57,7 +57,8 @@ declare const _default: {
|
|
|
57
57
|
duplicate: string;
|
|
58
58
|
delete: string;
|
|
59
59
|
selectAll: string;
|
|
60
|
-
|
|
60
|
+
selectInverse: string;
|
|
61
|
+
selectNone: string;
|
|
61
62
|
selectChildren: string;
|
|
62
63
|
selectParent: string;
|
|
63
64
|
selectPreviousSibling: string;
|
|
@@ -90,12 +91,12 @@ declare const _default: {
|
|
|
90
91
|
object: string;
|
|
91
92
|
groupSelection: string;
|
|
92
93
|
frameSelection: string;
|
|
93
|
-
|
|
94
|
+
ungroupSelection: string;
|
|
94
95
|
flip: string;
|
|
95
96
|
flipHorizontal: string;
|
|
96
97
|
flipVertical: string;
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
showOrHideSelection: string;
|
|
99
|
+
lockOrUnlockSelection: string;
|
|
99
100
|
layerOrder: string;
|
|
100
101
|
bringToFront: string;
|
|
101
102
|
bringForward: string;
|
package/dist/locale/zh-Hans.d.ts
CHANGED
|
@@ -58,7 +58,8 @@ declare const _default: {
|
|
|
58
58
|
duplicate: string;
|
|
59
59
|
delete: string;
|
|
60
60
|
selectAll: string;
|
|
61
|
-
|
|
61
|
+
selectInverse: string;
|
|
62
|
+
selectNone: string;
|
|
62
63
|
selectChildren: string;
|
|
63
64
|
selectParent: string;
|
|
64
65
|
selectPreviousSibling: string;
|
|
@@ -91,12 +92,12 @@ declare const _default: {
|
|
|
91
92
|
object: string;
|
|
92
93
|
groupSelection: string;
|
|
93
94
|
frameSelection: string;
|
|
94
|
-
|
|
95
|
+
ungroupSelection: string;
|
|
95
96
|
flip: string;
|
|
96
97
|
flipHorizontal: string;
|
|
97
98
|
flipVertical: string;
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
showOrHideSelection: string;
|
|
100
|
+
lockOrUnlockSelection: string;
|
|
100
101
|
layerOrder: string;
|
|
101
102
|
bringToFront: string;
|
|
102
103
|
bringForward: string;
|
|
@@ -46,10 +46,10 @@ declare global {
|
|
|
46
46
|
parseAnchor: (anchor: Anchor, isRtl?: boolean) => ParsedAnchor;
|
|
47
47
|
isNode: (value: any) => value is Node;
|
|
48
48
|
isRoot: (value: any) => value is Node;
|
|
49
|
-
inEditorIs: (
|
|
49
|
+
inEditorIs: (node: Node, inEditorIs?: EditorNodeType) => boolean;
|
|
50
50
|
isElement: (value: any) => value is Element2D;
|
|
51
|
-
isFrame: (
|
|
52
|
-
isTopFrame: (
|
|
51
|
+
isFrame: (node: Node) => boolean;
|
|
52
|
+
isTopFrame: (node: Node) => boolean;
|
|
53
53
|
isVisible: (node: Node) => boolean;
|
|
54
54
|
setVisible: (node: Node, visible: boolean) => void;
|
|
55
55
|
isLock: (node: Node) => boolean;
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
import type { Node } from 'modern-canvas';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Mce {
|
|
4
|
-
type
|
|
4
|
+
type ZOrderType = 'bringForward' | 'sendBackward' | 'bringToFront' | 'sendToBack';
|
|
5
|
+
type AlignDirection = 'left' | 'horizontal-center' | 'right' | 'top' | 'vertical-center' | 'bottom';
|
|
6
|
+
type DistributeSpacingDirection = 'horizontal' | 'vertical';
|
|
5
7
|
interface Commands {
|
|
8
|
+
zOrder: (target: Node | Node[], type: ZOrderType) => void;
|
|
6
9
|
bringForward: (target?: Node) => void;
|
|
7
10
|
sendBackward: (target?: Node) => void;
|
|
8
11
|
bringToFront: (target?: Node | Node[]) => void;
|
|
9
12
|
sendToBack: (target?: Node | Node[]) => void;
|
|
10
|
-
align: (direction:
|
|
13
|
+
align: (direction: AlignDirection) => void;
|
|
11
14
|
alignLeft: () => void;
|
|
12
15
|
alignRight: () => void;
|
|
13
16
|
alignTop: () => void;
|
|
14
17
|
alignBottom: () => void;
|
|
15
18
|
alignHorizontalCenter: () => void;
|
|
16
19
|
alignVerticalCenter: () => void;
|
|
20
|
+
distributeSpacing: (direction: DistributeSpacingDirection) => void;
|
|
21
|
+
distributeHorizontalSpacing: () => void;
|
|
22
|
+
distributeVerticalSpacing: () => void;
|
|
23
|
+
tidyUp: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface Hotkeys {
|
|
26
|
+
bringForward: [event: KeyboardEvent];
|
|
27
|
+
sendBackward: [event: KeyboardEvent];
|
|
28
|
+
bringToFront: [event: KeyboardEvent];
|
|
29
|
+
sendToBack: [event: KeyboardEvent];
|
|
30
|
+
alignLeft: [event: KeyboardEvent];
|
|
31
|
+
alignRight: [event: KeyboardEvent];
|
|
32
|
+
alignTop: [event: KeyboardEvent];
|
|
33
|
+
alignBottom: [event: KeyboardEvent];
|
|
34
|
+
alignHorizontalCenter: [event: KeyboardEvent];
|
|
35
|
+
alignVerticalCenter: [event: KeyboardEvent];
|
|
36
|
+
distributeHorizontalSpacing: [event: KeyboardEvent];
|
|
37
|
+
distributeVerticalSpacing: [event: KeyboardEvent];
|
|
38
|
+
tidyUp: [event: KeyboardEvent];
|
|
17
39
|
}
|
|
18
40
|
}
|
|
19
41
|
}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
+
import type { Node } from 'modern-canvas';
|
|
1
2
|
declare global {
|
|
2
3
|
namespace Mce {
|
|
3
|
-
|
|
4
|
-
selectAll: [event: KeyboardEvent];
|
|
5
|
-
deselectAll: [event: KeyboardEvent];
|
|
6
|
-
selectChildren: [event: KeyboardEvent];
|
|
7
|
-
selectParent: [event: KeyboardEvent];
|
|
8
|
-
selectPreviousSibling: [event: KeyboardEvent];
|
|
9
|
-
selectNextSibling: [event: KeyboardEvent];
|
|
10
|
-
}
|
|
4
|
+
type SelectTarget = 'none' | 'all' | 'inverse' | 'children' | 'parent' | 'previousSibling' | 'nextSibling' | Node[];
|
|
11
5
|
interface Commands {
|
|
6
|
+
select: (target: SelectTarget) => void;
|
|
12
7
|
selectAll: () => void;
|
|
13
|
-
|
|
8
|
+
selectInverse: () => void;
|
|
9
|
+
selectNone: () => void;
|
|
14
10
|
selectChildren: () => void;
|
|
15
11
|
selectParent: () => void;
|
|
16
12
|
selectPreviousSibling: () => void;
|
|
17
13
|
selectNextSibling: () => void;
|
|
14
|
+
groupSelection: () => void;
|
|
15
|
+
ungroupSelection: () => void;
|
|
16
|
+
frameSelection: () => void;
|
|
17
|
+
showOrHideSelection: (target?: 'show' | 'hide') => void;
|
|
18
|
+
lockOrUnlockSelection: (target?: 'lock' | 'unlock') => void;
|
|
19
|
+
}
|
|
20
|
+
interface Hotkeys {
|
|
21
|
+
selectAll: [event: KeyboardEvent];
|
|
22
|
+
selectInverse: [event: KeyboardEvent];
|
|
23
|
+
selectNone: [event: KeyboardEvent];
|
|
24
|
+
selectChildren: [event: KeyboardEvent];
|
|
25
|
+
selectParent: [event: KeyboardEvent];
|
|
26
|
+
selectPreviousSibling: [event: KeyboardEvent];
|
|
27
|
+
selectNextSibling: [event: KeyboardEvent];
|
|
28
|
+
groupSelection: [event: KeyboardEvent];
|
|
29
|
+
ungroupSelection: [event: KeyboardEvent];
|
|
30
|
+
frameSelection: [event: KeyboardEvent];
|
|
31
|
+
showOrHideSelection: [event: KeyboardEvent];
|
|
32
|
+
lockOrUnlockSelection: [event: KeyboardEvent];
|
|
18
33
|
}
|
|
19
34
|
}
|
|
20
35
|
}
|
package/dist/typed-plugins.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ import './plugins/drawingTool'
|
|
|
34
34
|
import './plugins/edit'
|
|
35
35
|
import './plugins/frame'
|
|
36
36
|
import './plugins/gif'
|
|
37
|
-
import './plugins/group'
|
|
38
37
|
import './plugins/history'
|
|
39
38
|
import './plugins/hover'
|
|
40
39
|
import './plugins/html'
|
|
@@ -42,7 +41,6 @@ import './plugins/image'
|
|
|
42
41
|
import './plugins/import'
|
|
43
42
|
import './plugins/json'
|
|
44
43
|
import './plugins/layers'
|
|
45
|
-
import './plugins/lock'
|
|
46
44
|
import './plugins/madeWith'
|
|
47
45
|
import './plugins/menu'
|
|
48
46
|
import './plugins/move'
|
|
@@ -69,7 +67,6 @@ import './plugins/transform'
|
|
|
69
67
|
import './plugins/ui'
|
|
70
68
|
import './plugins/url'
|
|
71
69
|
import './plugins/view'
|
|
72
|
-
import './plugins/visibility'
|
|
73
70
|
import './plugins/zoom'
|
|
74
71
|
|
|
75
72
|
export {}
|
package/package.json
CHANGED
package/dist/plugins/group.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Mce {
|
|
3
|
-
interface Commands {
|
|
4
|
-
groupSelection: () => void;
|
|
5
|
-
frameSelection: () => void;
|
|
6
|
-
ungroup: () => void;
|
|
7
|
-
}
|
|
8
|
-
interface Hotkeys {
|
|
9
|
-
groupSelection: [event: KeyboardEvent];
|
|
10
|
-
frameSelection: [event: KeyboardEvent];
|
|
11
|
-
ungroup: [event: KeyboardEvent];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
declare const _default: import("..").Plugin;
|
|
16
|
-
export default _default;
|
package/dist/plugins/lock.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Mce {
|
|
3
|
-
interface Commands {
|
|
4
|
-
'lock': () => void;
|
|
5
|
-
'unlock': () => void;
|
|
6
|
-
'lock/unlock': () => void;
|
|
7
|
-
}
|
|
8
|
-
interface Hotkeys {
|
|
9
|
-
'lock/unlock': [event: KeyboardEvent];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
declare const _default: import("..").Plugin;
|
|
14
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Mce {
|
|
3
|
-
interface Commands {
|
|
4
|
-
'hide': () => void;
|
|
5
|
-
'show': () => void;
|
|
6
|
-
'hide/show': () => void;
|
|
7
|
-
}
|
|
8
|
-
interface Hotkeys {
|
|
9
|
-
'hide/show': [event: KeyboardEvent];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
declare const _default: import("..").Plugin;
|
|
14
|
-
export default _default;
|