Skip to content

Commit

Permalink
fix(apis_entities): fix faulty map JS
Browse files Browse the repository at this point in the history
Fix references to longitude, latitude values,
incorrect check for existing map.
  • Loading branch information
koeaw committed May 15, 2024
1 parent ec96a62 commit fdad6f7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@

function showMap(element) {
$('.popover').remove();
let map;

let rect = element.getBoundingClientRect();
let pTop = rect.top + window.scrollY - 250;
Expand All @@ -187,13 +188,13 @@
$(mapDiv).offset({top: pTop, left: pLeft});
document.body.appendChild(mapDiv);

if (typeof map != "undefined") { map.off(); map.remove(); }
if (typeof map !== "undefined") { map.off(); map.remove(); }

let map = L.map('popovermap', { center: [element.dataset.lat, element.dataset.lng], zoom: 5 });
map = L.map('popovermap', { center: [parseInt(element.dataset.latitude), parseInt(element.dataset.longitude)], zoom: 5 });
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([element.dataset.lat, element.dataset.lng]).addTo(map);
L.marker([parseInt(element.dataset.latitude), parseInt(element.dataset.longitude)]).addTo(map);
}

function delMap(element) {
Expand Down

0 comments on commit fdad6f7

Please sign in to comment.