Don't animate aggregate map, just jump there.

This commit is contained in:
Eli Ribble 2026-03-05 17:40:28 +00:00
parent dd50035a47
commit 3a747b2b1d
No known key found for this signature in database

View file

@ -1,4 +1,3 @@
var map = null;
// A map that can be used to locate a single point by setting its location explicitly // A map that can be used to locate a single point by setting its location explicitly
// or by allowing the user to move a marker. // or by allowing the user to move a marker.
class MapAggregate extends HTMLElement { class MapAggregate extends HTMLElement {
@ -42,9 +41,11 @@ class MapAggregate extends HTMLElement {
center: centroid.coordinates, center: centroid.coordinates,
container: mapElement, container: mapElement,
style: "https://tiles.stadiamaps.com/styles/alidade_smooth.json", style: "https://tiles.stadiamaps.com/styles/alidade_smooth.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", () => { this._map.on("load", () => {
this._map.addSource("tegola", { this._map.addSource("tegola", {
type: "vector", type: "vector",