diff --git a/plugin-designs/country-posters/countries-map.vue b/plugin-designs/country-posters/countries-map.vue index 1da70ca9d..ca90ef275 100644 --- a/plugin-designs/country-posters/countries-map.vue +++ b/plugin-designs/country-posters/countries-map.vue @@ -1431,10 +1431,14 @@ async function ensureRegionsLoaded() { // compile (rega on research-map: 5.5 s MapLibre / 11.1 s Mapbox under SwiftShader). Painting each // current value through a case with two identical branches keeps the look and moves the compile // off the gesture. All three, or the other two still compile on the click (simpleresearch). + // "Already data-driven" means the value READS THE FEATURE somewhere, not merely that it is an + // array: a zoom-only interpolate is an array and still compiles a variant on the first gesture + // (simpleresearch). Anything keyed on a feature is left exactly as the layer wrote it. + const readsFeature = (e) => Array.isArray(e) && (e[0] === 'get' || e[0] === 'has' || e[0] === 'feature-state' || e.some(readsFeature)) for (const [layer, prop] of [['regions-fill', 'fill-opacity'], ['regions-border', 'line-color'], ['regions-border', 'line-width']]) { try { const v = map.value.getLayer(layer) && map.value.getPaintProperty(layer, prop) - if (v != null && !Array.isArray(v)) { + if (v != null && !readsFeature(v)) { map.value.setPaintProperty(layer, prop, ['case', ['in', ['get', 'iso_3166_1_alpha_3'], ['literal', []]], v, v]) } } catch (_) { /* a style without the layer: nothing to warm */ }