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

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,16 +42,22 @@ class FacilitiesMap extends React.Component { ...@@ -43,16 +42,22 @@ 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
}; };
setTimeout(() => { if (interactive) {
this.setState({ this.state.center = facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion);
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion) }else{
}); setTimeout(() => {
}, 500); console.log('ran');
this.setState({
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion)
});
}, 500);
}
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(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