Don't centre on load if the location is already in view

This commit is contained in:
Tom Hughes 2014-11-01 17:20:26 +00:00
parent 9b26dc79c6
commit c4746efdb5

View file

@ -293,8 +293,7 @@ OSM.Query = function(map) {
var params = querystring.parse(path.substring(path.indexOf('?') + 1)), var params = querystring.parse(path.substring(path.indexOf('?') + 1)),
latlng = L.latLng(params.lat, params.lon); latlng = L.latLng(params.lat, params.lon);
if (!window.location.hash && if (!window.location.hash && !noCentre && !map.getBounds().contains(latlng)) {
(!noCentre || !map.getBounds().contains(latlng))) {
OSM.router.withoutMoveListener(function () { OSM.router.withoutMoveListener(function () {
map.setView(latlng, 15); map.setView(latlng, 15);
}); });