Move the map to fit the pools on selection

This commit is contained in:
Eli Ribble 2026-03-05 16:04:58 +00:00
parent 8e64ba8032
commit 3501c38deb
No known key found for this signature in database
2 changed files with 38 additions and 2 deletions

View file

@ -45,9 +45,11 @@ class MapMultipoint extends HTMLElement {
center: centroid.coordinates,
container: mapElement,
style: "https://tiles.stadiamaps.com/styles/osm_bright.json",
}).fitBounds(bounds, {
padding: { top: 10, bottom: 10, left: 10, right: 10 },
});
let camera_transform = this._map.cameraForBounds(bounds, {
padding: 10,
});
this._map.setZoom(camera_transform.zoom);
this._map.on("load", () => {
if (organization_id != 0) {
this._map.addSource("tegola", {
@ -110,6 +112,9 @@ class MapMultipoint extends HTMLElement {
return this._map.queryRenderedFeatures(a);
}
FitBounds(bounds, options) {
return this._map.fitBounds(bounds, options);
}
SetLayoutProperty(layout, property, value) {
return this._map.setLayoutProperty(layout, property, value);
}