Fix layer map bounciness (#361)

This commit is contained in:
John Firebaugh 2013-07-20 12:58:43 -07:00 committed by Tom Hughes
parent 39902ce7d1
commit c71209507b
2 changed files with 11 additions and 7 deletions

View file

@ -64,16 +64,20 @@ L.OSM.layers = function(options) {
function shown() {
miniMap.invalidateSize();
setView();
map.on('moveend', setView);
setView({animate: false});
map.on('moveend', moved);
}
function hide() {
map.off('moveend', setView);
map.off('moveend', moved);
}
function setView() {
miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0));
function moved() {
setView();
}
function setView(options) {
miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0), options);
}
});

View file

@ -28,11 +28,11 @@ L.OSM.sidebar = function(selector) {
current = pane;
}
map.invalidateSize({pan: false, animate: false});
current
.show()
.trigger('show');
map.invalidateSize({pan: false, animate: false});
};
return control;