-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
CameraControls: consolidate OrbitControls, MapControls, and TrackballControls #18483
Conversation
I don't think it's a good idea to export three different classes from the same module. I've already mentioned here #17857 (comment) that this style is confusing.
As a long term goal, I don't think that we need to have both I think I would rather assign the |
Pretty sure we have other cases where we export multiple classes from a single module. I don't see this as a problem as it's very common in other frameworks as well.
Don't mean to point fingers at anyone, but we have yet to hear anything from @mrdoob on this matter. Honestly, I really would like to see this getting merged. We have been stuck on this discussion for about 3 months without any resemblance of a resolution. Let's, at least, try to find a common ground so that we can make progress on the matter. |
@Mugen87 I hoped you would have tested this and commented favorably on the contribution, but I guess that was too much to expect.
In other words, you want to block it, just as you have continued to block my other PRs. We can't function as long as you act as a blocker. When you create controversy, progress stops completely, and everyone is frustrated except for you. I am exercising my best judgment and merging this. Let's give users the opportunity to try this new implementation of |
As always, sorry for the delay... 😅 The notifications for these discussion were being pushed down continuously. So I've not been able to read the discussion. I agree with @Mugen87 that this approach doesn't follow the current pattern and has side effects like not being able to search for "OrbitControls" in the docs anymore. If I understand correctly, the idea is to unify the controls and reduce code duplication. Right? If so, I think something like this would follow the API pattern better:
So That way the user-facing API wouldn't change: import { MapControls } from './jsm/controls/MapControls.js';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { TrackballControls } from './jsm/controls/TrackballControls.js'; But the code will be cleaner. How does that sound? |
Another option would be to have all in examples like this:
It's tempting to delete |
A third option would be to use a different name:
That way, we can just ignore |
I am fine with any of those options. |
Recalling #16920 (comment). 😅 But r113 would certainly be too soon, now, let's at least allow time to write detailed migration options. Two thoughts: (1) If we'd rather have separate imports, long-term ... this wouldn't be a problem if we were only supporting (2) If we'd rather consolidate imports ... under a single root file, let's make sure we use a consistent naming convention. UpperCamelCase suggests a class, to me, and I wouldn't expect it to have multiple exports. Instead: // (A) These are equivalent in some bundlers, but only the second works on the web.
import { OrbitControls } from 'three/examples/jsm/controls/'
import { OrbitControls } from 'three/examples/jsm/controls/index.js'
// (B) Works anywhere. Lowercase to disambiguate from classes.
import { OrbitControls } from 'three/examples/jsm/controls/controls.js'; In my opinion, either of the patterns above would also benefit folders like nodes/ and curves/. |
TBH, I'm very disappointed about the way you behave in this thread. I'm sorry but this shows a poor capacity for teamwork. I've blocked your PR because I believe it's the wrong approach. If you can't accept this, well, then it's your problem. Software projects can't work if the devs do whatever they want. I explicitly asked you to wait for @mrdoob 's feedback what you have ignored. So I suggest no one of the collaborators merges PRs anymore. That includes of course me. In this way, it's at least possible to avoid such solo actions.
That was always my preferred goal! However, depending on how I also vote to revert the PR since I doubt we can manage to properly implement the other approach within two days. That might be something for the upcoming releases. |
Since the editor is now module based, I'm not aware of any dependencies to |
What if we move
I think the community might have a positive response to this ( given how it is commonly used on many projects ) and we don't run into the problem of having to (1) Worry about Cause I don't see anyway we can avoid making several changes to the API/imports if we choose to keep the module on |
So seems like it's still not clear what approach we should go with here. Considering we only have 2 days until release, I'm going to merge @Mugen87's revert but I'm going to add @Mugen87 no need to include this in the change log. |
Done. 1646da3 |
This PR allows
OrbitControls
,MapControls
, andTrackballControls
to share the same code.Usage:
The behavior of
OrbitControls
andMapControls
is unchanged.The
TrackballControls
implementation is completely different from the existing version, and some users may say the "feel" is different.The existing
OrbitControls.js
andTrackballControls.js
can remain for awhile.I can add a deprecated warning to those files whenever that is desired.