Change Type via multiselect
This commit is contained in:
parent
ba533e8942
commit
7a58b4bde1
@ -216,6 +216,11 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
element.updateRadius(event.wingspan/2)
|
element.updateRadius(event.wingspan/2)
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'parking-group-type':
|
||||||
|
this.selection.forEach(element => {
|
||||||
|
element.updateType(event.parking_type)
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -90,13 +90,12 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!--
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<span class="label">Parking Type :</span>
|
<span class="label">Parking Type :</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="17">
|
<el-col :span="17">
|
||||||
<el-select v-model="parking_type" placeholder="Select" :disabled="!editing">
|
<el-select v-model="parking_type" @change="typeChange" placeholder="Select" :disabled="!editing">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in options"
|
v-for="type in options"
|
||||||
:key="type.value"
|
:key="type.value"
|
||||||
@ -107,6 +106,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<!--
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<span class="label">Airline :</span>
|
<span class="label">Airline :</span>
|
||||||
@ -136,7 +136,7 @@ const convert = require('geo-coordinates-parser');
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data: Object, avgHeading: 5, editing: Boolean, wingspan: 0
|
data: Object, avgHeading: 5, editing: Boolean, wingspan: 0, parking_type: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -157,6 +157,7 @@ const convert = require('geo-coordinates-parser');
|
|||||||
setData (data) {
|
setData (data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.setAvgHeading();
|
this.setAvgHeading();
|
||||||
|
this.setAvgType();
|
||||||
},
|
},
|
||||||
setEditing(editing) {
|
setEditing(editing) {
|
||||||
this.editing = editing
|
this.editing = editing
|
||||||
@ -171,6 +172,17 @@ const convert = require('geo-coordinates-parser');
|
|||||||
return r;
|
return r;
|
||||||
}, { sum: 0, count: 0, avg: 0 }).avg);
|
}, { sum: 0, count: 0, avg: 0 }).avg);
|
||||||
},
|
},
|
||||||
|
setAvgType() {
|
||||||
|
if( this.data === null || this.data === undefined) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var types = this.data.map(parking => parking.options.attributes.type).filter((v, i, a) => a.indexOf(v) === i);
|
||||||
|
if (types.length == 1) {
|
||||||
|
this.parking_type = types[0];
|
||||||
|
} else {
|
||||||
|
this.parking_type = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
wingspanChange( newValue ) {
|
wingspanChange( newValue ) {
|
||||||
if ( newValue ) {
|
if ( newValue ) {
|
||||||
this.$emit('editParking', {type: 'parking-group-wingspan', wingspan: newValue} )
|
this.$emit('editParking', {type: 'parking-group-wingspan', wingspan: newValue} )
|
||||||
@ -186,6 +198,11 @@ const convert = require('geo-coordinates-parser');
|
|||||||
if ( newValue ) {
|
if ( newValue ) {
|
||||||
this.$emit('editParking', {type: 'parking-group-angle', angle: newValue} )
|
this.$emit('editParking', {type: 'parking-group-angle', angle: newValue} )
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
typeChange( newValue ) {
|
||||||
|
if ( newValue ) {
|
||||||
|
this.$emit('editParking', {type: 'parking-group-type', parking_type: newValue} )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -271,19 +288,6 @@ const convert = require('geo-coordinates-parser');
|
|||||||
{value: 'mil-fighter', label: 'military fighter'},
|
{value: 'mil-fighter', label: 'military fighter'},
|
||||||
{value: 'mil-cargo', label: 'military cargo'}
|
{value: 'mil-cargo', label: 'military cargo'}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
parking_type: {
|
|
||||||
// getter
|
|
||||||
get: function () {
|
|
||||||
if (this.$store.state.Editable.data.parking.type === undefined) {
|
|
||||||
return 'none'
|
|
||||||
}
|
|
||||||
return this.$store.state.Editable.data.parking.type
|
|
||||||
},
|
|
||||||
// setter
|
|
||||||
set: function (newValue) {
|
|
||||||
this.$store.commit('SET_EDIT_PARKING_TYPE', newValue)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,10 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
this.updateWheelPos();
|
this.updateWheelPos();
|
||||||
this.updateBox();
|
this.updateBox();
|
||||||
},
|
},
|
||||||
|
updateType(type) {
|
||||||
|
this.options.attributes.type = type;
|
||||||
|
this.deselect();
|
||||||
|
},
|
||||||
// Update the direction vertex from the direction
|
// Update the direction vertex from the direction
|
||||||
updateVertexFromDirection() {
|
updateVertexFromDirection() {
|
||||||
if (this.editEnabled()) {
|
if (this.editEnabled()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user