Commit fb893ca0 authored by Mattias J Duffy's avatar Mattias J Duffy

more map performance improvements

parent c650e27f
Pipeline #2897 passed with stages
in 1 minute and 42 seconds
......@@ -42,12 +42,17 @@ class FacilitiesMap extends React.Component {
this.state = {
maxBounds: getMaxBounds(campusRegion),
campusRegion: campusRegion,
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion),
zoom: facilityLocationExists ? [17] : [0],
zoom: [17],
fitBoundsOptions: {},
facilityLocations: [],
selectedLocation: null
selectedLocation: null,
isLoaded: false
};
setTimeout(() => {
this.setState({
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion)
});
}, 500);
}
componentWillReceiveProps(nextProps) {
......@@ -72,7 +77,7 @@ class FacilitiesMap extends React.Component {
maxBounds: getMaxBounds(campusRegion),
campusRegion: campusRegion,
center: facilityLocationExists ? facility.facility_location.coordinate_location.coordinates : getCenterOfCampusRegion(campusRegion),
zoom: facilityLocationExists ? [17] : [0]
zoom: [17]
});
};
......@@ -108,14 +113,13 @@ class FacilitiesMap extends React.Component {
this.setState({
selectedLocation: oldSelectedLocation !== location ? location : null,
center: location && location.location.coordinate_location.coordinates,
zoom: oldSelectedLocation !== location ? [17] : oldZoom
zoom: [17]
});
}
render() {
const {interactive = true} = this.props;
const {maxBounds, fitBoundsOptions, facilityLocations, selectedLocation, center, zoom} = this.state;
return (
<this.Map
onStyleLoad={(map) => {
......@@ -130,7 +134,7 @@ class FacilitiesMap extends React.Component {
}}
animationOptions={{
animate: true,
duration: 1500
duration: 1250
}}
style="mapbox://styles/mduffy8/cjbcdxi3v73hp2spiyhxbkjde"
movingMethod="easeTo"
......
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