don't leave follow mode on mapmove for a variable zoom
the user may want to use different zooms in follow mode (for example if he rides a bike or drives a car)...unfortunately, leaflet triggers maps movestart event _before_ the zoomstart event. this makes it impossible to differentiate between a mapmove triggered by a zoom-event or a move-event. the user can leave the follow mode by pressing the getLocation button...this should be enough.
This commit is contained in:
parent
be91809e84
commit
b5ffcb5448
@ -60,20 +60,10 @@ window.plugin.userLocation.setup = function() {
|
||||
window.plugin.userLocation.circle = circle;
|
||||
window.plugin.userLocation.icon = icon;
|
||||
|
||||
window.map.on('movestart', window.plugin.userLocation.onMoveStart);
|
||||
window.map.on('zoomend', window.plugin.userLocation.onZoomEnd);
|
||||
window.plugin.userLocation.onZoomEnd();
|
||||
};
|
||||
|
||||
window.plugin.userLocation.onMoveStart = function(e) {
|
||||
if(window.plugin.userLocation.moving)
|
||||
return;
|
||||
|
||||
window.plugin.userLocation.follow = false;
|
||||
if(typeof android !== 'undefined' && android && android.setFollowMode)
|
||||
android.setFollowMode(window.plugin.userLocation.follow);
|
||||
};
|
||||
|
||||
window.plugin.userLocation.onZoomEnd = function() {
|
||||
if(window.map.getZoom() < 16)
|
||||
window.plugin.userLocation.locationLayer.removeLayer(window.plugin.userLocation.circle);
|
||||
@ -122,9 +112,7 @@ window.plugin.userLocation.onLocationChange = function(lat, lng) {
|
||||
if(map.getBounds().pad(-0.15).contains(latlng))
|
||||
return;
|
||||
|
||||
window.plugin.userLocation.moving = true;
|
||||
window.map.setView(latlng);
|
||||
window.plugin.userLocation.moving = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user