Skip to content

Commit

Permalink
fix(model3d): Fix react controls to reset to defaults (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan authored May 14, 2021
1 parent 79fbd40 commit f305ea7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/viewers/box3d/model3d/Model3DViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/lib/viewers/box3d/model3d/__tests__/Model3DViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit f305ea7

Please sign in to comment.