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. How can I trigger/simulate left mouse up/down 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);