Select new Parking

This commit is contained in:
portree_kid 2020-06-15 07:09:17 +02:00
parent d4c0e59779
commit dea6a9bf19
2 changed files with 23 additions and 4 deletions

View File

@ -1,5 +1,4 @@
<template> <template></template>
</template>
<script lang="js"> <script lang="js">
/* eslint-disable */ /* eslint-disable */
@ -793,7 +792,7 @@
return return
} }
const newIndex = (++this.groundnetLayerGroup.maxId) const newIndex = (++this.groundnetLayerGroup.maxId)
const circle = new L.ParkingSpot(event.latlng, {attributes: {index: newIndex, radius: 20, heading: 0}}) const circle = new L.ParkingSpot(event.latlng, {attributes: {index: newIndex, radius: 26, heading: 0}})
circle.id = newIndex circle.id = newIndex
circle.glueindex = circle.id circle.glueindex = circle.id
circle.addTo(this.groundnetLayerGroup) circle.addTo(this.groundnetLayerGroup)
@ -801,6 +800,17 @@
circle.enableEdit() circle.enableEdit()
circle.extensions() circle.extensions()
circle.addListeners() circle.addListeners()
if (Number(this.$store.state.Editable.index) >= 0 &&
this.featureLookup[this.$store.state.Editable.index]!==undefined) {
this.featureLookup[this.$store.state.Editable.index].forEach(element => {
if(element.deselect !== undefined) {
element.deselect();
}
});
}
this.$store.dispatch('setParking', circle.options.attributes);
this.$store.dispatch('setParkingCoords', circle.getLatLng().lat.toFixed(5) + ' ' + circle.getLatLng().lng.toFixed(5));
circle.select()
addFeature(circle) addFeature(circle)
// console.log(this.groundnetLayerGroup) // console.log(this.groundnetLayerGroup)
this.$parent.mapObject.off('click', this.addParking) this.$parent.mapObject.off('click', this.addParking)

View File

@ -120,12 +120,21 @@ L.ParkingSpot = L.Circle.extend({
var style = {}; var style = {};
style['color'] = 'red'; style['color'] = 'red';
this.setStyle(style); this.setStyle(style);
if(this.direction) {
this.direction.setStyle(style);
this.frontWheel.setStyle(style);
}
this.updateWheelPos(); this.updateWheelPos();
}, },
deselect() { deselect() {
var style = {}; var style = {};
style['color'] = '#3388ff'; style['color'] = '#3388ff';
this.setStyle(style); this.setStyle(style);
if(this.direction) {
this.direction.setStyle(style);
this.frontWheel.setStyle(style);
}
this.updateWheelPos();
}, },
addListeners: function () { addListeners: function () {
this.on('editable:drawing:move', function (event) { this.on('editable:drawing:move', function (event) {