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 categorical metadata":
case "color by continuous metadata": { case "color by continuous metadata": {
const { world } = prevSharedState; const { world } = prevSharedState;
const { rgb, scale } = createColors(
world, /* toggle between this mode and reset */
action.type, const colorMode = action.type !== state.colorMode ? action.type : null;
action.colorAccessor const colorAccessor =
); action.colorAccessor !== state.colorAccessor
? action.colorAccessor
: null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return { return {
...state, ...state,
colorMode: action.type, colorMode,
colorAccessor: action.colorAccessor, colorAccessor,
rgb, rgb,
scale scale
}; };
@@ -69,11 +73,17 @@ const ColorsReducer = (
case "color by expression": { case "color by expression": {
const { world } = prevSharedState; 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 { return {
...state, ...state,
colorMode: action.type, colorMode,
colorAccessor: action.gene, colorAccessor,
rgb, rgb,
scale scale
}; };