Search code examples
javascriptcesiumjs

Fix minimum size of 3D globe cesium


I want to fix the minimum size of 3D globe such as if user decreases the size through mouse it should not decrease beyond some fixed value.

var viewer = new Cesium.Viewer("cesiumContainer", {

animation: false,

timeline: false

});

Sandcastle Link

Any help is highly appreciated, Thanks


Solution

  • Give this a try:

    var viewer = new Cesium.Viewer("cesiumContainer");  // plus whatever options
    
    viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1e8;
    

    The value 1e8 here is the maximum number of meters that the camera is allowed to travel away from the focus point (typically the center of the Earth). You can try 1e7 or 1e9 to adjust it.