Skip to content

Commit

Permalink
Update maplibre to v3.6.2 (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
aparlato authored Apr 8, 2024
1 parent 37227ae commit 4944620
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 60 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

- Update Maplibre GL to `v3.6.2`

## 0.15.0

- Switch to module for Stamen attribution
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.css

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"lodash.isequal": "^4.5.0",
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^2.14.1",
"maplibre-gl": "^2.4.0",
"maplibre-gl": "^3.6.2",
"postcss": "^8.4.23",
"sirv-cli": "^1.0.0",
"stamen-attribution": "github:stamen/stamen-attribution#v0.1.0",
Expand Down
27 changes: 15 additions & 12 deletions src/components/GlMap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
onMount(async () => {
await importRenderer();
const mapRenderer = renderer;
const glLibrary = renderer;
map = new mapRenderer.Map({
map = new glLibrary.Map({
container: id,
style: url,
preserveDrawingBuffer: true,
Expand Down Expand Up @@ -156,7 +156,7 @@
let renderedFeatures = map.queryRenderedFeatures(e.point);
if (!renderedFeatures.length) return;
if (!isPopupOpen) {
popup = new mapRenderer.Popup()
popup = new glLibrary.Popup()
.setLngLat(e.lngLat)
.setHTML(getPopupHtmlString(renderedFeatures))
.setMaxWidth(360)
Expand Down Expand Up @@ -194,15 +194,18 @@
// Resize the map when adding more maps and changing container size
$: if (map && numberOfMaps) {
map.once('render', () => {
const container = document.getElementById(id);
if (container) {
const resizeObserver = new ResizeObserver(() => {
map.resize({ resize: true });
});
resizeObserver.observe(container);
}
});
// As of `v3.0.0` maplibre no longer needs this resizing: https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md#potentially-breaking-changes
if (mapRenderer !== 'maplibre-gl') {
map.once('render', () => {
const container = document.getElementById(id);
if (container) {
const resizeObserver = new ResizeObserver(() => {
map.resize({ resize: true });
});
resizeObserver.observe(container);
}
});
}
}
</script>
Expand Down
1 change: 1 addition & 0 deletions src/components/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
mapStyle: map,
numberOfMaps: num,
};
setMapComponent(mapRenderer);
};
const setMapComponent = mapRenderer => {
Expand Down
235 changes: 194 additions & 41 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 4944620

Please sign in to comment.