PointerDragBehavior to work only on one specific mouse button

Hello everyone…
Is it possible to make PointerDragBehavior to work only on left-click? I saw this topic Only left click on PointerDragBehavior but It doesn’t helps.

Pinging @Cedric

I have no idea but I can check :slight_smile:

Depending on your use case, you can filter the pointerId in onPointerDown and call pointerDragBehavior.startDrag() with pointerDragBehavior.startAndReleaseDragOnPointerEvents = false
But you will have to handle the mesh picking for the filter.

1 Like

I made it with scene.onPointerObservable cus in onPointerDown (please correct me if I’m wrong) the pointerId is 1 for every mouse button, so I can’t distinguish which mouse button was clicked in there.

so when I use onPointerObservable I can move the sphere only by left click but there’s a bug with arcRotateCamera now. When you move the sphere you can’t later move the camera.


When you move the sphere you can’t later move the camera.

This has been fixed yesterday and will be in next nightly

1 Like

Ping @PolygonalSun for the pointerId issue

The pointerId is the identifier for the mouse itself so if you want to identify what button has been pressed, you’ll need to access the button property. Here’s an example:

scene.onPointerDown = ((pointerEvent, e) => {
        console.log("pointerButton : ", pointerEvent.button)

Left click should come up as a 0. Here’s a reference if you want to know how all the other mouse buttons are mapped.