felt/static/map.js

15 lines
366 B
JavaScript
Raw Normal View History

2023-07-03 05:10:58 +00:00
let map = null;
let mapImg = null;
2023-07-03 05:10:58 +00:00
function initializeMap(mapImgUrl) {
if (!map) {
map = L.map('map', { minZoom: 0, maxZoom: 4, crs: L.CRS.Simple });
}
if (mapImg) {
mapImg.removeFrom(map);
}
mapImg = L.imageOverlay(mapImgUrl, [[-180, 180],[180, -180]]);
mapImg.addTo(map);
2023-07-03 05:10:58 +00:00
map.setMaxBounds([[-180,180],[180,-180]]);
map.setView([0,0], 2);
}