diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 300aaff..bd7148a 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -144,8 +144,23 @@ switch (this.$store.state.Editable.type) { case 'node': this.removeNode(this.$store.state.Editable.index) + break; + case 'parking': + this.removeParking(this.$store.state.Editable.index) + break; } }, + removeParking (index) { + if(this.featureLookup[index]===undefined) { + console.error("Lookup " + index + " failed "); + return; + } + this.featureLookup[index].forEach((element, i) => { + if (element instanceof L.ParkingSpot) { + element.removeFrom(this.groundnetLayerGroup); + } + }); + }, removeNode (index) { if(this.featureLookup[index]===undefined) { console.error("Lookup " + index + " failed "); @@ -205,6 +220,9 @@ }, editedNode() { + if (this.$store.state.Editable.data.node===undefined) { + return; + } var isOnRunway = Number(this.$store.state.Editable.data.node.isOnRunway); var isHoldPoint = this.$store.state.Editable.data.node.holdPointType !== 'none' && this.$store.state.Editable.data.node.holdPointType !== undefined; diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index 83eafae..281b6f2 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -113,6 +113,15 @@ L.ParkingSpot = L.Circle.extend({ console.log("Click : " + event.target); store.default.dispatch('setParking', event.target.options.attributes); }); + this.on('editable:vertex:clicked', function (event) { + console.log(this.featureLookup[event.vertex.glueindex]); + if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){ + event.vertex._icon.style['background-color'] = 'red'; + store.default.dispatch('setParking', event.target.options.attributes); + } + + }); + this.on('editable:disable', function (event) { event.target.removeDirection(); }); diff --git a/src/renderer/store/modules/Editable.js b/src/renderer/store/modules/Editable.js index 4ecdea1..5adb918 100644 --- a/src/renderer/store/modules/Editable.js +++ b/src/renderer/store/modules/Editable.js @@ -15,19 +15,22 @@ const mutations = { state.type = 'airport' }, SET_EDIT_PARKING (state, parking) { - state.data.parking[parking.index] = parking + state.data = {} + state.data.parking = parking state.index = parking.index state.type = 'parking' }, 'SET_EDIT_NODE' (state, node) { + state.data = {} state.data.node = node state.index = node.index state.type = 'node' }, SET_EDIT_ARC (state, arc) { + state.data = {} state.data.arc = arc if (state.data.arc.name === undefined) { - state.data.arc.name = 'X' + state.data.arc.name = '' } state.index = arc.index state.type = 'arc'