# Check if PointerEventTypes.POINTERTAP comes from left or right mouse button

**URL:** <https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222>\
**Category:** Questions\
**Created:** [May 28, 2020, 9:01am UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222 "2020-05-28T09:01:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [May 28, 2020, 9:01am UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222/1 "2020-05-28T09:01:16Z")

</div>

BABYLON.PointerEventTypes.POINTERTAP is triggered independently if the user clicked in a mobile device, or a computer, that’s ok but there is any chance to know if the user pressed left or right mouse click on PC?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![wulf11](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wulf11/32/2196_2.png) [@wulf11](https://forum.babylonjs.com/u/wulf11)\
**Post date:** [May 28, 2020, 9:36am UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222/2 "2020-05-28T09:36:38Z")

</div>

It seems these **PointerEventTypes** are not available yet in the Babylon API.  
You could use the `event.button`-property:

```
 scene.onPointerObservable.add((pointerInfo) => {
		switch (pointerInfo.type) {
			case BABYLON.PointerEventTypes.POINTERTAP:
                switch (pointerInfo.event.button) {
                    case 0: 
                        console.log("LEFT");
                        break;
                    case 1: 
                        console.log("MIDDLE");
                        break;
                    case 2: 
                        console.log("RIGHT");
                        break;
                }
            break;
        }
    });

```

Consider that `event.which` property also works, but is **deprecated**!

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [May 28, 2020, 11:52am UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222/3 "2020-05-28T11:52:01Z")

</div>

It seems that pointerInfo.event.button returns a number but thank you so much!

---

<div class="post-metadata">

**Author:** ![wulf11](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wulf11/32/2196_2.png) [@wulf11](https://forum.babylonjs.com/u/wulf11)\
**Post date:** [May 28, 2020, 12:02pm UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222/4 "2020-05-28T12:02:58Z")

</div>

Did you try the provided code above? 🤔

Thats why I used a switch clause 😉  
You have to interpret the returned numbers with some sort of condition!

> **[MouseEvent.button](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)**
>
> The MouseEvent.button read-only property indicates which button was pressed on the mouse to trigger the event.

The PointerEventTypes are also just static constants, containing a number (like Enums)

> <https://github.com/BabylonJS/Babylon.js/blob/master/src/Events/pointerEvents.ts>

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [May 28, 2020, 12:06pm UTC](https://forum.babylonjs.com/t/check-if-pointereventtypes-pointertap-comes-from-left-or-right-mouse-button/11222/5 "2020-05-28T12:06:54Z")

</div>

Sorry my bad! I just copied pointerInfo.event.button and compared with “LEFT” 🙄
