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

[core] Avoid wrapping longitude values of exactly 180 and 360 (#12797) #13006

Merged
merged 2 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}