summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-08-30 19:54:50 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-08-31 10:27:06 +0300
commitbf554e0928146a0fe5733a126d78daca55dd6b5b (patch)
tree775be281949196249284bfe75e39dea0398d8401
parent0694d224c745ea5ee5eb1fc46cbb0b9487e6333a (diff)
downloadqtlocation-mapboxgl-bf554e0928146a0fe5733a126d78daca55dd6b5b.tar.gz
[core] Enforce re-evaluation of render layers if integer zoom changes
-rw-r--r--src/mbgl/map/zoom_history.hpp6
-rw-r--r--test/api/zoom_history.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/map/zoom_history.hpp b/src/mbgl/map/zoom_history.hpp
index ddec53e6af..80afb90e32 100644
--- a/src/mbgl/map/zoom_history.hpp
+++ b/src/mbgl/map/zoom_history.hpp
@@ -26,10 +26,12 @@ struct ZoomHistory {
return true;
}
+ bool integerZoomChanged = lastIntegerZoom != floorZ;
+
if (lastFloorZoom > floorZ) {
lastIntegerZoom = floorZ + 1;
lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
- } else if (lastFloorZoom < floorZ || lastIntegerZoom != floorZ) {
+ } else if (lastFloorZoom < floorZ || integerZoomChanged) {
lastIntegerZoom = floorZ;
lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
}
@@ -40,7 +42,7 @@ struct ZoomHistory {
return true;
}
- return false;
+ return integerZoomChanged;
}
};
diff --git a/test/api/zoom_history.cpp b/test/api/zoom_history.cpp
index 3c60a5e2f2..1b1159bf52 100644
--- a/test/api/zoom_history.cpp
+++ b/test/api/zoom_history.cpp
@@ -62,4 +62,10 @@ TEST(API, ZoomHistory) {
// ZoomHistory.lastIntegerZoom should be 0.
map->setZoom(0.5);
test::checkImage("test/fixtures/zoom_history", frontend.render(*map), 0.0002);
+
+ map->setZoom(1.0);
+ frontend.render(*map);
+
+ map->setZoom(0.5);
+ test::checkImage("test/fixtures/zoom_history", frontend.render(*map), 0.0002);
}