Make subs union no clickable (interactive) and wait for fire alerts
This commit is contained in:
parent
c35349670a
commit
79eed373d4
2 changed files with 12 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ const subsUnion = (union, options) => {
|
||||||
const color = options.color || '#145A32';
|
const color = options.color || '#145A32';
|
||||||
const fillColor = options.fillColor || 'green';
|
const fillColor = options.fillColor || 'green';
|
||||||
const opacity = options.options || 0.1;
|
const opacity = options.options || 0.1;
|
||||||
|
const interactive = options.interactive || false;
|
||||||
|
|
||||||
if (options.subs) {
|
if (options.subs) {
|
||||||
const lmap = options.map.leafletElement;
|
const lmap = options.map.leafletElement;
|
||||||
|
|
@ -18,10 +19,14 @@ const subsUnion = (union, options) => {
|
||||||
union = null;
|
union = null;
|
||||||
if (options.show) {
|
if (options.show) {
|
||||||
if (options.fromServer) {
|
if (options.fromServer) {
|
||||||
|
// http://leafletjs.com/reference-1.3.0.html#geojson
|
||||||
// We get the json from server side
|
// We get the json from server side
|
||||||
union = L.geoJson(JSON.parse(options.subs));
|
union = L.geoJson(JSON.parse(options.subs));
|
||||||
union.setStyle({ color, fillColor, fillOpacity: opacity });
|
union.setStyle({
|
||||||
|
color, fillColor, fillOpacity: opacity, interactive
|
||||||
|
});
|
||||||
union.addTo(lmap);
|
union.addTo(lmap);
|
||||||
|
union.bringToBack();
|
||||||
if (options.fit && options.bounds) {
|
if (options.fit && options.bounds) {
|
||||||
// console.log(options.bounds);
|
// console.log(options.bounds);
|
||||||
const bounds = JSON.parse(options.bounds);
|
const bounds = JSON.parse(options.bounds);
|
||||||
|
|
@ -34,7 +39,9 @@ const subsUnion = (union, options) => {
|
||||||
const bounds = result[1];
|
const bounds = result[1];
|
||||||
|
|
||||||
union = L.geoJson(unionJson);
|
union = L.geoJson(unionJson);
|
||||||
union.setStyle({ color, fillColor, fillOpacity: opacity });
|
union.setStyle({
|
||||||
|
color, fillColor, fillOpacity: opacity, interactive
|
||||||
|
});
|
||||||
union.addTo(lmap);
|
union.addTo(lmap);
|
||||||
if (options.fit) {
|
if (options.fit) {
|
||||||
options.map.leafletElement.fitBounds(bounds);
|
options.map.leafletElement.fitBounds(bounds);
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,7 @@ let geoInit = true;
|
||||||
|
|
||||||
export default translate([], { wait: true })(withTracker(() => {
|
export default translate([], { wait: true })(withTracker(() => {
|
||||||
let subscription;
|
let subscription;
|
||||||
|
let alertSubscription;
|
||||||
|
|
||||||
const centerStored = store.get('firesmap_center');
|
const centerStored = store.get('firesmap_center');
|
||||||
const zoomStored = store.get('firesmap_zoom');
|
const zoomStored = store.get('firesmap_zoom');
|
||||||
|
|
@ -362,7 +363,7 @@ export default translate([], { wait: true })(withTracker(() => {
|
||||||
mapSize.get()[1].lng,
|
mapSize.get()[1].lng,
|
||||||
mapSize.get()[1].lat
|
mapSize.get()[1].lat
|
||||||
);
|
);
|
||||||
Meteor.subscribe(
|
alertSubscription = Meteor.subscribe(
|
||||||
'fireAlerts',
|
'fireAlerts',
|
||||||
mapSize.get()[0].lng,
|
mapSize.get()[0].lng,
|
||||||
mapSize.get()[0].lat,
|
mapSize.get()[0].lat,
|
||||||
|
|
@ -388,7 +389,7 @@ export default translate([], { wait: true })(withTracker(() => {
|
||||||
const fireAlerts = FireAlertsCollection.find().fetch();
|
const fireAlerts = FireAlertsCollection.find().fetch();
|
||||||
const falsePositives = FalsePositivesCollection.find().fetch();
|
const falsePositives = FalsePositivesCollection.find().fetch();
|
||||||
return {
|
return {
|
||||||
loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready()),
|
loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready() && alertSubscription.ready()),
|
||||||
userSubs: userSubs ? userSubs.value : null,
|
userSubs: userSubs ? userSubs.value : null,
|
||||||
userSubsBounds: userSubs ? userSubsBounds.value : null,
|
userSubsBounds: userSubs ? userSubsBounds.value : null,
|
||||||
subsready: settingsSubs.ready(),
|
subsready: settingsSubs.ready(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue