Use L.CRS.Simple in leaflet, that maps coordinates to pixels

This commit is contained in:
jordi fita mas 2024-01-25 02:16:16 +01:00
parent dc7098daf3
commit 0da6845bde
1 changed files with 4 additions and 2 deletions

View File

@ -28,13 +28,15 @@
const latLngBounds = L.latLngBounds([[0, 0], [1192, 1500]]); const latLngBounds = L.latLngBounds([[0, 0], [1192, 1500]]);
const map = L.map(container, { const map = L.map(container, {
center: latLngBounds.getCenter(), center: latLngBounds.getCenter(),
zoom: 4, minZoom: -2,
maxZoom: 3,
zoom: -1,
scrollWheelZoom: false, scrollWheelZoom: false,
maxBounds: latLngBounds, maxBounds: latLngBounds,
maxBoundsViscosity: 1.0, maxBoundsViscosity: 1.0,
zoomSnap: 0, zoomSnap: 0,
crs: L.CRS.Simple,
}); });
map.setMinZoom(map.getBoundsZoom(latLngBounds, true));
map.fitBounds(latLngBounds); map.fitBounds(latLngBounds);
L.svgOverlay(svg, latLngBounds).addTo(map); L.svgOverlay(svg, latLngBounds).addTo(map);
})(); })();