Add timer so that pointerdown event can't be call two time in one click

This commit is contained in:
GRL 2021-06-03 17:08:56 +02:00
parent c435b7451e
commit 02ff6fb5bf

View File

@ -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);