Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Respect minzoom and maxzoom properties
Browse files Browse the repository at this point in the history
Fixes #5811
  • Loading branch information
tmpsantos committed Jul 29, 2016
1 parent de0cb55 commit 045a644
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/mbgl/style/layer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/style/layer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/style/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 045a644

Please sign in to comment.