From c9250c08f3381a57409665d8b7f2a6d8afe67151 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk <3636685+Palid@users.noreply.github.com> Date: Sun, 27 Dec 2020 10:47:56 +0100 Subject: [PATCH 1/2] Fix CustomizeScene killing CPU Fixes #518 --- front/src/Phaser/Login/CustomizeScene.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 9a8776a2..016afac4 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -148,7 +148,6 @@ export class CustomizeScene extends ResizableScene { this.selectedLayers[this.activeRow] = this.layers[this.activeRow].length - 1 } this.moveLayers(); - this.updateSelectedLayer(); this.saveInLocalStorage(); } From 640d994ddabef583821798991fcee5d0f838b707 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk <3636685+Palid@users.noreply.github.com> Date: Sun, 27 Dec 2020 11:00:23 +0100 Subject: [PATCH 2/2] Properly fix the CustomizeScene by limiting input When left/right arrow is being held on chrome the Phaser gets into infinite rendering loop that doesn't crash the browser but makes it slow to a crawl. --- front/src/Phaser/Login/CustomizeScene.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 016afac4..944b57f9 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -126,10 +126,10 @@ export class CustomizeScene extends ResizableScene { gameManager.tryResumingGame(this, EnableCameraSceneName); }); - this.input.keyboard.on('keydown-RIGHT', () => this.moveCursorHorizontally(1)); - this.input.keyboard.on('keydown-LEFT', () => this.moveCursorHorizontally(-1)); - this.input.keyboard.on('keydown-DOWN', () => this.moveCursorVertically(1)); - this.input.keyboard.on('keydown-UP', () => this.moveCursorVertically(-1)); + this.input.keyboard.on('keyup-RIGHT', () => this.moveCursorHorizontally(1)); + this.input.keyboard.on('keyup-LEFT', () => this.moveCursorHorizontally(-1)); + this.input.keyboard.on('keyup-DOWN', () => this.moveCursorVertically(1)); + this.input.keyboard.on('keyup-UP', () => this.moveCursorVertically(-1)); const customCursorPosition = localUserStore.getCustomCursorPosition(); if (customCursorPosition) { @@ -148,6 +148,7 @@ export class CustomizeScene extends ResizableScene { this.selectedLayers[this.activeRow] = this.layers[this.activeRow].length - 1 } this.moveLayers(); + this.updateSelectedLayer(); this.saveInLocalStorage(); }