Search code examples
javascriptbabylonjs

How can i disable right click on GUI Button in Babylonjs?


What is happening now is that if someone clicks the button with the left click, then the same thing is happening with the right click But I don’t like this: Click only with left click, button not click with right click

BABYLON.GUI.Button.CreateSimpleButton

You can see example below If u click button with right click they also work but i dont want this i only want to click this button with left not right.

https://playground.babylonjs.com/#1R7VD2


Solution

  • 
        button.onPointerUpObservable.add(function(event) {
            if (event.buttonIndex == 2) {return; }
            alert("click on button working");
        });