comment on pointerTimer and pointerClicked
This commit is contained in:
parent
0d2b190222
commit
edfdc3bf47
@ -144,6 +144,9 @@ export class SelectCharacterScene extends AbstractCharacterScene {
|
|||||||
if (this.currentSelectUser === i) {
|
if (this.currentSelectUser === i) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//To not trigger two time the pointerdown events :
|
||||||
|
// We set a boolean to true so that pointerdown events does nothing when the boolean is true
|
||||||
|
// We set a timer that we decrease in update function to not trigger the pointerdown events twice
|
||||||
this.pointerClicked = true;
|
this.pointerClicked = true;
|
||||||
this.pointerTimer = 250;
|
this.pointerTimer = 250;
|
||||||
this.currentSelectUser = i;
|
this.currentSelectUser = i;
|
||||||
@ -247,6 +250,8 @@ export class SelectCharacterScene extends AbstractCharacterScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(time: number, delta: number): void {
|
update(time: number, delta: number): void {
|
||||||
|
// pointerTimer is set to 250 when pointerdown events is trigger
|
||||||
|
// After 250ms, pointerClicked is set to false and the pointerdown events can be trigger again
|
||||||
this.pointerTimer -= delta;
|
this.pointerTimer -= delta;
|
||||||
if (this.pointerTimer <= 0) {
|
if (this.pointerTimer <= 0) {
|
||||||
this.pointerClicked = false;
|
this.pointerClicked = false;
|
||||||
|
@ -74,6 +74,8 @@ export class SelectCompanionScene extends ResizableScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(time: number, delta: number): void {
|
update(time: number, delta: number): void {
|
||||||
|
// pointerTimer is set to 250 when pointerdown events is trigger
|
||||||
|
// After 250ms, pointerClicked is set to false and the pointerdown events can be trigger again
|
||||||
this.pointerTimer -= delta;
|
this.pointerTimer -= delta;
|
||||||
if (this.pointerTimer <= 0) {
|
if (this.pointerTimer <= 0) {
|
||||||
this.pointerClicked = false;
|
this.pointerClicked = false;
|
||||||
@ -113,6 +115,9 @@ export class SelectCompanionScene extends ResizableScene {
|
|||||||
if (this.pointerClicked) {
|
if (this.pointerClicked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//To not trigger two time the pointerdown events :
|
||||||
|
// We set a boolean to true so that pointerdown events does nothing when the boolean is true
|
||||||
|
// We set a timer that we decrease in update function to not trigger the pointerdown events twice
|
||||||
this.pointerClicked = true;
|
this.pointerClicked = true;
|
||||||
this.pointerTimer = 250;
|
this.pointerTimer = 250;
|
||||||
this.currentCompanion = i;
|
this.currentCompanion = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user