diff --git a/imports/ui/components/Maps/SubsUnion/SubsUnion.js b/imports/ui/components/Maps/SubsUnion/SubsUnion.js index c624759..ab28b21 100644 --- a/imports/ui/components/Maps/SubsUnion/SubsUnion.js +++ b/imports/ui/components/Maps/SubsUnion/SubsUnion.js @@ -9,6 +9,7 @@ const subsUnion = (union, options) => { const color = options.color || '#145A32'; const fillColor = options.fillColor || 'green'; const opacity = options.options || 0.1; + const interactive = options.interactive || false; if (options.subs) { const lmap = options.map.leafletElement; @@ -18,10 +19,14 @@ const subsUnion = (union, options) => { union = null; if (options.show) { if (options.fromServer) { + // http://leafletjs.com/reference-1.3.0.html#geojson // We get the json from server side union = L.geoJson(JSON.parse(options.subs)); - union.setStyle({ color, fillColor, fillOpacity: opacity }); + union.setStyle({ + color, fillColor, fillOpacity: opacity, interactive + }); union.addTo(lmap); + union.bringToBack(); if (options.fit && options.bounds) { // console.log(options.bounds); const bounds = JSON.parse(options.bounds); @@ -34,7 +39,9 @@ const subsUnion = (union, options) => { const bounds = result[1]; union = L.geoJson(unionJson); - union.setStyle({ color, fillColor, fillOpacity: opacity }); + union.setStyle({ + color, fillColor, fillOpacity: opacity, interactive + }); union.addTo(lmap); if (options.fit) { options.map.leafletElement.fitBounds(bounds); diff --git a/imports/ui/pages/FiresMap/FiresMap.js b/imports/ui/pages/FiresMap/FiresMap.js index f577e08..3319841 100644 --- a/imports/ui/pages/FiresMap/FiresMap.js +++ b/imports/ui/pages/FiresMap/FiresMap.js @@ -336,6 +336,7 @@ let geoInit = true; export default translate([], { wait: true })(withTracker(() => { let subscription; + let alertSubscription; const centerStored = store.get('firesmap_center'); const zoomStored = store.get('firesmap_zoom'); @@ -362,7 +363,7 @@ export default translate([], { wait: true })(withTracker(() => { mapSize.get()[1].lng, mapSize.get()[1].lat ); - Meteor.subscribe( + alertSubscription = Meteor.subscribe( 'fireAlerts', mapSize.get()[0].lng, mapSize.get()[0].lat, @@ -388,7 +389,7 @@ export default translate([], { wait: true })(withTracker(() => { const fireAlerts = FireAlertsCollection.find().fetch(); const falsePositives = FalsePositivesCollection.find().fetch(); return { - loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready()), + loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready() && alertSubscription.ready()), userSubs: userSubs ? userSubs.value : null, userSubsBounds: userSubs ? userSubsBounds.value : null, subsready: settingsSubs.ready(),