diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-10-06 11:14:25 -0700 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-10-06 12:25:46 -0700 |
commit | 402819e1add767c11e691f209fa642ab807cf883 (patch) | |
tree | 08c1a41fba45cdc039052cc504c3dd0964d6b245 /src/mbgl/style | |
parent | 71be6923a8150321796c8b0add220f3aea531cb2 (diff) | |
download | qtlocation-mapboxgl-402819e1add767c11e691f209fa642ab807cf883.tar.gz |
Fix for style properties transition updates
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/style_layer.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/style_layer.hpp | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mbgl/style/style_layer.cpp b/src/mbgl/style/style_layer.cpp index 57a446b26a..aea89fe587 100644 --- a/src/mbgl/style/style_layer.cpp +++ b/src/mbgl/style/style_layer.cpp @@ -172,6 +172,7 @@ void StyleLayer::applyTransitionedStyleProperty(PropertyKey key, T &target, cons // We overwrite the current property partially with the new value. float progress = std::chrono::duration<float>(now - property.begin) / (property.end - property.begin); target = util::interpolate(target, mapbox::util::apply_visitor(evaluator, property.value), progress); + hasPendingTransitions = true; } else { // Do not apply this property because its transition hasn't begun yet. } @@ -280,6 +281,9 @@ void StyleLayer::applyStyleProperties<BackgroundProperties>(const float z, const void StyleLayer::updateProperties(float z, const TimePoint& now, ZoomHistory &zoomHistory) { cleanupAppliedStyleProperties(now); + // Clear the pending transitions flag upon each update. + hasPendingTransitions = false; + switch (type) { case StyleLayerType::Fill: applyStyleProperties<FillProperties>(z, now, zoomHistory); break; case StyleLayerType::Line: applyStyleProperties<LineProperties>(z, now, zoomHistory); break; @@ -317,7 +321,7 @@ bool StyleLayer::hasTransitions() const { return true; } } - return false; + return hasPendingTransitions; } void StyleLayer::cleanupAppliedStyleProperties(const TimePoint& now) { diff --git a/src/mbgl/style/style_layer.hpp b/src/mbgl/style/style_layer.hpp index 6d14e57e18..28d3f5ca9e 100644 --- a/src/mbgl/style/style_layer.hpp +++ b/src/mbgl/style/style_layer.hpp @@ -94,6 +94,10 @@ public: // Stores the evaluated, and cascaded styling information, specific to this // layer's type. StyleProperties properties; + +private: + // Stores whether there are pending transitions to be done on each update. + bool hasPendingTransitions = false; }; } |