@@ -797,7 +797,7 @@ export class MainView extends React.Component<IProps, IStates> {
797797 this . _scene . remove ( this . _clippingPlaneMesh ) ;
798798 }
799799
800- const selectedNames = this . _selectedMeshes . map ( sel => sel . name ) ;
800+ const selectedNames = Object . keys ( this . _currentSelection || { } ) ;
801801 this . _selectedMeshes = [ ] ;
802802
803803 this . _boundingGroup = new THREE . Box3 ( ) ;
@@ -896,10 +896,10 @@ export class MainView extends React.Component<IProps, IStates> {
896896 } ) ;
897897 this . _meshGroup ?. add ( meshGroup ) ;
898898 }
899-
900- this . _updateTransformControls ( selectedNames ) ;
901899 } ) ;
902900
901+ this . _updateTransformControls ( selectedNames ) ;
902+
903903 // Update the reflength.
904904 this . _updateRefLength ( this . _refLength === null ) ;
905905 // Set the expoded view if it's enabled
@@ -1137,12 +1137,13 @@ export class MainView extends React.Component<IProps, IStates> {
11371137
11381138 private _updateSelected ( selection : { [ key : string ] : ISelection } ) {
11391139 const selectionChanged =
1140- JSON . stringify ( selection ) !== JSON . stringify ( this . _previousSelection ) ;
1140+ JSON . stringify ( selection ) !== JSON . stringify ( this . _currentSelection ) ;
11411141
11421142 if ( ! selectionChanged ) {
11431143 return ;
11441144 }
1145- this . _previousSelection = { ...selection } ;
1145+ this . _currentSelection = { ...selection } ;
1146+ const selectedNames = Object . keys ( selection ) ;
11461147
11471148 // Reset original color and remove bounding boxes for old selection
11481149 for ( const selectedMesh of this . _selectedMeshes ) {
@@ -1182,7 +1183,6 @@ export class MainView extends React.Component<IProps, IStates> {
11821183
11831184 // Set new selection
11841185 this . _selectedMeshes = [ ] ;
1185- const selectedNames = Object . keys ( selection ) ;
11861186
11871187 for ( const selectionName of selectedNames ) {
11881188 const selectedMesh = this . _meshGroup ?. getObjectByName (
@@ -1806,7 +1806,7 @@ export class MainView extends React.Component<IProps, IStates> {
18061806 private _clippingPlanes = [ this . _clippingPlane ] ;
18071807 private _edgeMaterials : any [ ] = [ ] ;
18081808
1809- private _previousSelection : { [ key : string ] : ISelection } | null = null ;
1809+ private _currentSelection : { [ key : string ] : ISelection } | null = null ;
18101810
18111811 private _scene : THREE . Scene ; // Threejs scene
18121812 private _camera : THREE . PerspectiveCamera | THREE . OrthographicCamera ; // Threejs camera
0 commit comments