summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-10-06 11:14:25 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-10-06 12:25:46 -0700
commit402819e1add767c11e691f209fa642ab807cf883 (patch)
tree08c1a41fba45cdc039052cc504c3dd0964d6b245 /src/mbgl
parent71be6923a8150321796c8b0add220f3aea531cb2 (diff)
downloadqtlocation-mapboxgl-402819e1add767c11e691f209fa642ab807cf883.tar.gz
Fix for style properties transition updates
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/map/map_context.cpp7
-rw-r--r--src/mbgl/style/style_layer.cpp6
-rw-r--r--src/mbgl/style/style_layer.hpp4
3 files changed, 15 insertions, 2 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 662bff0e45..977dcf92ae 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -243,7 +243,12 @@ bool MapContext::renderSync(const TransformState& state, const FrameData& frame)
view.afterRender();
- if (style->hasTransitions() || painter->needsAnimation()) {
+ if (style->hasTransitions()) {
+ updateFlags |= Update::Classes;
+ asyncUpdate->send();
+ }
+
+ if (painter->needsAnimation()) {
updateFlags |= Update::Repaint;
asyncUpdate->send();
}
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;
};
}