You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when you move the map and change the zoom to something that resembles this...
And then click Reset Location, the map doesn't display as expected, instead it just zooms in.
Sometimes if you click Reset Location again it resets as expected. Other times it doesn't seem to matter how often you click Reset Location, the map doesn't display the expected location.
You'll also see inconsistencies in the way m.center returns a value
The text was updated successfully, but these errors were encountered:
That's indeed unexpected!
It looks like adding self.update() in leaflet.py before calling self.run_method('setCenter', center) or self.run_method('setZoom', zoom) avoids this problem. This reminds me of PR #2779 where we experiment with a very similar solution.
Like in PR #2779 I switched to sending normal updates to the client and using the updated lifecycle hook instead of using run_method to update center and zoom.
Furthermore, I replaced panTo and setZoom with a single setView. Only then the bug disappeared reliably.
Discussed in #2825
Originally posted by thetableman April 5, 2024
Consider the below Leaflet example:
When executed it displays as expected.
However, when you move the map and change the zoom to something that resembles this...
And then click
Reset Location
, the map doesn't display as expected, instead it just zooms in.Sometimes if you click
Reset Location
again it resets as expected. Other times it doesn't seem to matter how often you clickReset Location
, the map doesn't display the expected location.You'll also see inconsistencies in the way
m.center
returns a valueThe text was updated successfully, but these errors were encountered: