@@ -931,16 +931,14 @@ class GraphConnection extends SegmentationGraphSourceConnection {
931
931
for ( const segmentId of segments ) {
932
932
const isBaseSegment = isBaseSegmentId ( segmentId , this . graph . info . graph . nBitsForLayerId ) ;
933
933
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
+ } ) ;
944
942
}
945
943
}
946
944
}
@@ -969,11 +967,14 @@ class GraphConnection extends SegmentationGraphSourceConnection {
969
967
multicutState
970
968
. reset ( ) ; // need to clear the focus segment before deleting the multicut segment
971
969
const { segmentsState} = this ;
970
+ const wasSelected = segmentsState . selectedSegments . has ( focusSegment ) ;
972
971
segmentsState . selectedSegments . delete ( focusSegment ) ;
973
972
for ( const segment of [ ...sinks , ...sources ] ) {
974
973
segmentsState . selectedSegments . delete ( segment . rootId ) ;
975
974
}
976
- segmentsState . selectedSegments . add ( splitRoots ) ;
975
+ if ( wasSelected ) {
976
+ segmentsState . selectedSegments . add ( splitRoots ) ;
977
+ }
977
978
segmentsState . visibleSegments . add ( splitRoots ) ;
978
979
return true ;
979
980
}
@@ -1654,7 +1655,8 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
1654
1655
1655
1656
activation . bindAction ( 'set-anchor' , event => {
1656
1657
event . stopPropagation ( ) ;
1657
- const currentSegmentSelection = maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ; // or visible segments?
1658
+ const currentSegmentSelection =
1659
+ maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ;
1658
1660
if ( ! currentSegmentSelection ) return ;
1659
1661
const { rootId, segmentId} = currentSegmentSelection ;
1660
1662
const { focusSegment, segments} = multicutState ;
0 commit comments