diff --git a/src/graphics/trainWindow/TrainWindow.ts b/src/graphics/trainWindow/TrainWindow.ts index b7dd4c6..d149566 100644 --- a/src/graphics/trainWindow/TrainWindow.ts +++ b/src/graphics/trainWindow/TrainWindow.ts @@ -59,12 +59,14 @@ export class TrainWindow extends JlGraphic { } loadRealtions(): void { const sectionId = this.datas.sectionId; - const section = this.queryStore.queryById
(sectionId); - if (section) { - this.relationManage.addRelation( - this, - new GraphicRelationParam(section, section.datas.id) - ); + if (sectionId) { + const section = this.queryStore.queryById
(sectionId); + if (section) { + this.relationManage.addRelation( + this, + new GraphicRelationParam(section, section.datas.id) + ); + } } } getRelatedSections(): Section[] { diff --git a/src/graphics/trainWindow/TrainWindowDrawAssistant.ts b/src/graphics/trainWindow/TrainWindowDrawAssistant.ts index c11c593..7ef5740 100644 --- a/src/graphics/trainWindow/TrainWindowDrawAssistant.ts +++ b/src/graphics/trainWindow/TrainWindowDrawAssistant.ts @@ -171,7 +171,6 @@ function buildAbsorbablePositions( export class TrainWindowInteraction extends GraphicInteractionPlugin { static Name = 'TrainWindow_transform'; - static trainWindow: TrainWindow; constructor(app: JlDrawApp) { super(TrainWindowInteraction.Name, app); } @@ -184,7 +183,6 @@ export class TrainWindowInteraction extends GraphicInteractionPlugin g as TrainWindow); } bind(g: TrainWindow): void { - TrainWindowInteraction.trainWindow = g; g.eventMode = 'static'; g.cursor = 'pointer'; g.scalable = true; @@ -199,10 +197,9 @@ export class TrainWindowInteraction extends GraphicInteractionPlugin