Hello there,
It’s been a very long time !
TL;DR
I feel like disabling panning for multiTouch
event results in the wrong behaviour.
I can provide a PR if you agree with me.
Playground (use a mobile)
https://playground.babylonjs.com/#4U6TVQ#2
Description
I needed to disable panning on my ArcRotateCamera.
I found that there were three events to look at:
- Ctrl + click
- Right click
- Multi touch
Setting panningSensibility
to 0
disables panning for all events but I would like some granularity.
As stated in the docs, camera.attachControl(false, false, -1);
disables panning on ctrl + click and right click.
And this gives the same result as setting panningSensibility
to 0
, great!
Then, for multi touch event, I found two booleans associated with panning on ArcRotateCameraPointersInput
: multiTouchPanning
and multiTouchPanAndZoom
.
However, disabling them doesn’t give the expected result. UX is impacted, zooming becomes very hard on touch screen.
So I looked at the code and:
camera.inputs.attached.pointers.multiTouchPanAndZoom = false;
This instruction disables panning and zooming at the same time. Panning and zooming are still possible but only one at a time. There is a threshold to decide between panning and zooming.
camera.inputs.attached.pointers.multiTouchPanning = false;
Alone, disabling multiTouchPanning
has no effect because it’s a fallback when multiTouchPanAndZoom
is disabled.
camera.inputs.attached.pointers.multiTouchPanAndZoom = false;
camera.inputs.attached.pointers.multiTouchPanning = false;
These two instructions combined disable panning. Only zooming is enabled. But the threshold is still used to decide between zooming and doing nothing. And that’s why UX is impacted, it’s hard to zoom.
I think the right behaviour here should be same as setting panningSensibility
to 0
, it should not be hard to zoom. Do you agree?
I found a hack so threshold always says to zoom:
camera.pinchToPanMaxDistance = 0;
But I think it would be better to update the code to not use the threshold when panning is disabled. It shouldn’t be hard, I can provide a PR if you’re OK.