Make subs union no clickable (interactive) and wait for fire alerts

This commit is contained in:
vjrj 2018-02-16 16:46:06 +01:00
parent c35349670a
commit 79eed373d4
2 changed files with 12 additions and 4 deletions

View file

@ -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);

View file

@ -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(),