From d345b2a2d6d6ed4de4e78bc026d4b3c9563da5f8 Mon Sep 17 00:00:00 2001 From: AlexandruPopovici Date: Fri, 2 Dec 2022 00:02:25 +0200 Subject: [PATCH] Fixed an issue where the accumulation cycle would not start after toggling orthographic mode due to a dangling flag. Fixed an issue where accumulation would sometimes not start after viewer load --- packages/viewer/src/modules/Viewer.ts | 1 + .../viewer/src/modules/objects/SpeckleCameraControls.ts | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/viewer/src/modules/Viewer.ts b/packages/viewer/src/modules/Viewer.ts index d88bd1cd2..d4b846c28 100644 --- a/packages/viewer/src/modules/Viewer.ts +++ b/packages/viewer/src/modules/Viewer.ts @@ -104,6 +104,7 @@ export class Viewer extends EventEmitter implements IViewer { WorldTree.getRenderTree(url).buildRenderTree() this.speckleRenderer.addRenderTree(url) this.zoom() + this.speckleRenderer.resetPipeline(true) }) } public setSectionBox( diff --git a/packages/viewer/src/modules/objects/SpeckleCameraControls.ts b/packages/viewer/src/modules/objects/SpeckleCameraControls.ts index d7b60a09c..2c8eeb43a 100644 --- a/packages/viewer/src/modules/objects/SpeckleCameraControls.ts +++ b/packages/viewer/src/modules/objects/SpeckleCameraControls.ts @@ -309,10 +309,7 @@ export class SpeckleCameraControls extends CameraControls { } const zoomDelta = this._zoomEnd - this._zoom this._zoom += - zoomDelta * - (this.overrideZoomLerpRatio - ? this.overrideZoomLerpRatio - : this.overrideZoomLerpRatio) + zoomDelta * (this.overrideZoomLerpRatio ? this.overrideZoomLerpRatio : lerpRatio) if (this._camera.zoom !== this._zoom) { if (approxZero(zoomDelta)) { this._zoom = this._zoomEnd @@ -344,7 +341,7 @@ export class SpeckleCameraControls extends CameraControls { approxZero(deltaOffset.z, this.restThreshold) && !this._hasRested && !this._isTrucking && - !this._didZoom + (isOrthographicCamera(this._camera) ? !this._didZoom : true) ) { this._hasRested = true this.dispatchEvent({ type: 'rest' }) @@ -364,7 +361,7 @@ export class SpeckleCameraControls extends CameraControls { approxZero(deltaOffset.y, this.restThreshold) && approxZero(deltaOffset.z, this.restThreshold) && !this._isTrucking && - !this._didZoom + (isOrthographicCamera(this._camera) ? !this._didZoom : true) ) { this.dispatchEvent({ type: 'rest' }) this._didDollyLastFrame = false