diff --git a/imports/ui/pages/Fires/Fires.js b/imports/ui/pages/Fires/Fires.js index 69d9637..24e54bb 100644 --- a/imports/ui/pages/Fires/Fires.js +++ b/imports/ui/pages/Fires/Fires.js @@ -49,6 +49,7 @@ class Fire extends React.Component { } } + shouldComponentUpdate(nextProps, nextState) { return !(nextState.when === this.state.when && nextState.loading === this.state.loading && this.state.notfound === nextState.notfound); } @@ -65,6 +66,12 @@ class Fire extends React.Component { }); } + handleLeafletLoad(circle) { + if (this.fireMap && this.fireMap.leafletElement && circle && circle.leafletElement) { + this.fireMap.leafletElement.fitBounds(circle.leafletElement.getBounds()); + } + } + render() { const { notfound, loading, fire, t @@ -89,14 +96,12 @@ class Fire extends React.Component {

{this.title}

{ - this.fireMap = map; - }} + ref={(map) => { this.fireMap = map; }} animate sleep={false} center={[fire.lat, fire.lon]} className="fire-leaflet-container" - zoom={12} + zoom={13} > { this.circle = circle; this.handleLeafletLoad(circle); }} />