Check the pressed button onDragEnd

Hello !
I’m using the pointerDragBehavior to drag some meshes but I want to keep some cameras interactions and block others.
What I want is starting a drag by calling the function startDrag and keep the camera controls like zooming or moving the target with the wheel or right click. However those clicks call the dragEnd event and I only want it to be called when i use left mouse click.

Is there a way to manage this easily ? Thank you

I am sorry I am unsure of what you are exactly trying to achieve:

  1. Keep zooming rotating while dragging ?
    or 2. Manually entering and exiting drag ?

Thanks. Might be cool if you create a small PG to simplify our exchanges and highlight the issue ?

Adding @Cedric for the behaviors.

It’s a bit more complex than just keep zooming rotating while dragging. It’s keep zoom rotating while entered drag manually (which means that i didn’t press left click to trigger it)
I will try to set a playground to describe it.

Here’s an example :
https://playground.babylonjs.com/#VI5RSB

  • When I press K I strat the drag behavior and the sphere goes below the cursor.
  • I can zoom/unzoom while moving the sphere since I don’t click again
  • If I do a wheel click or a right click the drag is released which is not a behavior I want. I want the wheel button and the right mouse button to keep it’s camera control behavior without triggering the drag exit.
  • I only want my left click to exit drag.
  • OnDragEnd observer don’t send “event” parameter that contains info of the clicked button (left, wheel or right).

Ok got it i ll see what i can do :slight_smile:

You could use the special property to detach completely the behavior from pointer clicks:

tmpBehvior.startAndReleaseDragOnPointerEvents = false;

Then you can hook start and stop yourself :slight_smile:

Works fine, thanks :slight_smile: