limit zoom level on 'locate' function on mobile - otherwise you can end up *way* too close with maps supporting high zoom levels (e.g. bing, nokia ovi)

This commit is contained in:
Jon Atkins 2013-12-19 03:49:31 +00:00
parent e536fb6d12
commit 4828fd3fba

View File

@ -79,6 +79,11 @@ window.plugin.userLocation.locate = function(lat, lng, accuracy) {
var zoom = window.map.getBoundsZoom(L.latLngBounds(
[lat - latAccuracy, lng - lngAccuracy],
[lat + latAccuracy, lng + lngAccuracy]));
// an extremely close view is pretty pointless (especially with maps that support zoom level 20+)
// so limit to 17 (enough to see all portals)
zoom = Math.min(zoom,17);
window.map.setView(latlng, zoom);
}