Skip to content

Commit

Permalink
- FIX: Fixed issue where locations map wouldn't update when corner po…
Browse files Browse the repository at this point in the history
…ints are changed.

- FIX: Fixed GPS highlight in table not being accurately updated.
  • Loading branch information
sebastian-raubach committed Sep 3, 2020
1 parent 7b8a702 commit 061e374
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gridscore",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
19 changes: 10 additions & 9 deletions src/components/FieldMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import GpsInput from '@/components/GpsInput'
import Map from '@/components/Map'
export default {
data: function () {
return {
locations: [null, null, null, null]
}
},
props: {
geolocation: {
type: Object,
Expand All @@ -48,15 +53,6 @@ export default {
default: 1
}
},
computed: {
locations: function () {
if (this.dataset && this.dataset.cornerPoints) {
return this.dataset.cornerPoints.map(l => [l[0], l[1]])
} else {
return [null, null, null, null]
}
}
},
components: {
GpsInput,
Map
Expand All @@ -71,6 +67,11 @@ export default {
getCornerPoints: function () {
return this.locations
}
},
mounted: function () {
if (this.dataset && this.dataset.cornerPoints && this.dataset.cornerPoints.length === 4) {
this.locations = this.dataset.cornerPoints.map(l => [l[0], l[1]])
}
}
}
</script>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default {
locations: {
deep: true,
handler: function (newValue) {
if (this.locations) {
if (newValue) {
this.updateMarkers()
this.updateBounds()
}
Expand All @@ -109,6 +109,8 @@ export default {
// If the bounds are valid, move the map
if (bounds.isValid()) {
this.$refs.fieldMap.fitBounds(bounds.pad(0.1))
} else if (bounds.getCenter()) {
this.$refs.fieldMap.panTo(bounds.getCenter())
}
},
invalidateSize: function () {
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/SettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<b-row>
<b-col cols=12 md=6>
<b-form-group :label="$t('formLabelSettingsRows')" label-for="rows">
<b-form-input id="rows" :state="state.rows" number type="number" :min="1" required autofocus v-model="rows" />
<b-form-input id="rows" :state="state.rows" number type="number" :min="1" required autofocus v-model.number="rows" />
</b-form-group>
<b-form-group :label="$t('formLabelSettingsCols')" label-for="cols">
<b-form-input id="cols" :state="state.cols" number type="number" :min="1" required v-model="cols" />
<b-form-input id="cols" :state="state.cols" number type="number" :min="1" required v-model.number="cols" />
</b-form-group>
<b-form-group :label="$t('formLabelSettingsVarieties')" label-for="varieties">
<b-form-textarea id="varieties" :state="state.varieties" rows=6 required v-model="varieties" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default {
startGeoTracking: function () {
if (this.geolocationWatchId === null) {
if (navigator.geolocation) {
const options = { enableHighAccuracy: false, maximumAge: 1000, timeout: 20000 }
const options = { enableHighAccuracy: true, maximumAge: 100, timeout: 20000 }
this.geolocationWatchId = navigator.geolocation.watchPosition(position => {
if (position && position.coords) {
this.geolocation = {
Expand Down

0 comments on commit 061e374

Please sign in to comment.