move subsection control beside section control
This commit is contained in:
parent
745510ff99
commit
5836219503
2 changed files with 18 additions and 3 deletions
|
@ -207,10 +207,14 @@ form button.invisiblesubmit {
|
||||||
.leaflet-control-sections {
|
.leaflet-control-sections {
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
.leaflet-control-subsections {
|
||||||
|
position:absolute;
|
||||||
|
}
|
||||||
.leaflet-control-sections a, .leaflet-control-sections a:hover {
|
.leaflet-control-sections a, .leaflet-control-sections a:hover {
|
||||||
width: auto;
|
width: auto;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 0 7px;
|
padding: 0 7px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.leaflet-touch .leaflet-control-sections a, .leaflet-touch .leaflet-control-sections a:hover {
|
.leaflet-touch .leaflet-control-sections a, .leaflet-touch .leaflet-control-sections a:hover {
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
|
@ -39,7 +39,10 @@ editor = {
|
||||||
});
|
});
|
||||||
|
|
||||||
editor._section_control = new SectionControl().addTo(editor.map);
|
editor._section_control = new SectionControl().addTo(editor.map);
|
||||||
editor._subsection_control = new SectionControl().addTo(editor.map);
|
editor._subsection_control = new SectionControl({addClasses: 'leaflet-control-subsections'}).addTo(editor.map);
|
||||||
|
|
||||||
|
editor._section_control_container = $(editor._section_control._container);
|
||||||
|
editor._subsection_control_container = $(editor._subsection_control._container);
|
||||||
|
|
||||||
editor.init_geometries();
|
editor.init_geometries();
|
||||||
},
|
},
|
||||||
|
@ -155,6 +158,13 @@ editor = {
|
||||||
|
|
||||||
editor._fill_section_control(editor._section_control, content.find('[data-sections] a'));
|
editor._fill_section_control(editor._section_control, content.find('[data-sections] a'));
|
||||||
editor._fill_section_control(editor._subsection_control, content.find('[data-subsections] a'));
|
editor._fill_section_control(editor._subsection_control, content.find('[data-subsections] a'));
|
||||||
|
|
||||||
|
var section_control_offset = $(editor._section_control_container).position();
|
||||||
|
var offset_parent = $(editor._section_control_container).offsetParent();
|
||||||
|
$(editor._subsection_control._container).css({
|
||||||
|
bottom: offset_parent.height()-section_control_offset.top-editor._section_control_container.height()-parseInt(editor._section_control_container.css('margin-bottom')),
|
||||||
|
right: offset_parent.width()-section_control_offset.left
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$('body').removeClass('map-enabled').removeClass('show-map');
|
$('body').removeClass('map-enabled').removeClass('show-map');
|
||||||
editor._section_control.hide();
|
editor._section_control.hide();
|
||||||
|
@ -509,11 +519,12 @@ editor = {
|
||||||
|
|
||||||
SectionControl = L.Control.extend({
|
SectionControl = L.Control.extend({
|
||||||
options: {
|
options: {
|
||||||
position: 'bottomright'
|
position: 'bottomright',
|
||||||
|
addClasses: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function () {
|
onAdd: function () {
|
||||||
this._container = L.DomUtil.create('div', 'leaflet-control-sections leaflet-bar');
|
this._container = L.DomUtil.create('div', 'leaflet-control-sections leaflet-bar '+this.options.addClasses);
|
||||||
this._sectionButtons = [];
|
this._sectionButtons = [];
|
||||||
this._disabled = true;
|
this._disabled = true;
|
||||||
this._expanded = false;
|
this._expanded = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue