Setting camera view rectangle after scene transitions

Dear Cesium Community and Cesium Team,

I’m trying to change map view rectangle after scene transitions.

To do this, I used Scene.morphComplete field.

In Cesium Sandcastle app, I edited Camera tutorial to include the code snippet below:

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…’);

});

The above code hooks to the morph complete event and as soon as the scene transition is completed, view rectangle is set to a region in Europe. At least this is my expected behavior.

The observed behaviour is after morph is completed, Cesium view rectangle is in overseas. My question is how can I set map view rectangle after scene transitions?

Thank you.