From 446fdb798742bc2693f28d2505ee6762bf26166f Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 19 Oct 2022 11:11:49 -0400 Subject: [PATCH] Remember last custom basemap --- app/static/app/js/components/Map.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/static/app/js/components/Map.jsx b/app/static/app/js/components/Map.jsx index c15e42d9..6604a829 100644 --- a/app/static/app/js/components/Map.jsx +++ b/app/static/app/js/components/Map.jsx @@ -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;