|
@@ -15,6 +15,7 @@ import {calcDistance} from "./../helpers/distance";
|
|
|
import {longitude, latitude, mapWidth, mapHeight, markerIcon} from "./../config/variables";
|
|
|
import {Button} from "reactstrap";
|
|
|
import {getRoute} from "./../helpers/mapboxHelper";
|
|
|
+import PathButtons from "./../PathButtons";
|
|
|
|
|
|
export default class MapGL extends React.Component{
|
|
|
constructor(props){
|
|
@@ -32,10 +33,14 @@ export default class MapGL extends React.Component{
|
|
|
path: [[longitude, latitude]],
|
|
|
distance: 0,
|
|
|
}
|
|
|
-
|
|
|
this.getRoute = getRoute.bind(this)
|
|
|
}
|
|
|
|
|
|
+ updateState = (key, value) => {
|
|
|
+ this.setState({[key]: value})
|
|
|
+ this.getDistance()
|
|
|
+ }
|
|
|
+
|
|
|
addMarker = event => {
|
|
|
const lng = event.lngLat[0]
|
|
|
const lat = event.lngLat[1]
|
|
@@ -123,6 +128,7 @@ export default class MapGL extends React.Component{
|
|
|
<p>
|
|
|
Distanz: {Math.round(this.state.distance*100)/100} km
|
|
|
</p>
|
|
|
+ <PathButtons updateState={this.updateState} path={this.state.path} switchLatLng={true}/>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|