Don't start follow mode immediately

This commit is contained in:
fkloft 2013-12-24 11:48:01 +01:00
parent 4b415dba59
commit 7ff4c79910

View File

@ -102,13 +102,15 @@ window.plugin.userLocation.locate = function(lat, lng, accuracy) {
// so limit to 17 (enough to see all portals) // so limit to 17 (enough to see all portals)
zoom = Math.min(zoom,17); zoom = Math.min(zoom,17);
window.map.setView(latlng, zoom); if(window.map.getCenter().distanceTo(latlng) < 10) {
window.plugin.userLocation.follow = true; window.plugin.userLocation.follow = true;
if(typeof android !== 'undefined' && android && android.setFollowMode) if(typeof android !== 'undefined' && android && android.setFollowMode)
android.setFollowMode(window.plugin.userLocation.follow); android.setFollowMode(window.plugin.userLocation.follow);
} }
window.map.setView(latlng, zoom);
}
window.plugin.userLocation.onLocationChange = function(lat, lng) { window.plugin.userLocation.onLocationChange = function(lat, lng) {
var latlng = new L.LatLng(lat, lng); var latlng = new L.LatLng(lat, lng);
window.plugin.userLocation.marker.setLatLng(latlng); window.plugin.userLocation.marker.setLatLng(latlng);