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:
Dimitrie Stefanescu
2022-02-23 19:06:24 +00:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -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 )