mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-22 01:38:12 +08:00
* save graph selection in redux state * fix old graph brush select regressions * refactor graph brush selection to work with undo/redo * update tests to match new crossfilter spatial select API * graph selection state now in redux * remove dead code * sync graph selection with redux state; improvements to undoable machinery * fix regression in undoable * differentiate graph selection cancel from deselect action * simplify calculation * remove debugging code * fix responsive repaint bug in graph selection tool * undoable debugging and code cleanliness * undoable action filter state now merges, rather than replaces * improve comments * add debounce to undoable action filter; improve comments and debug sanity check code * comments * fix undoable bug with clear scatterplot actions * disable undoable debug flag * cleanup API and comments around statemachine * add test id attribute to lasso * add better error handling for gene fetch requests
60 lines
1.1 KiB
JavaScript
60 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 "reset World to eq Universe": {
|
|
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;
|