Remember last custom basemap

pull/1256/head v1.9.16
Piero Toffanin 2022-10-19 11:11:49 -04:00
rodzic 7ab2b14ba6
commit 446fdb7987
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -384,12 +384,14 @@ class Map extends React.Component {
const customLayer = L.layerGroup();
customLayer.on("add", a => {
const defaultCustomBm = window.localStorage.getItem('lastCustomBasemap') || 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png';
let url = window.prompt([_('Enter a tile URL template. Valid coordinates are:'),
_('{z}, {x}, {y} for Z/X/Y tile scheme'),
_('{-y} for flipped TMS-style Y coordinates'),
'',
_('Example:'),
'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'].join("\n"), 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png');
'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'].join("\n"), defaultCustomBm);
if (url){
customLayer.clearLayers();
@ -400,6 +402,7 @@ _('Example:'),
});
customLayer.addLayer(l);
l.bringToBack();
window.localStorage.setItem('lastCustomBasemap', url);
}
});
this.basemaps[_("Custom")] = customLayer;