@@ -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 }
@@ -1085,9 +1083,10 @@ class GraphConnection extends SegmentationGraphSourceConnection {
10851083 }
10861084 }
10871085 const segmentsState = this . layer . displayState . segmentationGroupState . value ;
1088- const { visibleSegments} = segmentsState ;
1089- visibleSegments . delete ( segmentsToRemove ) ;
1086+ const { visibleSegments, selectedSegments } = segmentsState ;
1087+ selectedSegments . delete ( segmentsToRemove ) ;
10901088 const latestRoots = await this . graph . graphServer . filterLatestRoots ( segmentsToAdd ) ;
1089+ selectedSegments . add ( latestRoots ) ;
10911090 visibleSegments . add ( latestRoots ) ;
10921091 merges . changed . dispatch ( ) ;
10931092 }
@@ -1654,7 +1653,8 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
16541653
16551654 activation . bindAction ( 'set-anchor' , event => {
16561655 event . stopPropagation ( ) ;
1657- const currentSegmentSelection = maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ; // or visible segments?
1656+ const currentSegmentSelection =
1657+ maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ;
16581658 if ( ! currentSegmentSelection ) return ;
16591659 const { rootId, segmentId} = currentSegmentSelection ;
16601660 const { focusSegment, segments} = multicutState ;
0 commit comments