Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera setView / flyTo rectangle produces inconsistent results in 2D with a narrow / portrait map viewer #6937

Open
pjaustin opened this issue Aug 20, 2018 · 2 comments

Comments

@pjaustin
Copy link

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".
@hpinkos
Copy link
Contributor

hpinkos commented Aug 20, 2018

Related #2473

@hpinkos
Copy link
Contributor

hpinkos commented Jul 14, 2020

@angrycat9000 ran into this issue today. flyTo/setView doesn't zoom as close to the rectangle as it can when the canvas aspect ratio is portrait instead of landscape.

sandcastle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants