FiresMap refactor

This commit is contained in:
vjrj 2018-01-31 11:26:12 +01:00
parent eafebf9d2a
commit 57ea015c03

View file

@ -47,6 +47,7 @@ class FiresMap extends React.Component {
zoom: props.zoom zoom: props.zoom
}, },
useMarkers: false, useMarkers: false,
scaleAdded: false,
showSubsUnion: true showSubsUnion: true
}; };
const self = this; const self = this;
@ -59,9 +60,6 @@ class FiresMap extends React.Component {
} }
componentDidMount() { componentDidMount() {
if (this.fireMap) {
this.addScale();
}
} }
onViewportChanged(viewport) { onViewportChanged(viewport) {
@ -111,11 +109,15 @@ class FiresMap extends React.Component {
} }
handleLeafletLoad(map) { handleLeafletLoad(map) {
// console.log('Map loading');
// console.log(map); // console.log(map);
if (map) { if (map) {
console.log('Firesmap loading');
const bounds = this.getMap().getBounds(); const bounds = this.getMap().getBounds();
mapSize.set([bounds.getNorthEast(), bounds.getSouthWest()]); mapSize.set([bounds.getNorthEast(), bounds.getSouthWest()]);
if (!this.state.scaleAdded) {
this.addScale();
this.state.scaleAdded = true;
}
this.state.union = subsUnion(this.state.union, { this.state.union = subsUnion(this.state.union, {
map, map,
subs: this.props.userSubs, subs: this.props.userSubs,