From 4828fd3fbaa0f777c7b2312151c9785d0570c5b3 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Thu, 19 Dec 2013 03:49:31 +0000 Subject: [PATCH] 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) --- mobile/plugins/user-location.user.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/plugins/user-location.user.js b/mobile/plugins/user-location.user.js index 1ca8dd90..03cf5f7e 100644 --- a/mobile/plugins/user-location.user.js +++ b/mobile/plugins/user-location.user.js @@ -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); }