OrbitControls: Handle double touch gesture on mobile device



I’m using OrbitControls to control touch events in an app that uses three js on a mobile device.
OrbitControls maps some touch events such as: single touch -> rotate, muti touch and move -> pan, and pinch -> zoom
Similarly, I want to map the “double touch” gesture to another action (toggle between maximizing and restoring a window pane)

I found some packages that handle double touch such as: here

I’m curious if adding external package is the way to go, since there is some logic involved, e.g. to differentiate double touch from two separate touches

I have not found examples in threejs that make use of double touch.
How should I go about handling this?
Can someone point to an example of threejs with double touch?



I don’t think I would use a separate library for this. If you just need a double-tap gesture, I would recommend to enhance OrbitControls with a double-tap detection routine. If you google this topic, you will find many code snippets for this. The idea behind such a routine is well explained at MDN: Using Touch Events

An application may consider different factors when defining the semantics of a gesture. For instance, the distance a touch point traveled from its starting location to its location when the touch ended. Another potential factor is time; for example, the time elapsed between the touch’s start and the touch’s end, or the time lapse between two simultaneous taps intended to create a double-tap gesture.