Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(controls): Add Settings menu to Model3D #1377

Merged
merged 5 commits into from
May 13, 2021

Conversation

ConradJChan
Copy link
Contributor

@ConradJChan ConradJChan commented May 12, 2021

TODO:

  • Unit tests
  • Cross-browser testing

Before:
Screen Shot 2021-05-12 at 3 21 54 PM

After:
Screen Shot 2021-05-12 at 3 21 42 PM

@ConradJChan ConradJChan requested a review from a team as a code owner May 12, 2021 22:37
Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, nice job.

src/lib/viewers/controls/model3d/Model3DSettings.scss Outdated Show resolved Hide resolved
src/lib/viewers/box3d/model3d/Model3DViewer.js Outdated Show resolved Hide resolved
@ConradJChan ConradJChan force-pushed the model3d-settings-react branch from 908621c to 5e31698 Compare May 13, 2021 20:40
src/lib/viewers/controls/model3d/Model3DSettings.scss Outdated Show resolved Hide resolved
src/lib/viewers/controls/model3d/Model3DSettings.tsx Outdated Show resolved Hide resolved
src/lib/viewers/controls/model3d/RotateAxisControls.scss Outdated Show resolved Hide resolved
}, []);

onClose();
}, [onClose]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like any call to Model3dViewer's renderUI would reset the controls, since the handler is declared as an inline function. Is that not the case? Would it be safer to create a useCallback helper that can both call setIsOpen and onClose or onOpen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's not the case. Seems like any call to renderUI should probably create a new callback for resetControls but not necessarily call it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you proposing something like:

const setIsOpenHelper = React.useCallback(() => {
    const nextIsOpen = !isOpen;
    setIsOpen(nextIsOpen);

    if (nextIsOpen) {
        onOpen();
    } else {
        onClose();
    }
}, [onClose, onOpen]);

And use that in place of setIsOpen?

src/lib/viewers/controls/settings/SettingsDropdown.tsx Outdated Show resolved Hide resolved
@@ -11,7 +11,7 @@ $bp-SettingsDropdown-spacing: 5px;
}

.bp-SettingsDropdown-flyout {
top: initial;
top: auto;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect the media controls at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is an override only for SettingsDropdown

jstoffan
jstoffan previously approved these changes May 13, 2021
@ConradJChan ConradJChan merged commit e37e30b into box:master May 13, 2021
@ConradJChan ConradJChan deleted the model3d-settings-react branch May 13, 2021 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants