Issues glueing parking

This commit is contained in:
portree_kid 2020-03-30 22:39:02 +02:00
parent f515d6249f
commit 2d5f2f0063
3 changed files with 8 additions and 4 deletions

View File

@ -485,8 +485,10 @@
if (event.latlng === undefined) { if (event.latlng === undefined) {
return return
} }
const circle = new L.ParkingSpot(event.latlng, {attributes: {radius: 20, heading: 0}}) const newIndex = (++this.groundnetLayerGroup.maxId)
circle.id = (++this.groundnetLayerGroup.maxId) const circle = new L.ParkingSpot(event.latlng, {attributes: {index: newIndex, radius: 20, heading: 0}})
circle.id = newIndex
circle.glueindex = circle.id
circle.addTo(this.groundnetLayerGroup) circle.addTo(this.groundnetLayerGroup)
circle.featureLookup = this.featureLookup circle.featureLookup = this.featureLookup
circle.enableEdit() circle.enableEdit()

View File

@ -8,7 +8,9 @@ const mutations = {
}, },
UPDATE_PARKING: (state, item) => { UPDATE_PARKING: (state, item) => {
const existingItem = state.items.find((i) => i.index === item.index) const existingItem = state.items.find((i) => i.index === item.index)
if (existingItem!==undefined) {
Object.assign(existingItem, item) Object.assign(existingItem, item)
}
}, },
SET_PARKINGS (state, parkings) { SET_PARKINGS (state, parkings) {
Vue.set(state, 'items', parkings) Vue.set(state, 'items', parkings)