Move center to marker when clicked (#388)

* 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
This commit is contained in:
1F616EMO~nya 2024-06-28 22:26:33 +08:00 committed by GitHub
parent ff1b0dc47a
commit 89ea214d02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -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();

View File

@ -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;