Restricted map bounds

This commit is contained in:
Alexandre Vryghem
2025-08-18 18:37:48 +02:00
parent bcc437d029
commit 643836addc

View File

@@ -150,13 +150,19 @@ export class GeospatialMapComponent implements AfterViewInit, OnInit, OnDestroy
this.map = L.map(el, { this.map = L.map(el, {
center: this.DEFAULT_CENTRE_POINT, center: this.DEFAULT_CENTRE_POINT,
zoom: 11, zoom: 11,
worldCopyJump: true,
maxBoundsViscosity: 1.0,
maxBounds: [
[-85, -Infinity],
[85, Infinity],
],
}); });
const tileProviders = environment.geospatialMapViewer.tileProviders; const tileProviders = environment.geospatialMapViewer.tileProviders;
for (let i = 0; i < tileProviders.length; i++) { for (let i = 0; i < tileProviders.length; i++) {
// Add tiles to the map // Add tiles to the map
const tiles = L.tileLayer.provider(tileProviders[i], { const tiles = L.tileLayer.provider(tileProviders[i], {
maxZoom: 18, maxZoom: 18,
minZoom: 3, minZoom: 1,
}); });
tiles.addTo(this.map); tiles.addTo(this.map);
} }