-
-
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
TrackballControls: extends OrbitControls - API refactor #17857
Conversation
I posted #17858 just to show how I implemented it. It may, or may not, be a better implementation. I'd only change |
I will force-push a simpler PR, no problem.
We did a similar thing when extending |
As far as implementations go, I feel like both PRs are handling the This PR:
West PR:
I don't know how impactful is keeping |
0d2942f
to
2de0765
Compare
The sensitivity and keyboard control are different from the original
IMO, auto rotate does not make sense with
Since there is no natural 'up direction', only screen-space panning makes sense for |
Makes sense 👍 |
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish | ||
// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move | ||
|
||
THREE.TrackballControls = function ( object, domElement ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really think this code and the definition of MapControls
should go in its own module file. The following code looks weird, IMO:
import { TrackballControls } from './jsm/controls/OrbitControls.js';
Yes, I'm aware that the JS versions would have a dependency to OrbitControls
but I think this is still better than having strange imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure actually. This is more of a preference / library consistency kind of deal, so I think that's up to you guys. I'll be happy to change if we decide on that course of action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, if we choose to do it. Keeping the old API available won't be an option and we will need to apply backwards compatibility.
The sensitivity and keyboard control are different from the original TrackballControls.
^ this could be a problem for the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary to keep the old API around. Users can checkout the repo at any release and use the respective version of TrackballControls
if necessary. There are even live links to older versions:
https://rawcdn.githack.com/mrdoob/three.js/r109/examples/js/controls/TrackballControls.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come on, @Mugen87. We tell users to always use files from the same release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I really don't understand your argumentation. We normally remove legacy/obsolete classes with very few exceptions. If we would keep all files, the repository would not be manageable anymore.
If users can't invest time in migration, it's okay to use one of the previous releases. Hence, I don't get your goal with retaining the API of TrackballControls
. It's good to align it without keeping the old stuff around. Moreover, as demonstrated by my PR, API changes can be often done gracefully (meaning backwards compatible).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we would keep all files, the repository would not be manageable anymore.
Come on, dude.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get your goal with retaining the API of TrackballControls.
Based on @WestLangley's #17842 (comment)
Similar to what was done to
MapControls
on #16961Notes:
Introduces
fixedUp
which controls whether or not to maintaincamera.up
direction on rotation.Noticeable
rotationSpeed
changes, due to the different mouse coordinates used inOrbitControls
.Implements @Mugen87's backwards compatibility changes on TrackballControls: Refactor API. #17842