|
@@ -1,62 +1,110 @@
|
|
|
import { useEditor } from "@/modules/editor";
|
|
|
+import { DesignComp } from "@/modules/editor/objects/DesignTemp/DesignComp";
|
|
|
+import {
|
|
|
+ TopToolbarsLeft,
|
|
|
+ TopToolbarsRight,
|
|
|
+} from "@/modules/editor/objects/Toolbars/topToolbars";
|
|
|
import { useLauncher } from "@/modules/launcher";
|
|
|
-import { css } from "@linaria/core";
|
|
|
+import { css, cx } from "@linaria/core";
|
|
|
+import { IconPlus, IconReduce } from "@queenjs/icons";
|
|
|
+import { InputNumber } from "ant-design-vue";
|
|
|
import { defineUI } from "queenjs";
|
|
|
import { TipIcons } from "../../TipIcons";
|
|
|
|
|
|
-import { TopToolbarsLeft, TopToolbarsRight } from "@/modules/editor/objects/Toolbars/topToolbars";
|
|
|
-import { DesignComp } from "@/modules/editor/objects/DesignTemp/DesignComp";
|
|
|
-
|
|
|
export default defineUI({
|
|
|
setup() {
|
|
|
const editor = useEditor();
|
|
|
- const { store, actions, helper } = editor;
|
|
|
+ const { controls, store, actions, helper } = editor;
|
|
|
+ const { editorCtrl } = controls;
|
|
|
const launcher = useLauncher();
|
|
|
-
|
|
|
+
|
|
|
return () => {
|
|
|
- const comp = helper.findComp(store.selected[0])
|
|
|
- const toolsLeft = comp ? TopToolbarsLeft.filter(t => t.getVisible.call(editor, comp)) : [];
|
|
|
- const toolsRight = comp ? TopToolbarsRight.filter(t => t.getVisible.call(editor, comp)) : [];
|
|
|
+ const comp = helper.findComp(store.selected[0]);
|
|
|
+ const toolsLeft = comp
|
|
|
+ ? TopToolbarsLeft.filter((t) => t.getVisible.call(editor, comp))
|
|
|
+ : [];
|
|
|
+ const toolsRight = comp
|
|
|
+ ? TopToolbarsRight.filter((t) => t.getVisible.call(editor, comp))
|
|
|
+ : [];
|
|
|
+
|
|
|
+ const scale = editorCtrl.state.scale;
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
- {
|
|
|
- false && <div id="toptoolbar" class={"p-10px h-50px flex items-center justify-between"}>
|
|
|
+ {false && (
|
|
|
+ <div
|
|
|
+ id="toptoolbar"
|
|
|
+ class={"p-10px h-50px flex items-center justify-between"}
|
|
|
+ >
|
|
|
<div class="flex-grow flex items-center">
|
|
|
- {
|
|
|
- toolsLeft.map((item) => {
|
|
|
+ {toolsLeft.map((item) => {
|
|
|
return (
|
|
|
<item.component
|
|
|
class="p-4px"
|
|
|
value={item.getValue?.(comp as DesignComp)}
|
|
|
- onClick={() => item.onClick.call(editor, comp as DesignComp)}
|
|
|
+ onClick={() =>
|
|
|
+ item.onClick.call(editor, comp as DesignComp)
|
|
|
+ }
|
|
|
/>
|
|
|
);
|
|
|
- })
|
|
|
- }
|
|
|
+ })}
|
|
|
</div>
|
|
|
<div class="flex items-center">
|
|
|
- {
|
|
|
- toolsRight.map((item) => {
|
|
|
- return (
|
|
|
- <item.component
|
|
|
- class="p-4px"
|
|
|
- value={item.getValue?.(comp as DesignComp)}
|
|
|
- onClick={() => item.onClick.call(editor, comp as DesignComp)}
|
|
|
- />
|
|
|
- );
|
|
|
- })
|
|
|
- }
|
|
|
+ {toolsRight.map((item) => {
|
|
|
+ return (
|
|
|
+ <item.component
|
|
|
+ class="p-4px"
|
|
|
+ value={item.getValue?.(comp as DesignComp)}
|
|
|
+ onClick={() =>
|
|
|
+ item.onClick.call(editor, comp as DesignComp)
|
|
|
+ }
|
|
|
+ />
|
|
|
+ );
|
|
|
+ })}
|
|
|
</div>
|
|
|
</div>
|
|
|
- }
|
|
|
- <div class="absolute right-25px top-80px space-x-10px z-1000">
|
|
|
+ )}
|
|
|
+ <div class="absolute right-20px top-40px space-x-10px z-1000">
|
|
|
<TipIcons.Screenshot
|
|
|
class={bottomBtnStyles}
|
|
|
onClick={() => actions.updateThumbnailByScreenshot(true)}
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="absolute bottom-20px right-20px z-1000">
|
|
|
+ <div class="absolute bottom-30px right-20px flex items-center justify-center z-1000 space-x-10px">
|
|
|
+ <div
|
|
|
+ class={cx(group, "flex items-center p-4px rounded bg-[#262626]")}
|
|
|
+ >
|
|
|
+ <IconReduce
|
|
|
+ class="ml-5px text-light-50 text-30px cursor-pointer transition hover:bg-dark-800"
|
|
|
+ onClick={() => editorCtrl.setScale(scale - 0.1)}
|
|
|
+ />
|
|
|
+ <IconPlus
|
|
|
+ class="text-light-50 text-30px cursor-pointer transition hover:bg-dark-800"
|
|
|
+ onClick={() => editorCtrl.setScale(scale + 0.1)}
|
|
|
+ />
|
|
|
+ <InputNumber
|
|
|
+ min={0.5}
|
|
|
+ max={2}
|
|
|
+ bordered={false}
|
|
|
+ controls={false}
|
|
|
+ value={scale}
|
|
|
+ class="!w-60px !ml-10px text-center !bg-[#303030] rounded"
|
|
|
+ formatter={(v: any) => Math.floor(v * 100) + "%"}
|
|
|
+ onPressEnter={(e: any) => {
|
|
|
+ const newScale = e.target.value.split("%")[0] / 100;
|
|
|
+ editorCtrl.setScale(newScale);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <TipIcons.Move
|
|
|
+ class={cx(
|
|
|
+ "p-10px rounded text-18px cursor-pointer transition hover:opacity-70",
|
|
|
+ editorCtrl.state.moveMode
|
|
|
+ ? "!text-orange bg-[#382916] !hover:(bg-[#382916])"
|
|
|
+ : "!text-light-50 bg-[#262626] !hover:(bg-[#262626])"
|
|
|
+ )}
|
|
|
+ onClick={() => editorCtrl.moveEditor()}
|
|
|
+ />
|
|
|
<TipIcons.QueenService
|
|
|
class={bottomBtnStyles}
|
|
|
onClick={() => {
|
|
@@ -68,7 +116,7 @@ export default defineUI({
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
});
|
|
|
|
|
@@ -78,3 +126,18 @@ const bottomBtnStyles = css`
|
|
|
background-color: #333;
|
|
|
@apply shadow;
|
|
|
`;
|
|
|
+
|
|
|
+const group = css`
|
|
|
+ .inficon {
|
|
|
+ transition: all 0.2s ease-in;
|
|
|
+ margin-right: -37px;
|
|
|
+ }
|
|
|
+ .ant-input-number-input {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ &:hover {
|
|
|
+ .inficon {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+`;
|