31 lines
698 B
JavaScript
31 lines
698 B
JavaScript
import { GisState } from "./state.js";
|
|
|
|
/**
|
|
* Functions / utilities to manipulate the Leaflet map
|
|
* @module Map
|
|
*/
|
|
|
|
/**
|
|
* Saves the current state of the map
|
|
* @param {L.Map} map
|
|
*/
|
|
export function saveCurrentState(map) {
|
|
let currentBase = {};
|
|
for (let key of Object.keys(GisState.baseLayers)) {
|
|
if (map.hasLayer(GisState.baseLayers[key])) {
|
|
currentBase = GisState.baseLayers[key];
|
|
break;
|
|
}
|
|
}
|
|
GisState.currentMapState = {
|
|
baseLayer: currentBase,
|
|
zoom: map.getZoom(),
|
|
center: map.getCenter(),
|
|
minZoom: map.getMinZoom(),
|
|
maxZoom: map.getMaxZoom(),
|
|
}
|
|
}
|
|
|
|
function getCurrentState() {
|
|
//TODO
|
|
} |