From 5ad860befed0ef83c47fdaf2495be4f55a57f6ae Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Tue, 5 Sep 2023 15:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E4=BF=A1=E6=81=AF=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/TrainInteraction.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drawApp/graphics/TrainInteraction.ts b/src/drawApp/graphics/TrainInteraction.ts index 6210271..1441f4b 100644 --- a/src/drawApp/graphics/TrainInteraction.ts +++ b/src/drawApp/graphics/TrainInteraction.ts @@ -5,7 +5,7 @@ import { state } from 'src/protos/device_state'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { - GraphicApp, + IGraphicApp, GraphicInteractionPlugin, JlGraphic, } from 'src/jl-graphic'; @@ -99,13 +99,13 @@ export class TrainState extends GraphicStateBase implements ITrainState { this.states.headDirection = v; } get dynamicState(): state.TrainDynamicState { - return this.states.dynamicState; + return this.states.dynamicState || new state.TrainDynamicState(); } set dynamicState(v: state.TrainDynamicState) { this.states.dynamicState = new state.TrainDynamicState(v); } get vobcState(): state.TrainVobcState { - return this.states.vobcState; + return this.states.vobcState || new state.TrainVobcState(); } set vobcState(v: state.TrainVobcState) { this.states.vobcState = new state.TrainVobcState(v); @@ -135,11 +135,11 @@ const TrainOperateMenu: ContextMenu = ContextMenu.init({ export class TrainOperateInteraction extends GraphicInteractionPlugin { static Name = 'train_operate_menu'; - constructor(app: GraphicApp) { + constructor(app: IGraphicApp) { super(TrainOperateInteraction.Name, app); app.registerMenu(TrainOperateMenu); } - static init(app: GraphicApp) { + static init(app: IGraphicApp) { return new TrainOperateInteraction(app); } filter(...grahpics: JlGraphic[]): Train[] | undefined {