|
|
@@ -16,6 +16,7 @@
|
|
16
|
16
|
<button @click="gotoPlace(currentPlace)">scroll to location</button>
|
|
17
|
17
|
<button @click="removeMarkers">clear route</button>
|
|
18
|
18
|
<button @click="locateUser">geolocate</button>
|
|
|
19
|
+ <button @click="emitRoute">calculate elevation</button>
|
|
19
|
20
|
</label>
|
|
20
|
21
|
<br/>
|
|
21
|
22
|
</div>
|
|
|
@@ -40,7 +41,8 @@
|
|
40
|
41
|
markers: [],
|
|
41
|
42
|
currentPlace: null,
|
|
42
|
43
|
directionsService: null,
|
|
43
|
|
- directionsDisplay: null
|
|
|
44
|
+ directionsDisplay: null,
|
|
|
45
|
+ currentRoute: null
|
|
44
|
46
|
}
|
|
45
|
47
|
},
|
|
46
|
48
|
methods: {
|
|
|
@@ -92,6 +94,7 @@
|
|
92
|
94
|
}, function (response, status) {
|
|
93
|
95
|
if (status === 'OK') {
|
|
94
|
96
|
vm.directionsDisplay.setDirections(response)
|
|
|
97
|
+ this.currentRoute = response
|
|
95
|
98
|
} else {
|
|
96
|
99
|
alert('Directions request failed due to ' + status)
|
|
97
|
100
|
}
|
|
|
@@ -99,6 +102,9 @@
|
|
99
|
102
|
},
|
|
100
|
103
|
clearRoute () {
|
|
101
|
104
|
if (this.directionsDisplay) this.directionsDisplay.setMap(null)
|
|
|
105
|
+ },
|
|
|
106
|
+ emitRoute () {
|
|
|
107
|
+ if (this.currentRoute) this.$emit('currentRoute', this.currentRoute)
|
|
102
|
108
|
}
|
|
103
|
109
|
}
|
|
104
|
110
|
}
|