Skip to content

Commit f42f12a

Browse files
authored
Merge pull request #39 from Jackass4life/copilot/fix-center-function-issue
Fix map centering to trigger on click instead of hover
2 parents cbd3034 + b06db09 commit f42f12a

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

static/js/map.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ function bindHoverAndLock(marker) {
524524
}
525525
const el = marker.getPopup()?.getElement();
526526
if (el) el.classList.add("popup-locked");
527+
map.panTo(marker.getLatLng());
527528
});
528529

529530
// --- keep popup alive while cursor is inside it ---
@@ -563,14 +564,6 @@ function addMarker(loc) {
563564
marker.addTo(markerLayer);
564565
}
565566

566-
// Center map on marker when its popup opens
567-
map.on('popupopen', (e) => {
568-
const latlng = e.popup.getLatLng();
569-
if (latlng) {
570-
map.panTo(latlng);
571-
}
572-
});
573-
574567
// Re-cluster on zoom
575568
map.on('zoomend', () => {
576569
if (allLocations.length > CLUSTER_THRESHOLD) {

0 commit comments

Comments
 (0)