Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Change back to a-state when using the tour and add layergroup check

ZachTRice67864e9fdb72
diff --git a/web/js/components/tour/modal-tour-in-progress.js b/web/js/components/tour/modal-tour-in-progress.js
index 5bb1430c7..c341abe89 100644
--- a/web/js/components/tour/modal-tour-in-progress.js
+++ b/web/js/components/tour/modal-tour-in-progress.js
@@ -114,7 +114,6 @@ class ModalInProgress extends React.Component {
var errors = [];
var config = this.props.config;
var models = this.props.models;
- var ui = this.props.ui;
// When the link is loaded, save the tour to URL
models.tour.active = true;
@@ -242,25 +241,6 @@ class ModalInProgress extends React.Component {
selectedB = new Date(selectedB);
models.date.selectedB = selectedB;
}
- }).then(() => {
- // Close the comparison mode if there is no comparison mode in the step link
- if ((!currentState.ca || !currentState.cm) && models.compare.active === true) {
- models.compare.toggle();
- models.compare.load({});
- ui.sidebar.reactComponent.setState({
- isCompareMode: false
- });
- models.compare.active = false;
- } else {
- if (!models.compare.isCompareA) {
- models.compare.load({});
- models.compare.toggleState();
- ui.sidebar.reactComponent.setState({
- isCompareA: true
- });
- models.compare.isCompareA = true;
- }
- }
}).then(util.wrap(() => this.loadLink(currentState, stepTransition, prevState, currentStepIndex)));
}
@@ -278,6 +258,26 @@ class ModalInProgress extends React.Component {
}
}
+ // Close the comparison mode if there is no comparison mode in the step link
+ if ((!currentState.ca || !currentState.cm) && models.compare.active === true) {
+ models.compare.toggle();
+ models.compare.load({});
+ ui.sidebar.reactComponent.setState({
+ isCompareMode: false
+ });
+ models.compare.active = false;
+ } else {
+ if (!models.compare.isCompareA) {
+ models.layers.activeLayers = 'active';
+ models.compare.load({});
+ models.compare.toggleState();
+ ui.sidebar.reactComponent.setState({
+ isCompareA: true
+ });
+ models.compare.isCompareA = true;
+ }
+ }
+
// LOAD: Comparison
promises.push(models.compare.load(currentState, errors));
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index e8b5ce774..9eb6867ed 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -565,7 +565,8 @@ export function mapui(models, config) {
id: def.id
}
});
- if (!layer && layers[0].get('group')) {
+
+ if (!layer && layers.length && layers[0].get('group')) {
let subGroup, olGroupLayer;
lodashEach(layers, layerGroup => {
if (layerGroup.get('group') === layerGroupStr) {