Hi, I am experiencing a problem since upgrading to Cesium version 1.20 from Version 1.14. On my map, I am constantly storing the 4 corners of the screen as longitude and latitude positions in local storage so that if I leave the map and come back to it, I will be brought back to where I was looking. Since upgrading to version 1.20 of Cesium, I have lost this functionality. When I come back to my map page, I am brought to the bottom mid point of the map and I am zoomed in to about 5m from the map. I tried out my code in sandcastle and it does the exact same thing. Here is my sandcastle code below:
//var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
//Play pause
animation: false,
//Bing layer picker
baseLayerPicker: false,
//Bing default provider
imageryProvider : false,
//Fullscreen button
fullscreenButton: false,
//Search
geocoder: false,
//Home button
homeButton : false,
//Shows on first start
infoBox: false,
//3D, 2.5D, 2D
sceneModePicker: false,
//No idea
selectionIndicator: false,
//Timeline
timeline: false,
//Help
navigationHelpButton: false,
//Default to 2D Mode
sceneMode: Cesium.SceneMode.SCENE2D,
//Set map projection
mapProjection : new Cesium.WebMercatorProjection()
});
function restoreExtents(){
var restoreMyExtents = "29.389366816112982,-92.80960171047546,29.389366816112982,-92.78906207714422,29.369455253062277,-92.78906207714422,29.36945525306227,-92.80960171047546";
if(restoreMyExtents == "null"){
viewer.scene.postRender.removeEventListener(restoreExtents);
return;
}
var positions = restoreMyExtents.split(",");
if(positions.length == 1 || isNaN(positions[0])){
return;
}
var position1Cartesian = new Cesium.Cartographic.fromDegrees(positions[0], positions[1]);
var position2Cartesian = new Cesium.Cartographic.fromDegrees(positions[2], positions[3]);
var position3Cartesian = new Cesium.Cartographic.fromDegrees(positions[4], positions[5]);
var position4Cartesian = new Cesium.Cartographic.fromDegrees(positions[6], positions[7]);
var positionsArray = [position1Cartesian, position2Cartesian, position3Cartesian, position4Cartesian];
var myView = Cesium.Rectangle.fromCartographicArray(positionsArray);
viewer.camera.flyTo({
destination : myView,
duration : 0
});
viewer.scene.postRender.removeEventListener(restoreExtents);
}
viewer.scene.postRender.addEventListener(restoreExtents);
So, basically I have a function that converts my longitude and latitude points into an array of cartographic points which I then make into a rectangle that I can give to the camera flyto as a destination. This function is then added to the EventListener. The function also removes itself from the Eventlistener in its call so that the function is called only once on map load up. When I put a breakpoint in my code it seems like something else is being called after this in version 1.20 of Cesium which is causing my map to focus in on the mid bottom of the map.
Any ideas?