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() {
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue