在 Cesium Sandcastle 应用程序中,我编辑了相机教程以包含以下代码片段:
window.scene = scene;
scene.morphComplete.addEventListener(function (){
console.log('Morph completed...');
var west = Cesium.Math.toRadians(10);
var east = Cesium.Math.toRadians(40);
var south = Cesium.Math.toRadians(35);
var north = Cesium.Math.toRadians(45);
var rectangle = new Cesium.Rectangle(west,south,east,north);
window.scene.camera.viewRectangle(rectangle);
console.log('Camera view rectangle updated...');
});
上面的代码挂钩到变形完成事件,一旦场景转换完成,视图矩形就会设置为欧洲的一个区域。至少这是我的预期行为。观察到的行为是在变形完成后,Cesium 视图矩形在海外。我的问题是如何在场景转换后设置地图视图矩形?