车次窗bug修复

This commit is contained in:
joylink_zhaoerwei 2023-06-19 14:42:31 +08:00
parent 8b46178f57
commit 932409e700
2 changed files with 10 additions and 11 deletions

View File

@ -59,12 +59,14 @@ export class TrainWindow extends JlGraphic {
} }
loadRealtions(): void { loadRealtions(): void {
const sectionId = this.datas.sectionId; const sectionId = this.datas.sectionId;
const section = this.queryStore.queryById<Section>(sectionId); if (sectionId) {
if (section) { const section = this.queryStore.queryById<Section>(sectionId);
this.relationManage.addRelation( if (section) {
this, this.relationManage.addRelation(
new GraphicRelationParam(section, section.datas.id) this,
); new GraphicRelationParam(section, section.datas.id)
);
}
} }
} }
getRelatedSections(): Section[] { getRelatedSections(): Section[] {

View File

@ -171,7 +171,6 @@ function buildAbsorbablePositions(
export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow> { export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow> {
static Name = 'TrainWindow_transform'; static Name = 'TrainWindow_transform';
static trainWindow: TrainWindow;
constructor(app: JlDrawApp) { constructor(app: JlDrawApp) {
super(TrainWindowInteraction.Name, app); super(TrainWindowInteraction.Name, app);
} }
@ -184,7 +183,6 @@ export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow
.map((g) => g as TrainWindow); .map((g) => g as TrainWindow);
} }
bind(g: TrainWindow): void { bind(g: TrainWindow): void {
TrainWindowInteraction.trainWindow = g;
g.eventMode = 'static'; g.eventMode = 'static';
g.cursor = 'pointer'; g.cursor = 'pointer';
g.scalable = true; g.scalable = true;
@ -199,10 +197,9 @@ export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow
g.off('selected', this.onSelected, this); g.off('selected', this.onSelected, this);
} }
onSelected(): void { onSelected(): void {
const trainWindow = this.app.selectedGraphics[0] as TrainWindow;
this.app.setOptions({ this.app.setOptions({
absorbablePositions: buildAbsorbablePositions( absorbablePositions: buildAbsorbablePositions(trainWindow),
TrainWindowInteraction.trainWindow
),
}); });
} }
} }