@tmagic/stage 1.2.6 → 1.2.8
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.js +164 -101
- package/dist/tmagic-stage.js.map +1 -1
- package/dist/tmagic-stage.umd.cjs +168 -104
- package/dist/tmagic-stage.umd.cjs.map +1 -1
- package/package.json +6 -6
- package/src/ActionManager.ts +32 -16
- package/src/DragResizeHelper.ts +40 -2
- package/src/MoveableActionsAble.ts +109 -0
- package/src/MoveableOptionsManager.ts +6 -6
- package/src/StageCore.ts +11 -4
- package/src/StageDragResize.ts +8 -34
- package/src/StageMultiDragResize.ts +28 -14
- package/src/types.ts +16 -2
- package/types/ActionManager.d.ts +1 -1
- package/types/DragResizeHelper.d.ts +2 -1
- package/types/{MoveableSelectParentAble.d.ts → MoveableActionsAble.d.ts} +5 -2
- package/types/MoveableOptionsManager.d.ts +1 -1
- package/types/StageCore.d.ts +2 -2
- package/types/StageDragResize.d.ts +1 -0
- package/types/StageMultiDragResize.d.ts +2 -0
- package/types/types.d.ts +14 -2
- package/src/MoveableSelectParentAble.ts +0 -76
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('events'), require('keycon'), require('lodash-es'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable'), require('moveable
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'events', 'keycon', 'lodash-es', '@tmagic/core', '@tmagic/utils', 'moveable', 'moveable
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicStage = {}, global.EventEmitter, global.KeyController, global.lodashEs, global.core, global.utils, global.
|
|
5
|
-
})(this, (function (exports, EventEmitter, KeyController, lodashEs, core, utils,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('events'), require('keycon'), require('lodash-es'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable-helper'), require('moveable'), require('@scena/guides')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'events', 'keycon', 'lodash-es', '@tmagic/core', '@tmagic/utils', 'moveable-helper', 'moveable', '@scena/guides'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicStage = {}, global.EventEmitter, global.KeyController, global.lodashEs, global.core, global.utils, global.MoveableHelper, global.Moveable, global.Guides));
|
|
5
|
+
})(this, (function (exports, EventEmitter, KeyController, lodashEs, core, utils, MoveableHelper, Moveable, Guides) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
9
9
|
const EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
|
10
10
|
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
11
|
-
const Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
|
|
12
11
|
const MoveableHelper__default = /*#__PURE__*/_interopDefaultLegacy(MoveableHelper);
|
|
12
|
+
const Moveable__default = /*#__PURE__*/_interopDefaultLegacy(Moveable);
|
|
13
13
|
const Guides__default = /*#__PURE__*/_interopDefaultLegacy(Guides);
|
|
14
14
|
|
|
15
15
|
const GHOST_EL_ID_PREFIX = "ghost_el_";
|
|
@@ -475,6 +475,29 @@
|
|
|
475
475
|
});
|
|
476
476
|
this.moveableHelper.onDragGroup(e);
|
|
477
477
|
}
|
|
478
|
+
getUpdatedElRect(el, parentEl, doc) {
|
|
479
|
+
const offset = this.mode === Mode.SORTABLE ? { left: 0, top: 0 } : { left: el.offsetLeft, top: el.offsetTop };
|
|
480
|
+
let left = calcValueByFontsize(doc, offset.left);
|
|
481
|
+
let top = calcValueByFontsize(doc, offset.top);
|
|
482
|
+
const width = calcValueByFontsize(doc, el.clientWidth);
|
|
483
|
+
const height = calcValueByFontsize(doc, el.clientHeight);
|
|
484
|
+
let shadowEl = this.getShadowEl();
|
|
485
|
+
const shadowEls = this.getShadowEls();
|
|
486
|
+
if (shadowEls.length) {
|
|
487
|
+
shadowEl = shadowEls.find((item) => item.id.endsWith(el.id));
|
|
488
|
+
}
|
|
489
|
+
if (parentEl && this.mode === Mode.ABSOLUTE && shadowEl) {
|
|
490
|
+
const targetShadowHtmlEl = shadowEl;
|
|
491
|
+
const targetShadowElOffsetLeft = targetShadowHtmlEl.offsetLeft || 0;
|
|
492
|
+
const targetShadowElOffsetTop = targetShadowHtmlEl.offsetTop || 0;
|
|
493
|
+
const frame = this.getFrame(shadowEl);
|
|
494
|
+
const [translateX, translateY] = frame?.properties.transform.translate.value;
|
|
495
|
+
const { left: parentLeft, top: parentTop } = getOffset(parentEl);
|
|
496
|
+
left = calcValueByFontsize(doc, targetShadowElOffsetLeft) + parseFloat(translateX) - calcValueByFontsize(doc, parentLeft);
|
|
497
|
+
top = calcValueByFontsize(doc, targetShadowElOffsetTop) + parseFloat(translateY) - calcValueByFontsize(doc, parentTop);
|
|
498
|
+
}
|
|
499
|
+
return { width, height, left, top };
|
|
500
|
+
}
|
|
478
501
|
setFramesSnapShot(events) {
|
|
479
502
|
if (this.framesSnapShot.length > 0)
|
|
480
503
|
return;
|
|
@@ -519,9 +542,33 @@
|
|
|
519
542
|
}
|
|
520
543
|
}
|
|
521
544
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
545
|
+
var ContainerHighlightType = /* @__PURE__ */ ((ContainerHighlightType2) => {
|
|
546
|
+
ContainerHighlightType2["DEFAULT"] = "default";
|
|
547
|
+
ContainerHighlightType2["ALT"] = "alt";
|
|
548
|
+
return ContainerHighlightType2;
|
|
549
|
+
})(ContainerHighlightType || {});
|
|
550
|
+
var SelectStatus = /* @__PURE__ */ ((SelectStatus2) => {
|
|
551
|
+
SelectStatus2["SELECT"] = "select";
|
|
552
|
+
SelectStatus2["MULTI_SELECT"] = "multiSelect";
|
|
553
|
+
return SelectStatus2;
|
|
554
|
+
})(SelectStatus || {});
|
|
555
|
+
var StageDragStatus = /* @__PURE__ */ ((StageDragStatus2) => {
|
|
556
|
+
StageDragStatus2["START"] = "start";
|
|
557
|
+
StageDragStatus2["ING"] = "ing";
|
|
558
|
+
StageDragStatus2["END"] = "end";
|
|
559
|
+
return StageDragStatus2;
|
|
560
|
+
})(StageDragStatus || {});
|
|
561
|
+
var AbleActionEventType = /* @__PURE__ */ ((AbleActionEventType2) => {
|
|
562
|
+
AbleActionEventType2["SELECT_PARENT"] = "select-parent";
|
|
563
|
+
AbleActionEventType2["REMOVE"] = "remove";
|
|
564
|
+
return AbleActionEventType2;
|
|
565
|
+
})(AbleActionEventType || {});
|
|
566
|
+
|
|
567
|
+
const MoveableActionsAble = (handler) => ({
|
|
568
|
+
name: "actions",
|
|
569
|
+
props: {
|
|
570
|
+
selectParent: Boolean
|
|
571
|
+
},
|
|
525
572
|
events: {},
|
|
526
573
|
render(moveable, React) {
|
|
527
574
|
const rect = moveable.getRect();
|
|
@@ -547,6 +594,23 @@
|
|
|
547
594
|
color: white;
|
|
548
595
|
font-size: 12px;
|
|
549
596
|
font-weight: bold;
|
|
597
|
+
margin-left: 2px;
|
|
598
|
+
position: relative;
|
|
599
|
+
}
|
|
600
|
+
.moveable-remove-button:before, .moveable-remove-button:after {
|
|
601
|
+
content: "";
|
|
602
|
+
position: absolute;
|
|
603
|
+
left: 50%;
|
|
604
|
+
top: 50%;
|
|
605
|
+
transform: translate(-50%, -50%) rotate(45deg);
|
|
606
|
+
width: 14px;
|
|
607
|
+
height: 2px;
|
|
608
|
+
background: #fff;
|
|
609
|
+
border-radius: 1px;
|
|
610
|
+
cursor: pointer;
|
|
611
|
+
}
|
|
612
|
+
.moveable-remove-button:after {
|
|
613
|
+
transform: translate(-50%, -50%) rotate(-45deg);
|
|
550
614
|
}
|
|
551
615
|
`
|
|
552
616
|
);
|
|
@@ -555,37 +619,49 @@
|
|
|
555
619
|
{
|
|
556
620
|
className: "moveable-editable",
|
|
557
621
|
style: {
|
|
558
|
-
transform: `translate(${pos2[0] -
|
|
622
|
+
transform: `translate(${pos2[0] - 48}px, ${pos2[1] - 28}px) rotate(${rect.rotation}deg) translate(10px)`
|
|
559
623
|
}
|
|
560
624
|
},
|
|
561
|
-
|
|
562
|
-
"button",
|
|
563
|
-
{
|
|
564
|
-
className: "moveable-button",
|
|
565
|
-
title: "\u9009\u4E2D\u7236\u7EC4\u4EF6",
|
|
566
|
-
onClick: () => {
|
|
567
|
-
selectParentHandler();
|
|
568
|
-
}
|
|
569
|
-
},
|
|
625
|
+
[
|
|
570
626
|
React.createElement(
|
|
571
|
-
"
|
|
627
|
+
"button",
|
|
572
628
|
{
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
578
|
-
style: {
|
|
579
|
-
transform: "rotate(90deg)"
|
|
629
|
+
className: "moveable-button",
|
|
630
|
+
title: "\u9009\u4E2D\u7236\u7EC4\u4EF6",
|
|
631
|
+
onClick: () => {
|
|
632
|
+
handler(AbleActionEventType.SELECT_PARENT);
|
|
580
633
|
}
|
|
581
634
|
},
|
|
582
|
-
React.createElement(
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
635
|
+
React.createElement(
|
|
636
|
+
"svg",
|
|
637
|
+
{
|
|
638
|
+
width: "20px",
|
|
639
|
+
height: "20px",
|
|
640
|
+
viewBox: "0 0 16 16",
|
|
641
|
+
fill: "none",
|
|
642
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
643
|
+
style: {
|
|
644
|
+
transform: "rotate(90deg)",
|
|
645
|
+
position: "absolute",
|
|
646
|
+
left: 0,
|
|
647
|
+
top: 0
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
React.createElement("path", {
|
|
651
|
+
d: "M13.0001 4V10H4.20718L5.85363 8.35355L5.14652 7.64645L2.64652 10.1464C2.45126 10.3417 2.45126 10.6583 2.64652 10.8536L5.14652 13.3536L5.85363 12.6464L4.20718 11H13.0001C13.5524 11 14.0001 10.5523 14.0001 10V4H13.0001Z",
|
|
652
|
+
fill: "currentColor",
|
|
653
|
+
fillOpacity: "0.9"
|
|
654
|
+
})
|
|
655
|
+
)
|
|
656
|
+
),
|
|
657
|
+
React.createElement("button", {
|
|
658
|
+
className: "moveable-button moveable-remove-button",
|
|
659
|
+
title: "\u5220\u9664",
|
|
660
|
+
onClick: () => {
|
|
661
|
+
handler(AbleActionEventType.REMOVE);
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
]
|
|
589
665
|
);
|
|
590
666
|
}
|
|
591
667
|
});
|
|
@@ -681,9 +757,9 @@
|
|
|
681
757
|
},
|
|
682
758
|
isDisplayInnerSnapDigit: true,
|
|
683
759
|
props: {
|
|
684
|
-
|
|
760
|
+
actions: true
|
|
685
761
|
},
|
|
686
|
-
ables: [
|
|
762
|
+
ables: [MoveableActionsAble(this.actionHandler.bind(this))]
|
|
687
763
|
};
|
|
688
764
|
}
|
|
689
765
|
getMultiOptions() {
|
|
@@ -702,8 +778,8 @@
|
|
|
702
778
|
}
|
|
703
779
|
return this.customizedOptions;
|
|
704
780
|
}
|
|
705
|
-
|
|
706
|
-
this.emit(
|
|
781
|
+
actionHandler(type) {
|
|
782
|
+
this.emit(type);
|
|
707
783
|
}
|
|
708
784
|
createGuidelineElements(selectedElList, allElList) {
|
|
709
785
|
const frame = globalThis.document.createDocumentFragment();
|
|
@@ -728,23 +804,6 @@
|
|
|
728
804
|
}
|
|
729
805
|
}
|
|
730
806
|
|
|
731
|
-
var ContainerHighlightType = /* @__PURE__ */ ((ContainerHighlightType2) => {
|
|
732
|
-
ContainerHighlightType2["DEFAULT"] = "default";
|
|
733
|
-
ContainerHighlightType2["ALT"] = "alt";
|
|
734
|
-
return ContainerHighlightType2;
|
|
735
|
-
})(ContainerHighlightType || {});
|
|
736
|
-
var SelectStatus = /* @__PURE__ */ ((SelectStatus2) => {
|
|
737
|
-
SelectStatus2["SELECT"] = "select";
|
|
738
|
-
SelectStatus2["MULTI_SELECT"] = "multiSelect";
|
|
739
|
-
return SelectStatus2;
|
|
740
|
-
})(SelectStatus || {});
|
|
741
|
-
var StageDragStatus = /* @__PURE__ */ ((StageDragStatus2) => {
|
|
742
|
-
StageDragStatus2["START"] = "start";
|
|
743
|
-
StageDragStatus2["ING"] = "ing";
|
|
744
|
-
StageDragStatus2["END"] = "end";
|
|
745
|
-
return StageDragStatus2;
|
|
746
|
-
})(StageDragStatus || {});
|
|
747
|
-
|
|
748
807
|
class StageDragResize extends MoveableOptionsManager {
|
|
749
808
|
target;
|
|
750
809
|
moveable;
|
|
@@ -760,16 +819,16 @@
|
|
|
760
819
|
this.markContainerEnd = config.markContainerEnd;
|
|
761
820
|
this.delayedMarkContainer = config.delayedMarkContainer;
|
|
762
821
|
this.disabledDragStart = config.disabledDragStart;
|
|
763
|
-
this.dragResizeHelper =
|
|
764
|
-
container: config.container,
|
|
765
|
-
updateDragEl: config.updateDragEl
|
|
766
|
-
});
|
|
822
|
+
this.dragResizeHelper = config.dragResizeHelper;
|
|
767
823
|
this.on("update-moveable", () => {
|
|
768
824
|
if (this.moveable) {
|
|
769
825
|
this.updateMoveable();
|
|
770
826
|
}
|
|
771
827
|
});
|
|
772
828
|
}
|
|
829
|
+
getTarget() {
|
|
830
|
+
return this.target;
|
|
831
|
+
}
|
|
773
832
|
select(el, event) {
|
|
774
833
|
if (!this.moveable || el !== this.target) {
|
|
775
834
|
this.initMoveable(el);
|
|
@@ -967,27 +1026,12 @@
|
|
|
967
1026
|
const doc = this.getRenderDocument();
|
|
968
1027
|
if (!doc)
|
|
969
1028
|
return;
|
|
970
|
-
const
|
|
971
|
-
let left = calcValueByFontsize(doc, offset.left);
|
|
972
|
-
let top = calcValueByFontsize(doc, offset.top);
|
|
973
|
-
const width = calcValueByFontsize(doc, this.target.clientWidth);
|
|
974
|
-
const height = calcValueByFontsize(doc, this.target.clientHeight);
|
|
975
|
-
const shadowEl = this.dragResizeHelper.getShadowEl();
|
|
976
|
-
if (parentEl && this.mode === Mode.ABSOLUTE && shadowEl) {
|
|
977
|
-
const targetShadowHtmlEl = shadowEl;
|
|
978
|
-
const targetShadowElOffsetLeft = targetShadowHtmlEl.offsetLeft || 0;
|
|
979
|
-
const targetShadowElOffsetTop = targetShadowHtmlEl.offsetTop || 0;
|
|
980
|
-
const frame = this.dragResizeHelper.getFrame(shadowEl);
|
|
981
|
-
const [translateX, translateY] = frame?.properties.transform.translate.value;
|
|
982
|
-
const { left: parentLeft, top: parentTop } = getOffset(parentEl);
|
|
983
|
-
left = calcValueByFontsize(doc, targetShadowElOffsetLeft) + parseFloat(translateX) - calcValueByFontsize(doc, parentLeft);
|
|
984
|
-
top = calcValueByFontsize(doc, targetShadowElOffsetTop) + parseFloat(translateY) - calcValueByFontsize(doc, parentTop);
|
|
985
|
-
}
|
|
1029
|
+
const rect = this.dragResizeHelper.getUpdatedElRect(this.target, parentEl, doc);
|
|
986
1030
|
this.emit("update", {
|
|
987
1031
|
data: [
|
|
988
1032
|
{
|
|
989
1033
|
el: this.target,
|
|
990
|
-
style: isResize ?
|
|
1034
|
+
style: isResize ? rect : { left: rect.left, top: rect.top }
|
|
991
1035
|
}
|
|
992
1036
|
],
|
|
993
1037
|
parentEl
|
|
@@ -1044,6 +1088,8 @@
|
|
|
1044
1088
|
dragStatus = StageDragStatus.END;
|
|
1045
1089
|
dragResizeHelper;
|
|
1046
1090
|
getRenderDocument;
|
|
1091
|
+
delayedMarkContainer;
|
|
1092
|
+
markContainerEnd;
|
|
1047
1093
|
constructor(config) {
|
|
1048
1094
|
const moveableOptionsManagerConfig = {
|
|
1049
1095
|
container: config.container,
|
|
@@ -1051,12 +1097,11 @@
|
|
|
1051
1097
|
getRootContainer: config.getRootContainer
|
|
1052
1098
|
};
|
|
1053
1099
|
super(moveableOptionsManagerConfig);
|
|
1100
|
+
this.delayedMarkContainer = config.delayedMarkContainer;
|
|
1101
|
+
this.markContainerEnd = config.markContainerEnd;
|
|
1054
1102
|
this.container = config.container;
|
|
1055
1103
|
this.getRenderDocument = config.getRenderDocument;
|
|
1056
|
-
this.dragResizeHelper =
|
|
1057
|
-
container: config.container,
|
|
1058
|
-
updateDragEl: config.updateDragEl
|
|
1059
|
-
});
|
|
1104
|
+
this.dragResizeHelper = config.dragResizeHelper;
|
|
1060
1105
|
this.on("update-moveable", () => {
|
|
1061
1106
|
if (this.moveableForMulti) {
|
|
1062
1107
|
this.updateMoveable();
|
|
@@ -1080,6 +1125,7 @@
|
|
|
1080
1125
|
target: this.dragResizeHelper.getShadowEls()
|
|
1081
1126
|
})
|
|
1082
1127
|
);
|
|
1128
|
+
let timeout;
|
|
1083
1129
|
this.moveableForMulti.on("resizeGroupStart", (e) => {
|
|
1084
1130
|
this.dragResizeHelper.onResizeGroupStart(e);
|
|
1085
1131
|
this.dragStatus = StageDragStatus.START;
|
|
@@ -1093,10 +1139,16 @@
|
|
|
1093
1139
|
this.dragResizeHelper.onDragGroupStart(e);
|
|
1094
1140
|
this.dragStatus = StageDragStatus.START;
|
|
1095
1141
|
}).on("dragGroup", (e) => {
|
|
1142
|
+
if (timeout) {
|
|
1143
|
+
globalThis.clearTimeout(timeout);
|
|
1144
|
+
timeout = void 0;
|
|
1145
|
+
}
|
|
1146
|
+
timeout = this.delayedMarkContainer(e.inputEvent, this.targetList);
|
|
1096
1147
|
this.dragResizeHelper.onDragGroup(e);
|
|
1097
1148
|
this.dragStatus = StageDragStatus.ING;
|
|
1098
1149
|
}).on("dragGroupEnd", () => {
|
|
1099
|
-
this.
|
|
1150
|
+
const parentEl = this.markContainerEnd();
|
|
1151
|
+
this.update(false, parentEl);
|
|
1100
1152
|
this.dragStatus = StageDragStatus.END;
|
|
1101
1153
|
}).on("clickGroup", (e) => {
|
|
1102
1154
|
const { inputTarget, targets } = e;
|
|
@@ -1148,23 +1200,20 @@
|
|
|
1148
1200
|
this.moveableForMulti?.destroy();
|
|
1149
1201
|
this.dragResizeHelper.destroy();
|
|
1150
1202
|
}
|
|
1151
|
-
update(isResize = false) {
|
|
1203
|
+
update(isResize = false, parentEl = null) {
|
|
1152
1204
|
if (this.targetList.length === 0)
|
|
1153
1205
|
return;
|
|
1154
1206
|
const doc = this.getRenderDocument();
|
|
1155
1207
|
if (!doc)
|
|
1156
1208
|
return;
|
|
1157
1209
|
const data = this.targetList.map((targetItem) => {
|
|
1158
|
-
const
|
|
1159
|
-
const top = calcValueByFontsize(doc, targetItem.offsetTop);
|
|
1160
|
-
const width = calcValueByFontsize(doc, targetItem.clientWidth);
|
|
1161
|
-
const height = calcValueByFontsize(doc, targetItem.clientHeight);
|
|
1210
|
+
const rect = this.dragResizeHelper.getUpdatedElRect(targetItem, parentEl, doc);
|
|
1162
1211
|
return {
|
|
1163
1212
|
el: targetItem,
|
|
1164
|
-
style: isResize ?
|
|
1213
|
+
style: isResize ? rect : { left: rect.left, top: rect.top }
|
|
1165
1214
|
};
|
|
1166
1215
|
});
|
|
1167
|
-
this.emit("update", data,
|
|
1216
|
+
this.emit("update", { data, parentEl });
|
|
1168
1217
|
}
|
|
1169
1218
|
}
|
|
1170
1219
|
|
|
@@ -1207,27 +1256,28 @@
|
|
|
1207
1256
|
this.canSelect = config.canSelect || ((el) => !!el.id);
|
|
1208
1257
|
this.getRenderDocument = config.getRenderDocument;
|
|
1209
1258
|
this.isContainer = config.isContainer;
|
|
1259
|
+
const createDrHelper = () => new DragResizeHelper({
|
|
1260
|
+
container: config.container,
|
|
1261
|
+
updateDragEl: config.updateDragEl
|
|
1262
|
+
});
|
|
1210
1263
|
this.dr = new StageDragResize({
|
|
1211
1264
|
container: config.container,
|
|
1212
1265
|
disabledDragStart: config.disabledDragStart,
|
|
1266
|
+
moveableOptions: this.changeCallback(config.moveableOptions),
|
|
1267
|
+
dragResizeHelper: createDrHelper(),
|
|
1213
1268
|
getRootContainer: config.getRootContainer,
|
|
1214
1269
|
getRenderDocument: config.getRenderDocument,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
delayedMarkContainer: (event, exclude) => {
|
|
1218
|
-
if (this.canAddToContainer()) {
|
|
1219
|
-
return this.delayedMarkContainer(event, exclude);
|
|
1220
|
-
}
|
|
1221
|
-
return void 0;
|
|
1222
|
-
},
|
|
1223
|
-
moveableOptions: this.changeCallback(config.moveableOptions)
|
|
1270
|
+
markContainerEnd: this.markContainerEnd.bind(this),
|
|
1271
|
+
delayedMarkContainer: this.delayedMarkContainer.bind(this)
|
|
1224
1272
|
});
|
|
1225
1273
|
this.multiDr = new StageMultiDragResize({
|
|
1226
1274
|
container: config.container,
|
|
1227
1275
|
multiMoveableOptions: config.multiMoveableOptions,
|
|
1276
|
+
dragResizeHelper: createDrHelper(),
|
|
1228
1277
|
getRootContainer: config.getRootContainer,
|
|
1229
1278
|
getRenderDocument: config.getRenderDocument,
|
|
1230
|
-
|
|
1279
|
+
markContainerEnd: this.markContainerEnd.bind(this),
|
|
1280
|
+
delayedMarkContainer: this.delayedMarkContainer.bind(this)
|
|
1231
1281
|
});
|
|
1232
1282
|
this.highlightLayer = new StageHighlight({
|
|
1233
1283
|
container: config.container,
|
|
@@ -1353,9 +1403,12 @@
|
|
|
1353
1403
|
}
|
|
1354
1404
|
}
|
|
1355
1405
|
delayedMarkContainer(event, excludeElList = []) {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1406
|
+
if (this.canAddToContainer()) {
|
|
1407
|
+
return globalThis.setTimeout(() => {
|
|
1408
|
+
this.addContainerHighlightClassName(event, excludeElList);
|
|
1409
|
+
}, this.containerHighlightDuration);
|
|
1410
|
+
}
|
|
1411
|
+
return void 0;
|
|
1359
1412
|
}
|
|
1360
1413
|
destroy() {
|
|
1361
1414
|
this.container.removeEventListener("mousedown", this.mouseDownHandler);
|
|
@@ -1442,9 +1495,17 @@
|
|
|
1442
1495
|
setTimeout(() => this.emit("sort", data));
|
|
1443
1496
|
}).on("select-parent", () => {
|
|
1444
1497
|
this.emit("select-parent");
|
|
1498
|
+
}).on("remove", () => {
|
|
1499
|
+
const drTarget = this.dr.getTarget();
|
|
1500
|
+
if (!drTarget)
|
|
1501
|
+
return;
|
|
1502
|
+
const data = {
|
|
1503
|
+
data: [{ el: drTarget }]
|
|
1504
|
+
};
|
|
1505
|
+
this.emit("remove", data);
|
|
1445
1506
|
});
|
|
1446
|
-
this.multiDr.on("update", (data
|
|
1447
|
-
this.emit("multi-update", data
|
|
1507
|
+
this.multiDr.on("update", (data) => {
|
|
1508
|
+
this.emit("multi-update", data);
|
|
1448
1509
|
}).on("change-to-select", async (id) => {
|
|
1449
1510
|
if (this.isMultiSelectStatus)
|
|
1450
1511
|
return false;
|
|
@@ -2145,14 +2206,16 @@
|
|
|
2145
2206
|
this.emit("sort", data);
|
|
2146
2207
|
}).on("select-parent", () => {
|
|
2147
2208
|
this.emit("select-parent");
|
|
2209
|
+
}).on("remove", (data) => {
|
|
2210
|
+
this.emit("remove", data);
|
|
2148
2211
|
});
|
|
2149
2212
|
}
|
|
2150
2213
|
initMulDrEvent() {
|
|
2151
2214
|
this.actionManager.on("change-to-select", (el) => {
|
|
2152
2215
|
this.select(el);
|
|
2153
2216
|
setTimeout(() => this.emit("select", el));
|
|
2154
|
-
}).on("multi-update", (data
|
|
2155
|
-
this.emit("update",
|
|
2217
|
+
}).on("multi-update", (data) => {
|
|
2218
|
+
this.emit("update", data);
|
|
2156
2219
|
});
|
|
2157
2220
|
}
|
|
2158
2221
|
initHighlightEvent() {
|
|
@@ -2162,6 +2225,7 @@
|
|
|
2162
2225
|
}
|
|
2163
2226
|
}
|
|
2164
2227
|
|
|
2228
|
+
exports.AbleActionEventType = AbleActionEventType;
|
|
2165
2229
|
exports.CONTAINER_HIGHLIGHT_CLASS_NAME = CONTAINER_HIGHLIGHT_CLASS_NAME;
|
|
2166
2230
|
exports.ContainerHighlightType = ContainerHighlightType;
|
|
2167
2231
|
exports.DEFAULT_ZOOM = DEFAULT_ZOOM;
|