mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-23 04:28:12 +08:00
* 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
62 lines
1.1 KiB
JavaScript
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;
|