Fix map breakage: zoom expr can't be nested in a case (circle-stroke-width)
Some checks are pending
build / lint-test (push) Waiting to run
build / build-push (push) Blocked by required conditions

The low_accuracy ring nested a zoom interpolate inside a case, which MapLibre rejects at addLayer — the vehicles-circle/arrow/label layers never loaded, so no markers and no trip clicks. Move interpolate to top level with case in the output stops.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kianiadee 2026-05-29 10:07:42 +03:00
parent 84e9421b4d
commit 0724dd017f

View file

@ -206,14 +206,14 @@ export function initMap(elementId, opts = {}) {
['==', ['get', 'low_accuracy'], true], '#f59e0b', ['==', ['get', 'low_accuracy'], true], '#f59e0b',
'#0b1220', '#0b1220',
], ],
// zoom must stay the top-level interpolate input; the low-accuracy
// widening goes in the per-stop output (a `case`), since MapLibre
// forbids a zoom expression nested inside a `case`.
'circle-stroke-width': [ 'circle-stroke-width': [
'case', 'interpolate', ['linear'], ['zoom'],
['==', ['get', 'low_accuracy'], true], 2.5, 5, ['case', ['==', ['get', 'low_accuracy'], true], 2.5, 0.5],
['interpolate', ['linear'], ['zoom'], 12, ['case', ['==', ['get', 'low_accuracy'], true], 2.5, 1.5],
5, 0.5, 16, ['case', ['==', ['get', 'low_accuracy'], true], 2.5, 2],
12, 1.5,
16, 2,
],
], ],
}, },
}); });