ArcRotateCameraPointersInput issue

Hi,

I was working with the ArcRotateCamera & ArcRotateCameraPointersInput to set it up with advanced pointers control. The issue is that while on desktop it is behaving as expected, on mobile (chrome devtools mobile simulation or actual mobile device) the behavior is broken. See this playground.

As it can be seen, on mobile devices, the arcRotateCamera does no rotate anymore when gestures are provided. This is caused by ArcRotateCameraPointersInput. Testing without them, the camera rotates as expected. I also tested with the different parameters like ‘multiTouchPanning‘, ‘multiTouchPanAndZoom’. The main issue seems to be that the gestures instead of going into rotation, go towards moving the target & zooming. I believe this is not what was intended when developing this component.

After some more testing I found out the onMultiTouch event is being called on mobile instead of onTouch. Without actually doing the multi touch gesture… I think the issue is in BaseCameraPointersInput.attachControl in one of the 26 if/else clauses.

cc @amoebachant

Looking into it…

Hi @Florin_Dumitru, I did some debugging and found that you’re right, onMultiTouch is being called, and that’s because this._pointA and this._pointB both have values, and that’s because two instances of this._pointerInput() are being run when you touch the screen. Looking back at the playground you sent, you call both camera.attachControl() and mouseInputs.attachControl(), which is causing this handler to be registered twice. Do you have a scenario where you need to call attachControl on both of those?

Thanks!

Hi @amoebachant and thanks for testing. I was unaware that camera.attachControl() and mouseInputs.attachControl() create two instances of _pointerInput. Somehow I thought that the more specialized behavior will override. The use case was to have different inputs attach & detach at different times, but from what I tested now, that works without having to call the general camera.attachControl(). So I guess now it remains to be decided if this edge case should be possible at all or at least be mentioned in the documentation. For my issue, it was resolved by removing camera.attachControl().

Thanks for the follow up @Florin_Dumitru! I’ll give some thought to deciding if the code should guard against this case or if it should just be documented. Thanks again for the report!