Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-web
Commits
f3245ca0
Commit
f3245ca0
authored
Oct 30, 2017
by
Mattias J Duffy
Browse files
commenting out irrelevent stuff
parent
2432e8b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/FacilitiesMap.js
View file @
f3245ca0
...
...
@@ -66,30 +66,30 @@ class FacilitiesMap extends React.Component {
}
}
componentWillReceiveProps
=
(
nextProps
)
=>
{
try
{
const
coordsArr
=
nextProps
.
facility
.
facility_location
.
coordinate_location
.
coordinates
const
coordsObj
=
{
latitude
:
coordsArr
[
1
],
longitude
:
coordsArr
[
0
]}
if
(
this
.
state
.
positionReady
){
getGeoLine
(
client
,
this
.
state
.
position
,
coordsObj
,()
=>
{}).
then
((
route
)
=>
{
const
coords
=
route
.
geometry
.
coordinates
const
bounds
=
coords
.
reduce
(
function
(
bounds
,
coord
)
{
return
bounds
.
extend
(
coord
);
},
new
mapboxgl
.
LngLatBounds
(
coords
[
0
],
coords
[
0
]));
const
boundsArr
=
[[
bounds
.
_sw
.
lng
,
bounds
.
_sw
.
lat
],[
bounds
.
_ne
.
lng
,
bounds
.
_ne
.
lat
]]
console
.
log
(
bounds
)
console
.
log
(
boundsArr
)
this
.
setState
({
mappedRoute
:
coords
,
fitBounds
:
boundsArr
,
fitBoundsOptions
:{
padding
:
20
},
})
})
}
}
catch
(
e
){
//
componentWillReceiveProps = (nextProps) =>{
//
try {
//
const coordsArr = nextProps.facility.facility_location.coordinate_location.coordinates
//
const coordsObj = {latitude:coordsArr[1],longitude:coordsArr[0]}
//
if(this.state.positionReady){
//
getGeoLine(client,this.state.position,coordsObj,()=>{}).then((route)=>{
//
const coords = route.geometry.coordinates
//
const bounds = coords.reduce(function(bounds, coord) {
//
return bounds.extend(coord);
//
}, new mapboxgl.LngLatBounds(coords[0], coords[0]));
//
const boundsArr = [[bounds._sw.lng,bounds._sw.lat],[bounds._ne.lng,bounds._ne.lat]]
//
console.log(bounds)
//
console.log(boundsArr)
//
this.setState({
//
mappedRoute:coords,
//
fitBounds:boundsArr,
//
fitBoundsOptions:{padding:20},
//
})
//
})
//
}
//
}catch(e){
}
}
//
}
//
}
render
(){
...
...
@@ -100,7 +100,12 @@ class FacilitiesMap extends React.Component {
<
div
>
<
Map
onStyleLoad
=
{(
map
,
e
)
=>
{
map
.
addControl
(
new
mapboxgl
.
GeolocateControl
({
positionOptions
:
{
enableHighAccuracy
:
true
},
trackUserLocation
:
true
}));
}}
style
=
"
mapbox://styles/mapbox/streets-v9
"
movingMethod
=
{
'
easeTo
'
}
...
...
@@ -118,18 +123,12 @@ class FacilitiesMap extends React.Component {
key
=
{
item
.
slug
}
coordinates
=
{
item
.
facility_location
.
coordinate_location
.
coordinates
}
anchor
=
"
bottom
"
>
{
/*
<img height={20} width={20} src={require('../images/starbucksSVG.svg')}/>
*/
}
<
div
style
=
{
Mark
}
><
/div
>
<
img
height
=
{
20
}
width
=
{
20
}
src
=
{
require
(
'
../images/starbucksSVG.svg
'
)}
/
>
{
/*
<div style={Mark}></div>
*/
}
<
/Marker
>
)
})}
{
<
Layer
type
=
"
line
"
layout
=
{{
"
line-join
"
:
"
round
"
,
"
line-cap
"
:
"
round
"
}}
paint
=
{{
"
line-color
"
:
"
#888
"
,
"
line-width
"
:
5
}}
>
{
mappedRoute
&&
<
Feature
coordinates
=
{
mappedRoute
}
/>
}
<
/Layer>}
<
/Map
>
<
/div
>
)
...
...
@@ -140,4 +139,12 @@ const styleSheet = {
}
export
default
withStyles
(
styleSheet
)(
FacilitiesMap
)
\ No newline at end of file
export
default
withStyles
(
styleSheet
)(
FacilitiesMap
)
// {<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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment