Skip to content

Commit

Permalink
Hover activated in map to show sample name
Browse files Browse the repository at this point in the history
  • Loading branch information
steps39 committed Sep 9, 2024
1 parent ecede90 commit 26484b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sdeMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ function sampleMap(meas) {
let chart_div = document.getElementById("c_radar_" + dateSampled + ": " + sample);
// just bodge to allow display of position const marker = L.marker([lat, lon], { icon: currentIcon }).addTo(map).bindPopup(chart_div,{autoClose:false,closeOnClick:false});
// popup.setContent(chart_div);
const marker = L.marker([lat, lon], { icon: currentIcon }).addTo(map).bindPopup(`<b>${dateSampled}: ${sample}</b><br>Latitude: ${lat}<br>Longitude: ${lon}`);
//const marker = L.marker([lat, lon], { icon: currentIcon }, {title: `${dateSampled}: ${sample}`}, {riseOnHover: true} ).
const marker = L.marker([lat, lon], { icon: currentIcon }).
addTo(map).bindPopup(`<b>${dateSampled}: ${sample}</b><br>Latitude: ${lat}<br>Longitude: ${lon}`).bindTooltip(`${dateSampled}: ${sample}`);
// const marker = L.marker([lat, lon], { icon: currentIcon }).addTo(map);
//const marker = L.marker([lat, lon], { icon: currentIcon }).addTo(map).bindPopup(`<b>${dateSampled}: ${sample}</b><br>Latitude: ${lat}<br>Longitude: ${lon}<br>${popupStatic}`);
/* const marker = L.circleMarker([lat, lon],
Expand Down Expand Up @@ -149,6 +151,10 @@ console.log(popup);
// Create a highlight for each sample
//console.log(sampleNo,lat,lon);
highlightMarkers[sampleNo] = new L.marker(new L.LatLng(lat, lon), { icon: highlightIcon });
// addTo(map).bindPopup(`<b>${dateSampled}: ${sample}</b><br>Latitude: ${lat}<br>Longitude: ${lon}`);
highlightMarkers[sampleNo].bindTooltip(`${dateSampled}: ${sample}`);


// Add a click event listener to the highlight marker
highlightMarkers[sampleNo].on('click', function () {
// Mark not just the clicked position but any things which are in the same place
Expand Down

0 comments on commit 26484b0

Please sign in to comment.