Jsfiddle templates should supply renderer.domElement to OrbitControls

A common problem with OrbitControls is that it hijacks (or “they hijack”) the mouse. This in practice disables dat.gui controls. The solution is to supply OrbitControls with renderer.domElement as the second argument.

The same applies to other testing templates, but I have not checked them.

@looeee

Somewhat related:

1 Like

I overlooked that @fraguada wrote the pinned post in the Questions category.

Note that https://github.com/mrdoob/three.js/pull/17612 will break the current fiddles, as well as all fiddles based on them (except those specifying a version). So this is some of a bleeding wound.

1 Like

We need a note in the migration guide when the PR gets merged.

1 Like

I have to correct/moderate myself here. #17612 only gives warnings when domElement is undefined. So the change is safe for current fiddles. I suppose it may be changed to errors or exceptions in the far future.

The change will lead to breakage for all users of OrbitControls and TrackballControls since it’s not possible to apply a fallback if no domElement is defined. document is not valid for both controls anymore.

OK, I didn’t check all of them. Thanks for clarifying. Then this stands for OrbitControls and TrackballControls:

Note that #17612 will break the current fiddles, as well as all fiddles based on them (except those specifying a version). So this is some of a bleeding wound.

If @fraguada is not going to fix the fiddles, maybe @looeee can make a new pinned post with updated ones?

2 Likes

@ EliasHasle If you create updated fiddles and post them here I’ll edit @fraguada’s posts with the new links.

1 Like

Good! :smiley:

JSFiddle:
master: https://jsfiddle.net/yjr2n3gt/
dev: https://jsfiddle.net/x84yuLnd/

CodePen:
master: https://codepen.io/eliashasle/pen/ZEEQOgM
dev: https://codepen.io/eliashasle/pen/qBBbNee

The “embedding” example (although not working, AFAICS) uses the CodePen master address.

Thanks @EliasHasle! And sorry for the delay, this totally slipped my mind.

We should update these to use modules at some point too I guess, or provide module and non-module versions.

EDIT: I’ve taken the opportunity to update the Question category sticky.

I’m thinking it might be more useful to have templates in Codesandbox or Glitch that show how to load a model rather than dev/master branch. What do you guys think?

You mean removing two of the jsfiddle/codepen templates (dev or master), and adding Codesandbox or Glitch templates that load 3D models?

Yes, but just keep the master branch.

It’s useful to have the dev and master branch templates on github so that people can check whether a bug has already been fixed, but I think the master branch is enough here.

Ah, the links in the issue tracker template are not updated. Do you have access to edit that one?

No, you will have to make PR on github for that I think.

:+1:

1 Like