Skip to content
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: Add recursive property. #26747

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/examples/en/controls/DragControls.html
Expand Up @@ -100,6 +100,11 @@ <h3>[property:Boolean enabled]</h3>
Whether or not the controls are enabled.
</p>

<h3>[property:Boolean recursive]</h3>
<p>
Whether children of draggable objects can be dragged independently from their parent. Default is `true`.
</p>

<h3>[property:Boolean transformGroup]</h3>
<p>
This option only works if the [page:DragControls.objects] array contains a single draggable group object.
Expand Down
5 changes: 3 additions & 2 deletions examples/jsm/controls/DragControls.js
Expand Up @@ -99,7 +99,7 @@ class DragControls extends EventDispatcher {
_intersections.length = 0;

_raycaster.setFromCamera( _pointer, _camera );
_raycaster.intersectObjects( _objects, true, _intersections );
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );

if ( _intersections.length > 0 ) {

Expand Down Expand Up @@ -151,7 +151,7 @@ class DragControls extends EventDispatcher {
_intersections.length = 0;

_raycaster.setFromCamera( _pointer, _camera );
_raycaster.intersectObjects( _objects, true, _intersections );
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );

if ( _intersections.length > 0 ) {

Expand Down Expand Up @@ -205,6 +205,7 @@ class DragControls extends EventDispatcher {
// API

this.enabled = true;
this.recursive = true;
this.transformGroup = false;

this.activate = activate;
Expand Down