Skip to content

Commit

Permalink
DragControls: Add recursive property. (#26747)
Browse files Browse the repository at this point in the history
* add recursive property to DragControls

* Update DragControls.js

Clean up.

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
  • Loading branch information
ssk4988 and Mugen87 authored Sep 25, 2023
1 parent 43d68fc commit 15e4656
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/examples/en/controls/DragControls.html
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 15e4656

Please sign in to comment.