fixed rectangle resize issue

This commit is contained in:
Johannes Berthel 2021-04-06 20:31:08 +02:00
parent fb90111cdf
commit 2438470088

View File

@ -122,10 +122,7 @@ export class SelectCompanionScene extends ResizableScene {
this.selectedCompanion.anims.pause(); this.selectedCompanion.anims.pause();
this.selectedCompanion = this.companions[index]; this.selectedCompanion = this.companions[index];
this.selectedRectangle.setVisible(true); this.redrawSelectedRectangle();
this.selectedRectangle.setX(this.selectedCompanion.x);
this.selectedRectangle.setY(this.selectedCompanion.y);
this.selectedRectangle.setSize(32, 32);
const model = this.companionModels[index]; const model = this.companionModels[index];
@ -134,6 +131,13 @@ export class SelectCompanionScene extends ResizableScene {
} }
} }
private redrawSelectedRectangle(): void {
this.selectedRectangle.setVisible(true);
this.selectedRectangle.setX(this.selectedCompanion.x);
this.selectedRectangle.setY(this.selectedCompanion.y);
this.selectedRectangle.setSize(32, 32);
}
private storeCompanionSelection(): string|null { private storeCompanionSelection(): string|null {
const index = this.companions.indexOf(this.selectedCompanion); const index = this.companions.indexOf(this.selectedCompanion);
const model = this.companionModels[index]; const model = this.companionModels[index];
@ -217,7 +221,7 @@ export class SelectCompanionScene extends ResizableScene {
companion.y = y; companion.y = y;
} }
this.selectCompanion(); this.redrawSelectedRectangle();
} }
private getCompanionIndex(): number { private getCompanionIndex(): number {