bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
141 stars 72 forks source link

zoom issues with popup that is visible on start-up #141

Closed ztzthu closed 1 year ago

ztzthu commented 3 years ago

Thanks for the plugin! This plugin is super useful for me as a regular leaflet and osm user.

However I found that the "fitbounds" value are not working properly when a pop-up near the border is opened on start-up. While I know it might be hard to calculate the correct zoom lever under this case, can we be given to choice to set the zoom level = "zoom level of fitbounds - 1", or add a padding option just like in https://leafletjs.com/reference-1.7.1.html#fitbounds-options-paddingtopleft ?

Thanks!

bozdoz commented 2 years ago

Ah I think I understand; opening the popup probably causes leaflet to zoom to include that popup, and then the fitbounds intention changes the bounds again, not including the popup. Not sure how that could be fixed; it might just be that for your case you should manually adjust the bounds, or do not show the popup initially