It’s been a very long time !
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)
I needed to disable panning on my ArcRotateCamera.
I found that there were three events to look at:
- Ctrl + click
- Right click
- Multi touch
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
Then, for multi touch event, I found two booleans associated with panning on
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;
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
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.