Skip to content

Commit

Permalink
Merge pull request #7909 from michaelhayes-dev/fly-to-antimeridian
Browse files Browse the repository at this point in the history
Camera improvement when moving to a rectangle which crosses the antimeridian
  • Loading branch information
Hannah authored Sep 18, 2019
2 parents b5fec75 + 1bf43b1 commit 84631de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

### 1.62 - 2019-10-01

##### Fixes :wrench:
* `Camera.flyTo` flies to the correct location in 2D when the destination crosses the international date line [#7909](https://github.com/AnalyticalGraphicsInc/cesium/pull/7909)

### 1.61 - 2019-09-03

##### Additions :tada:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Alexander Popiak](https://github.com/apopiak)
* [Trubie Turner](https://github.com/flexei)
* [Merijn Wijngaard](https://github.com/mwijngaard)
* [Michael Hayes](https://github.com/michaelhayes-dev)
* [Dennis Adams](https://github.com/dennisadams)
* [Hai Zhou](https://github.com/verybigzhouhai)
* [Pascal Poulain](https://github.com/ppoulainpro)
Expand Down
12 changes: 10 additions & 2 deletions Source/Scene/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -2392,12 +2392,20 @@ define([
var viewRectangle2DSouthWest = new Cartesian3();
function rectangleCameraPosition2D(camera, rectangle, result) {
var projection = camera._projection;

// Account for the rectangle crossing the International Date Line in 2D mode
var east = rectangle.east;
if (rectangle.west > rectangle.east) {
rectangle = Rectangle.MAX_VALUE;
if(camera._scene.mapMode2D === MapMode2D.INFINITE_SCROLL) {
east += CesiumMath.TWO_PI;
} else {
rectangle = Rectangle.MAX_VALUE;
east = rectangle.east;
}
}

var cart = viewRectangle2DCartographic;
cart.longitude = rectangle.east;
cart.longitude = east;
cart.latitude = rectangle.north;
var northEast = projection.project(cart, viewRectangle2DNorthEast);
cart.longitude = rectangle.west;
Expand Down

0 comments on commit 84631de

Please sign in to comment.