Non interactive layers

pull/125/head
Keith Paterson 4 years ago
parent 25e603d15f
commit ac53005c0d

@ -115,6 +115,8 @@ You should have received a copy of the GNU General Public License along with FG
this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
this.$parent.$parent.$refs.editLayer.disableEdit()
this.$parent.$parent.$refs.towerLayer.disableEdit()
this.$parent.$parent.$refs.thresholdLayer.disableEdit()
this.$parent.$parent.$refs.editLayer.reload(true)
},
undoLast () {
@ -123,6 +125,8 @@ You should have received a copy of the GNU General Public License along with FG
this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
this.$parent.$parent.$refs.editLayer.disableEdit()
this.$parent.$parent.$refs.towerLayer.disableEdit()
this.$parent.$parent.$refs.thresholdLayer.disableEdit()
this.$parent.$parent.$refs.editLayer.reload(false)
},
save () {
@ -141,6 +145,8 @@ You should have received a copy of the GNU General Public License along with FG
this.$parent.$parent.$refs.towerLayer.save()
this.$parent.$parent.$refs.thresholdLayer.save()
this.$parent.$parent.$refs.editLayer.disableEdit()
this.$parent.$parent.$refs.towerLayer.disableEdit()
this.$parent.$parent.$refs.thresholdLayer.disableEdit()
this.scanGroundnets()
Vue.set(this, 'saveDialogVisible', false)
},

@ -149,6 +149,10 @@ You should have received a copy of the GNU General Public License along with FG
if (l.updateArrows !== undefined) {
l.updateArrows(this.$store.state.Settings.zoom)
}
if (typeof l.setInteractive === 'function') {
l.setInteractive(false)
}
})
console.log(this.groundnetLayerGroup.maxId)
this.buildLookup()
@ -224,7 +228,8 @@ You should have received a copy of the GNU General Public License along with FG
l.setInteractive(true)
}
})
this.$store.dispatch('addWip', {icao: this.icao}); },
this.$store.dispatch('addWip', {icao: this.icao});
},
disableEdit () {
this.editable = false
this.editing = false

@ -258,6 +258,7 @@ You should have received a copy of the GNU General Public License along with FG
}
this.$refs.editLayer.enableEdit()
this.$refs.towerLayer.enableEdit()
this.$refs.thresholdLayer.enableEdit()
this.$refs.editBar.setEditing(event)
this.$refs.toolBar.setEditing(event)
this.$refs.sidebar.setEditing(event)

@ -77,6 +77,24 @@
this.deferredMountedTo(this.$parent.mapObject)
}
},
enableEdit () {
if (this.layerGroup) {
this.layerGroup.eachLayer(l => {
if (l instanceof L.Threshold) {
l.setInteractive(true)
}
})
}
},
disableEdit () {
if (this.layerGroup) {
this.layerGroup.eachLayer(l => {
if (l instanceof L.Threshold) {
l.setInteractive(false)
}
})
}
},
setVisible (visible) {
if (this.layerGroup !== undefined) {
if (visible !== this.visible) {

@ -72,6 +72,15 @@ You should have received a copy of the GNU General Public License along with FG
})
}
},
disableEdit () {
if (this.layerGroup) {
this.layerGroup.eachLayer(l => {
if (l instanceof L.TowerMarker) {
l.enableEdit(this.$parent.mapObject)
}
})
}
},
save () {
if (this.layerGroup) {
this.layerGroup.eachLayer(l => {

@ -239,7 +239,24 @@ L.ParkingSpot = L.Circle.extend({
if(this.box) {
this.box.setStyle(style);
}
},
},
setInteractive(interactive) {
if (interactive) {
if(this.direction) {
L.DomUtil.addClass(this.direction._path, 'leaflet-interactive');
}
if(this.box) {
L.DomUtil.addClass(this.box._path, 'leaflet-interactive');
}
} else {
if(this.direction) {
L.DomUtil.removeClass(this.direction._path, 'leaflet-interactive');
}
if(this.box) {
L.DomUtil.removeClass(this.box._path, 'leaflet-interactive');
}
}
},
addListeners: function () {
this.on('editable:drawing:move', function (event) {
console.debug("Move Parking Spot: ", event);
@ -265,6 +282,7 @@ L.ParkingSpot = L.Circle.extend({
if(event.target.box !== undefined) {
event.target.box.addTo(event.target._map);
}
event.target.setInteractive(false);
});
this.on('remove', function (event) {
console.log(event);

@ -26,6 +26,20 @@ L.RunwayNode = L.Marker.extend({
store.default.dispatch('setRunway', event.target.options.attributes);
}
});
this.on('add', function (event) {
event.target.setInteractive(false);
});
},
setInteractive(interactive) {
if (interactive) {
if(this._icon) {
L.DomUtil.addClass(this._icon, 'leaflet-interactive');
}
} else {
if(this._icon) {
L.DomUtil.removeClass(this._icon, 'leaflet-interactive');
}
}
},
select() {
try {

@ -27,6 +27,7 @@ L.Threshold = L.Marker.extend({
stopw_m: 0,
originLatLng: null,
rwy: '',
interactive: false,
stripSVG: function(fName) {
var rx = /<\s*svg[^>]*>([\s\S]*)<\s*\/svg[^>]*>/gm;
var svg = fs.readFileSync(path.join(__static, '/', fName), 'utf8');
@ -48,6 +49,7 @@ L.Threshold = L.Marker.extend({
className: 'threshold-marker-icon',
html: `<div style=\'transform: translateX(${offset}px) translateY(${offset}px) scale(${scale}) rotate(${this.heading}deg); border: 1px red\'>${this.svg}</div>`,
}));
this.setInteractive(this.interactive);
this.update(this.getLatLng());
this.setLatLng(this.getLatLng());
@ -55,6 +57,18 @@ L.Threshold = L.Marker.extend({
}
}
},
setInteractive(interactive) {
if (interactive) {
if(this._icon) {
L.DomUtil.addClass(this._icon, 'leaflet-interactive');
}
} else {
if(this._icon) {
L.DomUtil.removeClass(this._icon, 'leaflet-interactive');
}
}
this.interactive = interactive;
},
metersPerPixel: function (latitude, zoomLevel) {
var earthCircumference = 40075017;
var latitudeRadians = latitude * (Math.PI / 180);
@ -115,7 +129,7 @@ L.Threshold.addInitHook(function(){
store.default.dispatch('setThreshold', {rwy: event.target.rwy, displacement: event.target.displacement});
});
this.on('add', function (event) {
// event.target.direction.addTo(event.target._map);
event.target.setInteractive(false);
});
});

Loading…
Cancel
Save