Small trap in TrackballControls

I had a very strange mistake with the addition of the collection.
https://hofk.de/main/discourse.threejs/2019/index2019.html

During the local test of RestrictDragControls everything was perfect. After uploading it to my site I test it again. There was an error message.2019-12-08_20.56.49

In the source code (CTRL U) I found
if ( lastPosition.distanceToSquared( _this.object.position ) > EPS ||Â lastZoom !== _this.object.zoom ) {

That’s not correct. But why did it work locally?

If you look at the hexadecimal, you can see the code A0 after ||

The meaning is also
160 A0 U+00A0 No-break Space

My editor shows when I display non-printable characters 2019-12-08_21.22.15
You have to look closely, then you can also see the problem there.

Why the difference local and after upload?
I accidentally overwrote the line meta charset=“utf-8” while copying the style.

Obviously this is no problem locally on my computer, but after the upload.

Should the small issue A0 be fixed :question:

2 Likes

Yes, it would be great if you can make a PR :+1:

I’ll give it a try. Would be my first pull request. It may take a while, I have to (translate)read the many requirements and work steps first. :sweat:

Since it is only a Bug (easy), there is no hurry. :stopwatch:

Instead of forking the project you can also consider to directly edit the file at github. I guess this link should work: https://github.com/mrdoob/three.js/edit/dev/examples/js/controls/TrackballControls.js

You can then select the following option in order to create a PR:

1 Like

This is only possible with the necessary write permissions. Not every beginner like me should have that either. You are three.js professional!


2019-12-09_18.12.31


So I’m gonna learn.

Ops, okay. This guide might be helpful:

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork

1 Like

Forked three, started learning. :man_student:

Have a look at the file https://github.com/mrdoob/three.js/blob/3a324a69e3101407e24822fda1efdaf87fe77025/examples/js/controls/TrackballControls.js again.

Like a miracle - the code A0 has changed to 20.

(I searched all files in the controls folder for A0 and found nothing.)

Am I too stupid ??? :frowning_face:
… or a diligent professional probably wanted to spare me the stress. :+1: :slightly_smiling_face:

Solved via: https://github.com/mrdoob/three.js/pull/18251

2 Likes