import { Box3 , Object3D , Scene } from 'three' ; import { SelectionBoxHelper } from './SelectionBoxHelper' ; /**
 * Gizmo that shows the bounds of all currently selected actors
 */ export class SelectionBoundsBox { private scene : Scene ; private isVisible : boolean = false ; private box : Box3 ; public helper : SelectionBoxHelper ; public pivotObject : Object3D ; constructor ( scene ) { this . scene = scene ; this . box = new Box3 ( ) ; this . helper = new SelectionBoxHelper ( this . box ) ; this . pivotObject = new Object3D ( ) ; this . scene . add ( this . pivotObject ) ; } setVisible ( visible ) { if ( visible != this . isVisible ) { this . isVisible = visible ; if ( visible ) { this . scene . add ( this . helper ) ; } else { this . scene . remove ( this . helper ) ; } } } setBounds ( objects ) { this . box . makeEmpty ( ) ; objects . forEach ( obj => { this . box . expandByObject ( obj ) ; } ) ; this . box . getCenter ( this . pivotObject . position ) ; this . helper . updatePositionRotationScale ( ) ; } }