Cesium默认左键平移,中键旋转,右键缩放,但是这些功能都是可以绑定到任意键上的。
以下是将中键和右键功能互换的代码:
//设置中键放大缩小
viewer.scene.screenSpaceCameraController.zoomEventTypes = [
Cesium.CameraEventType.WHEEL,
Cesium.CameraEventType.MIDDLE_DRAG,
Cesium.CameraEventType.PINCH
];
//设置右键旋转
viewer.scene.screenSpaceCameraController.tiltEventTypes = [
Cesium.CameraEventType.RIGHT_DRAG,
Cesium.CameraEventType.PINCH,
{
eventType: Cesium.CameraEventType.RIGHT_DRAG,
modifier: Cesium.KeyboardEventModifier.CTRL
},
{
eventType: Cesium.CameraEventType.MIDDLE_DRAG,
modifier: Cesium.KeyboardEventModifier.CTRL
}
];
PS:换了以后经常会出现右键失灵的情况,按以下中键就会恢复,目前并不清楚原因