@tmagic/stage 1.3.0-alpha.14 → 1.3.0-alpha.16
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 +40 -55
- package/dist/tmagic-stage.js.map +1 -1
- package/dist/tmagic-stage.umd.cjs +40 -55
- package/dist/tmagic-stage.umd.cjs.map +1 -1
- package/package.json +7 -7
- package/src/MoveableActionsAble.ts +36 -54
- package/src/MoveableOptionsManager.ts +2 -1
- package/src/moveable-able.css +108 -0
- package/types/MoveableActionsAble.d.ts +2 -4
|
@@ -556,6 +556,8 @@
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
+
const ableCss = ".moveable-button {\n width: 20px;\n height: 20px;\n background: #4af;\n border-radius: 4px;\n appearance: none;\n border: 0;\n color: white;\n font-size: 12px;\n font-weight: bold;\n margin-left: 2px;\n position: relative;\n}\n.moveable-remove-button:before, .moveable-remove-button:after {\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%) rotate(45deg);\n width: 14px;\n height: 2px;\n background: #fff;\n border-radius: 1px;\n cursor: pointer;\n}\n.moveable-remove-button:after {\n transform: translate(-50%, -50%) rotate(-45deg);\n}\n\n.moveable-select-parent-arrow-top-icon {\n transform: rotateZ(-45deg);\n width: 4px;\n height: 4px;\n border-color: #fff;\n border-width: 2px 2px 0 0;\n border-style: solid;\n position: absolute;\n left: 4px;\n top: 4px;\n}\n\n.moveable-select-parent-arrow-body-icon {\n width: 7px;\n height: 11px;\n border-color: #fff;\n border-width: 0 0 2px 2px;\n border-style: solid;\n}\n\n.moveable-drag-area-button {\n cursor: move;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-top-icon {\n width: 2px;\n height: 2px;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-top-icon-top {\n transform: rotateZ(-45deg) translateX(-50%);\n left: 50%;\n top: 3px;\n transform-origin: left;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-top-icon-bottom {\n transform: rotateZ(135deg) translateX(-50%);\n transform-origin: left;\n left: 50%;\n top: auto;\n bottom: 3px;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-top-icon-right {\n transform: rotateZ(45deg) translateY(-50%);\n transform-origin: top;\n right: 3px;\n left: auto;\n top: 50%;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-top-icon-left {\n transform: rotateZ(235deg) translateY(-50%);\n transform-origin: top;\n left: 3px;\n top: 50%;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-body-icon-horizontal {\n width: 2px;\n height: 11px;\n background-color: #fff;\n position: absolute;\n transform: translateX(-50%);\n left: 50%;\n top: 4px;\n}\n\n.moveable-drag-area-button .moveable-select-parent-arrow-body-icon-vertical {\n width: 11px;\n height: 2px;\n background-color: #fff;\n position: absolute;\n transform: translateY(-50%);\n left: 4px;\n top: 50%;;\n}\n\n";
|
|
560
|
+
|
|
559
561
|
var ContainerHighlightType = /* @__PURE__ */ ((ContainerHighlightType2) => {
|
|
560
562
|
ContainerHighlightType2["DEFAULT"] = "default";
|
|
561
563
|
ContainerHighlightType2["ALT"] = "alt";
|
|
@@ -580,10 +582,8 @@
|
|
|
580
582
|
|
|
581
583
|
const MoveableActionsAble = (handler) => ({
|
|
582
584
|
name: "actions",
|
|
583
|
-
props:
|
|
584
|
-
|
|
585
|
-
},
|
|
586
|
-
events: {},
|
|
585
|
+
props: [],
|
|
586
|
+
events: [],
|
|
587
587
|
render(moveable, React) {
|
|
588
588
|
const rect = moveable.getRect();
|
|
589
589
|
const { pos2 } = moveable.state;
|
|
@@ -598,34 +598,7 @@
|
|
|
598
598
|
transform-origin: 0px 0px;
|
|
599
599
|
display: flex;
|
|
600
600
|
}
|
|
601
|
-
|
|
602
|
-
width: 20px;
|
|
603
|
-
height: 20px;
|
|
604
|
-
background: #4af;
|
|
605
|
-
border-radius: 4px;
|
|
606
|
-
appearance: none;
|
|
607
|
-
border: 0;
|
|
608
|
-
color: white;
|
|
609
|
-
font-size: 12px;
|
|
610
|
-
font-weight: bold;
|
|
611
|
-
margin-left: 2px;
|
|
612
|
-
position: relative;
|
|
613
|
-
}
|
|
614
|
-
.moveable-remove-button:before, .moveable-remove-button:after {
|
|
615
|
-
content: "";
|
|
616
|
-
position: absolute;
|
|
617
|
-
left: 50%;
|
|
618
|
-
top: 50%;
|
|
619
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
620
|
-
width: 14px;
|
|
621
|
-
height: 2px;
|
|
622
|
-
background: #fff;
|
|
623
|
-
border-radius: 1px;
|
|
624
|
-
cursor: pointer;
|
|
625
|
-
}
|
|
626
|
-
.moveable-remove-button:after {
|
|
627
|
-
transform: translate(-50%, -50%) rotate(-45deg);
|
|
628
|
-
}
|
|
601
|
+
${ableCss}
|
|
629
602
|
`
|
|
630
603
|
);
|
|
631
604
|
return React.createElement(
|
|
@@ -633,7 +606,7 @@
|
|
|
633
606
|
{
|
|
634
607
|
className: "moveable-editable",
|
|
635
608
|
style: {
|
|
636
|
-
transform: `translate(${pos2[0] -
|
|
609
|
+
transform: `translate(${pos2[0] - 60}px, ${pos2[1] - 28}px) rotate(${rect.rotation}deg)`
|
|
637
610
|
}
|
|
638
611
|
},
|
|
639
612
|
[
|
|
@@ -646,27 +619,12 @@
|
|
|
646
619
|
handler(AbleActionEventType.SELECT_PARENT);
|
|
647
620
|
}
|
|
648
621
|
},
|
|
649
|
-
React.createElement(
|
|
650
|
-
"
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
fill: "none",
|
|
656
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
657
|
-
style: {
|
|
658
|
-
transform: "rotate(90deg)",
|
|
659
|
-
position: "absolute",
|
|
660
|
-
left: 0,
|
|
661
|
-
top: 0
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
React.createElement("path", {
|
|
665
|
-
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",
|
|
666
|
-
fill: "currentColor",
|
|
667
|
-
fillOpacity: "0.9"
|
|
668
|
-
})
|
|
669
|
-
)
|
|
622
|
+
React.createElement("div", {
|
|
623
|
+
className: "moveable-select-parent-arrow-top-icon"
|
|
624
|
+
}),
|
|
625
|
+
React.createElement("div", {
|
|
626
|
+
className: "moveable-select-parent-arrow-body-icon"
|
|
627
|
+
})
|
|
670
628
|
),
|
|
671
629
|
React.createElement("button", {
|
|
672
630
|
className: "moveable-button moveable-remove-button",
|
|
@@ -674,7 +632,32 @@
|
|
|
674
632
|
onClick: () => {
|
|
675
633
|
handler(AbleActionEventType.REMOVE);
|
|
676
634
|
}
|
|
677
|
-
})
|
|
635
|
+
}),
|
|
636
|
+
React.createElement(
|
|
637
|
+
"button",
|
|
638
|
+
{
|
|
639
|
+
className: "moveable-button moveable-drag-area-button",
|
|
640
|
+
title: "拖动"
|
|
641
|
+
},
|
|
642
|
+
React.createElement("div", {
|
|
643
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-top"
|
|
644
|
+
}),
|
|
645
|
+
React.createElement("div", {
|
|
646
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-bottom"
|
|
647
|
+
}),
|
|
648
|
+
React.createElement("div", {
|
|
649
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-left"
|
|
650
|
+
}),
|
|
651
|
+
React.createElement("div", {
|
|
652
|
+
className: " moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-right"
|
|
653
|
+
}),
|
|
654
|
+
React.createElement("div", {
|
|
655
|
+
className: "moveable-select-parent-arrow-body-icon-horizontal"
|
|
656
|
+
}),
|
|
657
|
+
React.createElement("div", {
|
|
658
|
+
className: "moveable-select-parent-arrow-body-icon-vertical"
|
|
659
|
+
})
|
|
660
|
+
)
|
|
678
661
|
]
|
|
679
662
|
);
|
|
680
663
|
}
|
|
@@ -810,6 +793,8 @@
|
|
|
810
793
|
left: isAbsolute
|
|
811
794
|
},
|
|
812
795
|
isDisplayInnerSnapDigit: true,
|
|
796
|
+
dragTarget: ".moveable-drag-area-button",
|
|
797
|
+
dragTargetSelf: true,
|
|
813
798
|
props: {
|
|
814
799
|
actions: true
|
|
815
800
|
},
|