Double Tap

I finally switched to Phaser 3. There were a lot of questions, but the most important of them: is there a built-in ability to get the value of a double click in an event?
Now I’m catching a double click like this:

if (differenceTimeStamp(pointer.event.timeStamp, tapTime) < gameOptions.doubleTapDelay) {
				console.log('double tap')
				tapType = 'double tap'
				tapTime = 0;
			} else {
				console.log('tap')
				tapType = 'tap'
			}
		}
		tapTime = pointer.event.timeStamp;

However, now the single tap is always catching. Any ideas?

Not sure if there is a built-in way of doing this, but I would implement it like this:

let lastTime = 0;
this.input.on("pointerdown", ()=>{
    let clickDelay = this.time.now - lastTime;
    lastTime = this.time.now;
    if(clickDelay < 350) {
        console.log("We're double clicked!");
    }
});

Thx, your option is also good! It is a pity that there is no built-in function, as in Phaser 2

I have some gesture plugins. Here is a tap plugin. (Demo)

Thanks for the reply! I look at him.

I know this is an old thread, but @rexrainbow I wanted to ask whether your plugin also works when there are multiple pointer enabled in a Scene. Thanks in advance!

I guess it can work on multiple touch case, to add multiple touch, use scene.input.addPointer(num).

Thanks for the reply @rexrainbow! I will give it a shot and post here how it goes.