Squashed commit of the following:
All checks were successful
CI / Docker-Build (push) Successful in 1m49s

commit 9738678e54
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Thu May 9 17:23:28 2024 +0800

    打开列车驾驶台优化

commit 89012e6290
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Thu May 9 16:08:02 2024 +0800

    列车驾驶台方向按钮操作失败会回到之前的位置
This commit is contained in:
joylink_zhaoerwei 2024-05-09 17:34:33 +08:00
parent 9e8abf4624
commit 15702d4ac6
2 changed files with 9 additions and 6 deletions

View File

@ -288,8 +288,8 @@ watch(
); );
function tccHide() { function tccHide() {
lineApp.getScene(`tcc${tccStore.tccId}`).unbindDom();
tccStore.clearTccParam(); tccStore.clearTccParam();
lineApp.getScene('tcc').unbindDom();
} }
watch( watch(

View File

@ -25,8 +25,12 @@ export const useTccStore = defineStore('tcc', {
getTccScene() { getTccScene() {
const lineApp = getLineApp(); const lineApp = getLineApp();
if (!lineApp) throw Error('未初始化app'); if (!lineApp) throw Error('未初始化app');
lineApp.removeScene('tcc'); try {
return initTccScene(lineApp, 'tcc'); return lineApp.getScene(`tcc${this.tccId}`);
} catch (error) {
const tccScene = initTccScene(lineApp, `tcc${this.tccId}`);
return tccScene;
}
}, },
setTccParam(tccId: number, trainControlMapId: number) { setTccParam(tccId: number, trainControlMapId: number) {
this.tccId = tccId; this.tccId = tccId;
@ -34,14 +38,13 @@ export const useTccStore = defineStore('tcc', {
this.isTccDialogOpen = true; this.isTccDialogOpen = true;
}, },
clearTccParam() { clearTccParam() {
this.tccId = 0;
this.trainControlMapId = 0; this.trainControlMapId = 0;
this.isTccDialogOpen = false; this.isTccDialogOpen = false;
}, },
onMouseUpFromTccHandle() { onMouseUpFromTccHandle() {
const simulationId = useLineStore().simulationId; const simulationId = useLineStore().simulationId;
const tccHandle = (getLineApp() as IGraphicApp) const tccHandle = (getLineApp() as IGraphicApp)
.getScene('tcc') .getScene(`tcc${this.tccId}`)
.queryStore.queryById<TccHandle>(this.tccHandleId); .queryStore.queryById<TccHandle>(this.tccHandleId);
if (!simulationId) return; if (!simulationId) return;
const handleVal = Number( const handleVal = Number(
@ -61,7 +64,7 @@ export const useTccStore = defineStore('tcc', {
}, },
onMouseUpFromTccKeyDir() { onMouseUpFromTccKeyDir() {
const tccKeyDir = (getLineApp() as IGraphicApp) const tccKeyDir = (getLineApp() as IGraphicApp)
.getScene('tcc') .getScene(`tcc${this.tccId}`)
.queryStore.queryById<TccKey>(this.tccKeyDirId); .queryStore.queryById<TccKey>(this.tccKeyDirId);
let position = 0; let position = 0;
switch (tccKeyDir._tccKey.rotation) { switch (tccKeyDir._tccKey.rotation) {