Skip to content

Commit 15e4656

Browse files
ssk4988Mugen87
andauthoredSep 25, 2023
DragControls: Add recursive property. (#26747)
* add recursive property to DragControls * Update DragControls.js Clean up. --------- Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
1 parent 43d68fc commit 15e4656

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎docs/examples/en/controls/DragControls.html

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ <h3>[property:Boolean enabled]</h3>
100100
Whether or not the controls are enabled.
101101
</p>
102102

103+
<h3>[property:Boolean recursive]</h3>
104+
<p>
105+
Whether children of draggable objects can be dragged independently from their parent. Default is `true`.
106+
</p>
107+
103108
<h3>[property:Boolean transformGroup]</h3>
104109
<p>
105110
This option only works if the [page:DragControls.objects] array contains a single draggable group object.

‎examples/jsm/controls/DragControls.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class DragControls extends EventDispatcher {
9999
_intersections.length = 0;
100100

101101
_raycaster.setFromCamera( _pointer, _camera );
102-
_raycaster.intersectObjects( _objects, true, _intersections );
102+
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );
103103

104104
if ( _intersections.length > 0 ) {
105105

@@ -151,7 +151,7 @@ class DragControls extends EventDispatcher {
151151
_intersections.length = 0;
152152

153153
_raycaster.setFromCamera( _pointer, _camera );
154-
_raycaster.intersectObjects( _objects, true, _intersections );
154+
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );
155155

156156
if ( _intersections.length > 0 ) {
157157

@@ -205,6 +205,7 @@ class DragControls extends EventDispatcher {
205205
// API
206206

207207
this.enabled = true;
208+
this.recursive = true;
208209
this.transformGroup = false;
209210

210211
this.activate = activate;

0 commit comments

Comments
 (0)
Please sign in to comment.