summaryrefslogtreecommitdiff
path: root/src/mbgl/text
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
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')
-rw-r--r--src/mbgl/text/placement.cpp8
-rw-r--r--src/mbgl/text/placement.hpp2
2 files changed, 3 insertions, 7 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;
}
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index b2ad5d62e0..2ceb531d44 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -96,7 +96,7 @@ public:
void setPlacement(Immutable<Placement>);
const Immutable<Placement>& getPlacement() const { return placement; }
void setPlacementStale() { stale = true; }
- bool placementIsRecent(TimePoint now, const float zoom, optional<Duration> maximumDuration = nullopt) const;
+ bool placementIsRecent(TimePoint now, const float zoom, optional<Duration> periodOverride = nullopt) const;
bool hasTransitions(TimePoint now) const;
private: