From 57ea015c0335c7b954a444bbfa4c9189843ffe43 Mon Sep 17 00:00:00 2001 From: vjrj Date: Wed, 31 Jan 2018 11:26:12 +0100 Subject: [PATCH] FiresMap refactor --- imports/ui/pages/FiresMap/FiresMap.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/imports/ui/pages/FiresMap/FiresMap.js b/imports/ui/pages/FiresMap/FiresMap.js index e7ffcc3..041ae97 100644 --- a/imports/ui/pages/FiresMap/FiresMap.js +++ b/imports/ui/pages/FiresMap/FiresMap.js @@ -47,6 +47,7 @@ class FiresMap extends React.Component { zoom: props.zoom }, useMarkers: false, + scaleAdded: false, showSubsUnion: true }; const self = this; @@ -59,9 +60,6 @@ class FiresMap extends React.Component { } componentDidMount() { - if (this.fireMap) { - this.addScale(); - } } onViewportChanged(viewport) { @@ -111,11 +109,15 @@ class FiresMap extends React.Component { } handleLeafletLoad(map) { - // console.log('Map loading'); // console.log(map); if (map) { + console.log('Firesmap loading'); const bounds = this.getMap().getBounds(); mapSize.set([bounds.getNorthEast(), bounds.getSouthWest()]); + if (!this.state.scaleAdded) { + this.addScale(); + this.state.scaleAdded = true; + } this.state.union = subsUnion(this.state.union, { map, subs: this.props.userSubs,