From 66ca2e96873b3871df7b6eb55d98a6ba53555c9e Mon Sep 17 00:00:00 2001 From: fan Date: Fri, 21 Jul 2023 16:03:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E4=BB=A3=E7=A0=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=90=8E=E8=8F=9C=E5=8D=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/index.ts | 37 +++++++++++++++++++++++++------------ src/drawApp/lineApp.ts | 15 +++++++++------ src/layouts/LineLayout.vue | 4 ++-- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/drawApp/index.ts b/src/drawApp/index.ts index a1e81b7..3eb576b 100644 --- a/src/drawApp/index.ts +++ b/src/drawApp/index.ts @@ -127,20 +127,33 @@ const axleCountingSectionOptions: MenuItemOptions = { const LogicSectionOptions: MenuItemOptions = { name: '图层-逻辑区段', }; - +// [ +// { +// name: '图层菜单', +// items: [ +// AllOptions, +// linkOptions, +// axleCountingSectionOptions, +// LogicSectionOptions, +// ], +// }, +// ] const layerOptions: MenuItemOptions = { name: '图层', - subMenu: [ - { - name: '图层菜单', - items: [ - AllOptions, - linkOptions, - axleCountingSectionOptions, - LogicSectionOptions, - ], - }, - ], + subMenu: { + name: '图层菜单', + groups: [ + { + name: '图层菜单', + items: [ + AllOptions, + linkOptions, + axleCountingSectionOptions, + LogicSectionOptions, + ], + }, + ], + }, }; export const DefaultCanvasMenu = new ContextMenu({ diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index 6130fc4..838b05e 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -93,12 +93,15 @@ const linkOptions: MenuItemOptions = { const layerOptions: MenuItemOptions = { name: '图层', - subMenu: [ - { - name: '图层菜单', - items: [PhysicsOptions, linkOptions], - }, - ], + subMenu: { + name: '图层菜单', + groups: [ + { + name: '图层菜单', + items: [PhysicsOptions, linkOptions], + }, + ], + }, }; const DefaultCanvasMenu = new ContextMenu({ name: '图层选择', diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index 8d70767..ab606d0 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -28,7 +28,7 @@ import { onMounted, ref, computed, onUnmounted, watch } from 'vue'; import { useLineStore } from 'src/stores/line-store'; import { useRoute, useRouter } from 'vue-router'; -import { loadLineDatas, getLineApp, destroyLineApp } from 'src/drawApp/lineApp'; +import { loadLineDatas, getLineApp } from 'src/drawApp/lineApp'; import { destroySimulation } from 'src/api/Simulation'; import TrainPage from 'src/pages/TrainPage.vue'; import { Train } from 'src/graphics/train/Train'; @@ -86,7 +86,7 @@ onMounted(() => { onUnmounted(() => { if (simulationId) { lineStore.setSimulationId(null); - destroyLineApp(); + lineStore.destroy(); destroySimulation({ simulationId }); } });