leaflet-locatecontrol icon indicating copy to clipboard operation
leaflet-locatecontrol copied to clipboard

added oneshot callback (trigger, then stop) when location is found

Open valerino opened this issue 2 years ago • 2 comments

valerino avatar Oct 03 '23 09:10 valerino

Thanks for the updates. Why is this functionality required to be inside the plugin rather than something controlled from the outside (by listening to location updates on the map and then calling stop on the plugin)?

domoritz avatar Oct 16 '23 01:10 domoritz

I'm not the OP but I also came here looking for this functionality.

In my case, I'm using React, and I'd like to have more fine-grained control over the panning/zoom when the user's location is found, panning to a viewRect which encompasses both their location and also a target marker for their destination.

Because leaflet-locatecontrol does not expose the native event, I'd need to add a second custom component inside <MapContainer> simply to hook into this event and pass it up to the parent.

urb4nc4rl avatar Nov 14 '23 14:11 urb4nc4rl