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

Commit

Permalink
[core] Add changes to respect minzoom and maxzoom
Browse files Browse the repository at this point in the history
This adds only the changes made in
#5828 to address the
issue where the style zoom levels were not respected when deciding
when to render a layer.
  • Loading branch information
boundsj committed Jul 29, 2016
1 parent 85183dd commit e643ffe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/mbgl/style/layer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ 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;
}

This comment has been minimized.

Copy link
@1ec5

1ec5 Jul 29, 2016

Contributor

Weird indentation here.

This comment has been minimized.

Copy link
@tmpsantos

tmpsantos Jul 29, 2016

Contributor

ugh

This comment has been minimized.

Copy link
@tmpsantos

tmpsantos Jul 29, 2016

Contributor

@1ec5 I don't understand, I have this locally

-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
} // namespace mbgl
2 changes: 1 addition & 1 deletion src/mbgl/style/layer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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 @@ -212,7 +212,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->enabled = true;
if (!source->loaded && !source->isLoading()) {
source->load(fileSource);
Expand Down

1 comment on commit e643ffe

@boundsj
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1ec5 @tmpsantos Since it seems like we probably want to make a patch release today, I went ahead and manually pulled these changes in to the iOS release branch since the current iOS release branch is very far behind master.

Please sign in to comment.