@tmagic/stage 1.1.0-beta.7 → 1.1.0
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/tmagic-stage.mjs +136 -40
- package/dist/tmagic-stage.mjs.map +1 -1
- package/dist/tmagic-stage.umd.js +141 -43
- package/dist/tmagic-stage.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/StageCore.ts +19 -7
- package/src/StageDragResize.ts +54 -32
- package/src/StageMultiDragResize.ts +92 -23
- package/src/style.css +4 -0
- package/src/types.ts +34 -14
- package/types/StageCore.d.ts +2 -1
- package/types/StageDragResize.d.ts +2 -0
- package/types/StageMultiDragResize.d.ts +3 -1
- package/types/types.d.ts +32 -14
package/dist/tmagic-stage.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import EventEmitter$1, { EventEmitter } from 'events';
|
|
2
2
|
import { removeClassName, removeClassNameByClassName, createDiv, injectStyle, isSameDomain, getHost, addClassName } from '@tmagic/utils';
|
|
3
|
+
import KeyController from 'keycon';
|
|
3
4
|
import Moveable from 'moveable';
|
|
4
5
|
import MoveableHelper from 'moveable-helper';
|
|
5
|
-
import KeyController from 'keycon';
|
|
6
6
|
import { throttle } from 'lodash-es';
|
|
7
7
|
import Guides from '@scena/guides';
|
|
8
8
|
|
|
@@ -38,6 +38,18 @@ var Mode = /* @__PURE__ */ ((Mode2) => {
|
|
|
38
38
|
})(Mode || {});
|
|
39
39
|
const SELECTED_CLASS = "tmagic-stage-selected-area";
|
|
40
40
|
|
|
41
|
+
var ContainerHighlightType = /* @__PURE__ */ ((ContainerHighlightType2) => {
|
|
42
|
+
ContainerHighlightType2["DEFAULT"] = "default";
|
|
43
|
+
ContainerHighlightType2["ALT"] = "alt";
|
|
44
|
+
return ContainerHighlightType2;
|
|
45
|
+
})(ContainerHighlightType || {});
|
|
46
|
+
var StageDragStatus = /* @__PURE__ */ ((StageDragStatus2) => {
|
|
47
|
+
StageDragStatus2["START"] = "start";
|
|
48
|
+
StageDragStatus2["ING"] = "ing";
|
|
49
|
+
StageDragStatus2["END"] = "end";
|
|
50
|
+
return StageDragStatus2;
|
|
51
|
+
})(StageDragStatus || {});
|
|
52
|
+
|
|
41
53
|
const getParents = (el, relative) => {
|
|
42
54
|
let cur = el.parentElement;
|
|
43
55
|
const parents = [];
|
|
@@ -215,14 +227,27 @@ class StageDragResize extends EventEmitter {
|
|
|
215
227
|
elementGuidelines = [];
|
|
216
228
|
mode = Mode.ABSOLUTE;
|
|
217
229
|
moveableOptions = {};
|
|
218
|
-
dragStatus =
|
|
230
|
+
dragStatus = StageDragStatus.END;
|
|
219
231
|
ghostEl;
|
|
220
232
|
moveableHelper;
|
|
233
|
+
isContainerHighlight = false;
|
|
221
234
|
constructor(config) {
|
|
222
235
|
super();
|
|
223
236
|
this.core = config.core;
|
|
224
237
|
this.container = config.container;
|
|
225
238
|
this.mask = config.mask;
|
|
239
|
+
KeyController.global.keydown("alt", (e) => {
|
|
240
|
+
e.inputEvent.preventDefault();
|
|
241
|
+
this.isContainerHighlight = true;
|
|
242
|
+
});
|
|
243
|
+
KeyController.global.keyup("alt", (e) => {
|
|
244
|
+
e.inputEvent.preventDefault();
|
|
245
|
+
const doc = this.core.renderer.contentWindow?.document;
|
|
246
|
+
if (doc && this.canContainerHighlight()) {
|
|
247
|
+
removeClassNameByClassName(doc, this.core.containerHighlightClassName);
|
|
248
|
+
}
|
|
249
|
+
this.isContainerHighlight = false;
|
|
250
|
+
});
|
|
226
251
|
}
|
|
227
252
|
select(el, event) {
|
|
228
253
|
const oldTarget = this.target;
|
|
@@ -287,7 +312,7 @@ class StageDragResize extends EventEmitter {
|
|
|
287
312
|
this.moveable?.destroy();
|
|
288
313
|
this.destroyGhostEl();
|
|
289
314
|
this.destroyDragEl();
|
|
290
|
-
this.dragStatus =
|
|
315
|
+
this.dragStatus = StageDragStatus.END;
|
|
291
316
|
this.removeAllListeners();
|
|
292
317
|
}
|
|
293
318
|
init(el) {
|
|
@@ -351,7 +376,7 @@ class StageDragResize extends EventEmitter {
|
|
|
351
376
|
this.moveable.on("resizeStart", (e) => {
|
|
352
377
|
if (!this.target)
|
|
353
378
|
return;
|
|
354
|
-
this.dragStatus =
|
|
379
|
+
this.dragStatus = StageDragStatus.START;
|
|
355
380
|
this.moveableHelper?.onResizeStart(e);
|
|
356
381
|
frame.top = this.target.offsetTop;
|
|
357
382
|
frame.left = this.target.offsetLeft;
|
|
@@ -360,18 +385,20 @@ class StageDragResize extends EventEmitter {
|
|
|
360
385
|
if (!this.moveable || !this.target || !this.dragEl)
|
|
361
386
|
return;
|
|
362
387
|
const { beforeTranslate } = drag;
|
|
363
|
-
this.dragStatus =
|
|
364
|
-
this.moveableHelper?.onResize(e);
|
|
388
|
+
this.dragStatus = StageDragStatus.ING;
|
|
365
389
|
if (this.mode === Mode.SORTABLE) {
|
|
366
390
|
this.target.style.top = "0px";
|
|
391
|
+
this.dragEl.style.width = `${width}px`;
|
|
392
|
+
this.dragEl.style.height = `${height}px`;
|
|
367
393
|
} else {
|
|
394
|
+
this.moveableHelper?.onResize(e);
|
|
368
395
|
this.target.style.left = `${frame.left + beforeTranslate[0]}px`;
|
|
369
396
|
this.target.style.top = `${frame.top + beforeTranslate[1]}px`;
|
|
370
397
|
}
|
|
371
398
|
this.target.style.width = `${width}px`;
|
|
372
399
|
this.target.style.height = `${height}px`;
|
|
373
400
|
}).on("resizeEnd", () => {
|
|
374
|
-
this.dragStatus =
|
|
401
|
+
this.dragStatus = StageDragStatus.END;
|
|
375
402
|
this.update(true);
|
|
376
403
|
});
|
|
377
404
|
}
|
|
@@ -388,7 +415,7 @@ class StageDragResize extends EventEmitter {
|
|
|
388
415
|
this.moveable.on("dragStart", (e) => {
|
|
389
416
|
if (!this.target)
|
|
390
417
|
throw new Error("\u672A\u9009\u4E2D\u7EC4\u4EF6");
|
|
391
|
-
this.dragStatus =
|
|
418
|
+
this.dragStatus = StageDragStatus.START;
|
|
392
419
|
this.moveableHelper?.onDragStart(e);
|
|
393
420
|
if (this.mode === Mode.SORTABLE) {
|
|
394
421
|
this.ghostEl = this.generateGhostEl(this.target);
|
|
@@ -402,8 +429,10 @@ class StageDragResize extends EventEmitter {
|
|
|
402
429
|
globalThis.clearTimeout(timeout);
|
|
403
430
|
timeout = void 0;
|
|
404
431
|
}
|
|
405
|
-
|
|
406
|
-
|
|
432
|
+
if (this.canContainerHighlight()) {
|
|
433
|
+
timeout = this.core.getAddContainerHighlightClassNameTimeout(e.inputEvent, [this.target]);
|
|
434
|
+
}
|
|
435
|
+
this.dragStatus = StageDragStatus.ING;
|
|
407
436
|
if (this.ghostEl) {
|
|
408
437
|
this.ghostEl.style.top = `${frame.top + e.beforeTranslate[1]}px`;
|
|
409
438
|
return;
|
|
@@ -417,10 +446,10 @@ class StageDragResize extends EventEmitter {
|
|
|
417
446
|
timeout = void 0;
|
|
418
447
|
}
|
|
419
448
|
let parentEl = null;
|
|
420
|
-
if (doc) {
|
|
449
|
+
if (doc && this.canContainerHighlight()) {
|
|
421
450
|
parentEl = removeClassNameByClassName(doc, this.core.containerHighlightClassName);
|
|
422
451
|
}
|
|
423
|
-
if (this.dragStatus ===
|
|
452
|
+
if (this.dragStatus === StageDragStatus.ING) {
|
|
424
453
|
if (parentEl) {
|
|
425
454
|
this.update(false, parentEl);
|
|
426
455
|
} else {
|
|
@@ -433,7 +462,7 @@ class StageDragResize extends EventEmitter {
|
|
|
433
462
|
}
|
|
434
463
|
}
|
|
435
464
|
}
|
|
436
|
-
this.dragStatus =
|
|
465
|
+
this.dragStatus = StageDragStatus.END;
|
|
437
466
|
this.destroyGhostEl();
|
|
438
467
|
});
|
|
439
468
|
}
|
|
@@ -441,17 +470,17 @@ class StageDragResize extends EventEmitter {
|
|
|
441
470
|
if (!this.moveable)
|
|
442
471
|
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
443
472
|
this.moveable.on("rotateStart", (e) => {
|
|
444
|
-
this.dragStatus =
|
|
473
|
+
this.dragStatus = StageDragStatus.START;
|
|
445
474
|
this.moveableHelper?.onRotateStart(e);
|
|
446
475
|
}).on("rotate", (e) => {
|
|
447
476
|
if (!this.target || !this.dragEl)
|
|
448
477
|
return;
|
|
449
|
-
this.dragStatus =
|
|
478
|
+
this.dragStatus = StageDragStatus.ING;
|
|
450
479
|
this.moveableHelper?.onRotate(e);
|
|
451
480
|
const frame = this.moveableHelper?.getFrame(e.target);
|
|
452
481
|
this.target.style.transform = frame?.toCSSObject().transform || "";
|
|
453
482
|
}).on("rotateEnd", (e) => {
|
|
454
|
-
this.dragStatus =
|
|
483
|
+
this.dragStatus = StageDragStatus.END;
|
|
455
484
|
const frame = this.moveableHelper?.getFrame(e.target);
|
|
456
485
|
this.emit("update", {
|
|
457
486
|
el: this.target,
|
|
@@ -465,17 +494,17 @@ class StageDragResize extends EventEmitter {
|
|
|
465
494
|
if (!this.moveable)
|
|
466
495
|
throw new Error("moveable \u672A\u521D\u59CB\u5316");
|
|
467
496
|
this.moveable.on("scaleStart", (e) => {
|
|
468
|
-
this.dragStatus =
|
|
497
|
+
this.dragStatus = StageDragStatus.START;
|
|
469
498
|
this.moveableHelper?.onScaleStart(e);
|
|
470
499
|
}).on("scale", (e) => {
|
|
471
500
|
if (!this.target || !this.dragEl)
|
|
472
501
|
return;
|
|
473
|
-
this.dragStatus =
|
|
502
|
+
this.dragStatus = StageDragStatus.ING;
|
|
474
503
|
this.moveableHelper?.onScale(e);
|
|
475
504
|
const frame = this.moveableHelper?.getFrame(e.target);
|
|
476
505
|
this.target.style.transform = frame?.toCSSObject().transform || "";
|
|
477
506
|
}).on("scaleEnd", (e) => {
|
|
478
|
-
this.dragStatus =
|
|
507
|
+
this.dragStatus = StageDragStatus.END;
|
|
479
508
|
const frame = this.moveableHelper?.getFrame(e.target);
|
|
480
509
|
this.emit("update", {
|
|
481
510
|
el: this.target,
|
|
@@ -523,9 +552,13 @@ class StageDragResize extends EventEmitter {
|
|
|
523
552
|
top = calcValueByFontsize(doc, this.dragEl.offsetTop) + parseFloat(translateY) - calcValueByFontsize(doc, parentTop);
|
|
524
553
|
}
|
|
525
554
|
this.emit("update", {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
555
|
+
data: [
|
|
556
|
+
{
|
|
557
|
+
el: this.target,
|
|
558
|
+
style: isResize ? { left, top, width, height } : { left, top }
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
parentEl
|
|
529
562
|
});
|
|
530
563
|
}
|
|
531
564
|
generateGhostEl(el) {
|
|
@@ -563,6 +596,7 @@ class StageDragResize extends EventEmitter {
|
|
|
563
596
|
return {};
|
|
564
597
|
const isAbsolute = this.mode === Mode.ABSOLUTE;
|
|
565
598
|
const isFixed = this.mode === Mode.FIXED;
|
|
599
|
+
const isSortable = this.mode === Mode.SORTABLE;
|
|
566
600
|
let { moveableOptions = {} } = this.core.config;
|
|
567
601
|
if (typeof moveableOptions === "function") {
|
|
568
602
|
moveableOptions = moveableOptions(this.core);
|
|
@@ -609,13 +643,16 @@ class StageDragResize extends EventEmitter {
|
|
|
609
643
|
top: 0,
|
|
610
644
|
left: -1,
|
|
611
645
|
right: this.container.clientWidth - 1,
|
|
612
|
-
bottom: this.container.clientHeight,
|
|
646
|
+
bottom: isSortable ? void 0 : this.container.clientHeight,
|
|
613
647
|
...moveableOptions.bounds || {}
|
|
614
648
|
},
|
|
615
649
|
...options,
|
|
616
650
|
...moveableOptions
|
|
617
651
|
};
|
|
618
652
|
}
|
|
653
|
+
canContainerHighlight() {
|
|
654
|
+
return this.core.containerHighlightType === ContainerHighlightType.DEFAULT || this.core.containerHighlightType === ContainerHighlightType.ALT && this.isContainerHighlight;
|
|
655
|
+
}
|
|
619
656
|
}
|
|
620
657
|
|
|
621
658
|
class TargetCalibrate extends EventEmitter {
|
|
@@ -1102,6 +1139,7 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1102
1139
|
targetList = [];
|
|
1103
1140
|
dragElList = [];
|
|
1104
1141
|
moveableForMulti;
|
|
1142
|
+
dragStatus = StageDragStatus.END;
|
|
1105
1143
|
multiMoveableHelper;
|
|
1106
1144
|
constructor(config) {
|
|
1107
1145
|
super();
|
|
@@ -1134,9 +1172,7 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1134
1172
|
createAuto: true
|
|
1135
1173
|
});
|
|
1136
1174
|
const frames = [];
|
|
1137
|
-
|
|
1138
|
-
const { events } = params;
|
|
1139
|
-
this.multiMoveableHelper?.onDragGroupStart(params);
|
|
1175
|
+
const setFrames = (events) => {
|
|
1140
1176
|
events.forEach((ev) => {
|
|
1141
1177
|
const matchEventTarget = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
|
|
1142
1178
|
if (!matchEventTarget)
|
|
@@ -1147,6 +1183,40 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1147
1183
|
id: matchEventTarget.id
|
|
1148
1184
|
});
|
|
1149
1185
|
});
|
|
1186
|
+
};
|
|
1187
|
+
this.moveableForMulti.on("resizeGroupStart", (params) => {
|
|
1188
|
+
const { events } = params;
|
|
1189
|
+
this.multiMoveableHelper?.onResizeGroupStart(params);
|
|
1190
|
+
setFrames(events);
|
|
1191
|
+
this.dragStatus = StageDragStatus.START;
|
|
1192
|
+
}).on("resizeGroup", (params) => {
|
|
1193
|
+
const { events } = params;
|
|
1194
|
+
events.forEach((ev) => {
|
|
1195
|
+
const { width, height, beforeTranslate } = ev.drag;
|
|
1196
|
+
const frameSnapShot = frames.find((frameItem) => frameItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
|
|
1197
|
+
if (!frameSnapShot)
|
|
1198
|
+
return;
|
|
1199
|
+
const targeEl = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
|
|
1200
|
+
if (!targeEl)
|
|
1201
|
+
return;
|
|
1202
|
+
const isParentIncluded = this.targetList.find((targetItem) => targetItem.id === targeEl.parentElement?.id);
|
|
1203
|
+
if (!isParentIncluded) {
|
|
1204
|
+
targeEl.style.left = `${frameSnapShot.left + beforeTranslate[0]}px`;
|
|
1205
|
+
targeEl.style.top = `${frameSnapShot.top + beforeTranslate[1]}px`;
|
|
1206
|
+
}
|
|
1207
|
+
targeEl.style.width = `${width}px`;
|
|
1208
|
+
targeEl.style.height = `${height}px`;
|
|
1209
|
+
});
|
|
1210
|
+
this.multiMoveableHelper?.onResizeGroup(params);
|
|
1211
|
+
this.dragStatus = StageDragStatus.ING;
|
|
1212
|
+
}).on("resizeGroupEnd", () => {
|
|
1213
|
+
this.update(true);
|
|
1214
|
+
this.dragStatus = StageDragStatus.END;
|
|
1215
|
+
}).on("dragGroupStart", (params) => {
|
|
1216
|
+
const { events } = params;
|
|
1217
|
+
this.multiMoveableHelper?.onDragGroupStart(params);
|
|
1218
|
+
setFrames(events);
|
|
1219
|
+
this.dragStatus = StageDragStatus.START;
|
|
1150
1220
|
}).on("dragGroup", (params) => {
|
|
1151
1221
|
const { events } = params;
|
|
1152
1222
|
events.forEach((ev) => {
|
|
@@ -1163,8 +1233,15 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1163
1233
|
}
|
|
1164
1234
|
});
|
|
1165
1235
|
this.multiMoveableHelper?.onDragGroup(params);
|
|
1236
|
+
this.dragStatus = StageDragStatus.ING;
|
|
1166
1237
|
}).on("dragGroupEnd", () => {
|
|
1167
1238
|
this.update();
|
|
1239
|
+
this.dragStatus = StageDragStatus.END;
|
|
1240
|
+
}).on("clickGroup", (params) => {
|
|
1241
|
+
const { inputTarget, targets } = params;
|
|
1242
|
+
if (!this.mask.isMultiSelectStatus && targets.length > 1 && targets.includes(inputTarget)) {
|
|
1243
|
+
this.emit("select", inputTarget.id.replace(DRAG_EL_ID_PREFIX, ""));
|
|
1244
|
+
}
|
|
1168
1245
|
});
|
|
1169
1246
|
}
|
|
1170
1247
|
canSelect(el, stop) {
|
|
@@ -1211,16 +1288,19 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1211
1288
|
const doc = contentWindow?.document;
|
|
1212
1289
|
if (!doc)
|
|
1213
1290
|
return;
|
|
1214
|
-
this.
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1291
|
+
this.emit("update", {
|
|
1292
|
+
data: this.targetList.map((targetItem) => {
|
|
1293
|
+
const offset = { left: targetItem.offsetLeft, top: targetItem.offsetTop };
|
|
1294
|
+
const left = calcValueByFontsize(doc, offset.left);
|
|
1295
|
+
const top = calcValueByFontsize(doc, offset.top);
|
|
1296
|
+
const width = calcValueByFontsize(doc, targetItem.clientWidth);
|
|
1297
|
+
const height = calcValueByFontsize(doc, targetItem.clientHeight);
|
|
1298
|
+
return {
|
|
1299
|
+
el: targetItem,
|
|
1300
|
+
style: isResize ? { left, top, width, height } : { left, top }
|
|
1301
|
+
};
|
|
1302
|
+
}),
|
|
1303
|
+
parentEl: null
|
|
1224
1304
|
});
|
|
1225
1305
|
}
|
|
1226
1306
|
getOptions(options = {}) {
|
|
@@ -1239,13 +1319,21 @@ class StageMultiDragResize extends EventEmitter {
|
|
|
1239
1319
|
zoom: 1,
|
|
1240
1320
|
origin: true,
|
|
1241
1321
|
padding: { left: 0, top: 0, right: 0, bottom: 0 },
|
|
1322
|
+
snappable: true,
|
|
1323
|
+
bounds: {
|
|
1324
|
+
top: 0,
|
|
1325
|
+
left: -1,
|
|
1326
|
+
right: this.container.clientWidth - 1,
|
|
1327
|
+
bottom: this.container.clientHeight,
|
|
1328
|
+
...multiMoveableOptions.bounds || {}
|
|
1329
|
+
},
|
|
1242
1330
|
...options,
|
|
1243
1331
|
...multiMoveableOptions
|
|
1244
1332
|
};
|
|
1245
1333
|
}
|
|
1246
1334
|
}
|
|
1247
1335
|
|
|
1248
|
-
const style = ".tmagic-stage-container-highlight::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #000;\n opacity: .1;\n pointer-events: none;\n}\n";
|
|
1336
|
+
const style = ".tmagic-stage-container-highlight::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #000;\n opacity: .1;\n pointer-events: none;\n}\n\n.magic-ui-container.magic-layout-relative {\n min-height: 50px;\n}\n";
|
|
1249
1337
|
|
|
1250
1338
|
class StageRender extends EventEmitter {
|
|
1251
1339
|
contentWindow = null;
|
|
@@ -1346,6 +1434,7 @@ class StageCore extends EventEmitter {
|
|
|
1346
1434
|
zoom = DEFAULT_ZOOM;
|
|
1347
1435
|
containerHighlightClassName;
|
|
1348
1436
|
containerHighlightDuration;
|
|
1437
|
+
containerHighlightType;
|
|
1349
1438
|
isContainer;
|
|
1350
1439
|
canSelect;
|
|
1351
1440
|
constructor(config) {
|
|
@@ -1354,8 +1443,9 @@ class StageCore extends EventEmitter {
|
|
|
1354
1443
|
this.setZoom(config.zoom);
|
|
1355
1444
|
this.canSelect = config.canSelect || ((el) => !!el.id);
|
|
1356
1445
|
this.isContainer = config.isContainer;
|
|
1357
|
-
this.containerHighlightClassName = config.containerHighlightClassName;
|
|
1358
|
-
this.containerHighlightDuration = config.containerHighlightDuration;
|
|
1446
|
+
this.containerHighlightClassName = config.containerHighlightClassName || CONTAINER_HIGHLIGHT_CLASS;
|
|
1447
|
+
this.containerHighlightDuration = config.containerHighlightDuration || 800;
|
|
1448
|
+
this.containerHighlightType = config.containerHighlightType;
|
|
1359
1449
|
this.renderer = new StageRender({ core: this });
|
|
1360
1450
|
this.mask = new StageMask({ core: this });
|
|
1361
1451
|
this.dr = new StageDragResize({ core: this, container: this.mask.content, mask: this.mask });
|
|
@@ -1382,6 +1472,8 @@ class StageCore extends EventEmitter {
|
|
|
1382
1472
|
const el = await this.getElementFromPoint(event);
|
|
1383
1473
|
if (!el)
|
|
1384
1474
|
return;
|
|
1475
|
+
if (this.multiDr.dragStatus === StageDragStatus.ING)
|
|
1476
|
+
return;
|
|
1385
1477
|
await this.highlight(el);
|
|
1386
1478
|
if (this.highlightedDom === this.selectedDom) {
|
|
1387
1479
|
this.highlightLayer.clearHighlight();
|
|
@@ -1413,6 +1505,10 @@ class StageCore extends EventEmitter {
|
|
|
1413
1505
|
});
|
|
1414
1506
|
this.multiDr.on("update", (data) => {
|
|
1415
1507
|
setTimeout(() => this.emit("update", data));
|
|
1508
|
+
}).on("select", async (id) => {
|
|
1509
|
+
const el = await this.getTargetElement(id);
|
|
1510
|
+
this.select(el);
|
|
1511
|
+
setTimeout(() => this.emit("select", el));
|
|
1416
1512
|
});
|
|
1417
1513
|
}
|
|
1418
1514
|
getElementsFromPoint(event) {
|
|
@@ -1575,5 +1671,5 @@ class StageCore extends EventEmitter {
|
|
|
1575
1671
|
}
|
|
1576
1672
|
}
|
|
1577
1673
|
|
|
1578
|
-
export { CONTAINER_HIGHLIGHT_CLASS, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, GHOST_EL_ID_PREFIX, GuidesType, HIGHLIGHT_EL_ID_PREFIX, Mode, MouseButton, PAGE_CLASS, SELECTED_CLASS, StageDragResize, StageMask, StageRender, ZIndex, addSelectedClassName, calcValueByFontsize, StageCore as default, down, getAbsolutePosition, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isRelative, isStatic, removeSelectedClassName, up };
|
|
1674
|
+
export { CONTAINER_HIGHLIGHT_CLASS, ContainerHighlightType, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, GHOST_EL_ID_PREFIX, GuidesType, HIGHLIGHT_EL_ID_PREFIX, Mode, MouseButton, PAGE_CLASS, SELECTED_CLASS, StageDragResize, StageDragStatus, StageMask, StageRender, ZIndex, addSelectedClassName, calcValueByFontsize, StageCore as default, down, getAbsolutePosition, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isRelative, isStatic, removeSelectedClassName, up };
|
|
1579
1675
|
//# sourceMappingURL=tmagic-stage.mjs.map
|