Files
cellxgene/client/src/reducers/graphSelection.js
T
Bruce Martin 2357d0c1b8 layout change UI (#776)
* add layout to schema

* add layout choice action and reducer

* multi layout UI

* update unit tests

* add missing file

* update test schema

* fix duplicate test id

* fix tabs

* PR lint

* fix pytest
2019-05-22 13:21:33 -07:00

62 lines
1.1 KiB
JavaScript

const GraphSelection = (
state = {
tool: "lasso", // what selection tool mode (lasso, brush, ...)
selection: { mode: "all" } // current selection, which is tool specific
},
action
) => {
switch (action.type) {
case "set clip quantiles":
case "reset World to eq Universe":
case "set layout choice": {
return {
...state,
selection: {
mode: "all"
}
};
}
case "graph brush end":
case "graph brush change": {
const { brushCoords } = action;
return {
...state,
selection: {
mode: "within-rect",
brushCoords
}
};
}
case "graph lasso end": {
const { polygon } = action;
return {
...state,
selection: {
mode: "within-polygon",
polygon
}
};
}
case "graph lasso cancel":
case "graph brush cancel":
case "graph lasso deselect":
case "graph brush deselect": {
return {
...state,
selection: {
mode: "all"
}
};
}
default: {
return state;
}
}
};
export default GraphSelection;