diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index 662bff0e4..977dcf92a 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 57a446b26..aea89fe58 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(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(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(z, now, zoomHistory); break; case StyleLayerType::Line: applyStyleProperties(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 6d14e57e1..28d3f5ca9 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; }; }