button, reducer state

This commit is contained in:
Colin Megill
2021-12-07 15:53:56 -08:00
parent b048bbfd0c
commit 99c8f37a60
3 changed files with 38 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ import { getEmbSubsetView } from "../../util/stateManager/viewStackHelpers";
subsetPossible,
subsetResetPossible,
graphInteractionMode: state.controls.graphInteractionMode,
imageUnderlay: state.imageUnderlay,
clipPercentileMin: Math.round(100 * (annoMatrix?.clipRange?.[0] ?? 0)),
clipPercentileMax: Math.round(100 * (annoMatrix?.clipRange?.[1] ?? 1)),
userDefinedGenes: state.controls.userDefinedGenes,
@@ -206,6 +207,7 @@ class MenuBar extends React.PureComponent {
colorAccessor,
subsetPossible,
subsetResetPossible,
imageUnderlay,
} = this.props;
const { pendingClipPercentiles } = this.state;
@@ -268,6 +270,26 @@ class MenuBar extends React.PureComponent {
disabled={!isColoredByCategorical}
/>
</Tooltip>
<ButtonGroup className={styles.menubarButton}>
<Tooltip
content={"Toggle image"}
position="bottom"
hoverOpenDelay={globals.tooltipHoverOpenDelay}
>
<AnchorButton
type="button"
data-testid="toggle-image-underlay"
icon={"media"}
active={imageUnderlay.isActive}
onClick={() => {
dispatch({
type: "toggle image underlay",
});
}}
/>
</Tooltip>
</ButtonGroup>
<ButtonGroup className={styles.menubarButton}>
<Tooltip
content={selectionTooltip}

View File

@@ -0,0 +1,14 @@
const imageUnderlay = (state = { isActive: false }, action) => {
switch (action.type) {
case "toggle image underlay":
return {
...state,
isActive: !state.isActive,
};
default:
return state;
}
};
export default imageUnderlay;

View File

@@ -19,6 +19,7 @@ import genesetsUI from "./genesetsUI";
import autosave from "./autosave";
import centroidLabels from "./centroidLabels";
import pointDialation from "./pointDilation";
import imageUnderlay from "./imageUnderlay";
import { gcMiddleware as annoMatrixGC } from "../annoMatrix";
import undoableConfig from "./undoableConfig";
@@ -39,6 +40,7 @@ const Reducer = undoable(
["controls", controls],
["differential", differential],
["centroidLabels", centroidLabels],
["imageUnderlay", imageUnderlay],
["pointDilation", pointDialation],
["autosave", autosave],
]),