|
@@ -1,14 +1,13 @@
|
|
|
+import { IconRotate } from "@/assets/icons";
|
|
|
import { CompToolbars } from "@/modules/editor/objects/Toolbars";
|
|
|
import { css } from "@linaria/core";
|
|
|
import { defineComponent, onMounted, onUnmounted } from "vue";
|
|
|
import { useEditor } from "../../../..";
|
|
|
-import { IconMove, IconRotate } from "@/assets/icons";
|
|
|
-import { parseTransform } from "@/modules/editor/objects/DesignTemp/creates/createCompStyle";
|
|
|
|
|
|
export const Transfer = defineComponent({
|
|
|
setup() {
|
|
|
const editor = useEditor();
|
|
|
- const { store, controls, helper } = editor;
|
|
|
+ const { controls, helper } = editor;
|
|
|
const { transferCtrl } = controls;
|
|
|
const { transferStyle } = transferCtrl;
|
|
|
|
|
@@ -23,7 +22,7 @@ export const Transfer = defineComponent({
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
transferCtrl.destroy();
|
|
|
- console.log("transferCtrl.destroy========================")
|
|
|
+ // console.log("transferCtrl.destroy========================");
|
|
|
});
|
|
|
|
|
|
return () => {
|
|
@@ -34,74 +33,84 @@ export const Transfer = defineComponent({
|
|
|
// const showTransfer =
|
|
|
// store.isEditComp || store.pageCompIds.includes(comp.id);
|
|
|
const showTransfer = true;
|
|
|
- const styleTransform = parseTransform(transferStyle.transform);
|
|
|
|
|
|
return (
|
|
|
transferStyle.width && (
|
|
|
<div
|
|
|
- class="transfer absolute"
|
|
|
+ class="absolute transfer"
|
|
|
style={{
|
|
|
top: transferStyle.top,
|
|
|
left: transferStyle.left,
|
|
|
width: transferStyle.width,
|
|
|
- transform: styleTransform,
|
|
|
- transformOrigin: "left",
|
|
|
+ transform: `translateX(${transferStyle.transform.translateX}) translateY(${transferStyle.transform.translateY})`,
|
|
|
}}
|
|
|
>
|
|
|
+ {showTransfer && (
|
|
|
+ <div class={toolbarStyle}>
|
|
|
+ {toolbarOpts.map((item) => {
|
|
|
+ return item.getVisible.call(editor, comp) ? (
|
|
|
+ <item.component
|
|
|
+ class="p-4px"
|
|
|
+ value={item.getValue?.(comp)}
|
|
|
+ onClick={() => item.onClick.call(editor, comp)}
|
|
|
+ />
|
|
|
+ ) : null;
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
<div
|
|
|
- class={borderStyle}
|
|
|
style={{
|
|
|
- width: transferStyle.width,
|
|
|
- height: transferStyle.height,
|
|
|
+ transform: `rotate(${transferStyle.transform.rotate})`,
|
|
|
+ transformOrigin: `center ${
|
|
|
+ parseInt(transferStyle.height.split("px")[0]) / 2
|
|
|
+ }px`,
|
|
|
}}
|
|
|
- />
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class={borderStyle}
|
|
|
+ style={{
|
|
|
+ width: transferStyle.width,
|
|
|
+ height: transferStyle.height,
|
|
|
+ }}
|
|
|
+ />
|
|
|
+
|
|
|
+ {showTransfer && (
|
|
|
+ <>
|
|
|
+ <div
|
|
|
+ class={resizeStyle}
|
|
|
+ style={{ marginBottom: "-" + transferStyle.height }}
|
|
|
+ onMousedown={(e) =>
|
|
|
+ transferCtrl.mousedown(
|
|
|
+ e,
|
|
|
+ comp.compKey === "Image" ? "resizeXY" : "scale"
|
|
|
+ )
|
|
|
+ }
|
|
|
+ />
|
|
|
|
|
|
- {showTransfer && (
|
|
|
- <>
|
|
|
- <div
|
|
|
- class={resizeStyle}
|
|
|
- style={{ marginBottom: "-" + transferStyle.height }}
|
|
|
- onMousedown={(e) =>
|
|
|
- transferCtrl.mousedown(
|
|
|
- e,
|
|
|
- comp.compKey === "Image" ? "resizeXY" : "scale"
|
|
|
- )
|
|
|
- }
|
|
|
- />
|
|
|
- <div class={toolbarStyle}>
|
|
|
- {toolbarOpts.map((item) => {
|
|
|
- return item.getVisible.call(editor, comp) ? (
|
|
|
- <item.component
|
|
|
- class="p-4px"
|
|
|
- value={item.getValue?.(comp)}
|
|
|
- onClick={() => item.onClick.call(editor, comp)}
|
|
|
- />
|
|
|
- ) : null;
|
|
|
- })}
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class={transformBtnsStyle}
|
|
|
- style={{ marginBottom: "-" + transferStyle.height }}
|
|
|
- >
|
|
|
<div
|
|
|
- class={transBtnStyle}
|
|
|
- onMousedown={(e) => transferCtrl.mousedown(e, "rotate")}
|
|
|
+ class={transformBtnsStyle}
|
|
|
+ style={{ marginBottom: "-" + transferStyle.height }}
|
|
|
>
|
|
|
- <IconRotate />
|
|
|
+ <div
|
|
|
+ class={transBtnStyle}
|
|
|
+ onMousedown={(e) => transferCtrl.mousedown(e, "rotate")}
|
|
|
+ >
|
|
|
+ <IconRotate />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class={resizeHeightBtnCls}
|
|
|
- style={{ top: transferStyle.height }}
|
|
|
- onMousedown={(e) => transferCtrl.mousedown(e, "resizeY")}
|
|
|
- />
|
|
|
- <div
|
|
|
- class={resizeWidthBtnCls}
|
|
|
- style={{ top: parseInt(transferStyle.height) / 2 + "px" }}
|
|
|
- onMousedown={(e) => transferCtrl.mousedown(e, "resizeX")}
|
|
|
- />
|
|
|
- </>
|
|
|
- )}
|
|
|
+ <div
|
|
|
+ class={resizeHeightBtnCls}
|
|
|
+ style={{ top: transferStyle.height }}
|
|
|
+ onMousedown={(e) => transferCtrl.mousedown(e, "resizeY")}
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ class={resizeWidthBtnCls}
|
|
|
+ style={{ top: parseInt(transferStyle.height) / 2 + "px" }}
|
|
|
+ onMousedown={(e) => transferCtrl.mousedown(e, "resizeX")}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
)
|
|
|
);
|
|
@@ -170,7 +179,7 @@ const toolbarStyle = css`
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 50%;
|
|
|
- transform: translate(-50%, -40px);
|
|
|
+ transform: translate(-50%, -60px);
|
|
|
z-index: 999;
|
|
|
`;
|
|
|
|