范围配置app销毁

This commit is contained in:
Yuan 2023-08-25 18:18:17 +08:00
parent 6f2c573411
commit 0ab592a01d
3 changed files with 13 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import { Platform, PlatformTemplate } from 'src/graphics/platform/Platform';
import { SectionTemplate } from 'src/graphics/section/Section';
import { Signal, SignalTemplate } from 'src/graphics/signal/Signal';
import { Station, StationTemplate } from 'src/graphics/station/Station';
import { Train, TrainTemplate } from 'src/graphics/train/Train';
import { Turnout, TurnoutTemplate } from 'src/graphics/turnout/Turnout';
import { GraphicApp, GraphicData } from 'src/jl-graphic';
import {
@ -15,8 +14,6 @@ import {
} from './graphics/LogicSectionInteraction';
import { SeparatorTemplate } from 'src/graphics/separator/Separator';
import { AxleCountingTemplate } from 'src/graphics/axleCounting/AxleCounting';
import { TrainWindowTemplate } from 'src/graphics/trainWindow/TrainWindow';
import { TrainData, TrainState } from './graphics/TrainInteraction';
import { SignalData, SignalState } from './graphics/SignalInteraction';
import { PlatformData, PlatformState } from './graphics/PlatformInteraction';
import { StationData, StationState } from './graphics/StationInteraction';
@ -24,7 +21,6 @@ import { TurnoutData, TurnoutStates } from './graphics/TurnoutInteraction';
import { SectionData } from './graphics/SectionInteraction';
import { SeparatorData } from './graphics/SeparatorInteraction';
import { AxleCountingData } from './graphics/AxleCountingInteraction';
import { TrainWindowData } from './graphics/TrainWindowInteraction';
import { getPublishMapInfoByLineId } from 'src/api/PublishApi';
import { useRangeConfigStore } from 'src/stores/range-config-store';
import { graphicData } from 'src/protos/stationLayoutGraphics';
@ -49,7 +45,6 @@ export function initRangeConfigApp(dom: HTMLElement) {
new LogicSectionTemplate(new LogicSectionData(), new LogicSectionState()),
new SeparatorTemplate(new SeparatorData()),
new AxleCountingTemplate(new AxleCountingData()),
new TrainWindowTemplate(new TrainWindowData()),
];
rangeConfigApp.registerGraphicTemplates(...graphicTemplate);
rangeConfigApp.setOptions({
@ -64,7 +59,6 @@ export function initRangeConfigApp(dom: HTMLElement) {
Signal.Type,
Platform.Type,
Station.Type,
Train.Type,
LogicSection.Type,
Turnout.Type,
],
@ -137,3 +131,8 @@ export async function loadLineDatas(app: GraphicApp) {
});
}
}
export function destroyRangeConfigApp(): void {
if (rangeConfigApp) {
rangeConfigApp.destroy();
}
}

View File

@ -112,7 +112,6 @@ enum statusTextColor {
const deviceTypeString = new Map();
deviceTypeString.set(state.DeviceType.TRACK, LogicSection.Type);
deviceTypeString.set(state.DeviceType.SWITCH_TRACK, Section.Type);
console.log(1);
export const trainConsts = {
codeWidth: 120,

View File

@ -1,5 +1,8 @@
import { defineStore } from 'pinia';
import { initRangeConfigApp } from 'src/drawApp/rangeConfigApp';
import {
destroyRangeConfigApp,
initRangeConfigApp,
} from 'src/drawApp/rangeConfigApp';
import { JlGraphic } from 'src/jl-graphic';
export const useRangeConfigStore = defineStore('rangeConfig', {
@ -23,5 +26,9 @@ export const useRangeConfigStore = defineStore('rangeConfig', {
setLineName(name: string) {
this.lineName = name;
},
destory() {
this.selectedGraphics = [];
destroyRangeConfigApp();
},
},
});