Commit 85cfbe9c authored by Mattias J Duffy's avatar Mattias J Duffy
Browse files

dialog box now focusing on correct location

parent fb893ca0
...@@ -26,10 +26,9 @@ class FacilitiesMap extends React.Component { ...@@ -26,10 +26,9 @@ class FacilitiesMap extends React.Component {
this.Map = ReactMapboxGl({ this.Map = ReactMapboxGl({
accessToken: mapboxToken, accessToken: mapboxToken,
interactive: interactive, interactive: false,
attributionControl: false attributionControl: false
}); });
const facilityLocationExists = facility && facility.facility_location && facility.facility_location.campus_region === campusRegion; const facilityLocationExists = facility && facility.facility_location && facility.facility_location.campus_region === campusRegion;
/** /**
...@@ -43,17 +42,23 @@ class FacilitiesMap extends React.Component { ...@@ -43,17 +42,23 @@ class FacilitiesMap extends React.Component {
maxBounds: getMaxBounds(campusRegion), maxBounds: getMaxBounds(campusRegion),
campusRegion: campusRegion, campusRegion: campusRegion,
zoom: [17], zoom: [17],
// center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion),
fitBoundsOptions: {}, fitBoundsOptions: {},
facilityLocations: [], facilityLocations: [],
selectedLocation: null, selectedLocation: null,
isLoaded: false isLoaded: false
}; };
if (interactive) {
this.state.center = facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion);
}else{
setTimeout(() => { setTimeout(() => {
console.log('ran');
this.setState({ this.setState({
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion) center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion)
}); });
}, 500); }, 500);
} }
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const {facility, facilities} = nextProps; const {facility, facilities} = nextProps;
......
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