@@ -2767,12 +2767,13 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
27672767 const priorBaseSegmentHighlighting =
27682768 displayState . baseSegmentHighlighting . value ;
27692769 const priorHighlightColor = displayState . highlightColor . value ;
2770-
2770+ const priorHideSegmentZero = displayState . hideSegmentZero . value ;
27712771 activation . bindInputEventMap ( MULTICUT_SEGMENTS_INPUT_EVENT_MAP ) ;
27722772 activation . registerDisposer ( ( ) => {
27732773 resetMulticutDisplay ( ) ;
27742774 displayState . baseSegmentHighlighting . value = priorBaseSegmentHighlighting ;
27752775 displayState . highlightColor . value = priorHighlightColor ;
2776+ displayState . hideSegmentZero . value = priorHideSegmentZero ;
27762777 } ) ;
27772778 const resetMulticutDisplay = ( ) => {
27782779 resetTemporaryVisibleSegmentsState ( segmentationGroupState ) ;
@@ -2781,6 +2782,23 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
27812782 displayState . tempSegmentDefaultColor2d . value = undefined ;
27822783 displayState . highlightColor . value = undefined ;
27832784 } ;
2785+ const { segmentSelectionState } = layer . displayState ;
2786+ const updateHighlightColor = ( ) => {
2787+ const focusSegment = multicutState . focusSegment . value ;
2788+ if ( focusSegment === undefined ) {
2789+ displayState . highlightColor . value = undefined ;
2790+ return ;
2791+ }
2792+ const { value } = segmentSelectionState ;
2793+ if ( value === multicutState . focusSegment . value ) {
2794+ displayState . highlightColor . value = multicutState . blueGroup . value
2795+ ? BLUE_COLOR_HIGHTLIGHT
2796+ : RED_COLOR_HIGHLIGHT ;
2797+ } else {
2798+ // set hightlight to off color for all other segments to ignore them
2799+ displayState . highlightColor . value = MULTICUT_OFF_COLOR ;
2800+ }
2801+ } ;
27842802 const updateMulticutDisplay = ( ) => {
27852803 resetMulticutDisplay ( ) ;
27862804 activeGroupIndicator . classList . toggle (
@@ -2790,9 +2808,8 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
27902808 const focusSegment = multicutState . focusSegment . value ;
27912809 if ( focusSegment === undefined ) return ;
27922810 displayState . baseSegmentHighlighting . value = true ;
2793- displayState . highlightColor . value = multicutState . blueGroup . value
2794- ? BLUE_COLOR_HIGHTLIGHT
2795- : RED_COLOR_HIGHLIGHT ;
2811+ displayState . hideSegmentZero . value = false ;
2812+ updateHighlightColor ( ) ;
27962813 segmentsState . useTemporaryVisibleSegments . value = true ;
27972814 segmentsState . useTemporarySegmentEquivalences . value = true ;
27982815 // add focus segment and red/blue segments
@@ -2833,6 +2850,11 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
28332850 displayState . useTempSegmentStatedColors2d . value = true ;
28342851 } ;
28352852 updateMulticutDisplay ( ) ;
2853+ activation . registerDisposer (
2854+ layer . displayState . segmentSelectionState . changed . add (
2855+ updateHighlightColor ,
2856+ ) ,
2857+ ) ;
28362858 activation . registerDisposer (
28372859 multicutState . changed . add ( updateMulticutDisplay ) ,
28382860 ) ;
0 commit comments