Skip to content

Commit

Permalink
Move center to marker when clicked (#388)
Browse files Browse the repository at this point in the history
* Pan center to the marker upon clicking

* Properly bind onPopupOpen

* Messed up parameter types

* Fine-tune panTo parameters

* This should be the fix

* So yet again I forgot to save

* Move impllentation back to AbstractIconOverlay

* cleanup

* Yet another attempt

* Move panTo to marker
  • Loading branch information
Emojigit committed Jun 28, 2024
1 parent ff1b0dc commit 89ea214
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion public/js/map/MapFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import RealtimeTileLayer from './RealtimeTileLayer.js';

import config from '../config.js';


export function createMap(node, layerId, zoom, lat, lon){

const cfg = config.get();
Expand Down
5 changes: 5 additions & 0 deletions public/js/map/overlays/AbstractIconOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ export default L.LayerGroup.extend({
popup = self.createPopup(obj);
if (popup)
marker.bindPopup(popup);

marker.on('click', function () {
self.map.panTo(marker.getLatLng());
});

marker.addTo(self);

self.currentObjects[hash] = marker;
Expand Down

0 comments on commit 89ea214

Please sign in to comment.