From 02ff6fb5bf4a9718715b093e28984cd79996eed3 Mon Sep 17 00:00:00 2001 From: GRL Date: Thu, 3 Jun 2021 17:08:56 +0200 Subject: [PATCH] Add timer so that pointerdown event can't be call two time in one click --- front/src/Phaser/Login/SelectCompanionScene.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 9caa88f7..8f641a3a 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -23,6 +23,7 @@ export class SelectCompanionScene extends ResizableScene { private saveZoom: number = 0; private currentCompanion = 0; + private pointerClicked: boolean = false; constructor() { super({ @@ -105,8 +106,13 @@ export class SelectCompanionScene extends ResizableScene { }); companion.setInteractive().on("pointerdown", () => { + if (this.pointerClicked) { + return; + } + this.pointerClicked = true; this.currentCompanion = i; this.moveCompanion(); + setTimeout(() => {this.pointerClicked = false;}, 250) }); this.companions.push(companion);