Better zoom of fire pages
This commit is contained in:
parent
7ce9317876
commit
8b1d7f7602
1 changed files with 10 additions and 4 deletions
|
|
@ -49,6 +49,7 @@ class Fire extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
return !(nextState.when === this.state.when && nextState.loading === this.state.loading && this.state.notfound === nextState.notfound);
|
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() {
|
render() {
|
||||||
const {
|
const {
|
||||||
notfound, loading, fire, t
|
notfound, loading, fire, t
|
||||||
|
|
@ -89,14 +96,12 @@ class Fire extends React.Component {
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<h4 className="page-header">{this.title}</h4>
|
<h4 className="page-header">{this.title}</h4>
|
||||||
<Map
|
<Map
|
||||||
ref={(map) => {
|
ref={(map) => { this.fireMap = map; }}
|
||||||
this.fireMap = map;
|
|
||||||
}}
|
|
||||||
animate
|
animate
|
||||||
sleep={false}
|
sleep={false}
|
||||||
center={[fire.lat, fire.lon]}
|
center={[fire.lat, fire.lon]}
|
||||||
className="fire-leaflet-container"
|
className="fire-leaflet-container"
|
||||||
zoom={12}
|
zoom={13}
|
||||||
>
|
>
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Circle
|
<Circle
|
||||||
|
|
@ -106,6 +111,7 @@ class Fire extends React.Component {
|
||||||
fillOpacity={0.0}
|
fillOpacity={0.0}
|
||||||
interactive={false}
|
interactive={false}
|
||||||
radius={fire.scan ? fire.scan * 1000 : 300}
|
radius={fire.scan ? fire.scan * 1000 : 300}
|
||||||
|
ref={(circle) => { this.circle = circle; this.handleLeafletLoad(circle); }}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
<FireList
|
<FireList
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue