toggle color-by when repeatedly picked by the user (#696)

* toggle color-by when repeatedly picked

* remove debugging code
This commit is contained in:
Bruce Martin
2019-04-08 10:57:47 -07:00
committed by GitHub
parent c9a56fa73a
commit 71505abe4c
+20 -10
View File
@@ -53,15 +53,19 @@ const ColorsReducer = (
case "color by categorical metadata":
case "color by continuous metadata": {
const { world } = prevSharedState;
const { rgb, scale } = createColors(
world,
action.type,
action.colorAccessor
);
/* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null;
const colorAccessor =
action.colorAccessor !== state.colorAccessor
? action.colorAccessor
: null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return {
...state,
colorMode: action.type,
colorAccessor: action.colorAccessor,
colorMode,
colorAccessor,
rgb,
scale
};
@@ -69,11 +73,17 @@ const ColorsReducer = (
case "color by expression": {
const { world } = prevSharedState;
const { rgb, scale } = createColors(world, action.type, action.gene);
/* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null;
const colorAccessor =
action.gene !== state.colorAccessor ? action.gene : null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return {
...state,
colorMode: action.type,
colorAccessor: action.gene,
colorMode,
colorAccessor,
rgb,
scale
};