Interactive interface for browsing global, full-resolution satellite imagery
remove hover interactions #2144
Benjamin King9c1bef9bde9f
diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex 5c82f46f6..e6148b03e 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -90,7 +90,6 @@ export function mapui(models, config, store, ui) {createLayer = self.createLayer = layerBuilder.createLayer;self.promiseDay = precache.promiseDay;self.selectedVectors = {};- self.hoveredVectors = {};/*** Suscribe to redux store and listen for* specific action types@@ -141,15 +140,13 @@ export function mapui(models, config, store, ui) {case CALCULATE_RESPONSIVE_STATE:return onResize();case vectorStyleConstants.SET_SELECTED_VECTORS:- case vectorStyleConstants.SET_HOVERED_VECTORS:- const type = action.type === vectorStyleConstants.SET_SELECTED_VECTORS ? 'selection' : 'hovered';+ const type = 'selection';let newSelection = action.payload;let state = store.getState();let { compare, layers } = state;let activeLayerStr = compare.activeString;- let lastSelectionStr = type === 'selection' ? 'selectedVectors' : 'hoveredVectors';- updateVectorSelection(action.payload, self[lastSelectionStr], layers[activeLayerStr], type, state);- self[lastSelectionStr] = newSelection;+ updateVectorSelection(action.payload, self.selectedVectors, layers[activeLayerStr], type, state);+ self.selectedVectors = newSelection;return;case CHANGE_UNITS:return toggleMeasurementUnits(action.value);@@ -1130,7 +1127,6 @@ export function mapui(models, config, store, ui) {return;}pixels = map.getEventPixel(e.originalEvent);- onMapHoverGetVectorFeatures(pixels, map, store)coords = map.getCoordinateFromPixel(pixels);if (!coords) return;diff --git a/web/js/modules/vector-styles/actions.js b/web/js/modules/vector-styles/actions.jsindex 01c92642e..047dbeca5 100644--- a/web/js/modules/vector-styles/actions.js+++ b/web/js/modules/vector-styles/actions.js@@ -102,10 +102,4 @@ export function selectVectorFeatures(payload) {type: SET_SELECTED_VECTORS,payload}-}-export function hoverVectorFeatures(payload) {- return {- type: SET_HOVERED_VECTORS,- payload- }}\ No newline at end of filediff --git a/web/js/modules/vector-styles/reducers.js b/web/js/modules/vector-styles/reducers.jsindex 894fac2b8..1d2fcbf57 100644--- a/web/js/modules/vector-styles/reducers.js+++ b/web/js/modules/vector-styles/reducers.js@@ -10,8 +10,7 @@ export const defaultVectorStyleState = {custom: {},active: {},activeB: {},- selected: {},- hovered: {}+ selected: {}};export function getInitialVectorStyleState(config) {const custom = lodashGet(config, 'vectorStyles') || {};@@ -39,10 +38,6 @@ export function vectorStyleReducer(state = defaultVectorStyleState, action) {return lodashAssign({}, state, {selected: action.payload});- case SET_HOVERED_VECTORS:- return lodashAssign({}, state, {- hovered: action.payload- });default:return state;}diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.jsindex a6643dcbb..87d0fce2f 100644--- a/web/js/modules/vector-styles/selectors.js+++ b/web/js/modules/vector-styles/selectors.js@@ -82,7 +82,6 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)var layerState = state.layers;const activeLayerStr = state.compare.activeString;const selected = state.vectorStyles.selected;- const hovered = state.vectorStyles.hovered;var activeLayers = getLayers(layerState[activeLayerStr],{},@@ -141,10 +140,8 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)}});} else if (glStyle.name === 'SEDAC' &&- ((selected[layerId] && selected[layerId].length) ||- (hovered[layerId] && hovered[layerId].length))) {+ ((selected[layerId] && selected[layerId].length))) {const selectedFeatures = selected[layerId];- const hoveredFeatures = hovered[layerId];layer.setStyle(function (feature, resolution) {const data = state.config.vectorData[def.vectorData.id];const properties = data.mvt_properties;@@ -152,8 +149,6 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)const id = feature.getProperties()[titleKey];if (selectedFeatures && selectedFeatures.includes(id)) {return selectedStyleFunction(feature, styleFunction(feature, resolution));- } else if (hoveredFeatures && hoveredFeatures.includes(id)) {- return selectedStyleFunction(feature, styleFunction(feature, resolution));} else {return styleFunction(feature, resolution);}diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.jsindex 53026340b..20392f1fb 100644--- a/web/js/modules/vector-styles/util.js+++ b/web/js/modules/vector-styles/util.js@@ -136,7 +136,7 @@ export function onMapClickGetVectorFeatures(e, map, store) {wrapClassName: 'vector-modal-wrap',modalClassName: 'vector-modal light',CompletelyCustomModal: vectorDialog,- customProps: { vectorMetaObject: lodashGroupBy(metaArray, 'id') },+ customProps: { vectorMetaObject: lodashGroupBy(metaArray, 'id'), width: 500, offsetTop: 100 },onClose: () => {store.dispatch(selectVectorFeatures({}));}@@ -144,31 +144,6 @@ export function onMapClickGetVectorFeatures(e, map, store) {));};}-export function onMapHoverGetVectorFeatures(pixels, map, store) {- let selected = {};- const state = store.getState()- const lastSelection = state.vectorStyles.hovered;- const config = state.config;- map.forEachFeatureAtPixel(pixels, function (feature, layer) {- const def = lodashGet(layer, 'wv.def');- if (!def) return;- if (def.vectorData && def.vectorData.id && def.title) {- const layerId = def.id;- if (!selected[layerId]) selected[layerId] = [];- let features = feature.getProperties();- const vectorDataId = def.vectorData.id;- const data = config.vectorData[vectorDataId];- const properties = data.mvt_properties;- const titleKey = lodashFind(properties, { Function: 'Identify' })['Identifier'];- const title = features[titleKey];- if (!selected[layerId].includes(title)) selected[layerId].push(title);- }- });- if (lodashIsEqual(lastSelection, selected)) return;- if (Object.entries(selected).length || Object.entries(lastSelection).length) {- store.dispatch(hoverVectorFeatures(selected));- }-}export function updateVectorSelection(selectionObj, lastSelection, layers, type, state) {const vectorStyles = state.config.vectorStylesfor (let [key, featureIdArray] of Object.entries(selectionObj)) {