How to capture mouse *dblclick* event in renderer?

I have a simple scene (including Orbitcontrols) where I capture mouse clicks or touches via
renderer.domElement.addEventListener('click', onMouseClick);
or
renderer.domElement.addEventListener('pointerdown', onMouseClick);
respectively.
However, there does not seem to be an equivalent for dblclick (onDblClick), no matter if used in combination with OrbitControls or not.
Is there a standard way how to detect dblclick in threejs ?

Thank you! (as you may have guessed, I am new to threejs …)

Hmm, dblclick seems to work for me. I just tried this snippet on one of my template repos and it seemed to work:

    window.addEventListener('dblclick', () => {
        console.log("clicked floor")
    })

Yep, you are right. It even works with
renderer.domElement.addEventListener('dblclick', onMouseDblClick);
Thanks to your comment (using global window as target element) I was able to find my coding error … :roll_eyes:

1 Like