Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't display "Fill segment" option if editable mapping is active #7975

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed a bug that allowed the default newly created bounding box to appear outside the dataset. In case the whole bounding box would be outside it is created regardless. [#7892](https://github.com/scalableminds/webknossos/pull/7892)
- Fixed a rare bug that could cause hanging dataset uploads. [#7932](https://github.com/scalableminds/webknossos/pull/7932)
- Fixed that trashcan icons to remove layers during remote dataset upload were floating above the navbar. [#7954](https://github.com/scalableminds/webknossos/pull/7954)
- Fixed that the flood-filling action was available in the context menu although an editable mapping is active. Additionally volume related actions were removed from the context menu if only a skeleton layer is visible. [#7975](https://github.com/scalableminds/webknossos/pull/7975)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@ export function* floodFill(): Saga<void> {

const { position: positionFloat, planeId } = floodFillAction;
const volumeTracing = yield* select(enforceActiveVolumeTracing);
if (volumeTracing.hasEditableMapping) {
const message = "Volume modification is not allowed when an editable mapping is active.";
Toast.error(message);
console.error(message);
continue;
}
const segmentationLayer = yield* call(
[Model, Model.getSegmentationTracingLayer],
volumeTracing.tracingId,
Expand Down
17 changes: 8 additions & 9 deletions frontend/javascripts/oxalis/view/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ import {
ensureSegmentIndexIsLoadedAction,
} from "oxalis/model/actions/dataset_actions";
import { hideContextMenuAction } from "oxalis/model/actions/ui_actions";
import { getDisabledInfoForTools } from "oxalis/model/accessors/tool_accessor";

type ContextMenuContextValue = React.MutableRefObject<HTMLElement | null> | null;
export const ContextMenuContext = createContext<ContextMenuContextValue>(null);
Expand Down Expand Up @@ -924,6 +925,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
} = props;

const state = Store.getState();
const disabledVolumeInfo = getDisabledInfoForTools(state);
const isAgglomerateMappingEnabled = hasAgglomerateMapping(state);
const isConnectomeMappingEnabled = hasConnectomeFile(state);

Expand Down Expand Up @@ -1183,19 +1185,21 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
label: "Compute Mesh (ad-hoc)",
};
const nonSkeletonActions: ItemType[] =
volumeTracing != null && globalPosition != null
globalPosition != null && visibleSegmentationLayer != null
? [
// Segment 0 cannot/shouldn't be made active (as this
// would be an eraser effectively).
segmentIdAtPosition > 0
segmentIdAtPosition > 0 && !disabledVolumeInfo.PICK_CELL.isDisabled
? {
key: "select-cell",
onClick: () => {
Store.dispatch(
setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates),
);
},
disabled: segmentIdAtPosition === getActiveCellId(volumeTracing),
disabled:
volumeTracing == null || // satisfy TS
segmentIdAtPosition === getActiveCellId(volumeTracing),
label: (
<>
Activate Segment ({segmentIdAtPosition}){" "}
Expand All @@ -1207,7 +1211,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
focusInSegmentListItem,
loadPrecomputedMeshItem,
computeMeshAdHocItem,
allowUpdate
allowUpdate && !disabledVolumeInfo.FILL_CELL.isDisabled
? {
key: "fill-cell",
onClick: () => handleFloodFillFromGlobalPosition(globalPosition, viewport),
Expand All @@ -1217,11 +1221,6 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
]
: [];
const boundingBoxActions = getBoundingBoxMenuOptions(props);
if (volumeTracing == null && visibleSegmentationLayer != null && globalPosition != null) {
nonSkeletonActions.push(focusInSegmentListItem);
nonSkeletonActions.push(loadPrecomputedMeshItem);
nonSkeletonActions.push(computeMeshAdHocItem);
}

const isSkeletonToolActive = activeTool === AnnotationToolEnum.SKELETON;
let allActions: ItemType[] = [];
Expand Down