From fbac0656517e1f71fad00ef6c2f51cd1658e03cd Mon Sep 17 00:00:00 2001 From: ryanhamley Date: Tue, 2 Oct 2018 15:29:31 -0700 Subject: [PATCH 1/2] Avoid wrapping longitude values of exactly 180 and 360 --- include/mbgl/util/geo.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index dacdb968f37..2df32a7b26f 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -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; } From 617f5e4ea972c7f94002e561661b7074ed442feb Mon Sep 17 00:00:00 2001 From: ryanhamley Date: Wed, 24 Oct 2018 16:17:16 -0700 Subject: [PATCH 2/2] Add staging changelog --- scripts/changelog_staging/invalid-latlngbounds.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 scripts/changelog_staging/invalid-latlngbounds.json diff --git a/scripts/changelog_staging/invalid-latlngbounds.json b/scripts/changelog_staging/invalid-latlngbounds.json new file mode 100644 index 00000000000..32bb8760204 --- /dev/null +++ b/scripts/changelog_staging/invalid-latlngbounds.json @@ -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 +}