diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-04-13 23:46:19 +0300 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-14 12:52:20 -0700 |
commit | 09a22715769c629ad433b405908b60e1b9fa969b (patch) | |
tree | ed4851f872f97de32fe38578d6c7b1c4bac5bb01 /src/mbgl/map/map.cpp | |
parent | 98e2e59e5e963dbc5451a19233d942b429a74855 (diff) | |
download | qtlocation-mapboxgl-09a22715769c629ad433b405908b60e1b9fa969b.tar.gz |
[core] Ignore shortest path in Map::pixelForLatLng
Diffstat (limited to 'src/mbgl/map/map.cpp')
-rw-r--r-- | src/mbgl/map/map.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index fde466054c..afa3304316 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -586,7 +586,7 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed ScreenCoordinate swPixel = {INFINITY, INFINITY}; double viewportHeight = getSize().height; for (LatLng latLng : latLngs) { - ScreenCoordinate pixel = pixelForLatLng(latLng); + ScreenCoordinate pixel = impl->transform.latLngToScreenCoordinate(latLng); swPixel.x = std::min(swPixel.x, pixel.x); nePixel.x = std::max(nePixel.x, pixel.x); swPixel.y = std::min(swPixel.y, viewportHeight - pixel.y); @@ -811,7 +811,12 @@ LatLng Map::latLngForProjectedMeters(const ProjectedMeters& projectedMeters) con } ScreenCoordinate Map::pixelForLatLng(const LatLng& latLng) const { - return impl->transform.latLngToScreenCoordinate(latLng); + // If the center and point longitudes are not in the same side of the + // antimeridian, we unwrap the point longitude so it would be seen if + // e.g. the next antimeridian side is visible. + LatLng unwrappedLatLng = latLng.wrapped(); + unwrappedLatLng.unwrapForShortestPath(getLatLng()); + return impl->transform.latLngToScreenCoordinate(unwrappedLatLng); } LatLng Map::latLngForPixel(const ScreenCoordinate& pixel) const { |