Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix map rendering of data buttons/swaths #1829

Benjamin Kingb9b77838aef5
diff --git a/web/js/map/data/map.js b/web/js/map/data/map.js
index 5bdd01c6d..9ea054840 100644
--- a/web/js/map/data/map.js
+++ b/web/js/map/data/map.js
@@ -27,16 +27,7 @@ export function dataMap(store, maps, dataUi, ui) {
var swathLayer = null;
var hovering = null;
var selectedFeatures = null;
- const subscribeToStore = function(action) {
- switch (action.type) {
- case CHANGE_PROJECTION:
- return updateProjection();
- case 'MAP/UPDATE_MAP_UI':
- map = maps.selected;
- }
- };
var init = function() {
- ui.events.on('last-action', subscribeToStore);
dataUi.events
.on('activate', updateProjection)
.on('query', clear)
@@ -183,11 +174,11 @@ export function dataMap(store, maps, dataUi, ui) {
};
var create = function() {
- createSelectionLayer();
createGridLayer();
createSwathLayer();
createButtonLayer();
createHoverLayer();
+ createSelectionLayer();
$(maps.selected.getViewport()).on('mousemove', hoverCheck);
$(maps.selected.getViewport()).on('click', clickCheck);
};
@@ -304,7 +295,6 @@ export function dataMap(store, maps, dataUi, ui) {
granule.feature.changed();
var select = new OlFeature(granule.geometry[projCrs]);
select.granule = granule;
- // granule.selectedFeature = select;
selectionLayer.getSource().addFeature(select);
selectedFeatures[granule.id] = select;
};
diff --git a/web/js/map/data/ui.js b/web/js/map/data/ui.js
index 2c66322b2..f9b14e69b 100644
--- a/web/js/map/data/ui.js
+++ b/web/js/map/data/ui.js
@@ -17,6 +17,7 @@ import { LOCATION_POP_ACTION } from '../../redux-location-state-customs';
import { getLayers } from '../../modules/layers/selectors';
import { getDataProductsFromActiveLayers } from '../../modules/data/selectors';
import * as LAYER_CONSTANTS from '../../modules/layers/constants';
+import { CHANGE_PROJECTION } from '../../modules/projection/constants';
export function dataUi(store, ui, config) {
var queryActive = false;
@@ -46,6 +47,8 @@ export function dataUi(store, ui, config) {
const subscribeToStore = function(action) {
switch (action.type) {
+ case CHANGE_PROJECTION:
+ return changeProjection();
case LOCATION_POP_ACTION:
case CHANGE_SIDEBAR_TAB:
return action.activeTab === 'download' ? onActivate() : mapController ? onDeactivate() : '';
@@ -68,6 +71,11 @@ export function dataUi(store, ui, config) {
return query();
}
};
+ var changeProjection = function() {
+ updateLayers();
+ query();
+ self.events.trigger('projectionUpdate');
+ };
var updateLayers = function() {
const state = store.getState();
const { layers, compare, proj, data } = state;