ArcballControl problems on mobile

I am trying to replace a TrackBallControl for an ArcballControl. On a desktop, everything worked beautifully, but when I run on iPhone, only the rotation works. The model vanishes as soon as a Pan or Zoom is started. However, the official example from three.js works just fine.

The only difference I can see is that I am not using the lil-gui. Does it make any initialization for gestures, like pinch? Another problem is that copy and pasting the control state produces

Uncaught TypeError: navigator.clipboard is undefined

DOMException: Clipboard write was blocked due to lack of user activation.

Again, in the official example this feature also works.

Any help is welcome.

Thanks.

The code with ArcballControls is here

with TrackballControls is here

and with OrbitControls is here

Cerberus with gui is here

Cerberus without gui is here

ctrl+c and ctrl+v only work when using the https protocol.

I am drawing some helpers when the key “s” is pressed or the stats check button is checked. Everything seems to be OK, but ArcBallControls zoom and pan do not work on mobile devices.

I think the problem is the view frustum (near, far). I am using controls.adjustNearFar = true,
but it seems not to be working for mobile devices.

Found the bug. The problem is when the camera position is set after the ArcballControls is created. In the official example, one just need to move camera.position.set() after arcballGui.setArcballControls(). The fix is easy, because it is just a question of calling controls.setCamera(camera) again.

arcballGui.setArcballControls();
camera.position.set(0, 0, perspectiveDistance); <---- moved here
controls.setCamera(camera); <----- fix

Nonetheless, this caused the problem with mobile devices, because
nearPos0 becomes less than zero, in ArcballControls.js:

this._nearPos0 = camera.position.distanceTo( this.target ) - camera.near;

I do not think Ricardo will see this post, but maybe it helps someone else in the future…