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

This commit is contained in:
Ryan Hamley
2018-10-24 18:38:54 -07:00
committed by GitHub
parent 7def0888c4
commit 3ec0231bb7
2 changed files with 5 additions and 1 deletions

View File

@@ -61,7 +61,7 @@ public:
// 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;
}

View File

@@ -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
}