mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 05:18: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 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
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user