mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-27 03:58:11 +08:00
toggle color-by when repeatedly picked by the user (#696)
* toggle color-by when repeatedly picked * remove debugging code
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user