From 24384700888e9c91f498663d663bc7d15428a206 Mon Sep 17 00:00:00 2001 From: Johannes Berthel Date: Tue, 6 Apr 2021 20:31:08 +0200 Subject: [PATCH] fixed rectangle resize issue --- front/src/Phaser/Login/SelectCompanionScene.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 34892a3c..9b5c38fb 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -122,10 +122,7 @@ export class SelectCompanionScene extends ResizableScene { this.selectedCompanion.anims.pause(); this.selectedCompanion = this.companions[index]; - this.selectedRectangle.setVisible(true); - this.selectedRectangle.setX(this.selectedCompanion.x); - this.selectedRectangle.setY(this.selectedCompanion.y); - this.selectedRectangle.setSize(32, 32); + this.redrawSelectedRectangle(); 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 { const index = this.companions.indexOf(this.selectedCompanion); const model = this.companionModels[index]; @@ -217,7 +221,7 @@ export class SelectCompanionScene extends ResizableScene { companion.y = y; } - this.selectCompanion(); + this.redrawSelectedRectangle(); } private getCompanionIndex(): number {