map.panTo - incorrect behavior when #1. After #2 user and so forth, it works

756 views
Skip to first unread message

Ricardo Freitas

unread,
Feb 6, 2013, 2:04:30 PM2/6/13
to leaflet-js
Hello everyone

I've been trying to get this to work but failed miserably and so, I come to request your help.

First things first: 


As you can see, when you load the page for the first time the map doesn't center on the marker (both coordinates are the same - the ones provided for the pan and the ones provided for the marker).

I understood that the center is slightly off in Firefox and Chrome.

If you try this in IE, you can see that the map won't even come close to the marker.


As I've been told by someone very patiente and helpful, this could be related to the map size not getting define before the marker is set and, thus, the dimensions of the container getting mixed up.

I don't think this is the case as after the #1 pan, every pan works fine.


Furthermore, I seem to have to execute, every single time the page loads, the "L.Util.requestAnimFrame(map.invalidateSize,map,!1,map._container);" fix, so all the tiles get loaded.

Is this a common situation?

Thank you very much for all your help.

Ricardo
Message has been deleted

Ricardo Freitas

unread,
Feb 7, 2013, 6:17:58 AM2/7/13
to leaflet-js
I've come to understand that this is due to a zoom factor.


If you change the zoom to < 9, the map stops working correctly.

I think this is valid for the first view only. 

Vladimir Agafonkin

unread,
Feb 8, 2013, 8:17:52 AM2/8/13
to leafl...@googlegroups.com
For others reading this message, here's an actual issue: https://github.com/Leaflet/Leaflet/issues/426

Ricardo Freitas

unread,
Feb 8, 2013, 9:33:18 AM2/8/13
to leaflet-js
Indeed. setView fixed it for me. Thanks for the tip, Vladimir.:)


--
 
---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages