Is it possible to replicate the left click mouse button + drag event to right click + drag?


Is there any way to copy the behavior on the left click which allows you to pan the Cesium map, to the right click?

We have a certain requirement on our app to allow panning the map by holding down the right click mouse button.

I was able to disable the default behavior of the right click by setting the enableZoom of the ScreenSpaceCameraController to false.

Any guides from anyone that I can take a look at?
Or maybe you can point in the CesiumJs source code that does this behavior so I can replicate it to work with the right click mouse button.

Hoping to get some replies soon.


Hi @iramgelb , Yes it’s possible with CesiumJs.
You can try following lines of codes to customize ScreenSpaceCameraController for right click moue button.

viewer.scene.screenSpaceCameraController.rotateEventTypes = [Cesium.CameraEventType.RIGHT_DRAG];
viewer.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.MIDDLE_DRAG, Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];
  • Regards

Thank you @Jacky for your prompt reply. Appreciate it!
I will try these and will get back to you how it went.


Thanks @Jacky,

I can confirm that the solution above works.
Appreciate your fast response.