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

Examples: Make domElement to a mandatory parameter for all controls. #17612

Merged
merged 2 commits into from
Oct 11, 2019

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Sep 30, 2019

Replacement of #16336

This PR makes domElement to a mandatory ctor parameter. No default value (like document) is set anymore. OrbitControls and TrackballControls have an additional check which warns users when they use document as a ctor argument. The reason for this is explained here: #16326 (comment)

@Mugen87 Mugen87 changed the title Examples: Make domElement mandatory parameter. Examples: Make domElement mandatory parameter for all controls. Sep 30, 2019
@Mugen87 Mugen87 changed the title Examples: Make domElement mandatory parameter for all controls. Examples: Make domElement to a mandatory parameter for all controls. Sep 30, 2019
@mrdoob
Copy link
Owner

mrdoob commented Oct 10, 2019

Looking great!

editor/js/EditorControls.js Outdated Show resolved Hide resolved
@mrdoob
Copy link
Owner

mrdoob commented Oct 11, 2019

Thanks!

@SalazarRiva
Copy link

I'm sorry, I'm a bit lost with this change here. I get it is supposed to get something fixed, but I do not get how I'm supposed to handle this - if up till now I could get away with controls = new THREE.OrbitControls( camera ) - where should I add a change. Is there an example somewhere with what changes I should do?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 28, 2019

Instead of

const controls = new THREE.OrbitControls( camera );

do this:

const controls = new THREE.OrbitControls( camera, renderer.domElement );

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