Skip to content

Commit

Permalink
Merge pull request #136 from Smithsonian/dev-bugfix
Browse files Browse the repository at this point in the history
Dev bugfix
  • Loading branch information
gjcope committed May 5, 2022
2 parents b1c998e + 3040858 commit 587e8d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/client/components/CVOrbitNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class CVOrbitNavigation extends CObject3D
private _scene: CScene = null;
private _modelBoundingBox: Box3 = null;
private _hasChanged = false;
private _hasZoomed = false;
private _isAutoZooming = false;

constructor(node: Node, id: string)
Expand Down Expand Up @@ -207,12 +208,14 @@ export default class CVOrbitNavigation extends CObject3D
/*edge case when loaded event triggers before document parsing */
}
else {
controller.camera = cameraComponent.camera;

// Hack until we have a better way to make sure camera is initialized on first zoom
cameraComponent.camera.aspect = controller.camera.aspect;

controller.camera = cameraComponent.camera;

controller.zoomExtents(this._modelBoundingBox);
cameraComponent.ins.zoom.set();
this._hasZoomed = true;
}
this._isAutoZooming = false;
}
Expand Down Expand Up @@ -372,7 +375,7 @@ export default class CVOrbitNavigation extends CObject3D

protected onLoadingCompleted(isLoading: boolean)
{
if (this.ins.autoZoom.value && !this._hasChanged) {
if (this.ins.autoZoom.value && (!this._hasChanged || !this._hasZoomed)) {
this.ins.zoomExtents.set();
this._isAutoZooming = true;
}
Expand Down

0 comments on commit 587e8d4

Please sign in to comment.