Camera setView / flyTo produces inconsistent results with an orthographic camera
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
When in 2D mode, calling camera.setView({ destination: rectangle }); or camera.flyTo({ destination: rectangle }); displays a larger area than expected when the map viewer is narrow / portrait.
Typically, the above functions result in a view where the rectangle fills the screen (i.e. the camera is centred of over the rectangle and zoomed in as far as possible such the view still contains the whole rectangle). This behaviour appears to work consistently in 3D and CV, and most of the time in 2D, except when the map viewer is narrow / portrait, in which case the camera is not zoomed in as far as it could be, and a larger area than necessary is displayed.
Steps to reproduce:
- Open sandcastle camera examples: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html?src=Camera.html
- Resize either the map viewer pane or the browser as a whole such that the map viewer is narrow / portrait (the issue is sometimes more apparent with rectangles that are tall and narrow, but the default rectangles in the examples are sufficient to reproduce this).
- Set the globe to 2D.
- From the drop down menu in the example, select "Fly to Rectangle" / "View a Rectangle".
Contributor guide
Research direction
Start with the Sandcastle Camera examples and reproduce the issue in 2D using "Fly to Rectangle" and "View a Rectangle" with a narrow or portrait viewer. Trace the camera.setView and camera.flyTo paths for rectangle destinations, then verify that the rectangle fills the view as closely as possible while remaining fully visible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100