From 7412401cdb0ed8f80d8e001a93e7bae8d9bb04fc Mon Sep 17 00:00:00 2001 From: Conrad Chan Date: Fri, 14 May 2021 15:41:39 -0700 Subject: [PATCH] fix(model3d): Fix react controls to reset to defaults --- src/lib/viewers/box3d/model3d/Model3DViewer.js | 8 ++++---- .../viewers/box3d/model3d/__tests__/Model3DViewer-test.js | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/viewers/box3d/model3d/Model3DViewer.js b/src/lib/viewers/box3d/model3d/Model3DViewer.js index c98c4694a..770f298a7 100644 --- a/src/lib/viewers/box3d/model3d/Model3DViewer.js +++ b/src/lib/viewers/box3d/model3d/Model3DViewer.js @@ -350,8 +350,8 @@ class Model3DViewer extends Box3DViewer { super.handleReset(); this.setAnimationState(false); - this.handleSetCameraProjection(this.projection); - this.handleSetRenderMode(this.renderMode); + this.handleSetCameraProjection(CAMERA_PROJECTION_PERSPECTIVE); + this.handleSetRenderMode(RENDER_MODE_LIT); this.handleShowGrid(true); this.handleShowSkeletons(false); this.handleShowWireframes(false); @@ -360,8 +360,8 @@ class Model3DViewer extends Box3DViewer { if (this.getViewerOption('useReactControls')) { this.renderUI(); } else { - this.controls.handleSetRenderMode(this.renderMode); - this.controls.setCurrentProjectionMode(this.projection); + this.controls.handleSetRenderMode(RENDER_MODE_LIT); + this.controls.setCurrentProjectionMode(CAMERA_PROJECTION_PERSPECTIVE); this.controls.handleSetSkeletonsVisible(false); this.controls.handleSetWireframesVisible(false); this.controls.handleSetGridVisible(this.showGrid); diff --git a/src/lib/viewers/box3d/model3d/__tests__/Model3DViewer-test.js b/src/lib/viewers/box3d/model3d/__tests__/Model3DViewer-test.js index 72d2378bc..b90157581 100644 --- a/src/lib/viewers/box3d/model3d/__tests__/Model3DViewer-test.js +++ b/src/lib/viewers/box3d/model3d/__tests__/Model3DViewer-test.js @@ -833,6 +833,11 @@ describe('lib/viewers/box3d/model3d/Model3DViewer', () => { test('should reset controls state and call renderUI', () => { model3d.isAnimationPlaying = true; + model3d.projection = 'Orthographic'; + model3d.renderMode = 'Normals'; + model3d.showGrid = false; + model3d.showSkeletons = true; + model3d.showWireframes = true; model3d.handleReset();