ol-cesium
ol-cesium copied to clipboard
Projection/positioning issues in scene.morphTo2D / scene.morphTo3D
I am trying to implement smooth transitions between 2D and 3D. For that, I have replaced in my doToggle3D method:
this.map3d.setEnabled(!this.map3d.getEnabled());
with:
var scene = map3d.getCesiumScene();
if (map3d.getEnabled()) {
scene.morphTo2D(2);
setTimeout(function() { map3d.setEnabled(false); }, 2000);
} else {
scene.morphTo2D(0);
map3d.setEnabled(true);
scene.morphTo3D(2);
}
In the transition from 3D to 2D (the lines run if map3d.getEnabled()), after the morphTo2D finishes, the map looks 2D, but is still rendered by Cesium. At this point, executing map3d.setEnabled(false) disables the 3D (Cesium) map, but does not enable the 2D (OpenLayers) map.
The 2D map is correctly enabled if I just run map3d.setEnabled(false);
scene.morphTo2D seems to prevent map3d.setEnabled(false) from working correctly.