|
@@ -1,23 +1,16 @@
|
|
<template>
|
|
<template>
|
|
- <div class="draw-layout">
|
|
|
|
- <div class="draw-slide">
|
|
|
|
- <div
|
|
|
|
- v-for="menu in menus"
|
|
|
|
- :key="menu.key"
|
|
|
|
- @click="uiType.change(menu.key)"
|
|
|
|
- :class="{ active: menu.key === uiType.current }"
|
|
|
|
- >
|
|
|
|
- {{ menu.text }}
|
|
|
|
|
|
+ <MainPanel :menus="menus" :active-menu-key="uiType.current">
|
|
|
|
+ <div class="draw-layout">
|
|
|
|
+ <div class="canvas-layout">+
|
|
|
|
+ <canvas ref="drawCanvasRef" class="draw-canvas" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="canvas-layout">+
|
|
|
|
- <canvas ref="drawCanvasRef" class="draw-canvas" />
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ </MainPanel>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { onMounted, ref } from "vue";
|
|
|
|
|
|
+import MainPanel from '@/components/main-panel/index.vue'
|
|
|
|
+import {computed, onMounted, ref} from "vue";
|
|
import { setCanvas, UIType, uiType } from "@/hook/useGraphic";
|
|
import { setCanvas, UIType, uiType } from "@/hook/useGraphic";
|
|
|
|
|
|
const drawCanvasRef = ref<HTMLCanvasElement>();
|
|
const drawCanvasRef = ref<HTMLCanvasElement>();
|
|
@@ -26,13 +19,23 @@ const setCanvasSize = () => {
|
|
drawCanvasRef.value.height = drawCanvasRef.value.offsetHeight;
|
|
drawCanvasRef.value.height = drawCanvasRef.value.offsetHeight;
|
|
};
|
|
};
|
|
|
|
|
|
-const menus = ref([
|
|
|
|
|
|
+const menusRaw = ref([
|
|
{ key: UIType.Road, text: "直路" },
|
|
{ key: UIType.Road, text: "直路" },
|
|
{ key: UIType.CurveRoad, text: "弯路" },
|
|
{ key: UIType.CurveRoad, text: "弯路" },
|
|
{ key: UIType.Tag, text: "标注" },
|
|
{ key: UIType.Tag, text: "标注" },
|
|
{ key: UIType.MeasureLine, text: "测量线" },
|
|
{ key: UIType.MeasureLine, text: "测量线" },
|
|
{ key: UIType.Img, text: "背景图片" },
|
|
{ key: UIType.Img, text: "背景图片" },
|
|
]);
|
|
]);
|
|
|
|
+const menus = computed(() =>
|
|
|
|
+ menusRaw.value.map((menu) => ({
|
|
|
|
+ title: menu.text,
|
|
|
|
+ name: menu.key,
|
|
|
|
+ isRoute: false,
|
|
|
|
+ icon: 'menu',
|
|
|
|
+ onClick: () => uiType.change(menu.key as any)
|
|
|
|
+ }))
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
setCanvasSize();
|
|
setCanvasSize();
|