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;}