{
evt.preventDefault();
props.handleSegmentDropdownMenuVisibility(segment.id, true);
@@ -215,7 +218,7 @@ function _MeshInfoItem(props: {
}
const { seedPosition, isLoading, isPrecomputed, isVisible } = isosurface;
- const textStyle = isVisible ? {} : deemphasizedStyle;
+ const className = isVisible ? "" : "deemphasized italic";
const downloadButton = (
{toggleVisibilityCheckbox}
{
props.setPosition(seedPosition);
}}
- style={{ ...textStyle, marginLeft: 8 }}
+ style={{ marginLeft: 8 }}
>
{isPrecomputed ? "Mesh (precomputed)" : "Mesh (ad-hoc computed)"}
@@ -320,6 +324,7 @@ function _SegmentListItem({
activeDropdownSegmentId,
allowUpdate,
updateSegment,
+ removeSegment,
onSelectSegment,
visibleSegmentationLayer,
loadAdHocMesh,
@@ -363,20 +368,20 @@ function _SegmentListItem({
andCloseContextMenu,
),
getMakeSegmentActiveMenuItem(segment, setActiveCell, activeCellId, andCloseContextMenu),
- /*
- * Disable the change-color menu if the segment was mapped to another segment, because
- * changing the color wouldn't do anything as long as the mapping is still active.
- * This is because the id (A) is mapped to another one (B). So, the user would need
- * to change the color of B to see the effect for A.
- */
{
key: "changeSegmentColor",
+ /*
+ * Disable the change-color menu if the segment was mapped to another segment, because
+ * changing the color wouldn't do anything as long as the mapping is still active.
+ * This is because the id (A) is mapped to another one (B). So, the user would need
+ * to change the color of B to see the effect for A.
+ */
disabled: isEditingDisabled || segment.id !== mappedId,
label: (
{
+ onSetColor={(color, createsNewUndoState) => {
if (visibleSegmentationLayer == null) {
return;
}
@@ -386,6 +391,7 @@ function _SegmentListItem({
color,
},
visibleSegmentationLayer.name,
+ createsNewUndoState,
);
}}
rgb={Utils.take3(segmentColorRGBA)}
@@ -406,10 +412,23 @@ function _SegmentListItem({
color: null,
},
visibleSegmentationLayer.name,
+ true,
);
},
label: "Reset Segment Color",
},
+ {
+ key: "removeSegmentFromList",
+ disabled: isEditingDisabled,
+ onClick: () => {
+ if (isEditingDisabled || visibleSegmentationLayer == null) {
+ return;
+ }
+ removeSegment(segment.id, visibleSegmentationLayer.name);
+ andCloseContextMenu();
+ },
+ label: "Remove Segment From List",
+ },
],
});
@@ -417,7 +436,7 @@ function _SegmentListItem({
if (isJSONMappingEnabled && segment.id !== mappedId)
return (
-
+
{segment.id} → {mappedId}
@@ -425,7 +444,7 @@ function _SegmentListItem({
// Only if segment.name is truthy, render additional info.
return segment.name ? (
- {segment.id}
+ {segment.id}
) : null;
}
@@ -475,6 +494,7 @@ function _SegmentListItem({
name,
},
visibleSegmentationLayer.name,
+ true,
);
}
}}
@@ -491,7 +511,7 @@ function _SegmentListItem({
{segment.id === centeredSegmentId ? (
) => ({
dispatch(updateTemporarySettingAction("hoveredSegmentId", segmentId || null));
},
- loadAdHocMesh(cellId: number, seedPosition: Vector3) {
- dispatch(loadAdHocMeshAction(cellId, seedPosition));
+ loadAdHocMesh(segmentId: number, seedPosition: Vector3) {
+ dispatch(loadAdHocMeshAction(segmentId, seedPosition));
},
- loadPrecomputedMesh(cellId: number, seedPosition: Vector3, meshFileName: string) {
- dispatch(loadPrecomputedMeshAction(cellId, seedPosition, meshFileName));
+ loadPrecomputedMesh(segmentId: number, seedPosition: Vector3, meshFileName: string) {
+ dispatch(loadPrecomputedMeshAction(segmentId, seedPosition, meshFileName));
},
setActiveCell(segmentId: number, somePosition?: Vector3) {
@@ -158,8 +159,19 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
dispatch(setPositionAction(position));
},
- updateSegment(segmentId: number, segmentShape: Partial, layerName: string) {
- dispatch(updateSegmentAction(segmentId, segmentShape, layerName));
+ updateSegment(
+ segmentId: number,
+ segmentShape: Partial,
+ layerName: string,
+ createsNewUndoState: boolean,
+ ) {
+ dispatch(
+ updateSegmentAction(segmentId, segmentShape, layerName, undefined, createsNewUndoState),
+ );
+ },
+
+ removeSegment(segmentId: number, layerName: string) {
+ dispatch(removeSegmentAction(segmentId, layerName));
},
});
@@ -697,6 +709,7 @@ class SegmentsView extends React.Component {
setHoveredSegmentId={this.props.setHoveredSegmentId}
allowUpdate={this.props.allowUpdate}
updateSegment={this.props.updateSegment}
+ removeSegment={this.props.removeSegment}
visibleSegmentationLayer={this.props.visibleSegmentationLayer}
loadAdHocMesh={this.props.loadAdHocMesh}
loadPrecomputedMesh={this.props.loadPrecomputedMesh}
diff --git a/frontend/stylesheets/_utils.less b/frontend/stylesheets/_utils.less
index eb71950bb3..3da056a25c 100644
--- a/frontend/stylesheets/_utils.less
+++ b/frontend/stylesheets/_utils.less
@@ -126,3 +126,11 @@ td.nowrap * {
.text-center {
text-align: center;
}
+
+.deemphasized {
+ color: #989898;
+}
+
+.italic {
+ font-style: italic;
+}
diff --git a/frontend/stylesheets/trace_view/_right_menu.less b/frontend/stylesheets/trace_view/_right_menu.less
index 3eaa025ddf..e25c047755 100644
--- a/frontend/stylesheets/trace_view/_right_menu.less
+++ b/frontend/stylesheets/trace_view/_right_menu.less
@@ -51,11 +51,6 @@
}
}
-.deemphasized-segment-name {
- font-style: italic;
- color: #989898;
-}
-
#commentList {
.comment,
.comment-tree {