Merge pull request #3571 from rowanwins/layerControlScroll
Scrollbar for layers control with too many layers
This commit is contained in:
commit
c38159d986
4
dist/leaflet.css
vendored
4
dist/leaflet.css
vendored
@ -331,6 +331,10 @@
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers-scrollbar {
|
||||
overflow-y: scroll;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.leaflet-control-layers-selector {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
|
@ -248,6 +248,12 @@ L.Control.Layers = L.Control.extend({
|
||||
|
||||
_expand: function () {
|
||||
L.DomUtil.addClass(this._container, 'leaflet-control-layers-expanded');
|
||||
var acceptableHeight = this._map._size.y - (this._container.offsetTop * 4);
|
||||
if (acceptableHeight < this._form.clientHeight)
|
||||
{
|
||||
L.DomUtil.addClass(this._form, 'leaflet-control-layers-scrollbar');
|
||||
this._form.style.height = acceptableHeight + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
_collapse: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user