loleaflet: Enable/disable spreadsheet tabs for edit/view mode
Change-Id: I084f676e77fc161c109a5271dd1cad60a3e5474f
This commit is contained in:
parent
7734f2557a
commit
3d02fb7497
2 changed files with 24 additions and 1 deletions
8
loleaflet/dist/spreadsheet.css
vendored
8
loleaflet/dist/spreadsheet.css
vendored
|
@ -41,16 +41,22 @@
|
|||
display: inline-block;
|
||||
border: 1px solid darkgrey;
|
||||
background-color: lightgrey;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.spreadsheet-context-menu-selected {
|
||||
background: white;
|
||||
background: white !important;
|
||||
color: black !important;
|
||||
border-top: 1px solid lightgrey;
|
||||
border-left: 1px solid lightgrey;
|
||||
border-right: 1px solid lightgrey;
|
||||
border-bottom: 1px solid lightgrey;
|
||||
}
|
||||
|
||||
.spreadsheet-context-menu.context-menu-disabled {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.spreadsheet-header-corner {
|
||||
border-top: 1px solid darkgrey;
|
||||
border-left: 1px solid darkgrey;
|
||||
|
|
|
@ -67,6 +67,15 @@ L.Control.Tabs = L.Control.extend({
|
|||
});
|
||||
|
||||
map.on('updateparts', this._updateDisabled, this);
|
||||
map.on('editlock', this._enableTabsContextMenu, this);
|
||||
},
|
||||
|
||||
_enableTabsContextMenu: function(e) {
|
||||
if (!e.value) {
|
||||
$('.spreadsheet-context-menu').contextMenu(false);
|
||||
} else {
|
||||
$('.spreadsheet-context-menu').contextMenu(true);
|
||||
}
|
||||
},
|
||||
|
||||
_updateDisabled: function (e) {
|
||||
|
@ -115,11 +124,19 @@ L.Control.Tabs = L.Control.extend({
|
|||
if (part === selectedPart) {
|
||||
L.DomUtil.addClass(this._spreadsheetTabs[key], 'spreadsheet-context-menu-selected');
|
||||
}
|
||||
|
||||
if (map._editlock) {
|
||||
L.DomUtil.removeClass(this._spreadsheetTabs[key], 'context-menu-disabled');
|
||||
} else {
|
||||
L.DomUtil.addClass(this._spreadsheetTabs[key], 'context-menu-disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setPart: function (e) {
|
||||
if (!map._editlock)
|
||||
return;
|
||||
var part = e.target.id.match(/\d+/g)[0];
|
||||
if (part !== null) {
|
||||
this._map.setPart(parseInt(part));
|
||||
|
|
Loading…
Reference in a new issue