brushable histogram brush selection responds to state updates (#670)

* add continuousSelection reducer and make histo respond to state changes

* correctly handle uninitialized state for brush move

* PR review tweaks
This commit is contained in:
Bruce Martin
2019-03-25 15:02:39 -07:00
committed by GitHub
parent df46db965a
commit 153f240c43
3 changed files with 91 additions and 16 deletions
@@ -0,0 +1,26 @@
import { makeContinuousDimensionName } from "../util/nameCreators";
const ContinuousSelection = (state = {}, action) => {
switch (action.type) {
case "reset World to eq Universe": {
return {};
}
case "continuous metadata histogram start":
case "continuous metadata histogram brush":
case "continuous metadata histogram end": {
const name = makeContinuousDimensionName(
action.continuousNamespace,
action.selection
);
return {
...state,
[name]: action.range
};
}
default: {
return state;
}
}
};
export default ContinuousSelection;