@@ -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
}
@@ -1085,9 +1083,10 @@ class GraphConnection extends SegmentationGraphSourceConnection {
1085
1083
}
1086
1084
}
1087
1085
const segmentsState = this . layer . displayState . segmentationGroupState . value ;
1088
- const { visibleSegments} = segmentsState ;
1089
- visibleSegments . delete ( segmentsToRemove ) ;
1086
+ const { visibleSegments, selectedSegments } = segmentsState ;
1087
+ selectedSegments . delete ( segmentsToRemove ) ;
1090
1088
const latestRoots = await this . graph . graphServer . filterLatestRoots ( segmentsToAdd ) ;
1089
+ selectedSegments . add ( latestRoots ) ;
1091
1090
visibleSegments . add ( latestRoots ) ;
1092
1091
merges . changed . dispatch ( ) ;
1093
1092
}
@@ -1654,7 +1653,8 @@ class MulticutSegmentsTool extends LayerTool<SegmentationUserLayer> {
1654
1653
1655
1654
activation . bindAction ( 'set-anchor' , event => {
1656
1655
event . stopPropagation ( ) ;
1657
- const currentSegmentSelection = maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ; // or visible segments?
1656
+ const currentSegmentSelection =
1657
+ maybeGetSelection ( this , segmentationGroupState . visibleSegments ) ;
1658
1658
if ( ! currentSegmentSelection ) return ;
1659
1659
const { rootId, segmentId} = currentSegmentSelection ;
1660
1660
const { focusSegment, segments} = multicutState ;
0 commit comments