Skip to content

Commit db6242e

Browse files
committed
fix image loading after basemap switch
1 parent a1e1bee commit db6242e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/javascript/maplibre/map.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { resetEditMode } from 'maplibre/edit';
1212
import { highlightFeature, resetHighlightedFeature } from 'maplibre/feature';
1313
import { getFeature, initializeLayers, initializeLayerSources, initializeLayerStyles, layers, renderLayers } from 'maplibre/layers/layers';
1414
import { basemaps, defaultFont, demSource, elevationSource } from 'maplibre/styles/basemaps';
15-
import { loadImage, setStyleDefaultFont } from 'maplibre/styles/styles';
15+
import { clearImageState, loadImage, setStyleDefaultFont } from 'maplibre/styles/styles';
1616

1717
export let map
1818
export let mapProperties
@@ -461,6 +461,8 @@ export function setBackgroundMapLayer (mapName = mapProperties.base_map, force =
461461
backgroundContours = mapProperties.contours
462462
backgroundGlobe = mapProperties.globe
463463
setStyleDefaultFont(basemap.font || defaultFont)
464+
// Clear image cache so icons can be re-loaded after basemap change
465+
clearImageState()
464466
map.setStyle(basemap.style, { diff: true, strictMode: true })
465467
}
466468
}

0 commit comments

Comments
 (0)