fix color-by regression in toggle (#705)

* fix color-by regression in toggle

* fix incorrect field reference
This commit is contained in:
Bruce Martin
2019-04-11 12:47:38 -07:00
committed by GitHub
parent 73852dd6f4
commit 9044b8d85d
+9 -10
View File
@@ -55,11 +55,11 @@ const ColorsReducer = (
const { world } = prevSharedState; const { world } = prevSharedState;
/* toggle between this mode and reset */ /* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null; const resetCurrent =
const colorAccessor = action.type === state.colorMode &&
action.colorAccessor !== state.colorAccessor && colorMode !== null action.colorAccessor === state.colorAccessor;
? action.colorAccessor const colorMode = !resetCurrent ? action.type : null;
: null; const colorAccessor = !resetCurrent ? action.colorAccessor : null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor); const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return { return {
@@ -75,11 +75,10 @@ const ColorsReducer = (
const { world } = prevSharedState; const { world } = prevSharedState;
/* toggle between this mode and reset */ /* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null; const resetCurrent =
const colorAccessor = action.type === state.colorMode && action.gene === state.colorAccessor;
action.gene !== state.colorAccessor && coorMode !== null const colorMode = !resetCurrent ? action.type : null;
? action.gene const colorAccessor = !resetCurrent ? action.gene : null;
: null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor); const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return { return {