Skip to content

Commit

Permalink
Remove unused currentBounds state
Browse files Browse the repository at this point in the history
This was added in 8a213ac but the usage
was removed in 43ee2ed.

Move other lines closer to where they are used.
  • Loading branch information
victorlin committed May 4, 2023
1 parent 7c7cdce commit f80a98e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,16 @@ class Map extends React.Component {
}
}
fitMapBoundsToData(demeData, demeIndices) {
const SWNE = this.getGeoRange(demeData, demeIndices);
// window.L available because leaflet() was called in UNSAFE_componentWillMount
this.state.currentBounds = window.L.latLngBounds(SWNE[0], SWNE[1]); // eslint-disable-line react/no-direct-mutation-state
const maxZoom = this.getMaxZoomForFittingMapToData();
// first, clear any existing timeout
if (this.bounds_timeout) {
window.clearTimeout(this.bounds_timeout);
}
// delay to change map bounds
this.bounds_timeout = window.setTimeout(
(map) => {
const SWNE = this.getGeoRange(demeData, demeIndices);
const maxZoom = this.getMaxZoomForFittingMapToData();
// window.L available because leaflet() was called in UNSAFE_componentWillMount
map.fitBounds(window.L.latLngBounds(SWNE[0], SWNE[1]), {maxZoom});
},
this.props.narrativeMode ? 100 : 750,
Expand Down

0 comments on commit f80a98e

Please sign in to comment.