From a8678be29dd02647a5891a8e2a2569f2fa41d2da Mon Sep 17 00:00:00 2001 From: Charlie Meister Date: Mon, 23 Sep 2024 15:39:10 +0200 Subject: [PATCH 1/4] disable proofreading actions for meshfiles that were created for a mapping --- .../javascripts/oxalis/view/context_menu.tsx | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/frontend/javascripts/oxalis/view/context_menu.tsx b/frontend/javascripts/oxalis/view/context_menu.tsx index 20da1aabffd..ecd458ba1d7 100644 --- a/frontend/javascripts/oxalis/view/context_menu.tsx +++ b/frontend/javascripts/oxalis/view/context_menu.tsx @@ -394,6 +394,7 @@ function getMeshItems( maybeUnmappedSegmentId: number | null | undefined, visibleSegmentationLayer: APIDataLayer | null | undefined, voxelSizeFactor: Vector3, + meshFileMapping: string | null | undefined, ): MenuItemType[] { if ( clickedMeshId == null || @@ -422,7 +423,8 @@ function getMeshItems( !isProofreadingActive || activeSegmentMissing || clickedMeshId === activeCellId || - maybeUnmappedSegmentId == null, + maybeUnmappedSegmentId == null || + meshFileMapping != null, onClick: () => { if (maybeUnmappedSegmentId == null) { // Should not happen due to the disabled property. @@ -437,9 +439,11 @@ function getMeshItems( ? "Cannot merge because the proofreading tool is not active." : maybeUnmappedSegmentId == null ? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." - : activeSegmentMissing - ? "Select a segment first." - : null + : meshFileMapping != null + ? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation." + : activeSegmentMissing + ? "Select a segment first." + : null } > Merge with active segment @@ -454,7 +458,8 @@ function getMeshItems( clickedMeshId !== activeCellId || maybeUnmappedSegmentId == null || activeUnmappedSegmentId == null || - maybeUnmappedSegmentId === activeUnmappedSegmentId, + maybeUnmappedSegmentId === activeUnmappedSegmentId || + meshFileMapping != null, onClick: () => { if (maybeUnmappedSegmentId == null) { // Should not happen due to the disabled property. @@ -471,9 +476,11 @@ function getMeshItems( ? "Cannot split because the proofreading tool is not active." : maybeUnmappedSegmentId == null ? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." - : activeSegmentMissing - ? "Select a segment first." - : null + : meshFileMapping != null + ? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation." + : activeSegmentMissing + ? "Select a segment first." + : null } > Split from active segment @@ -482,7 +489,7 @@ function getMeshItems( }, { key: "split-from-all-neighbors", - disabled: maybeUnmappedSegmentId == null, + disabled: maybeUnmappedSegmentId == null || meshFileMapping != null, onClick: () => { if (maybeUnmappedSegmentId == null) { // Should not happen due to the disabled property. @@ -499,7 +506,9 @@ function getMeshItems( ? "Cannot split because the proofreading tool is not active." : maybeUnmappedSegmentId == null ? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." - : null + : meshFileMapping != null + ? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation." + : null } > Split from all neighboring segments @@ -576,6 +585,7 @@ function getNodeContextMenuOptions({ volumeTracing, infoRows, allowUpdate, + currentMeshFile, }: NodeContextMenuOptionsProps): ItemType[] { const state = Store.getState(); const isProofreadingActive = state.uiInformation.activeTool === AnnotationToolEnum.PROOFREAD; @@ -617,6 +627,7 @@ function getNodeContextMenuOptions({ maybeUnmappedSegmentId, visibleSegmentationLayer, voxelSize.factor, + currentMeshFile?.mappingName, ); const menuItems: ItemType[] = [ @@ -1251,6 +1262,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] maybeUnmappedSegmentId, visibleSegmentationLayer, voxelSize.factor, + currentMeshFile?.mappingName, ); if (isSkeletonToolActive) { From c6cdd1b2faf80231f92fd9b05cb2cde77e9c7842 Mon Sep 17 00:00:00 2001 From: Charlie Meister Date: Mon, 23 Sep 2024 16:35:30 +0200 Subject: [PATCH 2/4] add changelog --- CHANGELOG.unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 54c30f51bda..19b17babd1e 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -22,6 +22,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Updated frontend package management to yarn version 4. [8061](https://github.com/scalableminds/webknossos/pull/8061) - Updated React to version 18. Updated many peer dependencies inlcuding Redux, React-Router, antd, and FlexLayout. [#8048](https://github.com/scalableminds/webknossos/pull/8048) - Improved the performance of context menus in the bounding box tab. [#8059](https://github.com/scalableminds/webknossos/pull/8059) +- Some mesh-related actions were disabled in proofreading-mode when using meshfiles that were created for a mapping rather than an oversegmentation. [#8091](https://github.com/scalableminds/webknossos/pull/8091) ### Fixed - The JS API v2 has been removed as it was deprecated by v3 in 2018. Please upgrade to v3 in case your scripts still use v2. [#8076](https://github.com/scalableminds/webknossos/pull/8076) From 89790bdb2aaa5415a17e8a63bd056a7e991f5847 Mon Sep 17 00:00:00 2001 From: Charlie Meister Date: Tue, 24 Sep 2024 22:25:34 +0200 Subject: [PATCH 3/4] address review --- .../javascripts/oxalis/view/context_menu.tsx | 718 +++++++++--------- 1 file changed, 345 insertions(+), 373 deletions(-) diff --git a/frontend/javascripts/oxalis/view/context_menu.tsx b/frontend/javascripts/oxalis/view/context_menu.tsx index ecd458ba1d7..34b477ffdd1 100644 --- a/frontend/javascripts/oxalis/view/context_menu.tsx +++ b/frontend/javascripts/oxalis/view/context_menu.tsx @@ -394,7 +394,7 @@ function getMeshItems( maybeUnmappedSegmentId: number | null | undefined, visibleSegmentationLayer: APIDataLayer | null | undefined, voxelSizeFactor: Vector3, - meshFileMapping: string | null | undefined, + meshFileMappingName: string | null | undefined, ): MenuItemType[] { if ( clickedMeshId == null || @@ -415,107 +415,79 @@ function getMeshItems( // by looking the segment id up the segments list and checking against null. const activeSegmentMissing = segments.getNullable(activeCellId) == null; + const getTooltip = (actionVerb: "merge" | "split", actionNeedsActiveSegment: boolean) => { + return !isProofreadingActive + ? `Cannot ${actionVerb} because the proofreading tool is not active.` + : maybeUnmappedSegmentId == null + ? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." + : meshFileMappingName != null + ? "This mesh was created for a mapping. Please use a meshfile that is based on unmapped oversegmentation data." + : actionNeedsActiveSegment && activeSegmentMissing + ? "Select a segment first." + : null; + }; + + const shouldAgglomerateSkeletonActionsBeDisabled = + !isProofreadingActive || + activeSegmentMissing || + maybeUnmappedSegmentId == null || + meshFileMappingName != null; + const maybeProofreadingItems: MenuItemType[] = isProofreadingActive ? [ - { - key: "merge-agglomerate-skeleton", - disabled: - !isProofreadingActive || - activeSegmentMissing || - clickedMeshId === activeCellId || - maybeUnmappedSegmentId == null || - meshFileMapping != null, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - return Store.dispatch(proofreadMerge(null, maybeUnmappedSegmentId, clickedMeshId)); - }, - label: ( - - Merge with active segment - - ), + { + key: "merge-agglomerate-skeleton", + disabled: shouldAgglomerateSkeletonActionsBeDisabled || clickedMeshId === activeCellId, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + return Store.dispatch(proofreadMerge(null, maybeUnmappedSegmentId, clickedMeshId)); }, - { - key: "min-cut-agglomerate-at-position", - disabled: - !isProofreadingActive || - activeSegmentMissing || - clickedMeshId !== activeCellId || - maybeUnmappedSegmentId == null || - activeUnmappedSegmentId == null || - maybeUnmappedSegmentId === activeUnmappedSegmentId || - meshFileMapping != null, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - Store.dispatch( - minCutAgglomerateWithPositionAction(null, maybeUnmappedSegmentId, clickedMeshId), - ); - }, - label: ( - - Split from active segment - - ), + label: ( + Merge with active segment + ), + }, + { + key: "min-cut-agglomerate-at-position", + disabled: + shouldAgglomerateSkeletonActionsBeDisabled || + clickedMeshId !== activeCellId || + activeUnmappedSegmentId == null || + maybeUnmappedSegmentId === activeUnmappedSegmentId, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + Store.dispatch( + minCutAgglomerateWithPositionAction(null, maybeUnmappedSegmentId, clickedMeshId), + ); }, - { - key: "split-from-all-neighbors", - disabled: maybeUnmappedSegmentId == null || meshFileMapping != null, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - Store.dispatch( - cutAgglomerateFromNeighborsAction(null, null, maybeUnmappedSegmentId, clickedMeshId), - ); - }, - label: ( - - Split from all neighboring segments - - ), + label: ( + Split from active segment + ), + }, + { + key: "split-from-all-neighbors", + disabled: maybeUnmappedSegmentId == null || meshFileMappingName != null, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + Store.dispatch( + cutAgglomerateFromNeighborsAction(null, null, maybeUnmappedSegmentId, clickedMeshId), + ); }, - ] + label: ( + + Split from all neighboring segments + + ), + }, + ] : []; const segmentIdLabel = @@ -529,21 +501,21 @@ function getMeshItems( return [ isProofreadingActive && activeUnmappedSegmentId != null && isAlreadySelected ? { - // If a supervoxel is selected (and thus highlighted), allow to select it. - key: "deactivate-segment", - onClick: () => - Store.dispatch(setActiveCellAction(clickedMeshId, undefined, undefined, undefined)), - label: `Deselect ${segmentOrSuperVoxel} (${segmentIdLabel})`, - } + // If a supervoxel is selected (and thus highlighted), allow to select it. + key: "deactivate-segment", + onClick: () => + Store.dispatch(setActiveCellAction(clickedMeshId, undefined, undefined, undefined)), + label: `Deselect ${segmentOrSuperVoxel} (${segmentIdLabel})`, + } : { - key: "activate-segment", - onClick: () => - Store.dispatch( - setActiveCellAction(clickedMeshId, undefined, undefined, maybeUnmappedSegmentId), - ), - disabled: isAlreadySelected, - label: `Select ${segmentOrSuperVoxel} (${segmentIdLabel})`, - }, + key: "activate-segment", + onClick: () => + Store.dispatch( + setActiveCellAction(clickedMeshId, undefined, undefined, maybeUnmappedSegmentId), + ), + disabled: isAlreadySelected, + label: `Select ${segmentOrSuperVoxel} (${segmentIdLabel})`, + }, { key: "hide-mesh", onClick: () => Actions.hideMesh(Store.dispatch, visibleSegmentationLayer.name, clickedMeshId), @@ -640,129 +612,129 @@ function getNodeContextMenuOptions({ getMaybeMinCutItem(clickedTree, volumeTracing, userBoundingBoxes, isVolumeModificationAllowed), ...(allowUpdate ? [ - { - key: "merge-trees", - disabled: areInSameTree, + { + key: "merge-trees", + disabled: areInSameTree, + onClick: () => + activeNodeId != null + ? Store.dispatch(mergeTreesAction(activeNodeId, clickedNodeId)) + : null, + label: ( + <> + Create Edge & Merge with this Tree{" "} + {useLegacyBindings ? shortcutBuilder(["Shift", AltOrOptionKey, "leftMouse"]) : null} + + ), + }, + isProofreadingActive + ? { + key: "min-cut-node", + disabled: !areInSameTree || isTheSameNode, onClick: () => activeNodeId != null - ? Store.dispatch(mergeTreesAction(activeNodeId, clickedNodeId)) + ? Store.dispatch(minCutAgglomerateAction(clickedNodeId, activeNodeId)) : null, - label: ( - <> - Create Edge & Merge with this Tree{" "} - {useLegacyBindings ? shortcutBuilder(["Shift", AltOrOptionKey, "leftMouse"]) : null} - - ), - }, - isProofreadingActive - ? { - key: "min-cut-node", - disabled: !areInSameTree || isTheSameNode, - onClick: () => - activeNodeId != null - ? Store.dispatch(minCutAgglomerateAction(clickedNodeId, activeNodeId)) - : null, - label: "Perform Min-Cut between these Nodes", - } - : null, + label: "Perform Min-Cut between these Nodes", + } + : null, - isProofreadingActive - ? { - key: "cut-agglomerate-from-neighbors", - disabled: !isProofreadingActive, - onClick: () => - Store.dispatch( - cutAgglomerateFromNeighborsAction( - clickedNode.untransformedPosition, - clickedTree, - ), - ), - label: ( - - Split from all neighboring segments - + isProofreadingActive + ? { + key: "cut-agglomerate-from-neighbors", + disabled: !isProofreadingActive, + onClick: () => + Store.dispatch( + cutAgglomerateFromNeighborsAction( + clickedNode.untransformedPosition, + clickedTree, ), - } - : null, + ), + label: ( + + Split from all neighboring segments + + ), + } + : null, - { - key: "delete-edge", - disabled: !areNodesConnected, + { + key: "delete-edge", + disabled: !areNodesConnected, + onClick: () => + activeNodeId != null + ? Store.dispatch(deleteEdgeAction(activeNodeId, clickedNodeId)) + : null, + label: ( + <> + Delete Edge to this Node{" "} + {useLegacyBindings ? shortcutBuilder(["Shift", CtrlOrCmdKey, "leftMouse"]) : null} + + ), + }, + { + key: "delete-node", + onClick: () => Actions.deleteNode(Store.dispatch, clickedNodeId, clickedTree.treeId), + label: ( + <> + Delete this Node {activeNodeId === clickedNodeId ? shortcutBuilder(["Del"]) : null} + + ), + }, + isBranchpoint + ? { + key: "branchpoint-node", + className: "node-context-menu-item", + onClick: () => + activeNodeId != null + ? Store.dispatch(deleteBranchpointByIdAction(clickedNodeId, clickedTree.treeId)) + : null, + label: "Unmark as Branchpoint", + } + : { + key: "branchpoint-node", + className: "node-context-menu-item", onClick: () => activeNodeId != null - ? Store.dispatch(deleteEdgeAction(activeNodeId, clickedNodeId)) + ? Store.dispatch(createBranchPointAction(clickedNodeId, clickedTree.treeId)) : null, label: ( <> - Delete Edge to this Node{" "} - {useLegacyBindings ? shortcutBuilder(["Shift", CtrlOrCmdKey, "leftMouse"]) : null} + Mark as Branchpoint{" "} + {activeNodeId === clickedNodeId ? shortcutBuilder(["B"]) : null} ), }, - { - key: "delete-node", - onClick: () => Actions.deleteNode(Store.dispatch, clickedNodeId, clickedTree.treeId), - label: ( - <> - Delete this Node {activeNodeId === clickedNodeId ? shortcutBuilder(["Del"]) : null} - - ), + isTheSameNode + ? null + : { + key: "extract-shortest-path", + disabled: activeNodeId == null || !areInSameTree || isTheSameNode, + onClick: () => + activeNodeId != null + ? extractShortestPathAsNewTree(clickedTree, activeNodeId, clickedNodeId) + : null, + label: "Extract shortest Path to this Node", }, - isBranchpoint - ? { - key: "branchpoint-node", - className: "node-context-menu-item", - onClick: () => - activeNodeId != null - ? Store.dispatch(deleteBranchpointByIdAction(clickedNodeId, clickedTree.treeId)) - : null, - label: "Unmark as Branchpoint", - } - : { - key: "branchpoint-node", - className: "node-context-menu-item", - onClick: () => - activeNodeId != null - ? Store.dispatch(createBranchPointAction(clickedNodeId, clickedTree.treeId)) - : null, - label: ( - <> - Mark as Branchpoint{" "} - {activeNodeId === clickedNodeId ? shortcutBuilder(["B"]) : null} - - ), - }, - isTheSameNode - ? null - : { - key: "extract-shortest-path", - disabled: activeNodeId == null || !areInSameTree || isTheSameNode, - onClick: () => - activeNodeId != null - ? extractShortestPathAsNewTree(clickedTree, activeNodeId, clickedNodeId) - : null, - label: "Extract shortest Path to this Node", - }, - ] + ] : []), ...meshItems, isTheSameNode ? null : { - key: "measure-node-path-length", - disabled: activeNodeId == null || !areInSameTree || isTheSameNode, - onClick: () => - activeNodeId != null - ? measureAndShowLengthBetweenNodes(activeNodeId, clickedNodeId, voxelSize.unit) - : null, - label: "Path Length to this Node", - }, + key: "measure-node-path-length", + disabled: activeNodeId == null || !areInSameTree || isTheSameNode, + onClick: () => + activeNodeId != null + ? measureAndShowLengthBetweenNodes(activeNodeId, clickedNodeId, voxelSize.unit) + : null, + label: "Path Length to this Node", + }, { key: "measure-whole-tree-length", onClick: () => @@ -771,10 +743,10 @@ function getNodeContextMenuOptions({ }, allowUpdate ? { - key: "hide-tree", - onClick: () => Store.dispatch(setTreeVisibilityAction(clickedTree.treeId, false)), - label: "Hide this Tree", - } + key: "hide-tree", + onClick: () => Store.dispatch(setTreeVisibilityAction(clickedTree.treeId, false)), + label: "Hide this Tree", + } : null, ...infoRows, ]; @@ -1037,7 +1009,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] ), - onOk() {}, + onOk() { }, }); const isVolumeBasedToolActive = VolumeTools.includes(activeTool); @@ -1045,113 +1017,113 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] const skeletonActions: ItemType[] = skeletonTracing != null && globalPosition != null && allowUpdate ? [ - { - key: "create-node", - onClick: () => handleCreateNodeFromGlobalPosition(globalPosition, viewport, false), - label: "Create Node here", - disabled: isSkeletonLayerTransformed(state), + { + key: "create-node", + onClick: () => handleCreateNodeFromGlobalPosition(globalPosition, viewport, false), + label: "Create Node here", + disabled: isSkeletonLayerTransformed(state), + }, + { + key: "create-node-with-tree", + onClick: () => { + Store.dispatch(createTreeAction()); + handleCreateNodeFromGlobalPosition(globalPosition, viewport, false); }, - { - key: "create-node-with-tree", - onClick: () => { - Store.dispatch(createTreeAction()); - handleCreateNodeFromGlobalPosition(globalPosition, viewport, false); - }, + label: ( + <> + Create new Tree here{" "} + {!isVolumeBasedToolActive && !isBoundingBoxToolActive + ? shortcutBuilder(["C"]) + : null} + + ), + }, + { + key: "load-agglomerate-skeleton", + // Do not disable menu entry, but show modal advertising automated segmentation services if no agglomerate file is activated + onClick: () => + isAgglomerateMappingEnabled.value + ? loadAgglomerateSkeletonAtPosition(globalPosition) + : showAutomatedSegmentationServicesModal( + isAgglomerateMappingEnabled.reason, + "Agglomerate files", + ), + label: ( + { + Store.dispatch(ensureLayerMappingsAreLoadedAction()); + }} + > + + Import Agglomerate Skeleton{" "} + {!isAgglomerateMappingEnabled.value ? ( + + ) : null}{" "} + {shortcutBuilder(["Shift", "middleMouse"])} + + + ), + }, + isAgglomerateMappingEnabled.value + ? { + key: "merge-agglomerate-skeleton", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(proofreadMerge(globalPosition)), label: ( - <> - Create new Tree here{" "} - {!isVolumeBasedToolActive && !isBoundingBoxToolActive - ? shortcutBuilder(["C"]) - : null} - + + Merge with active segment {shortcutBuilder(["Shift", "leftMouse"])} + ), - }, - { - key: "load-agglomerate-skeleton", - // Do not disable menu entry, but show modal advertising automated segmentation services if no agglomerate file is activated - onClick: () => - isAgglomerateMappingEnabled.value - ? loadAgglomerateSkeletonAtPosition(globalPosition) - : showAutomatedSegmentationServicesModal( - isAgglomerateMappingEnabled.reason, - "Agglomerate files", - ), + } + : null, + isAgglomerateMappingEnabled.value + ? { + key: "min-cut-agglomerate-at-position", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(minCutAgglomerateWithPositionAction(globalPosition)), label: ( { - Store.dispatch(ensureLayerMappingsAreLoadedAction()); - }} > - Import Agglomerate Skeleton{" "} - {!isAgglomerateMappingEnabled.value ? ( - - ) : null}{" "} - {shortcutBuilder(["Shift", "middleMouse"])} + Split from active segment {shortcutBuilder([CtrlOrCmdKey, "leftMouse"])} ), - }, - isAgglomerateMappingEnabled.value - ? { - key: "merge-agglomerate-skeleton", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(proofreadMerge(globalPosition)), - label: ( - - Merge with active segment {shortcutBuilder(["Shift", "leftMouse"])} - - ), - } - : null, - isAgglomerateMappingEnabled.value - ? { - key: "min-cut-agglomerate-at-position", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(minCutAgglomerateWithPositionAction(globalPosition)), - label: ( - - - Split from active segment {shortcutBuilder([CtrlOrCmdKey, "leftMouse"])} - - - ), - } - : null, - isAgglomerateMappingEnabled.value - ? { - key: "cut-agglomerate-from-neighbors", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(cutAgglomerateFromNeighborsAction(globalPosition)), - label: ( - - Split from all neighboring segments - - ), - } - : null, - ] + } + : null, + isAgglomerateMappingEnabled.value + ? { + key: "cut-agglomerate-from-neighbors", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(cutAgglomerateFromNeighborsAction(globalPosition)), + label: ( + + Split from all neighboring segments + + ), + } + : null, + ] : []; const segmentationLayerName = visibleSegmentationLayer != null ? visibleSegmentationLayer.name : null; @@ -1165,17 +1137,17 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] // Do not disable menu entry, but show modal advertising automated segmentation services if no connectome file is activated onClick: isConnectomeMappingEnabled.value ? withMappingActivationConfirmation( - () => loadSynapsesOfAgglomerateAtPosition(globalPosition), - connectomeFileMappingName, - "connectome file", - segmentationLayerName, - mappingInfo, - ) + () => loadSynapsesOfAgglomerateAtPosition(globalPosition), + connectomeFileMappingName, + "connectome file", + segmentationLayerName, + mappingInfo, + ) : () => - showAutomatedSegmentationServicesModal( - isConnectomeMappingEnabled.reason, - "Connectome files", - ), + showAutomatedSegmentationServicesModal( + isConnectomeMappingEnabled.reason, + "Connectome files", + ), label: isConnectomeMappingEnabled.value ? ( "Import Synapses" ) : ( @@ -1217,38 +1189,38 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] const nonSkeletonActions: ItemType[] = globalPosition != null && visibleSegmentationLayer != null ? [ - // Segment 0 cannot/shouldn't be made active (as this - // would be an eraser effectively). - segmentIdAtPosition > 0 && !disabledVolumeInfo.PICK_CELL.isDisabled - ? { - key: "select-cell", - onClick: () => { - Store.dispatch( - setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates), - ); - }, - disabled: - volumeTracing == null || // satisfy TS - segmentIdAtPosition === getActiveCellId(volumeTracing), - label: ( - <> - Activate Segment ({segmentIdAtPosition}){" "} - {isVolumeBasedToolActive ? shortcutBuilder(["Shift", "leftMouse"]) : null} - - ), - } - : null, - focusInSegmentListItem, - loadPrecomputedMeshItem, - computeMeshAdHocItem, - allowUpdate && !disabledVolumeInfo.FILL_CELL.isDisabled - ? { - key: "fill-cell", - onClick: () => handleFloodFillFromGlobalPosition(globalPosition, viewport), - label: "Fill Segment (flood-fill region)", - } - : null, - ] + // Segment 0 cannot/shouldn't be made active (as this + // would be an eraser effectively). + segmentIdAtPosition > 0 && !disabledVolumeInfo.PICK_CELL.isDisabled + ? { + key: "select-cell", + onClick: () => { + Store.dispatch( + setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates), + ); + }, + disabled: + volumeTracing == null || // satisfy TS + segmentIdAtPosition === getActiveCellId(volumeTracing), + label: ( + <> + Activate Segment ({segmentIdAtPosition}){" "} + {isVolumeBasedToolActive ? shortcutBuilder(["Shift", "leftMouse"]) : null} + + ), + } + : null, + focusInSegmentListItem, + loadPrecomputedMeshItem, + computeMeshAdHocItem, + allowUpdate && !disabledVolumeInfo.FILL_CELL.isDisabled + ? { + key: "fill-cell", + onClick: () => handleFloodFillFromGlobalPosition(globalPosition, viewport), + label: "Fill Segment (flood-fill region)", + } + : null, + ] : []; const boundingBoxActions = getBoundingBoxMenuOptions(props); @@ -1387,7 +1359,7 @@ function WkContextMenu() { currentConnectomeFile: visibleSegmentationLayer != null ? state.localSegmentationData[visibleSegmentationLayer.name].connectomeData - .currentConnectomeFile + .currentConnectomeFile : null, useLegacyBindings: state.userConfiguration.useLegacyBindings, userBoundingBoxes: someTracing != null ? someTracing.userBoundingBoxes : [], @@ -1564,12 +1536,12 @@ function ContextMenuInner(propsWithInputRef: Props) { const distanceToSelection = activeNode != null && positionToMeasureDistanceTo != null ? [ - formatNumberToLength( - V3.scaledDist(getActiveNodePosition(), positionToMeasureDistanceTo, voxelSize.factor), - LongUnitToShortUnitMap[voxelSize.unit], - ), - formatLengthAsVx(V3.length(V3.sub(getActiveNodePosition(), positionToMeasureDistanceTo))), - ] + formatNumberToLength( + V3.scaledDist(getActiveNodePosition(), positionToMeasureDistanceTo, voxelSize.factor), + LongUnitToShortUnitMap[voxelSize.unit], + ), + formatLengthAsVx(V3.length(V3.sub(getActiveNodePosition(), positionToMeasureDistanceTo))), + ] : null; const nodePositionAsString = nodeContextMenuNode != null && clickedNodesPosition != null @@ -1732,17 +1704,17 @@ function ContextMenuInner(propsWithInputRef: Props) { ? [] : maybeClickedNodeId != null ? getNodeContextMenuOptions({ - clickedNodeId: maybeClickedNodeId, - infoRows, - viewport: maybeViewport, - ...props, - }) + clickedNodeId: maybeClickedNodeId, + infoRows, + viewport: maybeViewport, + ...props, + }) : getNoNodeContextMenuOptions({ - segmentIdAtPosition, - infoRows, - viewport: maybeViewport, - ...props, - }), + segmentIdAtPosition, + infoRows, + viewport: maybeViewport, + ...props, + }), }; if (inputRef == null || inputRef.current == null) return null; From 1f1977b8e9f60131d28b343f842695d4d9ac1491 Mon Sep 17 00:00:00 2001 From: Charlie Meister Date: Tue, 24 Sep 2024 22:37:46 +0200 Subject: [PATCH 4/4] format code --- .../javascripts/oxalis/view/context_menu.tsx | 652 +++++++++--------- 1 file changed, 326 insertions(+), 326 deletions(-) diff --git a/frontend/javascripts/oxalis/view/context_menu.tsx b/frontend/javascripts/oxalis/view/context_menu.tsx index 34b477ffdd1..b1bbcae56fc 100644 --- a/frontend/javascripts/oxalis/view/context_menu.tsx +++ b/frontend/javascripts/oxalis/view/context_menu.tsx @@ -435,59 +435,59 @@ function getMeshItems( const maybeProofreadingItems: MenuItemType[] = isProofreadingActive ? [ - { - key: "merge-agglomerate-skeleton", - disabled: shouldAgglomerateSkeletonActionsBeDisabled || clickedMeshId === activeCellId, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - return Store.dispatch(proofreadMerge(null, maybeUnmappedSegmentId, clickedMeshId)); + { + key: "merge-agglomerate-skeleton", + disabled: shouldAgglomerateSkeletonActionsBeDisabled || clickedMeshId === activeCellId, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + return Store.dispatch(proofreadMerge(null, maybeUnmappedSegmentId, clickedMeshId)); + }, + label: ( + Merge with active segment + ), }, - label: ( - Merge with active segment - ), - }, - { - key: "min-cut-agglomerate-at-position", - disabled: - shouldAgglomerateSkeletonActionsBeDisabled || - clickedMeshId !== activeCellId || - activeUnmappedSegmentId == null || - maybeUnmappedSegmentId === activeUnmappedSegmentId, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - Store.dispatch( - minCutAgglomerateWithPositionAction(null, maybeUnmappedSegmentId, clickedMeshId), - ); + { + key: "min-cut-agglomerate-at-position", + disabled: + shouldAgglomerateSkeletonActionsBeDisabled || + clickedMeshId !== activeCellId || + activeUnmappedSegmentId == null || + maybeUnmappedSegmentId === activeUnmappedSegmentId, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + Store.dispatch( + minCutAgglomerateWithPositionAction(null, maybeUnmappedSegmentId, clickedMeshId), + ); + }, + label: ( + Split from active segment + ), }, - label: ( - Split from active segment - ), - }, - { - key: "split-from-all-neighbors", - disabled: maybeUnmappedSegmentId == null || meshFileMappingName != null, - onClick: () => { - if (maybeUnmappedSegmentId == null) { - // Should not happen due to the disabled property. - return; - } - Store.dispatch( - cutAgglomerateFromNeighborsAction(null, null, maybeUnmappedSegmentId, clickedMeshId), - ); + { + key: "split-from-all-neighbors", + disabled: maybeUnmappedSegmentId == null || meshFileMappingName != null, + onClick: () => { + if (maybeUnmappedSegmentId == null) { + // Should not happen due to the disabled property. + return; + } + Store.dispatch( + cutAgglomerateFromNeighborsAction(null, null, maybeUnmappedSegmentId, clickedMeshId), + ); + }, + label: ( + + Split from all neighboring segments + + ), }, - label: ( - - Split from all neighboring segments - - ), - }, - ] + ] : []; const segmentIdLabel = @@ -501,21 +501,21 @@ function getMeshItems( return [ isProofreadingActive && activeUnmappedSegmentId != null && isAlreadySelected ? { - // If a supervoxel is selected (and thus highlighted), allow to select it. - key: "deactivate-segment", - onClick: () => - Store.dispatch(setActiveCellAction(clickedMeshId, undefined, undefined, undefined)), - label: `Deselect ${segmentOrSuperVoxel} (${segmentIdLabel})`, - } + // If a supervoxel is selected (and thus highlighted), allow to select it. + key: "deactivate-segment", + onClick: () => + Store.dispatch(setActiveCellAction(clickedMeshId, undefined, undefined, undefined)), + label: `Deselect ${segmentOrSuperVoxel} (${segmentIdLabel})`, + } : { - key: "activate-segment", - onClick: () => - Store.dispatch( - setActiveCellAction(clickedMeshId, undefined, undefined, maybeUnmappedSegmentId), - ), - disabled: isAlreadySelected, - label: `Select ${segmentOrSuperVoxel} (${segmentIdLabel})`, - }, + key: "activate-segment", + onClick: () => + Store.dispatch( + setActiveCellAction(clickedMeshId, undefined, undefined, maybeUnmappedSegmentId), + ), + disabled: isAlreadySelected, + label: `Select ${segmentOrSuperVoxel} (${segmentIdLabel})`, + }, { key: "hide-mesh", onClick: () => Actions.hideMesh(Store.dispatch, visibleSegmentationLayer.name, clickedMeshId), @@ -612,129 +612,129 @@ function getNodeContextMenuOptions({ getMaybeMinCutItem(clickedTree, volumeTracing, userBoundingBoxes, isVolumeModificationAllowed), ...(allowUpdate ? [ - { - key: "merge-trees", - disabled: areInSameTree, - onClick: () => - activeNodeId != null - ? Store.dispatch(mergeTreesAction(activeNodeId, clickedNodeId)) - : null, - label: ( - <> - Create Edge & Merge with this Tree{" "} - {useLegacyBindings ? shortcutBuilder(["Shift", AltOrOptionKey, "leftMouse"]) : null} - - ), - }, - isProofreadingActive - ? { - key: "min-cut-node", - disabled: !areInSameTree || isTheSameNode, + { + key: "merge-trees", + disabled: areInSameTree, onClick: () => activeNodeId != null - ? Store.dispatch(minCutAgglomerateAction(clickedNodeId, activeNodeId)) + ? Store.dispatch(mergeTreesAction(activeNodeId, clickedNodeId)) : null, - label: "Perform Min-Cut between these Nodes", - } - : null, - - isProofreadingActive - ? { - key: "cut-agglomerate-from-neighbors", - disabled: !isProofreadingActive, - onClick: () => - Store.dispatch( - cutAgglomerateFromNeighborsAction( - clickedNode.untransformedPosition, - clickedTree, - ), - ), label: ( - - Split from all neighboring segments - + <> + Create Edge & Merge with this Tree{" "} + {useLegacyBindings ? shortcutBuilder(["Shift", AltOrOptionKey, "leftMouse"]) : null} + ), - } - : null, + }, + isProofreadingActive + ? { + key: "min-cut-node", + disabled: !areInSameTree || isTheSameNode, + onClick: () => + activeNodeId != null + ? Store.dispatch(minCutAgglomerateAction(clickedNodeId, activeNodeId)) + : null, + label: "Perform Min-Cut between these Nodes", + } + : null, - { - key: "delete-edge", - disabled: !areNodesConnected, - onClick: () => - activeNodeId != null - ? Store.dispatch(deleteEdgeAction(activeNodeId, clickedNodeId)) - : null, - label: ( - <> - Delete Edge to this Node{" "} - {useLegacyBindings ? shortcutBuilder(["Shift", CtrlOrCmdKey, "leftMouse"]) : null} - - ), - }, - { - key: "delete-node", - onClick: () => Actions.deleteNode(Store.dispatch, clickedNodeId, clickedTree.treeId), - label: ( - <> - Delete this Node {activeNodeId === clickedNodeId ? shortcutBuilder(["Del"]) : null} - - ), - }, - isBranchpoint - ? { - key: "branchpoint-node", - className: "node-context-menu-item", - onClick: () => - activeNodeId != null - ? Store.dispatch(deleteBranchpointByIdAction(clickedNodeId, clickedTree.treeId)) - : null, - label: "Unmark as Branchpoint", - } - : { - key: "branchpoint-node", - className: "node-context-menu-item", + isProofreadingActive + ? { + key: "cut-agglomerate-from-neighbors", + disabled: !isProofreadingActive, + onClick: () => + Store.dispatch( + cutAgglomerateFromNeighborsAction( + clickedNode.untransformedPosition, + clickedTree, + ), + ), + label: ( + + Split from all neighboring segments + + ), + } + : null, + + { + key: "delete-edge", + disabled: !areNodesConnected, onClick: () => activeNodeId != null - ? Store.dispatch(createBranchPointAction(clickedNodeId, clickedTree.treeId)) + ? Store.dispatch(deleteEdgeAction(activeNodeId, clickedNodeId)) : null, label: ( <> - Mark as Branchpoint{" "} - {activeNodeId === clickedNodeId ? shortcutBuilder(["B"]) : null} + Delete Edge to this Node{" "} + {useLegacyBindings ? shortcutBuilder(["Shift", CtrlOrCmdKey, "leftMouse"]) : null} ), }, - isTheSameNode - ? null - : { - key: "extract-shortest-path", - disabled: activeNodeId == null || !areInSameTree || isTheSameNode, - onClick: () => - activeNodeId != null - ? extractShortestPathAsNewTree(clickedTree, activeNodeId, clickedNodeId) - : null, - label: "Extract shortest Path to this Node", + { + key: "delete-node", + onClick: () => Actions.deleteNode(Store.dispatch, clickedNodeId, clickedTree.treeId), + label: ( + <> + Delete this Node {activeNodeId === clickedNodeId ? shortcutBuilder(["Del"]) : null} + + ), }, - ] + isBranchpoint + ? { + key: "branchpoint-node", + className: "node-context-menu-item", + onClick: () => + activeNodeId != null + ? Store.dispatch(deleteBranchpointByIdAction(clickedNodeId, clickedTree.treeId)) + : null, + label: "Unmark as Branchpoint", + } + : { + key: "branchpoint-node", + className: "node-context-menu-item", + onClick: () => + activeNodeId != null + ? Store.dispatch(createBranchPointAction(clickedNodeId, clickedTree.treeId)) + : null, + label: ( + <> + Mark as Branchpoint{" "} + {activeNodeId === clickedNodeId ? shortcutBuilder(["B"]) : null} + + ), + }, + isTheSameNode + ? null + : { + key: "extract-shortest-path", + disabled: activeNodeId == null || !areInSameTree || isTheSameNode, + onClick: () => + activeNodeId != null + ? extractShortestPathAsNewTree(clickedTree, activeNodeId, clickedNodeId) + : null, + label: "Extract shortest Path to this Node", + }, + ] : []), ...meshItems, isTheSameNode ? null : { - key: "measure-node-path-length", - disabled: activeNodeId == null || !areInSameTree || isTheSameNode, - onClick: () => - activeNodeId != null - ? measureAndShowLengthBetweenNodes(activeNodeId, clickedNodeId, voxelSize.unit) - : null, - label: "Path Length to this Node", - }, + key: "measure-node-path-length", + disabled: activeNodeId == null || !areInSameTree || isTheSameNode, + onClick: () => + activeNodeId != null + ? measureAndShowLengthBetweenNodes(activeNodeId, clickedNodeId, voxelSize.unit) + : null, + label: "Path Length to this Node", + }, { key: "measure-whole-tree-length", onClick: () => @@ -743,10 +743,10 @@ function getNodeContextMenuOptions({ }, allowUpdate ? { - key: "hide-tree", - onClick: () => Store.dispatch(setTreeVisibilityAction(clickedTree.treeId, false)), - label: "Hide this Tree", - } + key: "hide-tree", + onClick: () => Store.dispatch(setTreeVisibilityAction(clickedTree.treeId, false)), + label: "Hide this Tree", + } : null, ...infoRows, ]; @@ -1009,7 +1009,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] ), - onOk() { }, + onOk() {}, }); const isVolumeBasedToolActive = VolumeTools.includes(activeTool); @@ -1017,113 +1017,113 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] const skeletonActions: ItemType[] = skeletonTracing != null && globalPosition != null && allowUpdate ? [ - { - key: "create-node", - onClick: () => handleCreateNodeFromGlobalPosition(globalPosition, viewport, false), - label: "Create Node here", - disabled: isSkeletonLayerTransformed(state), - }, - { - key: "create-node-with-tree", - onClick: () => { - Store.dispatch(createTreeAction()); - handleCreateNodeFromGlobalPosition(globalPosition, viewport, false); + { + key: "create-node", + onClick: () => handleCreateNodeFromGlobalPosition(globalPosition, viewport, false), + label: "Create Node here", + disabled: isSkeletonLayerTransformed(state), }, - label: ( - <> - Create new Tree here{" "} - {!isVolumeBasedToolActive && !isBoundingBoxToolActive - ? shortcutBuilder(["C"]) - : null} - - ), - }, - { - key: "load-agglomerate-skeleton", - // Do not disable menu entry, but show modal advertising automated segmentation services if no agglomerate file is activated - onClick: () => - isAgglomerateMappingEnabled.value - ? loadAgglomerateSkeletonAtPosition(globalPosition) - : showAutomatedSegmentationServicesModal( - isAgglomerateMappingEnabled.reason, - "Agglomerate files", - ), - label: ( - { - Store.dispatch(ensureLayerMappingsAreLoadedAction()); - }} - > - - Import Agglomerate Skeleton{" "} - {!isAgglomerateMappingEnabled.value ? ( - - ) : null}{" "} - {shortcutBuilder(["Shift", "middleMouse"])} - - - ), - }, - isAgglomerateMappingEnabled.value - ? { - key: "merge-agglomerate-skeleton", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(proofreadMerge(globalPosition)), + { + key: "create-node-with-tree", + onClick: () => { + Store.dispatch(createTreeAction()); + handleCreateNodeFromGlobalPosition(globalPosition, viewport, false); + }, label: ( - - Merge with active segment {shortcutBuilder(["Shift", "leftMouse"])} - + <> + Create new Tree here{" "} + {!isVolumeBasedToolActive && !isBoundingBoxToolActive + ? shortcutBuilder(["C"]) + : null} + ), - } - : null, - isAgglomerateMappingEnabled.value - ? { - key: "min-cut-agglomerate-at-position", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(minCutAgglomerateWithPositionAction(globalPosition)), + }, + { + key: "load-agglomerate-skeleton", + // Do not disable menu entry, but show modal advertising automated segmentation services if no agglomerate file is activated + onClick: () => + isAgglomerateMappingEnabled.value + ? loadAgglomerateSkeletonAtPosition(globalPosition) + : showAutomatedSegmentationServicesModal( + isAgglomerateMappingEnabled.reason, + "Agglomerate files", + ), label: ( { + Store.dispatch(ensureLayerMappingsAreLoadedAction()); + }} > - Split from active segment {shortcutBuilder([CtrlOrCmdKey, "leftMouse"])} + Import Agglomerate Skeleton{" "} + {!isAgglomerateMappingEnabled.value ? ( + + ) : null}{" "} + {shortcutBuilder(["Shift", "middleMouse"])} ), - } - : null, - isAgglomerateMappingEnabled.value - ? { - key: "cut-agglomerate-from-neighbors", - disabled: !isProofreadingActive, - onClick: () => Store.dispatch(cutAgglomerateFromNeighborsAction(globalPosition)), - label: ( - - Split from all neighboring segments - - ), - } - : null, - ] + }, + isAgglomerateMappingEnabled.value + ? { + key: "merge-agglomerate-skeleton", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(proofreadMerge(globalPosition)), + label: ( + + Merge with active segment {shortcutBuilder(["Shift", "leftMouse"])} + + ), + } + : null, + isAgglomerateMappingEnabled.value + ? { + key: "min-cut-agglomerate-at-position", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(minCutAgglomerateWithPositionAction(globalPosition)), + label: ( + + + Split from active segment {shortcutBuilder([CtrlOrCmdKey, "leftMouse"])} + + + ), + } + : null, + isAgglomerateMappingEnabled.value + ? { + key: "cut-agglomerate-from-neighbors", + disabled: !isProofreadingActive, + onClick: () => Store.dispatch(cutAgglomerateFromNeighborsAction(globalPosition)), + label: ( + + Split from all neighboring segments + + ), + } + : null, + ] : []; const segmentationLayerName = visibleSegmentationLayer != null ? visibleSegmentationLayer.name : null; @@ -1137,17 +1137,17 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] // Do not disable menu entry, but show modal advertising automated segmentation services if no connectome file is activated onClick: isConnectomeMappingEnabled.value ? withMappingActivationConfirmation( - () => loadSynapsesOfAgglomerateAtPosition(globalPosition), - connectomeFileMappingName, - "connectome file", - segmentationLayerName, - mappingInfo, - ) + () => loadSynapsesOfAgglomerateAtPosition(globalPosition), + connectomeFileMappingName, + "connectome file", + segmentationLayerName, + mappingInfo, + ) : () => - showAutomatedSegmentationServicesModal( - isConnectomeMappingEnabled.reason, - "Connectome files", - ), + showAutomatedSegmentationServicesModal( + isConnectomeMappingEnabled.reason, + "Connectome files", + ), label: isConnectomeMappingEnabled.value ? ( "Import Synapses" ) : ( @@ -1189,38 +1189,38 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] const nonSkeletonActions: ItemType[] = globalPosition != null && visibleSegmentationLayer != null ? [ - // Segment 0 cannot/shouldn't be made active (as this - // would be an eraser effectively). - segmentIdAtPosition > 0 && !disabledVolumeInfo.PICK_CELL.isDisabled - ? { - key: "select-cell", - onClick: () => { - Store.dispatch( - setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates), - ); - }, - disabled: - volumeTracing == null || // satisfy TS - segmentIdAtPosition === getActiveCellId(volumeTracing), - label: ( - <> - Activate Segment ({segmentIdAtPosition}){" "} - {isVolumeBasedToolActive ? shortcutBuilder(["Shift", "leftMouse"]) : null} - - ), - } - : null, - focusInSegmentListItem, - loadPrecomputedMeshItem, - computeMeshAdHocItem, - allowUpdate && !disabledVolumeInfo.FILL_CELL.isDisabled - ? { - key: "fill-cell", - onClick: () => handleFloodFillFromGlobalPosition(globalPosition, viewport), - label: "Fill Segment (flood-fill region)", - } - : null, - ] + // Segment 0 cannot/shouldn't be made active (as this + // would be an eraser effectively). + segmentIdAtPosition > 0 && !disabledVolumeInfo.PICK_CELL.isDisabled + ? { + key: "select-cell", + onClick: () => { + Store.dispatch( + setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates), + ); + }, + disabled: + volumeTracing == null || // satisfy TS + segmentIdAtPosition === getActiveCellId(volumeTracing), + label: ( + <> + Activate Segment ({segmentIdAtPosition}){" "} + {isVolumeBasedToolActive ? shortcutBuilder(["Shift", "leftMouse"]) : null} + + ), + } + : null, + focusInSegmentListItem, + loadPrecomputedMeshItem, + computeMeshAdHocItem, + allowUpdate && !disabledVolumeInfo.FILL_CELL.isDisabled + ? { + key: "fill-cell", + onClick: () => handleFloodFillFromGlobalPosition(globalPosition, viewport), + label: "Fill Segment (flood-fill region)", + } + : null, + ] : []; const boundingBoxActions = getBoundingBoxMenuOptions(props); @@ -1359,7 +1359,7 @@ function WkContextMenu() { currentConnectomeFile: visibleSegmentationLayer != null ? state.localSegmentationData[visibleSegmentationLayer.name].connectomeData - .currentConnectomeFile + .currentConnectomeFile : null, useLegacyBindings: state.userConfiguration.useLegacyBindings, userBoundingBoxes: someTracing != null ? someTracing.userBoundingBoxes : [], @@ -1536,12 +1536,12 @@ function ContextMenuInner(propsWithInputRef: Props) { const distanceToSelection = activeNode != null && positionToMeasureDistanceTo != null ? [ - formatNumberToLength( - V3.scaledDist(getActiveNodePosition(), positionToMeasureDistanceTo, voxelSize.factor), - LongUnitToShortUnitMap[voxelSize.unit], - ), - formatLengthAsVx(V3.length(V3.sub(getActiveNodePosition(), positionToMeasureDistanceTo))), - ] + formatNumberToLength( + V3.scaledDist(getActiveNodePosition(), positionToMeasureDistanceTo, voxelSize.factor), + LongUnitToShortUnitMap[voxelSize.unit], + ), + formatLengthAsVx(V3.length(V3.sub(getActiveNodePosition(), positionToMeasureDistanceTo))), + ] : null; const nodePositionAsString = nodeContextMenuNode != null && clickedNodesPosition != null @@ -1704,17 +1704,17 @@ function ContextMenuInner(propsWithInputRef: Props) { ? [] : maybeClickedNodeId != null ? getNodeContextMenuOptions({ - clickedNodeId: maybeClickedNodeId, - infoRows, - viewport: maybeViewport, - ...props, - }) + clickedNodeId: maybeClickedNodeId, + infoRows, + viewport: maybeViewport, + ...props, + }) : getNoNodeContextMenuOptions({ - segmentIdAtPosition, - infoRows, - viewport: maybeViewport, - ...props, - }), + segmentIdAtPosition, + infoRows, + viewport: maybeViewport, + ...props, + }), }; if (inputRef == null || inputRef.current == null) return null;