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

View File

@@ -55,11 +55,11 @@ const ColorsReducer = (
const { world } = prevSharedState;
/* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null;
const colorAccessor =
action.colorAccessor !== state.colorAccessor && colorMode !== null
? action.colorAccessor
: null;
const resetCurrent =
action.type === state.colorMode &&
action.colorAccessor === state.colorAccessor;
const colorMode = !resetCurrent ? action.type : null;
const colorAccessor = !resetCurrent ? action.colorAccessor : null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return {
@@ -75,11 +75,10 @@ const ColorsReducer = (
const { world } = prevSharedState;
/* toggle between this mode and reset */
const colorMode = action.type !== state.colorMode ? action.type : null;
const colorAccessor =
action.gene !== state.colorAccessor && coorMode !== null
? action.gene
: null;
const resetCurrent =
action.type === state.colorMode && action.gene === state.colorAccessor;
const colorMode = !resetCurrent ? action.type : null;
const colorAccessor = !resetCurrent ? action.gene : null;
const { rgb, scale } = createColors(world, colorMode, colorAccessor);
return {