Merge pull request #603 from specklesystems/dim/viewer-zoom-to-objectid
feat(viewer): adds a zoom to object id function
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@speckle/viewer",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.7",
|
||||
"description": "A 3d viewer for Speckle, based on threejs.",
|
||||
"homepage": "https://speckle.systems",
|
||||
"repository": {
|
||||
|
||||
@@ -130,6 +130,12 @@ export default class InteractionHandler {
|
||||
this.viewer.emit( 'select', this.selectedObjectsUserData )
|
||||
}
|
||||
|
||||
zoomToObjectId( id ) {
|
||||
let obj = this.viewer.sceneManager.allObjects.find( o => o.uuid === id )
|
||||
if( obj ) this.zoomToObject( obj )
|
||||
else console.warn( `No object with id of ${id} found.` )
|
||||
}
|
||||
|
||||
zoomToObject( target, fit = 1.2, transition = true ) {
|
||||
const box = new THREE.Box3().setFromObject( target )
|
||||
this.zoomToBox( box, fit, transition )
|
||||
|
||||
Reference in New Issue
Block a user