From e1bf234cbb270f89b8f57484da3d88692279846c Mon Sep 17 00:00:00 2001 From: portree_kid Date: Wed, 26 Feb 2020 17:42:04 +0100 Subject: [PATCH] Arc colour update --- src/renderer/components/EditLayer.vue | 7 ++++++- src/renderer/loaders/ParkingSpot.js | 2 +- src/renderer/loaders/TaxiwaySegmentExtender.js | 12 ++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 5a5fa47..c0f817c 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -235,7 +235,12 @@ }) }, editedArc() { - console.log('Edited Arc'); + console.log('Edited Arc : ' + this.$store.state.Editable.index); + var arc = this.groundnetLayerGroup.getLayer(this.$store.state.Editable.index); + if (arc) { + arc.options.attributes = Object.assign({}, this.$store.state.Editable.data.arc) + arc.updateStyle(); + } }, editedNode() { if (this.$store.state.Editable.index === undefined || diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index b4cd171..df62318 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -118,7 +118,7 @@ L.ParkingSpot = L.Circle.extend({ return state.Editable.data.parking; }, () => { - event.target.setStyle({color : '#3388ff'}); + event.target.updateStyle(); this.unwatch(); } , diff --git a/src/renderer/loaders/TaxiwaySegmentExtender.js b/src/renderer/loaders/TaxiwaySegmentExtender.js index 432a26e..352d69e 100644 --- a/src/renderer/loaders/TaxiwaySegmentExtender.js +++ b/src/renderer/loaders/TaxiwaySegmentExtender.js @@ -45,6 +45,8 @@ exports.extendTaxiSegment = function (taxiwaySegment) { event.target.setStyle({color : 'red'}); console.log("Click : " + event.target); if (store.default.state.Editable.data.arc !== event.target.options.attributes) { + event.target.options.attributes.index = event.target._leaflet_id; + event.target.options.attributes.selected = true; store.default.dispatch('setArc', event.target.options.attributes); } this.unwatch = store.default.watch( @@ -53,7 +55,8 @@ exports.extendTaxiSegment = function (taxiwaySegment) { }, () => { // Reset colour - event.target.setStyle({color : '#3388ff'}); + event.target.options.attributes.selected = false; + event.target.updateStyle(); this.unwatch(); } , @@ -205,9 +208,14 @@ exports.extendTaxiSegment = function (taxiwaySegment) { taxiwaySegment.__proto__.updateStyle = function() { var style = {}; - if (this.options.attributes.isPushBackRoute) { + if(this.options.attributes.selected){ + style.color = 'red'; + } else if (this.options.attributes.isPushBackRoute) { style.color = 'magenta'; } + else { + style.color = '#3388ff'; + } this.setStyle(style); if (!this.bidirectional) { this.setText(' ► ', {repeat: true, attributes: {fill: 'red', size: 20}})