Use the "official" min/max zoom defaults in zoom check

This commit is contained in:
Martin Tůma 2019-10-02 23:14:20 +02:00
parent 82308857ba
commit e00c8feab6
2 changed files with 4 additions and 8 deletions

View File

@ -437,7 +437,7 @@ Text::RotationAlignment Style::Layer::Layout::textRotationAlignment(int zoom)
} }
Style::Layer::Layer(const QJsonObject &json) Style::Layer::Layer(const QJsonObject &json)
: _type(Unknown), _minZoom(-1), _maxZoom(-1) : _type(Unknown), _minZoom(0), _maxZoom(22)
{ {
// type // type
QString type(json["type"].toString()); 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 bool Style::Layer::match(int zoom, const PBF::Feature &feature) const
{ {
if (zoom >= 0) { if (zoom >= 0 && (zoom < _minZoom || zoom > _maxZoom))
if (_minZoom > 0 && zoom < _minZoom)
return false; return false;
if (_maxZoom > 0 && zoom > _maxZoom)
return false;
}
return _filter.match(feature); return _filter.match(feature);
} }

View File

@ -35,7 +35,7 @@ public:
private: private:
class Layer { class Layer {
public: public:
Layer() : _type(Unknown), _minZoom(-1), _maxZoom(-1) {} Layer() : _type(Unknown), _minZoom(0), _maxZoom(22) {}
Layer(const QJsonObject &json); Layer(const QJsonObject &json);
const QString &sourceLayer() const {return _sourceLayer;} const QString &sourceLayer() const {return _sourceLayer;}