移除 tilt 50° 限制
This commit is contained in:
@@ -213,23 +213,6 @@ export class CesiumGlobe {
|
||||
controller.minimumZoomDistance = 3000; // 最近约 3 km(城区尺度)
|
||||
controller.maximumZoomDistance = 8e6; // 最远约 8000 km
|
||||
|
||||
// 限制最大倾斜角:pitch 夹取到 -40°(即从天底最多 50°)。用 postUpdate 手动夹取,
|
||||
// 避免原生 maximumTiltAngle 在极限处与拖动反复角力产生的抖动。
|
||||
const MAX_TILT_PITCH = Cesium.Math.toRadians(-40);
|
||||
scene.postUpdate.addEventListener(() => {
|
||||
const camera = viewer.camera;
|
||||
if (camera.pitch > MAX_TILT_PITCH) {
|
||||
camera.setView({
|
||||
destination: Cesium.Cartesian3.clone(camera.positionWC),
|
||||
orientation: {
|
||||
heading: camera.heading,
|
||||
pitch: MAX_TILT_PITCH,
|
||||
roll: camera.roll,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 限制鼠标按钮:只保留左键旋转 + 滚轮缩放;禁用中键倾斜、右键缩放
|
||||
controller.rotateEventTypes = Cesium.CameraEventType.LEFT_DRAG;
|
||||
controller.zoomEventTypes = [
|
||||
|
||||
Reference in New Issue
Block a user