|
@@ -55,31 +55,32 @@ export default class Mapbox extends React.Component{
|
|
|
const position = [this.state.longitude, this.state.latitude]
|
|
|
return (
|
|
|
<div>
|
|
|
- <Map
|
|
|
- style="mapbox://styles/mapbox/bright-v9"
|
|
|
- containerStyle={{
|
|
|
- height: mapHeight,
|
|
|
- width: mapWidth
|
|
|
- }}
|
|
|
- center={this.state.center}
|
|
|
- zoom={this.state.zoom}
|
|
|
- onClick={(e, c) => this.addMarker(e, c)}
|
|
|
- >
|
|
|
- <Layer type="symbol" id="marker" layout={{"icon-image": "marker-15" }}>
|
|
|
- {this.state.path.map((pos, idx) =>
|
|
|
- <Feature
|
|
|
- coordinates={pos}
|
|
|
- key={idx} draggable={true}
|
|
|
- onDragEnd={(e) => this.updateMarker(idx, e)}
|
|
|
- />
|
|
|
- )}
|
|
|
- </Layer>
|
|
|
- <ZoomControl position={"top-right"}/>
|
|
|
- <ScaleControl position={"bottom-right"}/>
|
|
|
- <RotationControl position={"top-right"}/>
|
|
|
- </Map>
|
|
|
-
|
|
|
- <div>
|
|
|
+ <div className="map">
|
|
|
+ <Map
|
|
|
+ style="mapbox://styles/mapbox/bright-v9"
|
|
|
+ containerStyle={{
|
|
|
+ height: mapHeight,
|
|
|
+ width: mapWidth
|
|
|
+ }}
|
|
|
+ center={this.state.center}
|
|
|
+ zoom={this.state.zoom}
|
|
|
+ onClick={(e, c) => this.addMarker(e, c)}
|
|
|
+ >
|
|
|
+ <Layer type="symbol" id="marker" layout={{"icon-image": "marker-15" }}>
|
|
|
+ {this.state.path.map((pos, idx) =>
|
|
|
+ <Feature
|
|
|
+ coordinates={pos}
|
|
|
+ key={idx} draggable={true}
|
|
|
+ onDragEnd={(e) => this.updateMarker(idx, e)}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </Layer>
|
|
|
+ <ZoomControl position={"top-right"}/>
|
|
|
+ <ScaleControl position={"bottom-right"}/>
|
|
|
+ <RotationControl position={"top-right"}/>
|
|
|
+ </Map>
|
|
|
+ </div>
|
|
|
+ <div className="mapInfo">
|
|
|
<button onClick={this.clearPath}>Clear path</button>
|
|
|
<button onClick={this.getDistance}>Calculate Distance</button>
|
|
|
<p>
|