diff options
Diffstat (limited to 'src/mbgl/style/style.cpp')
-rw-r--r-- | src/mbgl/style/style.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 0605a66d80..cec922f45e 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -254,6 +254,8 @@ void Style::cascade(const TimePoint& timePoint, MapMode mode) { } void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) { + // Disable all sources first. If we find an enabled layer that uses this source, we will + // re-enable it later. for (const auto& source : sources) { source->baseImpl->enabled = false; } @@ -287,6 +289,13 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) { } } } + + // Remove the existing tiles if we didn't end up re-enabling the source. + for (const auto& source : sources) { + if (!source->baseImpl->enabled) { + source->baseImpl->removeTiles(); + } + } } Source* Style::getSource(const std::string& id) const { |