# Filter mouse buttons for PointerDragBehavior?

**URL:** <https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270>\
**Category:** Questions\
**Created:** [April 1, 2019, 9:45am UTC](https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270 "2019-04-01T09:45:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eole211](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eole211/32/7380_2.png) [@Eole211](https://forum.babylonjs.com/u/Eole211)\
**Post date:** [April 1, 2019, 9:45am UTC](https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270/1 "2019-04-01T09:45:01Z")

</div>

Hello,  
I have a PointerDragBehavior, and I was trying to make it drag only on left click (it seems like a basic feature a lot of dev might want to use : actions are often different depending on the mouse button you use).  
Sadly, I found no easy way to do it. The currentDraggingPointerID doesn’t seem to bring any button info…  
So I had to change the dragBehavior.\_pointerObserver.callback to do it :

```
    const currentCallback = dragBehavior._pointerObserver.callback;
    dragBehavior._pointerObserver.callback = (pointerInfo, eventState) => {
            if (pointerInfo.event.button !== 0 && pointerInfo.event.type !== "pointermove") {
                return;
            }
            currentCallback(pointerInfo, eventState);
    };

```

It’s working, but it’s not really nice to have to do this sort of thing just to drag on left click only…  
Am I missing something ? If not, it would be nice to add a allowed mouse button(s) parameter to the PointerDragBehavior, and maybe to the gizmos too.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 1, 2019, 3:01pm UTC](https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270/2 "2019-04-01T15:01:14Z")

</div>

Pinging @trevordev

---

<div class="post-metadata">

**Author:** ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)\
**Post date:** [April 2, 2019, 12:05am UTC](https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270/3 "2019-04-02T00:05:06Z")

</div>

Hey @Eole211, welcome to the forum.

This seems reasonably useful. Would you want to try to create a PR to support this? The file can be found here [Babylon.js/pointerDragBehavior.ts at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/master/src/Behaviors/Meshes/pointerDragBehavior.ts) . I always struggle with how many options/settings should be exposed on helper classes like these but am happy to review/accept a PR.

Also I would note that if in your code you are using variables/methods starting with \_ (eg. \_pointerObserver) those are internal and may be renamed or modified in future version of babylon.

---

<div class="post-metadata">

**Author:** ![Eole211](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eole211/32/7380_2.png) [@Eole211](https://forum.babylonjs.com/u/Eole211)\
**Post date:** [April 3, 2019, 12:53pm UTC](https://forum.babylonjs.com/t/filter-mouse-buttons-for-pointerdragbehavior/2270/4 "2019-04-03T12:53:42Z")

</div>

Ok, I’ll see to it next week maybe.
