From e00c8feab6d1db3610894e8c0915e49650bf166b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 2 Oct 2019 23:14:20 +0200 Subject: [PATCH] Use the "official" min/max zoom defaults in zoom check --- src/style.cpp | 10 +++------- src/style.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/style.cpp b/src/style.cpp index 1d5b15a..8a1d543 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -437,7 +437,7 @@ Text::RotationAlignment Style::Layer::Layout::textRotationAlignment(int zoom) } Style::Layer::Layer(const QJsonObject &json) - : _type(Unknown), _minZoom(-1), _maxZoom(-1) + : _type(Unknown), _minZoom(0), _maxZoom(22) { // type QString type(json["type"].toString()); @@ -475,12 +475,8 @@ Style::Layer::Layer(const QJsonObject &json) bool Style::Layer::match(int zoom, const PBF::Feature &feature) const { - if (zoom >= 0) { - if (_minZoom > 0 && zoom < _minZoom) - return false; - if (_maxZoom > 0 && zoom > _maxZoom) - return false; - } + if (zoom >= 0 && (zoom < _minZoom || zoom > _maxZoom)) + return false; return _filter.match(feature); } diff --git a/src/style.h b/src/style.h index fb00cbe..f35966b 100644 --- a/src/style.h +++ b/src/style.h @@ -35,7 +35,7 @@ public: private: class Layer { public: - Layer() : _type(Unknown), _minZoom(-1), _maxZoom(-1) {} + Layer() : _type(Unknown), _minZoom(0), _maxZoom(22) {} Layer(const QJsonObject &json); const QString &sourceLayer() const {return _sourceLayer;}