From 03d6bb0f5564ebbabc1fc4df708e83742dfb4426 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 12 Jul 2022 18:14:40 +0200 Subject: [PATCH] fix some boundaries not hidden by the filter, closes #9171 --- CHANGELOG.md | 4 +++- modules/renderer/features.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1917a16..8f72ca806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ _Breaking developer changes, which may affect downstream projects or sites that * Fix leaking of localized tag values into raw tags by multiCombo fields ([#9164], thanks [@1ec5]) * Fix localizable labels in multiCombo fields ("chips") being rendered multiple times ([#9169]) * Fix missing styling when rendering of proposed footway/cycleway/path bridges ([#9172], thanks [@k-yle]) +* Fix some boundary lines (and preset) not hidden by the map features filter ([#9171], thanks [@k-yle]) #### :rocket: Presets * Disable taginfo suggestions for the `via` field ([#9140], thanks [@k-yle]) * Treat `surface=chipseal` as a paved surface ([#9139], thanks [@k-yle]) @@ -77,7 +78,8 @@ _Breaking developer changes, which may affect downstream projects or sites that [#9157]: https://github.com/openstreetmap/iD/issues/9157 [#9164]: https://github.com/openstreetmap/iD/issues/9164 [#9169]: https://github.com/openstreetmap/iD/issues/9169 -[#9172]: https://github.com/openstreetmap/iD/issues/9172 +[#9171]: https://github.com/openstreetmap/iD/pull/9171 +[#9172]: https://github.com/openstreetmap/iD/pull/9172 [@furkanmutlu]: https://github.com/furkanmutlu [@JackNUMBER]: https://github.com/JackNUMBER [@aaditya0000]: https://github.com/aaditya0000 diff --git a/modules/renderer/features.js b/modules/renderer/features.js index 453faeb0a..6253b12df 100644 --- a/modules/renderer/features.js +++ b/modules/renderer/features.js @@ -69,6 +69,11 @@ export function rendererFeatures(context) { } + /** + * @param {string} k + * @param {(tags: Record, geometry: string) => boolean} filter + * @param {?number} max + */ function defineRule(k, filter, max) { var isEnabled = true; @@ -133,9 +138,13 @@ export function rendererFeatures(context) { !_rules.pistes.filter(tags); }); - defineRule('boundaries', function isBoundary(tags) { + defineRule('boundaries', function isBoundary(tags, geometry) { + // This rule applies if the object has no interesting tags, and if either: + // (a) is a way having a `boundary=*` tag, or + // (b) is a relation of `type=boundary`. return ( - !!tags.boundary + (geometry === 'line' && !!tags.boundary) || + (geometry === 'relation' && tags.type === 'boundary') ) && !( traffic_roads[tags.highway] || service_roads[tags.highway] ||