@@ -931,16 +931,14 @@ class GraphConnection extends SegmentationGraphSourceConnection {
931931 for ( const segmentId of segments ) {
932932 const isBaseSegment = isBaseSegmentId ( segmentId , this . graph . info . graph . nBitsForLayerId ) ;
933933 const segmentConst = segmentId . clone ( ) ;
934- if ( added ) {
935- if ( isBaseSegment ) {
936- this . graph . getRoot ( segmentConst ) . then ( rootId => {
937- if ( segmentsState . visibleSegments . has ( segmentConst ) ) {
938- segmentsState . visibleSegments . add ( rootId ) ;
939- }
940- segmentsState . selectedSegments . delete ( segmentConst ) ;
941- segmentsState . selectedSegments . add ( rootId ) ;
942- } ) ;
943- }
934+ if ( added && isBaseSegment ) {
935+ this . graph . getRoot ( segmentConst ) . then ( rootId => {
936+ if ( segmentsState . visibleSegments . has ( segmentConst ) ) {
937+ segmentsState . visibleSegments . add ( rootId ) ;
938+ }
939+ segmentsState . selectedSegments . delete ( segmentConst ) ;
940+ segmentsState . selectedSegments . add ( rootId ) ;
941+ } ) ;
944942 }
945943 }
946944 }
@@ -969,11 +967,14 @@ class GraphConnection extends SegmentationGraphSourceConnection {
969967 multicutState
970968 . reset ( ) ; // need to clear the focus segment before deleting the multicut segment
971969 const { segmentsState} = this ;
970+ const wasSelected = segmentsState . selectedSegments . has ( focusSegment ) ;
972971 segmentsState . selectedSegments . delete ( focusSegment ) ;
973972 for ( const segment of [ ...sinks , ...sources ] ) {
974973 segmentsState . selectedSegments . delete ( segment . rootId ) ;
975974 }
976- segmentsState . selectedSegments . add ( splitRoots ) ;
975+ if ( wasSelected ) {
976+ segmentsState . selectedSegments . add ( splitRoots ) ;
977+ }
977978 segmentsState . visibleSegments . add ( splitRoots ) ;
978979 return true ;
979980 }
@@ -1654,7 +1655,8 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
16541655
16551656 activation . bindAction ( 'set-anchor' , event => {
16561657 event . stopPropagation ( ) ;
1657- const currentSegmentSelection = maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ; // or visible segments?
1658+ const currentSegmentSelection =
1659+ maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ;
16581660 if ( ! currentSegmentSelection ) return ;
16591661 const { rootId, segmentId} = currentSegmentSelection ;
16601662 const { focusSegment, segments} = multicutState ;
0 commit comments