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

[core] Respect minzoom and maxzoom properties #5828

Merged
merged 1 commit into from
Jul 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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