Fix layer map bounciness (#361)
This commit is contained in:
parent
39902ce7d1
commit
c71209507b
2 changed files with 11 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue