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 doesn't work as expected in 2D when rectangle overlaps antimeridian #6936

Closed
pjaustin opened this issue Aug 20, 2018 · 6 comments

Comments

@pjaustin
Copy link

When in 2D mode, calling camera.setView({ destination: rectangle }); or camera.flyTo({ destination: rectangle }); results in a view of the whole world when the rectangle overlaps the antimeridian, rather than a view containing only the rectangle.
Note these both work fine in 3D. In CV they also result in a view of the whole world, which seems reasonable because the globe is not wrapped in CV. However in 2D, when the globe is wrapped, it seems reasonable to expect that these should result in a "correct" view of the rectangle regardless of whether it crosses the anitmeridian.

Steps to reproduce:

    var west = 178.0; // -77.0;
    var south = 38.0;
    var east = -178.0; // -72.0;
    var north = 42.0;
    ...
  • Run the example
  • Set the globe to 2D
  • From the drop down menu in the example, select "Fly to Rectangle" / "View a Rectangle" as applicable.
@hpinkos
Copy link
Contributor

hpinkos commented Aug 20, 2018

Thanks for reporting this @pjaustin! Changes will need to be made to this function: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Camera.js#L2330

I think we can check if east < west and change what we're subtracting to get width/height it will fix the problem. We just need to also check that camera._scene.mapMode2D === MapMode2D.INFINITE_SCROLL because we don't want to swap it when the 2D map is in rotate mode.

Would you be interested in opening a pull request? You can find our contributors documentation here: https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors

@pjaustin
Copy link
Author

@hpinkos thanks for confirming this. At the moment this (and #6937) are relatively low priority for us, but as and when they become higher priority I'd be happy to take a look and submit a pull request if they're still open.

@hpinkos
Copy link
Contributor

hpinkos commented Aug 20, 2018

Sounds good, thanks @pjaustin!

@OmarShehata
Copy link
Contributor

I believe this is the same issue reported on the forum again here.

@hpinkos
Copy link
Contributor

hpinkos commented Sep 18, 2019

Fixed in #7909

@hpinkos hpinkos closed this as completed Sep 18, 2019
@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/d/msg/cesium-dev/p5ygxIQA490/mbAYcjUlBgAJ

If this issue affects any of these threads, please post a comment like the following:

The issue at #6936 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.

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

4 participants