车次窗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 {
const sectionId = this.datas.sectionId;
const section = this.queryStore.queryById<Section>(sectionId);
if (section) {
this.relationManage.addRelation(
this,
new GraphicRelationParam(section, section.datas.id)
);
if (sectionId) {
const section = this.queryStore.queryById<Section>(sectionId);
if (section) {
this.relationManage.addRelation(
this,
new GraphicRelationParam(section, section.datas.id)
);
}
}
}
getRelatedSections(): Section[] {

View File

@ -171,7 +171,6 @@ function buildAbsorbablePositions(
export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow> {
static Name = 'TrainWindow_transform';
static trainWindow: TrainWindow;
constructor(app: JlDrawApp) {
super(TrainWindowInteraction.Name, app);
}
@ -184,7 +183,6 @@ export class TrainWindowInteraction extends GraphicInteractionPlugin<TrainWindow
.map((g) => 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<TrainWindow
g.off('selected', this.onSelected, this);
}
onSelected(): void {
const trainWindow = this.app.selectedGraphics[0] as TrainWindow;
this.app.setOptions({
absorbablePositions: buildAbsorbablePositions(
TrainWindowInteraction.trainWindow
),
absorbablePositions: buildAbsorbablePositions(trainWindow),
});
}
}