From 3501c38debe0504796b2e24d302a46987f7d28b6 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 5 Mar 2026 16:04:58 +0000 Subject: [PATCH] Move the map to fit the pools on selection --- html/static/js/map-multipoint.js | 9 +++++-- html/template/sync/intelligence-root.html | 31 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/html/static/js/map-multipoint.js b/html/static/js/map-multipoint.js index b75c0632..f7a25d3b 100644 --- a/html/static/js/map-multipoint.js +++ b/html/static/js/map-multipoint.js @@ -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); } diff --git a/html/template/sync/intelligence-root.html b/html/template/sync/intelligence-root.html index 1fd06ae3..879e7bb6 100644 --- a/html/template/sync/intelligence-root.html +++ b/html/template/sync/intelligence-root.html @@ -13,6 +13,33 @@ >