psl按钮接口重复调用调整

This commit is contained in:
fan 2023-10-20 16:04:27 +08:00
parent 62544cdafb
commit 3bf6e09acb

View File

@ -1,6 +1,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { initPslScene } from 'src/drawApp/pslScene'; import { initPslScene } from 'src/drawApp/pslScene';
import { getLineApp } from 'src/drawApp/lineApp'; import { getLineApp } from 'src/drawApp/lineApp';
import { GraphicApp } from 'src/jl-graphic/app/JlGraphicApp';
export const usePslStore = defineStore('psl', { export const usePslStore = defineStore('psl', {
state: () => ({ state: () => ({
@ -10,10 +11,12 @@ export const usePslStore = defineStore('psl', {
}), }),
actions: { actions: {
getPslScene() { getPslScene() {
const lineApp = getLineApp(); const lineApp = getLineApp() as GraphicApp;
if (!lineApp) return; if (!lineApp) return;
const pslScene = initPslScene(lineApp, 'psl'); if (lineApp.scenes.get('psl')) {
return pslScene; return lineApp.getScene('psl');
}
return initPslScene(lineApp, 'psl');
}, },
setPslParam(gatedBoxId: string, pslMapCode: string) { setPslParam(gatedBoxId: string, pslMapCode: string) {
this.gatedBoxId = gatedBoxId; this.gatedBoxId = gatedBoxId;