Properly set bounds on multipoint map startup
This commit is contained in:
parent
6c922ec9df
commit
2283aba713
1 changed files with 1 additions and 5 deletions
|
|
@ -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", {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue