Properly set bounds on multipoint map startup

This commit is contained in:
Eli Ribble 2026-03-05 19:09:45 +00:00
parent 6c922ec9df
commit 2283aba713
No known key found for this signature in database

View file

@ -42,14 +42,10 @@ class MapMultipoint extends HTMLElement {
const mapElement = this.shadowRoot.querySelector("#map"); const mapElement = this.shadowRoot.querySelector("#map");
this._map = new maplibregl.Map({ this._map = new maplibregl.Map({
center: centroid.coordinates, bounds: bounds,
container: mapElement, container: mapElement,
style: "https://tiles.stadiamaps.com/styles/osm_bright.json", style: "https://tiles.stadiamaps.com/styles/osm_bright.json",
}); });
let camera_transform = this._map.cameraForBounds(bounds, {
padding: 10,
});
this._map.setZoom(camera_transform.zoom);
this._map.on("load", () => { this._map.on("load", () => {
if (organization_id != 0) { if (organization_id != 0) {
this._map.addSource("tegola", { this._map.addSource("tegola", {