diff --git a/js/map.js b/js/map.js index 439048d..960939f 100644 --- a/js/map.js +++ b/js/map.js @@ -49,10 +49,10 @@ export async function init(){ // Polygone définissant les limites de la carte fetch("./couches/emprise.geojson").then(res => res.json()).then(geojson => { let coordinate_list = geojson.features[0].geometry.coordinates[0] - let first_point = map.project(L.latLng([...coordinate_list[0]].reverse())) - let bounds = L.bounds(first_point, first_point) + let first_point = L.latLng([...coordinate_list[0]].reverse()) + let bounds = L.latLngBounds(first_point, first_point) for(let i = 1; i { + if(map_bounds.contains(map.getCenter())){ + map.setMaxZoom(21) + } else { + map.setMaxZoom(18) + } + }) + // La couche Openstreetmap standard L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' @@ -84,7 +92,7 @@ export async function init(){ ).addTo(map) // Parametrage de la carte initiale - map.setMaxBounds(map_bounds) + //map.setMaxBounds(map_bounds) map.setView(map_center, 19, { animate: false, })