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

Use provided three.js canvas ID in three.js helper #93

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

TyLindberg
Copy link
Contributor

Currently, the API of the three.js helper allows a canvas ID to be passed in for the three.js canvas, but that parameter is ignored when finding the canvas in the DOM. This change fixes that behavior to respect the canvas ID that is passed in.

@xavierjs
Copy link
Member

Hi,

Thank you for this PR proposal but to keep backward compatibility you need to provide a default value for spec.threejsCanvasId which would be 'threejsCanvas'. I suggest something like:

 const threejsCanvasId = (typeof(spec.threejsCanvasId)==='undefined')?'threejsCanvas':spec.threejsCanvasId;
 threejsCanvas=document.getElementById(threejsCanvasId);

I cannot accept your PR as this since it may break some demos where spec.threejsCanvasId is undefined.

Best,
Xavier

@TyLindberg
Copy link
Contributor Author

If spec.threejsCanvasId is undefined it should never hit this code block since it's wrapped in an if statement, correct? However, we could add a check to make sure spec.threejsCanvasId is of type string if we're concerned about that.

@xavierjs
Copy link
Member

Yes you are right I didn't read the wrapping if statement

@xavierjs xavierjs merged commit 7546bf0 into jeeliz:master Mar 28, 2019
@TyLindberg TyLindberg deleted the threejs-helper-fix branch March 28, 2019 20:16
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