Only one pane visible at a time
This commit is contained in:
parent
1f4e41f672
commit
a6ac56c5e5
5 changed files with 78 additions and 52 deletions
|
@ -16,8 +16,7 @@ L.OSM.layers = function(options) {
|
|||
.appendTo($container);
|
||||
|
||||
var $ui = $('<div>')
|
||||
.attr('class', 'layers-ui')
|
||||
.appendTo(options.uiPane);
|
||||
.attr('class', 'layers-ui');
|
||||
|
||||
$('<h2>')
|
||||
.text(I18n.t('javascripts.map.layers.header'))
|
||||
|
@ -124,25 +123,23 @@ L.OSM.layers = function(options) {
|
|||
});
|
||||
});
|
||||
|
||||
function toggle(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
options.sidebar.addPane($ui);
|
||||
|
||||
var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
|
||||
|
||||
if ($ui.is(':visible')) {
|
||||
$(control.options.uiPane).hide();
|
||||
controlContainer.css({paddingRight: '0'});
|
||||
} else {
|
||||
$(control.options.uiPane).show();
|
||||
controlContainer.css({paddingRight: '230px'});
|
||||
}
|
||||
$ui
|
||||
.on('show', shown);
|
||||
|
||||
function shown() {
|
||||
$ui.find('.base-layers .leaflet-container').each(function() {
|
||||
$(this).data('map').invalidateSize();
|
||||
});
|
||||
}
|
||||
|
||||
function toggle(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
options.sidebar.togglePane($ui);
|
||||
}
|
||||
|
||||
return $container[0];
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue