Interactive interface for browsing global, full-resolution satellite imagery
Wv 2837 display currently selected preset (#4637)
Patrick Moulden226b9908f960
diff --git a/web/js/components/layer/settings/band-selection/band-selection-menu.js b/web/js/components/layer/settings/band-selection/band-selection-menu.jsindex a5ca36e3f..4795967a5 100644--- a/web/js/components/layer/settings/band-selection/band-selection-menu.js+++ b/web/js/components/layer/settings/band-selection/band-selection-menu.js@@ -18,14 +18,16 @@ export default function BandSelection({ layer }) {activeLayers: getActiveLayers(state, state.compare.activeString).map((layer) => layer),}));const layerIndex = activeLayers.findIndex((activeLayer) => activeLayer.id === layer.id);+ const currentSelectedPreset = useSelector((state) => state.layers.active.layers[layerIndex].selectedPreset);+ const [selectedPreset, setSelectedPreset] = useState(currentSelectedPreset);const updateBandCombination = (id, bandCombo) => {- dispatch(updateBandCombinationAction(id, bandCombo, layerIndex));+ dispatch(updateBandCombinationAction(id, bandCombo, layerIndex, selectedPreset));};+const removeLayer = (id) => { dispatch(removeLayerAction(id)); };const closeModal = () => { dispatch(onClose()); };- const [selectedPreset, setSelectedPreset] = useState(null);const [bandSelection, setBandSelection] = useState({r: layer.bandCombo.r,g: layer.bandCombo.g,diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.jsindex fea6aef4c..798cec6e2 100644--- a/web/js/modules/layers/actions.js+++ b/web/js/modules/layers/actions.js@@ -416,7 +416,7 @@ export function updateLayerDateCollection(layerInfo) {};}-export function updateBandCombination(id, bandCombo, layerIndex) {+export function updateBandCombination(id, bandCombo, layerIndex, selectedPreset) {return (dispatch, getState) => {const state = getState();const {@@ -435,6 +435,7 @@ export function updateBandCombination(id, bandCombo, layerIndex) {proj.id,groupOverlays,bandCombo,+ selectedPreset,);const projections = Object.keys(config.projections);updateRecentLayers(layerObj, projections);diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.jsindex c6b63bc43..d88ce4972 100644--- a/web/js/modules/layers/selectors.js+++ b/web/js/modules/layers/selectors.js@@ -21,7 +21,7 @@ const getLayerState = ({ layers }) => layers;const getConfig = ({ config }) => config;const getLayerId = (state, { layer }) => layer && layer.id;-export function addLayer(id, spec = {}, layersParam, layerConfig, overlayLength, projection, groupOverlays, bandComboParam) {+export function addLayer(id, spec = {}, layersParam, layerConfig, overlayLength, projection, groupOverlays, bandComboParam, selectedPresetParam) {let layers = lodashCloneDeep(layersParam);if (projection) {layers = layers.filter((layer) => layer.projections[projection]);@@ -53,6 +53,10 @@ export function addLayer(id, spec = {}, layersParam, layerConfig, overlayLength,def.bandCombo = bandComboParam;}+ if (selectedPresetParam) {+ def.selectedPreset = selectedPresetParam;+ }+if (!lodashIsUndefined(spec.visible)) {def.visible = spec.visible;} else if (!lodashIsUndefined(spec.hidden)) {