Prevent scroll in pointerDragBehavior

How can I prevent the scroll of my mouse to affect the drag behaviour.
I only want the dragBehaviour to happen on mouse click.

Here is the playground for replicating the issue.
https://playground.babylonjs.com/#S2NTDA#6

Note that, the dragging of the plane is happening with both mouse click and mouse scroll button pressed.

Hi,
You can limit pointer interactions (and then depending on context, i.e. Pick) to just pointerDown on mouse 0 button (left-click). Else, you could use custom inputs to override the defaults.

The drag plane is still responding to scroll press in the playground you shared. Need some help with that.

Indeed. I just realized that. Kind of fancy. Let me check this with the expert @PolygonalSun

We use an array with the mouse button numbers to define what can perform the drag behavior. To change what buttons can activate this, all you need to do is to just change values inside of this array. Example:

// This should make it so only the left mouse button can perform the behavior
pointerDragBehavior.dragButtons = [0];
// Omitting 1 instead will make it so on the left and right mouse buttons can perform a drag
pointerDragBehavior.dragButtons = [0, 2];
4 Likes