Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

replace legacy model event listener with direct dispatchers of map updates

Benjamin Kingb4d0f392d8a7
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index 03f3d90a6..03fa99a6d 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -326,7 +326,7 @@ function mapStateToProps(state) {
maxDate: layersLastDateTime(layers[activeStr], config),
isActive:
isActive &&
- lodashGet(legacy, 'map.selectedMap.frameState_') &&
+ lodashGet(legacy, 'map.ui.selected.frameState_') &&
sidebar.activeTab !== 'download' && // No Animation when data download is active
!(modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT'), // No Animation when Image download is open
hasSubdailyLayers,
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index c4132bff5..7ea8fbff2 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -80,13 +80,13 @@ class GIF extends Component {
const resolutions = isGeoProjection ? resolutionsGeo : resolutionsPolar;
const lonlats = imageUtilGetCoordsFromPixelValues(
boundaries,
- map.selectedMap
+ map.ui.selected
);
const crs = proj.crs;
const geolonlat1 = olProj.transform(lonlats[0], crs, 'EPSG:4326');
const geolonlat2 = olProj.transform(lonlats[1], crs, 'EPSG:4326');
const resolution = imageUtilCalculateResolution(
- Math.round(map.getZoom()),
+ Math.round(map.ui.selected.getView().getZoom()),
isGeoProjection,
proj.resolutions
);
diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.js
index aedb4112d..88b0cfd7a 100644
--- a/web/js/containers/image-download.js
+++ b/web/js/containers/image-download.js
@@ -72,7 +72,7 @@ class ImageDownloadContainer extends Component {
const resolutions = isGeoProjection ? resolutionsGeo : resolutionsPolar;
const lonlats = imageUtilGetCoordsFromPixelValues(
boundaries,
- map.selectedMap
+ map.ui.selected
);
const crs = proj.selected.crs;
const geolonlat1 = olProj.transform(lonlats[0], crs, 'EPSG:4326');
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index ddf07434d..1884c1f9c 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -14,7 +14,7 @@ import AnimationWidget from '../animation-widget';
import AnimationButton from '../../components/timeline/timeline-controls/animation-button';
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
-import lodashDebounce from 'lodash/debounce';
+import {debounce as lodashDebounce, get as lodashGet} from 'lodash';
import {
hasSubDaily,
@@ -428,7 +428,6 @@ function mapStateToProps(state) {
timeScaleChangeUnit,
timelineEndDateLimit
);
-
return {
draggerSelected: isCompareA ? 'selected' : 'selectedB', // ! will work for dragger?
hasSubdailyLayers,
@@ -456,8 +455,7 @@ function mapStateToProps(state) {
hideTimeline:
(modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT') || animation.gifActive,
animationDisabled:
- !legacy.map.selectedMap ||
- !legacy.map.selectedMap.frameState_ ||
+ !lodashGet(legacy, 'map.ui.selected.frameState_') ||
sidebar.activeTab === 'download'
};
}
diff --git a/web/js/modules/animation/selectors.js b/web/js/modules/animation/selectors.js
index aa9987985..f7b9b91d5 100644
--- a/web/js/modules/animation/selectors.js
+++ b/web/js/modules/animation/selectors.js
@@ -39,7 +39,7 @@ export function getImageArray(
var strDate;
var lonlats = imageUtilGetCoordsFromPixelValues(
boundaries,
- legacy.map.selectedMap
+ legacy.map.ui.selected
);
var layersArray;
var opacities;
diff --git a/web/js/modules/migration/reducers.js b/web/js/modules/migration/reducers.js
index 77f00ed06..a481838f1 100644
--- a/web/js/modules/migration/reducers.js
+++ b/web/js/modules/migration/reducers.js
@@ -2,7 +2,7 @@ import update from 'immutability-helper';
const legacyState = {
loaded: false,
- map: { selectedMap: null, rotation: 0 },
+ map: { ui: { selected: null }, rotation: 0, extent: [] },
initComplete: false
};
@@ -11,7 +11,7 @@ export default function legacyReducer(state = legacyState, action) {
case 'MAP/UPDATE_MAP_EXTENT':
return update(state, { map: { extent: { $set: action.extent } } });
case 'MAP/UPDATE_MAP_UI':
- return update(state, { map: { selectedMap: { $set: action.ui } } });
+ return update(state, { map: { ui: { $set: action.ui } } });
case 'MAP/UPDATE_ROTATION':
return update(state, { map: { rotation: { $set: action.rotation } } });
default: