@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
package/dist/tmagic-stage.js
CHANGED
|
@@ -559,6 +559,8 @@ class DragResizeHelper {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
|
|
562
|
+
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";
|
|
563
|
+
|
|
562
564
|
var ContainerHighlightType = /* @__PURE__ */ ((ContainerHighlightType2) => {
|
|
563
565
|
ContainerHighlightType2["DEFAULT"] = "default";
|
|
564
566
|
ContainerHighlightType2["ALT"] = "alt";
|
|
@@ -583,10 +585,8 @@ var AbleActionEventType = /* @__PURE__ */ ((AbleActionEventType2) => {
|
|
|
583
585
|
|
|
584
586
|
const MoveableActionsAble = (handler) => ({
|
|
585
587
|
name: "actions",
|
|
586
|
-
props:
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
events: {},
|
|
588
|
+
props: [],
|
|
589
|
+
events: [],
|
|
590
590
|
render(moveable, React) {
|
|
591
591
|
const rect = moveable.getRect();
|
|
592
592
|
const { pos2 } = moveable.state;
|
|
@@ -601,34 +601,7 @@ const MoveableActionsAble = (handler) => ({
|
|
|
601
601
|
transform-origin: 0px 0px;
|
|
602
602
|
display: flex;
|
|
603
603
|
}
|
|
604
|
-
|
|
605
|
-
width: 20px;
|
|
606
|
-
height: 20px;
|
|
607
|
-
background: #4af;
|
|
608
|
-
border-radius: 4px;
|
|
609
|
-
appearance: none;
|
|
610
|
-
border: 0;
|
|
611
|
-
color: white;
|
|
612
|
-
font-size: 12px;
|
|
613
|
-
font-weight: bold;
|
|
614
|
-
margin-left: 2px;
|
|
615
|
-
position: relative;
|
|
616
|
-
}
|
|
617
|
-
.moveable-remove-button:before, .moveable-remove-button:after {
|
|
618
|
-
content: "";
|
|
619
|
-
position: absolute;
|
|
620
|
-
left: 50%;
|
|
621
|
-
top: 50%;
|
|
622
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
623
|
-
width: 14px;
|
|
624
|
-
height: 2px;
|
|
625
|
-
background: #fff;
|
|
626
|
-
border-radius: 1px;
|
|
627
|
-
cursor: pointer;
|
|
628
|
-
}
|
|
629
|
-
.moveable-remove-button:after {
|
|
630
|
-
transform: translate(-50%, -50%) rotate(-45deg);
|
|
631
|
-
}
|
|
604
|
+
${ableCss}
|
|
632
605
|
`
|
|
633
606
|
);
|
|
634
607
|
return React.createElement(
|
|
@@ -636,7 +609,7 @@ const MoveableActionsAble = (handler) => ({
|
|
|
636
609
|
{
|
|
637
610
|
className: "moveable-editable",
|
|
638
611
|
style: {
|
|
639
|
-
transform: `translate(${pos2[0] -
|
|
612
|
+
transform: `translate(${pos2[0] - 60}px, ${pos2[1] - 28}px) rotate(${rect.rotation}deg)`
|
|
640
613
|
}
|
|
641
614
|
},
|
|
642
615
|
[
|
|
@@ -649,27 +622,12 @@ const MoveableActionsAble = (handler) => ({
|
|
|
649
622
|
handler(AbleActionEventType.SELECT_PARENT);
|
|
650
623
|
}
|
|
651
624
|
},
|
|
652
|
-
React.createElement(
|
|
653
|
-
"
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
fill: "none",
|
|
659
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
660
|
-
style: {
|
|
661
|
-
transform: "rotate(90deg)",
|
|
662
|
-
position: "absolute",
|
|
663
|
-
left: 0,
|
|
664
|
-
top: 0
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
React.createElement("path", {
|
|
668
|
-
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",
|
|
669
|
-
fill: "currentColor",
|
|
670
|
-
fillOpacity: "0.9"
|
|
671
|
-
})
|
|
672
|
-
)
|
|
625
|
+
React.createElement("div", {
|
|
626
|
+
className: "moveable-select-parent-arrow-top-icon"
|
|
627
|
+
}),
|
|
628
|
+
React.createElement("div", {
|
|
629
|
+
className: "moveable-select-parent-arrow-body-icon"
|
|
630
|
+
})
|
|
673
631
|
),
|
|
674
632
|
React.createElement("button", {
|
|
675
633
|
className: "moveable-button moveable-remove-button",
|
|
@@ -677,7 +635,32 @@ const MoveableActionsAble = (handler) => ({
|
|
|
677
635
|
onClick: () => {
|
|
678
636
|
handler(AbleActionEventType.REMOVE);
|
|
679
637
|
}
|
|
680
|
-
})
|
|
638
|
+
}),
|
|
639
|
+
React.createElement(
|
|
640
|
+
"button",
|
|
641
|
+
{
|
|
642
|
+
className: "moveable-button moveable-drag-area-button",
|
|
643
|
+
title: "拖动"
|
|
644
|
+
},
|
|
645
|
+
React.createElement("div", {
|
|
646
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-top"
|
|
647
|
+
}),
|
|
648
|
+
React.createElement("div", {
|
|
649
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-bottom"
|
|
650
|
+
}),
|
|
651
|
+
React.createElement("div", {
|
|
652
|
+
className: "moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-left"
|
|
653
|
+
}),
|
|
654
|
+
React.createElement("div", {
|
|
655
|
+
className: " moveable-select-parent-arrow-top-icon moveable-select-parent-arrow-top-icon-right"
|
|
656
|
+
}),
|
|
657
|
+
React.createElement("div", {
|
|
658
|
+
className: "moveable-select-parent-arrow-body-icon-horizontal"
|
|
659
|
+
}),
|
|
660
|
+
React.createElement("div", {
|
|
661
|
+
className: "moveable-select-parent-arrow-body-icon-vertical"
|
|
662
|
+
})
|
|
663
|
+
)
|
|
681
664
|
]
|
|
682
665
|
);
|
|
683
666
|
}
|
|
@@ -813,6 +796,8 @@ class MoveableOptionsManager extends EventEmitter {
|
|
|
813
796
|
left: isAbsolute
|
|
814
797
|
},
|
|
815
798
|
isDisplayInnerSnapDigit: true,
|
|
799
|
+
dragTarget: ".moveable-drag-area-button",
|
|
800
|
+
dragTargetSelf: true,
|
|
816
801
|
props: {
|
|
817
802
|
actions: true
|
|
818
803
|
},
|