summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/util/geo.hpp2
-rw-r--r--scripts/changelog_staging/invalid-latlngbounds.json4
2 files changed, 5 insertions, 1 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index dacdb968f3..2df32a7b26 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -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;
}
diff --git a/scripts/changelog_staging/invalid-latlngbounds.json b/scripts/changelog_staging/invalid-latlngbounds.json
new file mode 100644
index 0000000000..32bb876020
--- /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
+}