-
Notifications
You must be signed in to change notification settings - Fork 224
labels not moving after panTo in Leaflet #142
Comments
Hi, we have exactly the same issue. The panTo is triggered from an anchor tag with a data-position attribute. the map pans but the labels not. |
Just to add some more details: The data that is labeled is a geojson layer. I just realized, that they don't move if the pan distance is to far to just move the map a bit. |
I have a similar problem with Leaflet Search plugins What would the best way to redraw the labels or to get leaflet to redraw the overlay container after a move? My guess is it is an issue with either the leaflet Label plugin or the Leaflet itself. But I originally made a post on the Leaflet Search Git found at stefanocudini/leaflet-search#127. |
I think I found a solution. I found that the labels were being updated in the label sources code using two leaflet event, moveend and viewreset. The event viewreset is suppose to trigger when the map is triggered by something other than the mouse. more info on view reset can be found at http://leafletjs.com/reference-1.0.0.html#map-event. In the file leaflet.label-src.js around line 197 I commented out the
I found the orgin of This fixed the problem for Hopefully someone can provide a better solution then my hack. Thanks |
Thanks TranquilAbyss, this fix also works for me. I assume it's an issue with the viewReset event not having the hard attribute. Version mismatch? |
If call map.panTo(...) in Leaflet, labels are stays at screen, but map and view are moved.
How tell to labels to update position? Bug?
The text was updated successfully, but these errors were encountered: