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() { function shown() {
miniMap.invalidateSize(); miniMap.invalidateSize();
setView(); setView({animate: false});
map.on('moveend', setView); map.on('moveend', moved);
} }
function hide() { function hide() {
map.off('moveend', setView); map.off('moveend', moved);
} }
function setView() { function moved() {
miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0)); 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; current = pane;
} }
map.invalidateSize({pan: false, animate: false});
current current
.show() .show()
.trigger('show'); .trigger('show');
map.invalidateSize({pan: false, animate: false});
}; };
return control; return control;