diff --git a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts index d0a3d56..cb82a3f 100644 --- a/src/drawApp/relayCabinetGraphics/RelayInteraction.ts +++ b/src/drawApp/relayCabinetGraphics/RelayInteraction.ts @@ -92,16 +92,16 @@ export class RelayState extends GraphicStateBase implements IRelayState { const setOpen: MenuItemOptions = { name: '驱动落下' }; const setClose: MenuItemOptions = { name: '驱动吸起' }; -export const RelayOperationMenu: ContextMenu = ContextMenu.init({ - name: 'Relay操作', - groups: [{ items: [setOpen, setClose] }], -}); - export class RelayOperationPlugin extends GraphicInteractionPlugin { static Name = 'relay_operate_menu'; + relayOperationMenu: ContextMenu = ContextMenu.init({ + name: 'Relay操作', + groups: [{ items: [setOpen, setClose] }], + }); + constructor(app: IGraphicScene) { super(RelayOperationPlugin.Name, app); - app.registerMenu(RelayOperationMenu); + app.registerMenu(this.relayOperationMenu); } static init(app: IGraphicScene) { return new RelayOperationPlugin(app); @@ -155,6 +155,6 @@ export class RelayOperationPlugin extends GraphicInteractionPlugin { setClose.handler = () => { changeRelayState(true); }; - RelayOperationMenu.open(e.global); + this.relayOperationMenu.open(e.global); } } diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index 71aff5c..5b83978 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -59,7 +59,6 @@ import { ApiError } from 'src/boot/axios'; import { layerList } from 'src/drawApp/lineScene'; import { IGraphicScene } from 'src/jl-graphic'; import { ISceneName, getSceneName } from 'src/drawApp/lineApp'; -import { RelayOperationMenu } from 'src/drawApp/relayCabinetGraphics/RelayInteraction'; const $q = useQuasar(); const canvasWidth = ref(0); @@ -192,7 +191,6 @@ function switchScene(val: MapInfo) { sceneName = getSceneNameFn(val); lineStore.setSceneName(sceneName); scene = lineApp.getScene(sceneName); - scene.registerMenu(RelayOperationMenu); const dom = document.getElementById('line-app-container'); if (dom) { scene.bindDom(dom);