Skip to content

Commit d0d97bb

Browse files
authored
Added allowOtherButtonsDuringDrag flag to PointerDragBehavior (#16805)
By default, the PointerDragBehavior cancels a drag if another button on the same pointer is pressed. To allow for overriding this behavior, a new flag has been added: allowOtherButtonsDuringDrag
1 parent f125563 commit d0d97bb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/dev/core/src/Behaviors/Meshes/pointerDragBehavior.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
150150
*/
151151
public useObjectOrientationForDragging = true;
152152

153+
/**
154+
* Normally a drag is canceled when the user presses another button on the same pointer. If this is set to true,
155+
* the drag will continue even if another button is pressed on the same pointer.
156+
*/
157+
public allowOtherButtonsDuringDrag = false;
158+
153159
private _options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 };
154160

155161
/**
@@ -271,7 +277,8 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
271277
this.dragging &&
272278
this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&
273279
pointerInfo.event.button !== -1 &&
274-
pointerInfo.event.button !== this._activeDragButton
280+
pointerInfo.event.button !== this._activeDragButton &&
281+
!this.allowOtherButtonsDuringDrag
275282
) {
276283
this.releaseDrag();
277284
return;

0 commit comments

Comments
 (0)