summaryrefslogtreecommitdiff
path: root/src/mbgl/text/placement.cpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-09 16:34:18 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-12 23:35:55 +0200
commitf29865f31ddd9e6293053e810a65c6c093b7d597 (patch)
tree4206f235131e3338b98d94c4436ce660a07dc804 /src/mbgl/text/placement.cpp
parent7a2126bebb080c6f7b013dbe94ca4cd242b71136 (diff)
downloadqtlocation-mapboxgl-f29865f31ddd9e6293053e810a65c6c093b7d597.tar.gz
[core] Do not squeeze placement period if the view is tilted
If the view is not tilted, we want the new symbols to show up faster, so we squeeze the placement period. On contrary, with the tilted view it's more important to make placement rarely for performance reasons and as the new symbols are normally "far away" and the user is not that interested to see them ASAP.
Diffstat (limited to 'src/mbgl/text/placement.cpp')
-rw-r--r--src/mbgl/text/placement.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index f5e0be0829..d8cf4653c6 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -68,14 +68,10 @@ void PlacementController::setPlacement(Immutable<Placement> placement_) {
stale = false;
}
-bool PlacementController::placementIsRecent(TimePoint now, const float zoom, optional<Duration> maximumDuration) const {
+bool PlacementController::placementIsRecent(TimePoint now, const float zoom, optional<Duration> periodOverride) const {
if (!placement->transitionsEnabled()) return false;
- auto updatePeriod = placement->getUpdatePeriod(zoom);
-
- if (maximumDuration) {
- updatePeriod = std::min(*maximumDuration, updatePeriod);
- }
+ auto updatePeriod = periodOverride ? *periodOverride : placement->getUpdatePeriod(zoom);
return placement->getCommitTime() + updatePeriod > now;
}