Country posters: clearing a highlight keeps the region paints data-driven
The load-time pre-warm made the regions fill and border paints data-driven, but every clear (clearCountryHighlight, clearAllHighlights and the reset branches) wrote the plain constants back. All 18 writes now use regionIdle(v), the same identical-branch case the pre-warm uses, so the property never returns to its constant variant and a second highlight cannot re-pay a variant switch. Nothing changes on screen.
This commit is contained in:
parent
ad822c0f31
commit
db7cc16907
1 changed files with 25 additions and 18 deletions
|
|
@ -659,6 +659,13 @@ async function highlightCountryByIso(iso3) {
|
|||
// Reverse highlightCountryByIso: reset the regions polygon paint to default and
|
||||
// re-hide it when we're not on the Regions tab (a country search may have shown
|
||||
// it cross-tab). Used when the user picks a non-country result or clears search.
|
||||
// A region paint's idle value, kept DATA-DRIVEN: ['case', …, v, v] draws exactly v, but the property never
|
||||
// drops back to a plain constant. The load-time pre-warm wraps the layer's paints this way; a clear that
|
||||
// wrote the plain value would put the property back on its constant variant, and whether an engine
|
||||
// then re-pays the variant switch on the next highlight is engine-internal. Keeping every write on the
|
||||
// data-driven form makes it a non-question (upg100 / dx-shepherd CLR).
|
||||
function regionIdle(v) { return ['case', ['has', 'iso_3166_1_alpha_3'], v, v] }
|
||||
|
||||
function clearCountryHighlight() {
|
||||
// Always drop the country boundary outline first — it's independent of
|
||||
// regions-fill, so it must clear even when that layer isn't present (tabs
|
||||
|
|
@ -666,10 +673,10 @@ function clearCountryHighlight() {
|
|||
countryOutline.clearCountry()
|
||||
const m = map.value
|
||||
if (!m || !m.getLayer('regions-fill')) return
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.20)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.20))
|
||||
m.setPaintProperty('regions-fill', 'fill-outline-color', null)
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
if (activeTab.value?.id !== 'doxa-regions') {
|
||||
m.setLayoutProperty('regions-fill', 'visibility', 'none')
|
||||
m.setLayoutProperty('regions-border', 'visibility', 'none')
|
||||
|
|
@ -1043,9 +1050,9 @@ function onSemanticTreeSelect(node) {
|
|||
}
|
||||
// Reset region polygon highlight when deselecting on the WAGF Regions tab.
|
||||
if (m && m.getLayer('regions-fill')) {
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.7)
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.7))
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
}
|
||||
if (mapStore.selectedFamily) mapStore.selectFamily(null)
|
||||
if (mapStore.selectedLanguage) mapStore.selectLanguage(null)
|
||||
|
|
@ -1133,9 +1140,9 @@ function onSemanticTreeSelect(node) {
|
|||
'case', ['in', ['get', 'iso_3166_1_alpha_3'], isoArr], 2.5, 0.3
|
||||
])
|
||||
} else {
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.7)
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.7))
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1629,12 +1636,12 @@ function clearAllHighlights(m) {
|
|||
_syncHitboxFilter(m, null)
|
||||
mapLayers.syncGlowFilter(null)
|
||||
if (m.getLayer('regions-fill')) {
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.7)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.7))
|
||||
m.setPaintProperty('regions-fill', 'fill-outline-color', null)
|
||||
}
|
||||
if (m.getLayer('regions-border')) {
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
}
|
||||
_lastHL.family = _lastHL.language = _lastHL.dialect = _lastHL.region = null
|
||||
_lastHL.prayer = _lastHL.engagement = _lastHL.adoption = null
|
||||
|
|
@ -1767,9 +1774,9 @@ function applyDimFilter(detail) {
|
|||
'case', ['in', ['get', 'iso_3166_1_alpha_3'], isoArr], 2.5, 0.3
|
||||
])
|
||||
} else {
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.7)
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.7))
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1852,9 +1859,9 @@ function applyDimFilter(detail) {
|
|||
_syncHitboxFilter(m, matchExpr)
|
||||
mapLayers.syncGlowFilter(matchExpr)
|
||||
if (m.getLayer('regions-fill')) {
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', 0.20)
|
||||
m.setPaintProperty('regions-border', 'line-color', 'rgba(60,60,80,0.35)')
|
||||
m.setPaintProperty('regions-border', 'line-width', 0.6)
|
||||
m.setPaintProperty('regions-fill', 'fill-opacity', regionIdle(0.20))
|
||||
m.setPaintProperty('regions-border', 'line-color', regionIdle('rgba(60,60,80,0.35)'))
|
||||
m.setPaintProperty('regions-border', 'line-width', regionIdle(0.6))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue