Add timer so that pointerdown event can't be call two time in one click
This commit is contained in:
parent
c435b7451e
commit
02ff6fb5bf
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user