Pan using right mouse button

I want to implement pan control using right mouse button. How could this be achieved?

Can I simply trigger Left mouse up down in my right mouse up down?

I think you’ll have to turn off the default controls and set your own, like I described here:

https://groups.google.com/d/msg/cesium-dev/fPbgK9_TMt0/zS8dmzA1AgAJ

I’m not sure if there’s an easier way to do this. What sort of application are you building that requires this? Is this more of a preference thing?

You could probably dig into the source code and switch those two events (here’s the file where they’re initialized https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/ScreenSpaceEventHandler.js) but that involves creating your own modified version of the Cesium source.

I actually want to use one mouse button for pan (which is there for left mouse button by default), and other mouse button to rotate around clicked entity.
I can rotate around using left mouse button with simply this line of code: viewer.camera.lookAt(pickedCenter);

But then I want pan using right mouse button. So I was thinking to trigger/simulate left mouse up/down event using right mouse up/down.

handler.setInputAction(function(movement) {

// Pick a new feature

var pickedFeature = viewer.scene.pick(movement.position);

if (!Cesium.defined(pickedFeature) || typeof(pickedFeature.content) == ‘undefined’) {

return;

}

scene.screenSpaceCameraController.enableRotate = true;

var x = pickedFeature.content._model._rtcCenter3D.x;

var y = pickedFeature.content._model._rtcCenter3D.y;

var z = pickedFeature.content._model._rtcCenter3D.z;

pickedCenter = Cesium.Cartesian3.fromElements(x, y, z);

viewer.camera.lookAt(pickedCenter);

}, Cesium.ScreenSpaceEventType.LEFT_DOWN);