Skip to content

Commit 84631de

Browse files
author
Hannah
authored
Merge pull request #7909 from michaelhayes-dev/fly-to-antimeridian
Camera improvement when moving to a rectangle which crosses the antimeridian
2 parents b5fec75 + 1bf43b1 commit 84631de

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Change Log
22
==========
33

4+
### 1.62 - 2019-10-01
5+
6+
##### Fixes :wrench:
7+
* `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)
8+
49
### 1.61 - 2019-09-03
510

611
##### Additions :tada:

CONTRIBUTORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
222222
* [Alexander Popiak](https://github.com/apopiak)
223223
* [Trubie Turner](https://github.com/flexei)
224224
* [Merijn Wijngaard](https://github.com/mwijngaard)
225+
* [Michael Hayes](https://github.com/michaelhayes-dev)
225226
* [Dennis Adams](https://github.com/dennisadams)
226227
* [Hai Zhou](https://github.com/verybigzhouhai)
227228
* [Pascal Poulain](https://github.com/ppoulainpro)

Source/Scene/Camera.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -2392,12 +2392,20 @@ define([
23922392
var viewRectangle2DSouthWest = new Cartesian3();
23932393
function rectangleCameraPosition2D(camera, rectangle, result) {
23942394
var projection = camera._projection;
2395+
2396+
// Account for the rectangle crossing the International Date Line in 2D mode
2397+
var east = rectangle.east;
23952398
if (rectangle.west > rectangle.east) {
2396-
rectangle = Rectangle.MAX_VALUE;
2399+
if(camera._scene.mapMode2D === MapMode2D.INFINITE_SCROLL) {
2400+
east += CesiumMath.TWO_PI;
2401+
} else {
2402+
rectangle = Rectangle.MAX_VALUE;
2403+
east = rectangle.east;
2404+
}
23972405
}
23982406

23992407
var cart = viewRectangle2DCartographic;
2400-
cart.longitude = rectangle.east;
2408+
cart.longitude = east;
24012409
cart.latitude = rectangle.north;
24022410
var northEast = projection.project(cart, viewRectangle2DNorthEast);
24032411
cart.longitude = rectangle.west;

0 commit comments

Comments
 (0)