maximumZoomDistance not working in 2D

21 views
Skip to first unread message

maaron...@gmail.com

unread,
Oct 4, 2019, 4:07:46 PM10/4/19
to cesium-dev
1. A concise explanation of the problem you're experiencing.

screenSpaceCameraController.maximumZoomDistance does not seem to work in 2D. When I go to 2d it seems to limit the camera height to around 40,000 km regardless of screen size. Worse yet, if I programatically zoom out farther, for example camera.flyHome() with some default rectangle, as soon as the user tries to zoom in or out it will snap back to that 40,000km distance

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.scene.screenSpaceCameraController.maximumZoomDistance = 60000000;

 Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(-80,-90,100,90);

setInterval(()=>{    
console.log(viewer.camera.positionCartographic.height);
},2000)



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am trying to control limits of zooming and panning in 2D. I would like to set the max zoom distance in 2D to be the width of the earth. Setting DEFAULT_VIEW_RECTANGLE works to zoom to map height but not width. 

4. The Cesium version you're using, your operating system and browser.

Cesium v1.61
Chrome Version 77.0.3865.90 (Official Build) (64-bit)
Windows 10 64-bit

maaron...@gmail.com

unread,
Mar 18, 2020, 10:35:19 AM3/18/20
to cesium-dev
Updated SandCastle link with mapProjection set to Mercator. It seems the issue that I'm describing happens when home button is clicked in 2D and then user tries to zoom out for example.
Reply all
Reply to author
Forward
0 new messages