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

passing additional zoom and center values

parent f0ed0665
...@@ -108,10 +108,10 @@ class FacilitiesMap extends React.Component { ...@@ -108,10 +108,10 @@ class FacilitiesMap extends React.Component {
let center,zoom; let center,zoom;
try{ try{
center = facility.facility_location.coordinate_location.coordinates; center = facility.facility_location.coordinate_location.coordinates;
zoom = 17; zoom = [17];
}catch(e){ }catch(e){
center = [(maxBounds[0][0]+maxBounds[1][0])/2,(maxBounds[0][1]+maxBounds[1][1])/2] center = [(maxBounds[0][0]+maxBounds[1][0])/2,(maxBounds[0][1]+maxBounds[1][1])/2]
zoom=13; zoom=[13];
} }
return( return(
<div className={classes.mapContainer} style={{'transform': isMapOpen ? 'translateY(0px)' : 'translateY(436px)'}}> <div className={classes.mapContainer} style={{'transform': isMapOpen ? 'translateY(0px)' : 'translateY(436px)'}}>
...@@ -142,9 +142,10 @@ class FacilitiesMap extends React.Component { ...@@ -142,9 +142,10 @@ class FacilitiesMap extends React.Component {
}} }}
center={center} center={center}
zoom={[zoom]} zoom={zoom}
fitBounds={fitBounds} fitBounds={fitBounds}
fitBoundsOptions={fitBoundsOptions} fitBoundsOptions={fitBoundsOptions}
zoom={zoom}
maxBounds={maxBounds}> maxBounds={maxBounds}>
{(facilities.length > 0) && facilities.map((item) =>{ {(facilities.length > 0) && facilities.map((item) =>{
return( return(
...@@ -164,6 +165,8 @@ class FacilitiesMap extends React.Component { ...@@ -164,6 +165,8 @@ class FacilitiesMap extends React.Component {
facilities={facilities} facilities={facilities}
facility={facility} facility={facility}
maxBounds={maxBounds} maxBounds={maxBounds}
zoom={zoom}
center={center}
onRequestClose={this.handleRequestClose} onRequestClose={this.handleRequestClose}
/> />
</div> </div>
......
...@@ -44,15 +44,7 @@ class MapDialog extends React.Component { ...@@ -44,15 +44,7 @@ class MapDialog extends React.Component {
}; };
render() { render() {
const { classes, selectedValue,facility,facilities,maxBounds,...other } = this.props; const { classes, selectedValue,facility,facilities,zoom,center,maxBounds,...other } = this.props;
let center,zoom
try{
center = facility.facility_location.coordinate_location.coordinates;
zoom = 17;
}catch(e){
zoom=13;
center = [(maxBounds[0][0]+maxBounds[1][0])/2,(maxBounds[0][1]+maxBounds[1][1])/2]
}
return ( return (
<Dialog onRequestClose={this.handleRequestClose} {...other}> <Dialog onRequestClose={this.handleRequestClose} {...other}>
......
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