I want to set the default view/home location for a cesium app.
I don't just want to flyTo the location once; I want the location set as the default/home - so that it can be used elsewhere in the app - e.g. in the HomeButton Widget.
I've tried setting the Camera.DEFAULT_VIEW_RECTANGLE
(docs here) like this:
var extent = Cesium.Rectangle.fromDegrees(117.940573,-29.808406,118.313421,-29.468825);
viewer.camera.DEFAULT_VIEW_RECTANGLE = extent;
But it doesn't work..
For completeness, here's how I'm initializing the app:
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider : new Cesium.CesiumTerrainProvider({
url : '//cesiumjs.org/stk-terrain/tilesets/world/tiles'
}),
mapProjection : new Cesium.WebMercatorProjection(),
timeline: false,
animation: false,
});
Any suggestions? If any further info is needed please let me know.
overwrite home button event, like this:
viewer.homeButton.viewModel.command.beforeExecute.addEventListener(
function(e) {
e.cancel = true;
viewer.scene.camera.flyTo(homeCameraView);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With