From 045a644a7dd997a0123a1f49efa0e8c744b83fdf Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 29 Jul 2016 15:18:21 +0300 Subject: [PATCH] [core] Respect minzoom and maxzoom properties Fixes #5811 --- src/mbgl/style/layer_impl.cpp | 7 +++++-- src/mbgl/style/layer_impl.hpp | 2 +- src/mbgl/style/style.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mbgl/style/layer_impl.cpp b/src/mbgl/style/layer_impl.cpp index b345297027b..f50bf87339b 100644 --- a/src/mbgl/style/layer_impl.cpp +++ b/src/mbgl/style/layer_impl.cpp @@ -21,8 +21,11 @@ bool Layer::Impl::hasRenderPass(RenderPass pass) const { return bool(passes & pass); } -bool Layer::Impl::needsRendering() const { - return passes != RenderPass::None && visibility != VisibilityType::None; +bool Layer::Impl::needsRendering(float zoom) const { + return passes != RenderPass::None + && visibility != VisibilityType::None + && minZoom <= zoom + && maxZoom >= zoom; } } // namespace style diff --git a/src/mbgl/style/layer_impl.hpp b/src/mbgl/style/layer_impl.hpp index d2bf866e8e1..c1f04fe5137 100644 --- a/src/mbgl/style/layer_impl.hpp +++ b/src/mbgl/style/layer_impl.hpp @@ -64,7 +64,7 @@ class Layer::Impl { bool hasRenderPass(RenderPass) const; // Checks whether this layer can be rendered. - bool needsRendering() const; + bool needsRendering(float zoom) const; virtual float getQueryRadius() const { return 0; } virtual bool queryIntersectsGeometry( diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index aae0e38d518..ce33a409f7e 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -223,7 +223,7 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) { hasPendingTransitions |= layer->baseImpl->recalculate(parameters); Source* source = getSource(layer->baseImpl->source); - if (source && layer->baseImpl->needsRendering()) { + if (source && layer->baseImpl->needsRendering(z)) { source->baseImpl->enabled = true; if (!source->baseImpl->loaded) { source->baseImpl->load(fileSource);