Commit cff88353 authored by Alexander Basov's avatar Alexander Basov
Browse files

fixed map layer's order

parent f53dd92e
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
jQuery(document).ready(function () { jQuery(document).ready(function () {
var map = L.map('map').setView([20, 0], 2); var map = L.map('map').setView([20, 0], 2);
var topPane = map._createPane('leaflet-top-pane', map.getPanes().mapPane);
var mapProviders = { var mapProviders = {
Openstreetmap: L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { Openstreetmap: L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
...@@ -188,8 +189,12 @@ ...@@ -188,8 +189,12 @@
}; };
if (cookieUtils.getCookie('mapProviders') && cookieUtils.getCookie('mapProviders') != '') { if (cookieUtils.getCookie('mapProviders') && cookieUtils.getCookie('mapProviders') != '') {
mapProviders[cookieUtils.getCookie('mapProviders')].addTo(map); mapProviders[cookieUtils.getCookie('mapProviders')].addTo(map);
topPane.appendChild(mapProviders[cookieUtils.getCookie('mapProviders')].getContainer());
mapProviders[cookieUtils.getCookie('mapProviders')].setZIndex(0);
} else { } else {
mapProviders.MapQuest.addTo(map); mapProviders.MapQuest.addTo(map);
topPane.appendChild(mapProviders[cookieUtils.getCookie('mapProviders')].getContainer());
mapProviders.MapQuest.setZIndex(0);
} }
$(document).on('cookieUpdate', function () { $(document).on('cookieUpdate', function () {
for (var key in mapProviders) { for (var key in mapProviders) {
...@@ -197,8 +202,12 @@ ...@@ -197,8 +202,12 @@
} }
if (cookieUtils.getCookie('mapProviders')) { if (cookieUtils.getCookie('mapProviders')) {
mapProviders[cookieUtils.getCookie('mapProviders')].addTo(map); mapProviders[cookieUtils.getCookie('mapProviders')].addTo(map);
topPane.appendChild(mapProviders[cookieUtils.getCookie('mapProviders')].getContainer());
mapProviders[cookieUtils.getCookie('mapProviders')].setZIndex(0);
} else { } else {
mapProviders.MapQuest.addTo(map); mapProviders.MapQuest.addTo(map);
topPane.appendChild(mapProviders[cookieUtils.getCookie('mapProviders')].getContainer());
mapProviders.MapQuest.setZIndex(0);
} }
}); });
$("body").on("click", ".map-provider", function (e) { $("body").on("click", ".map-provider", function (e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment