|
@@ -4,7 +4,7 @@ import { animation } from "@/core/hook/use-animation";
|
|
|
import saveAs from "@/utils/file-serve";
|
|
import saveAs from "@/utils/file-serve";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
|
import { Mode } from "@/constant/mode";
|
|
import { Mode } from "@/constant/mode";
|
|
|
-import { ui18n } from "@/lang";
|
|
|
|
|
|
|
+import { availableLocales, lang, langNameEum, ui18n } from "@/lang";
|
|
|
|
|
|
|
|
export type Action = {
|
|
export type Action = {
|
|
|
handler?: (draw: Draw) => void;
|
|
handler?: (draw: Draw) => void;
|
|
@@ -22,7 +22,7 @@ const rotateView = (draw: Draw) => {
|
|
|
animation({ rotation: 0 }, { rotation: Math.PI / 2 }, ({ rotation }) => {
|
|
animation({ rotation: 0 }, { rotation: Math.PI / 2 }, ({ rotation }) => {
|
|
|
draw.viewer.rotatePixel(
|
|
draw.viewer.rotatePixel(
|
|
|
{ x: dom.offsetWidth / 2, y: dom.offsetHeight / 2 },
|
|
{ x: dom.offsetWidth / 2, y: dom.offsetHeight / 2 },
|
|
|
- rotation - rotated
|
|
|
|
|
|
|
+ rotation - rotated,
|
|
|
);
|
|
);
|
|
|
rotated = rotation;
|
|
rotated = rotation;
|
|
|
});
|
|
});
|
|
@@ -39,22 +39,22 @@ export const getHeaderActions = (draw: Draw) => {
|
|
|
const floorCovers = computed(() =>
|
|
const floorCovers = computed(() =>
|
|
|
draw.store
|
|
draw.store
|
|
|
.getTypeItems("image")
|
|
.getTypeItems("image")
|
|
|
- .filter((item) => item.key === "kankan-floor-cover")
|
|
|
|
|
|
|
+ .filter((item) => item.key === "kankan-floor-cover"),
|
|
|
);
|
|
);
|
|
|
const floorCoversHide = computed(() =>
|
|
const floorCoversHide = computed(() =>
|
|
|
- floorCovers.value.some((image) => image.hide)
|
|
|
|
|
|
|
+ floorCovers.value.some((image) => image.hide),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
undo: reactive({
|
|
undo: reactive({
|
|
|
handler: () => draw.history.undo(),
|
|
handler: () => draw.history.undo(),
|
|
|
- text: ui18n.t('sys.actions.undo'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.undo"),
|
|
|
icon: "undo",
|
|
icon: "undo",
|
|
|
disabled: computed(() => !draw.history.hasUndo.value),
|
|
disabled: computed(() => !draw.history.hasUndo.value),
|
|
|
}),
|
|
}),
|
|
|
redo: reactive({
|
|
redo: reactive({
|
|
|
handler: () => draw.history.redo(),
|
|
handler: () => draw.history.redo(),
|
|
|
- text: ui18n.t('sys.actions.redo'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.redo"),
|
|
|
icon: "redo",
|
|
icon: "redo",
|
|
|
disabled: computed(() => !draw.history.hasRedo.value),
|
|
disabled: computed(() => !draw.history.hasRedo.value),
|
|
|
}),
|
|
}),
|
|
@@ -66,23 +66,23 @@ export const getHeaderActions = (draw: Draw) => {
|
|
|
draw.store.clear();
|
|
draw.store.clear();
|
|
|
},
|
|
},
|
|
|
disabled: computed(() => draw.drawing),
|
|
disabled: computed(() => draw.drawing),
|
|
|
- text: ui18n.t('sys.actions.clear'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.clear"),
|
|
|
icon: "clear",
|
|
icon: "clear",
|
|
|
}),
|
|
}),
|
|
|
rotateView: reactive({
|
|
rotateView: reactive({
|
|
|
handler: () => rotateView(draw),
|
|
handler: () => rotateView(draw),
|
|
|
- text: ui18n.t('sys.actions.rotate'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.rotate"),
|
|
|
icon: "rotate",
|
|
icon: "rotate",
|
|
|
}),
|
|
}),
|
|
|
initViewport: reactive({
|
|
initViewport: reactive({
|
|
|
handler: () => draw.initViewport(),
|
|
handler: () => draw.initViewport(),
|
|
|
- text: ui18n.t('sys.actions.a_adapt'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.a_adapt"),
|
|
|
icon: "a_adapt",
|
|
icon: "a_adapt",
|
|
|
}),
|
|
}),
|
|
|
toggleShow: reactive({
|
|
toggleShow: reactive({
|
|
|
handler: () => {
|
|
handler: () => {
|
|
|
draw.history.onceTrack(() => {
|
|
draw.history.onceTrack(() => {
|
|
|
- const val = !floorCoversHide.value
|
|
|
|
|
|
|
+ const val = !floorCoversHide.value;
|
|
|
floorCovers.value.forEach((image) => {
|
|
floorCovers.value.forEach((image) => {
|
|
|
draw.store.setItem("image", {
|
|
draw.store.setItem("image", {
|
|
|
value: { ...image, hide: val },
|
|
value: { ...image, hide: val },
|
|
@@ -91,14 +91,18 @@ export const getHeaderActions = (draw: Draw) => {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- text: computed(() => (floorCoversHide.value ? ui18n.t('sys.actions.floor.show') : ui18n.t('sys.actions.floor.hide'))),
|
|
|
|
|
|
|
+ text: computed(() =>
|
|
|
|
|
+ floorCoversHide.value
|
|
|
|
|
+ ? ui18n.t("sys.actions.floor.show")
|
|
|
|
|
+ : ui18n.t("sys.actions.floor.hide"),
|
|
|
|
|
+ ),
|
|
|
icon: computed(() => "visible___" + (floorCoversHide.value ? "n" : "s")),
|
|
icon: computed(() => "visible___" + (floorCoversHide.value ? "n" : "s")),
|
|
|
- disabled: computed(() => !floorCovers.value.length)
|
|
|
|
|
|
|
+ disabled: computed(() => !floorCovers.value.length),
|
|
|
}),
|
|
}),
|
|
|
expose: reactive({
|
|
expose: reactive({
|
|
|
disabled: computed(() => draw.drawing),
|
|
disabled: computed(() => draw.drawing),
|
|
|
handler: () => {},
|
|
handler: () => {},
|
|
|
- text: ui18n.t('sys.actions.download.name'),
|
|
|
|
|
|
|
+ text: ui18n.t("sys.actions.download.name"),
|
|
|
icon: "download",
|
|
icon: "download",
|
|
|
children: [
|
|
children: [
|
|
|
{
|
|
{
|
|
@@ -137,7 +141,7 @@ export const getHeaderActions = (draw: Draw) => {
|
|
|
pop();
|
|
pop();
|
|
|
draw.config.back = oldBack;
|
|
draw.config.back = oldBack;
|
|
|
draw.config.showGrid = oldShowGrid;
|
|
draw.config.showGrid = oldShowGrid;
|
|
|
- ElMessage.success(ui18n.t('sys.actions.download.success'));
|
|
|
|
|
|
|
+ ElMessage.success(ui18n.t("sys.actions.download.success"));
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
text: "PNG",
|
|
text: "PNG",
|
|
@@ -155,5 +159,16 @@ export const getHeaderActions = (draw: Draw) => {
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
}),
|
|
}),
|
|
|
|
|
+ lang: {
|
|
|
|
|
+ handler: () => {},
|
|
|
|
|
+ text: ui18n.t("sys.lang"),
|
|
|
|
|
+ icon: "nav-geography",
|
|
|
|
|
+ children: Object.keys(availableLocales).map((key) => ({
|
|
|
|
|
+ text: availableLocales[key as langNameEum],
|
|
|
|
|
+ handler: () => {
|
|
|
|
|
+ ui18n.change(key as langNameEum);
|
|
|
|
|
+ },
|
|
|
|
|
+ })),
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|