diff --git a/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue b/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue index be538ab30..5e42b9931 100644 --- a/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue +++ b/client/web/compose/src/components/ModuleFields/Editor/Geometry.vue @@ -276,14 +276,14 @@ export default { this.map.value = this.field.isMulti ? [...this.localValue] : this.localValue this.localValueIndex = index + const firstCoordinates = (index >= 0 ? this.localValue[index] : this.localValue) || {} - firstCoordinates.coordinates = firstCoordinates.coordinates ? [...firstCoordinates.coordinates] : [] + const areCoordinatesValid = firstCoordinates.coordinates && firstCoordinates.coordinates.length === 2 && firstCoordinates.coordinates.every(isNumber) - this.map.center = firstCoordinates.coordinates && - firstCoordinates.coordinates.length === 2 && - firstCoordinates.coordinates.every(isNumber) ? firstCoordinates.coordinates : this.field.options.center + firstCoordinates.coordinates = areCoordinatesValid ? [...firstCoordinates.coordinates] : [] - this.map.zoom = index >= 0 ? 13 : this.field.options.zoom + this.map.center = areCoordinatesValid ? firstCoordinates.coordinates : this.field.options.center + this.map.zoom = areCoordinatesValid ? 13 : this.field.options.zoom this.map.show = true }, diff --git a/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue b/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue index c50f3cd78..903f0cfdb 100644 --- a/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue +++ b/client/web/compose/src/components/ModuleFields/Viewer/Geometry.vue @@ -23,7 +23,6 @@ > { - return { value: JSON.parse(v || '{"coordinates":[]}').coordinates || [] } + return this.value.map((v, i) => { + return { + value: JSON.parse(v || '{"coordinates":[]}').coordinates || [], + opacity: this.localValueIndex === undefined || i === this.localValueIndex ? 1.0 : 0.6, + } }).filter(c => c && c.value && c.value.length) } else { return [{ value: JSON.parse(this.value || '{"coordinates":[]}').coordinates || [] }].filter(c => c && c.value && c.value.length) @@ -87,7 +89,10 @@ export default { methods: { openMap (index) { this.localValueIndex = index - this.map.center = (this.localValue[index] && this.localValue[index].value) || this.field.options.center + + const { value } = this.localValue[index] || {} + + this.map.center = value || this.field.options.center this.map.zoom = index >= 0 ? 13 : this.field.options.zoom this.map.show = true },