Fixed: [vue][add-address] fix map center when editing existing address

https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/674
This commit is contained in:
Mathieu Jaumotte 2022-12-12 16:37:06 +01:00
parent 49380f5f61
commit 52512e45fc
2 changed files with 10 additions and 5 deletions

View File

@ -19,7 +19,7 @@ export default {
},
computed: {
center() {
return this.entity.selected.addressMap.center;
return this.entity.addressMap.center;
},
},
methods:{
@ -41,10 +41,10 @@ export default {
this.marker.addTo(this.map);
},
update() {
//console.log('update map with : ', this.entity.addressMap.center)
if (this.marker && this.entity.addressMap.center) {
this.marker.setLatLng(this.entity.addressMap.center);
this.map.setView(this.entity.addressMap.center, 15);
console.log('update map with : ', this.center)
if (this.marker && this.center) {
this.marker.setLatLng(this.center);
this.map.setView(this.center, 15);
}
}
},

View File

@ -98,6 +98,11 @@ export default {
}
},
},
mounted() {
if (this.value.point) {
this.updateMapCenter(this.value.point);
}
},
methods: {
transName(value) {
return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`