Not interactive when not editing

This commit is contained in:
Keith Paterson 2020-12-30 18:15:47 +01:00
parent b7954d15df
commit af03c5fe12
2 changed files with 34 additions and 1 deletions

View File

@ -206,7 +206,6 @@ You should have received a copy of the GNU General Public License along with FG
this.featureLookup = [];
this.groundnetLayerGroup.eachLayer(l => {
l.enableEdit()
l.featureLookup = this.featureLookup;
if (typeof l.extensions === 'function') {
l.extensions(this)
@ -214,6 +213,12 @@ You should have received a copy of the GNU General Public License along with FG
if (typeof l.bringToFront === 'function') {
l.bringToFront()
}
if (typeof l.updateStyle === 'function') {
l.updateStyle()
}
if (typeof l.setInteractive === 'function') {
l.setInteractive(true)
}
})
this.$store.dispatch('addWip', {icao: this.icao}); },
disableEdit () {
@ -221,6 +226,9 @@ You should have received a copy of the GNU General Public License along with FG
this.editing = false
this.$store.commit('SET_EDIT', false)
this.groundnetLayerGroup.eachLayer(l => {
if (typeof l.setInteractive === 'function') {
l.setInteractive(false)
}
l.disableEdit()
})
},

View File

@ -512,6 +512,26 @@ const extendTaxiSegment = function (taxiwaySegment) {
}
}
taxiwaySegment.__proto__.setInteractive = function (interactive) {
if (this.getLayers) {
this.getLayers().forEach(layer => {
layer.setInteractive(interactive);
});
return;
}
if (!this._path) {
return;
}
this.options.interactive = interactive;
if (interactive) {
L.DomUtil.addClass(this._path, 'leaflet-interactive');
} else {
L.DomUtil.removeClass(this._path, 'leaflet-interactive');
}
};
taxiwaySegment.__proto__.updateStyle = function () {
var style = {};
if(!this.options.attributes) {
@ -525,6 +545,11 @@ const extendTaxiSegment = function (taxiwaySegment) {
else {
style.color = '#3388ff';
}
if(this.editEnabled()) {
style.interactive = true;
} else {
style.interactive = false;
}
this.setStyle(style);
if (this._map !== null) {
if (this.options.attributes.direction === 'forward') {