[core] Add changes to respect minzoom and maxzoom
This adds only the changes made in https://github.com/mapbox/mapbox-gl-native/pull/5828 to address the issue where the style zoom levels were not respected when deciding when to render a layer.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user