Commit f3245ca0 authored by Mattias J Duffy's avatar Mattias J Duffy
Browse files

commenting out irrelevent stuff

parent 2432e8b7
...@@ -66,30 +66,30 @@ class FacilitiesMap extends React.Component { ...@@ -66,30 +66,30 @@ class FacilitiesMap extends React.Component {
} }
} }
componentWillReceiveProps = (nextProps) =>{ // componentWillReceiveProps = (nextProps) =>{
try { // try {
const coordsArr = nextProps.facility.facility_location.coordinate_location.coordinates // const coordsArr = nextProps.facility.facility_location.coordinate_location.coordinates
const coordsObj = {latitude:coordsArr[1],longitude:coordsArr[0]} // const coordsObj = {latitude:coordsArr[1],longitude:coordsArr[0]}
if(this.state.positionReady){ // if(this.state.positionReady){
getGeoLine(client,this.state.position,coordsObj,()=>{}).then((route)=>{ // getGeoLine(client,this.state.position,coordsObj,()=>{}).then((route)=>{
const coords = route.geometry.coordinates // const coords = route.geometry.coordinates
const bounds = coords.reduce(function(bounds, coord) { // const bounds = coords.reduce(function(bounds, coord) {
return bounds.extend(coord); // return bounds.extend(coord);
}, new mapboxgl.LngLatBounds(coords[0], coords[0])); // }, new mapboxgl.LngLatBounds(coords[0], coords[0]));
const boundsArr = [[bounds._sw.lng,bounds._sw.lat],[bounds._ne.lng,bounds._ne.lat]] // const boundsArr = [[bounds._sw.lng,bounds._sw.lat],[bounds._ne.lng,bounds._ne.lat]]
console.log(bounds) // console.log(bounds)
console.log(boundsArr) // console.log(boundsArr)
this.setState({ // this.setState({
mappedRoute:coords, // mappedRoute:coords,
fitBounds:boundsArr, // fitBounds:boundsArr,
fitBoundsOptions:{padding:20}, // fitBoundsOptions:{padding:20},
}) // })
}) // })
} // }
}catch(e){ // }catch(e){
} // }
} // }
render (){ render (){
...@@ -100,7 +100,12 @@ class FacilitiesMap extends React.Component { ...@@ -100,7 +100,12 @@ class FacilitiesMap extends React.Component {
<div> <div>
<Map <Map
onStyleLoad={(map,e)=>{ onStyleLoad={(map,e)=>{
map.addControl(new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true
}));
}} }}
style="mapbox://styles/mapbox/streets-v9" style="mapbox://styles/mapbox/streets-v9"
movingMethod={'easeTo'} movingMethod={'easeTo'}
...@@ -118,18 +123,12 @@ class FacilitiesMap extends React.Component { ...@@ -118,18 +123,12 @@ class FacilitiesMap extends React.Component {
key={item.slug} key={item.slug}
coordinates={item.facility_location.coordinate_location.coordinates} coordinates={item.facility_location.coordinate_location.coordinates}
anchor="bottom"> anchor="bottom">
{/* <img height={20} width={20} src={require('../images/starbucksSVG.svg')}/> */} <img height={20} width={20} src={require('../images/starbucksSVG.svg')}/>
<div style={Mark}></div> {/* <div style={Mark}></div> */}
</Marker> </Marker>
) )
})} })}
{<Layer
type="line"
layout={{"line-join": "round","line-cap": "round"}}
paint={{"line-color": "#888","line-width": 5}}
>
{mappedRoute && <Feature coordinates={mappedRoute}/>}
</Layer>}
</Map> </Map>
</div> </div>
) )
...@@ -140,4 +139,12 @@ const styleSheet = { ...@@ -140,4 +139,12 @@ const styleSheet = {
} }
export default withStyles(styleSheet)(FacilitiesMap) export default withStyles(styleSheet)(FacilitiesMap)
\ No newline at end of file
// {<Layer
// type="line"
// layout={{"line-join": "round","line-cap": "round"}}
// paint={{"line-color": "#888","line-width": 5}}
// >
// {mappedRoute && <Feature coordinates={mappedRoute}/>}
// </Layer>}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment