-
-
Notifications
You must be signed in to change notification settings - Fork 36k
DragControls: Refactor API. #29079
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
DragControls: Refactor API. #29079
Changes from all commits
db7c2f5
e2851da
ad9cce0
176ce7c
887ab04
c3503fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { EventDispatcher } from 'three'; | ||
|
||
class Controls extends EventDispatcher { | ||
|
||
constructor( object, domElement ) { | ||
|
||
super(); | ||
|
||
this.object = object; | ||
this.domElement = domElement; | ||
|
||
this.enabled = true; | ||
|
||
this.state = - 1; | ||
|
||
this.keys = {}; | ||
this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null }; | ||
this.touches = { ONE: null, TWO: null }; | ||
|
||
} | ||
|
||
connect() {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Mugen87 What do you think about being able to pass the dom element here? That way the code could look like this: const controls = new OrbitControls( camera );
controls.connect( renderer.domElement ); I guess we'll need to do a bit of management though: connect( element ) {
if ( this.domElement !== element ) {
this.disconnect();
}
this.domElement = element;
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a convenient feature, I guess it's fine. That said, |
||
|
||
disconnect() {} | ||
|
||
dispose() {} | ||
|
||
update() {} | ||
|
||
} | ||
|
||
export { Controls }; |
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.
@Mugen87
constructor( object, domElement = null )
maybe?Right now it's
undefined
by default but subclasses set it tonull
...