diff --git a/flatisfy/web/js_src/components/flat.vue b/flatisfy/web/js_src/components/flat.vue index 6041057..58ab8cb 100644 --- a/flatisfy/web/js_src/components/flat.vue +++ b/flatisfy/web/js_src/components/flat.vue @@ -101,7 +101,7 @@

{{ $t("flatsDetails.Location") }}

- +

{{ $t("flatsDetails.Notes") }}

@@ -239,7 +239,7 @@ export default { isLoading () { return this.$store.getters.isLoading }, - flatMarkers () { + flatMarker () { return this.$store.getters.flatsMarkers(this.$router, flat => flat.id === this.flat.id) }, 'flatpickrValue' () { diff --git a/flatisfy/web/js_src/components/flatsmap.vue b/flatisfy/web/js_src/components/flatsmap.vue index 555769c..7911fe3 100644 --- a/flatisfy/web/js_src/components/flatsmap.vue +++ b/flatisfy/web/js_src/components/flatsmap.vue @@ -1,6 +1,6 @@ @@ -53,7 +54,7 @@ export default { fillColor: '#e4ce7f', fillOpacity: 1 }, - center: [46.449, 2.210], + bounds: [[40.91351257612758, -7.580566406250001], [51.65892664880053, 12.0849609375]], zoom: { defaultZoom: 6, minZoom: 5, @@ -83,17 +84,18 @@ export default { 'v-geojson-layer': LGeoJSON }, - computed: { - bounds () { - let bounds = [] - this.flats.forEach(flat => bounds.push(flat.gps)) - Object.keys(this.places).forEach(place => bounds.push(this.places[place])) + watch: { + flats: 'computeBounds', + places: 'computeBounds' + }, - if (bounds.length > 0) { - bounds = L.latLngBounds(bounds) - return bounds - } else { - return null + methods: { + computeBounds (newData, oldData) { + if (this.flats.length && JSON.stringify(newData) !== JSON.stringify(oldData)) { + const allBounds = [] + this.flats.forEach(flat => allBounds.push(flat.gps)) + Object.keys(this.places).forEach(place => allBounds.push(this.places[place])) + this.bounds = allBounds.length ? L.latLngBounds(allBounds) : undefined } } }, diff --git a/flatisfy/web/js_src/store/getters.js b/flatisfy/web/js_src/store/getters.js index 905c974..7963091 100644 --- a/flatisfy/web/js_src/store/getters.js +++ b/flatisfy/web/js_src/store/getters.js @@ -37,9 +37,9 @@ export default { marker => marker.gps[0] === gps[0] && marker.gps[1] === gps[1] ) if (previousMarker) { - // randomize position a bit - gps[0] += (Math.random() - 0.5) / 500 - gps[1] += (Math.random() - 0.5) / 500 + // randomize position a bit + // gps[0] += (Math.random() - 0.5) / 500 + // gps[1] += (Math.random() - 0.5) / 500 } const href = router.resolve({ name: 'details', params: { id: flat.id }}).href const cost = flat.cost ? ' ( ' + flat.cost + '€)' : ''