我知道你在找它,如果没有你打我
1.取消Cesium版权信息
$(".cesium-widget-credits").remove();
或
const credits = document.getElementsByClassName("cesium-widget-credits");
credits[0].parentElement.removeChild(credits[0]);
2.禁止双击zoom到Entity
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
效果:禁止双击放大地图
3.标记去掉地形遮挡
entity.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY
4.禁用默认相机控制事件
scene.screenSpaceCameraController.enableRotate = false;
scene.screenSpaceCameraController.enableTranslate = false;
scene.screenSpaceCameraController.enableZoom = false;
scene.screenSpaceCameraController.enableTilt = false;
scene.screenSpaceCameraController.enableLook = false;
5.地球移动事件
camera.moveStart.addEventListener(function() {
});
camera.moveEnd.addEventListener(function() {
});
6.球缩放事件
viewer.camera.changed.addEventListener(function(percentage) {
});
7.修改鼠标操作习惯
利用Cesium.ScreenSpaceCameraController(scene)实现
例如:
//设置操作习惯,更换中键和右键
viewer.scene.screenSpaceCameraController.tiltEventTypes = [
Cesium.CameraEventType.RIGHT_DRAG, Cesium.CameraEventType.PINCH,
{ eventType: Cesium.CameraEventType.LEFT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL },
{ eventType: Cesium.CameraEventType.RIGHT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL }
];
viewer.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.MIDDLE_DRAG, Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];