Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Avoid wrapping longitude values of exactly 180 and 360 (#12797) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhamley authored Oct 25, 2018
1 parent 7def088 commit 3ec0231
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/mbgl/util/geo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LatLng {
// world, unwrap the start longitude to ensure the shortest path is taken.
void unwrapForShortestPath(const LatLng& end) {
const double delta = std::abs(end.lon - lon);
if (delta < util::LONGITUDE_MAX || delta > util::DEGREES_MAX) return;
if (delta <= util::LONGITUDE_MAX || delta >= util::DEGREES_MAX) return;
if (lon > 0 && end.lon < 0) lon -= util::DEGREES_MAX;
else if (lon < 0 && end.lon > 0) lon += util::DEGREES_MAX;
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/changelog_staging/invalid-latlngbounds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"core": "When using longitude values of +-180° in LatLngBounds, the longitude was being improperly wrapped resulting in an unexpected bounding box.",
"issue": 12797
}

0 comments on commit 3ec0231

Please sign in to comment.