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

Editor: Added shortcut ('f') for focusing on selection #12874

Merged
merged 2 commits into from
Dec 15, 2017

Conversation

TyLindberg
Copy link
Contributor

In many 3D applications such as Unity or Maya, the 'f' key is used as a shortcut to focus on the current selection. I figured adding that shortcut to the three.js editor would increase the productivity of those familiar with 3D applications.

@TyLindberg
Copy link
Contributor Author

While adding this in, I found that when you try to focus on the default Camera in the editor it throws an error since the camera isn't a child of the scene. It doesn't necessarily break anything, but I was wondering if that was an active decision or something that should be fixed.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 13, 2017

For testing: http://rawgit.com/TyLindberg/three.js/editor-focus-shortcut/editor/index.html


if ( editor.selected !== null ) {

editor.focusById( editor.selected.id );
Copy link
Owner

Choose a reason for hiding this comment

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

How about editor.focus( editor.selected ); instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's a lot cleaner! I just changed it, and that fixed the bug that occurred when trying to focus on the camera as well, so that's nice.

@mrdoob mrdoob merged commit 6d9c1f7 into mrdoob:dev Dec 15, 2017
@mrdoob
Copy link
Owner

mrdoob commented Dec 15, 2017

Thanks!

@TyLindberg
Copy link
Contributor Author

Thank you!

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.

3 participants