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 committed by Julien Fastré
parent ad94c7bcb7
commit 6a14c2b9b3
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 13 additions and 1 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,17 @@ export default {
this.marker.addTo(this.map);
},
update() {
/*<<<<<<< HEAD
//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, this.entity.addressMap.zoom);
=======*/
console.log('update map with : ', this.center)
if (this.marker && this.center) {
this.marker.setLatLng(this.center);
this.map.setView(this.center, 15);
//>>>>>>> 52512e45f (Fixed: [vue][add-address] fix map center when editing existing address)
}
}
},

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}`