lihis Posted October 9, 2017 Share Posted October 9, 2017 Hello, With C2D i've used action managers left pick trigger for drag / click stuff and right pick trigger to make context menus, is there a way to enable right click on Babylon GUI elements? I can only find the pointer down / up events. Thanky hanky. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 9, 2017 Share Posted October 9, 2017 Hello can you describe what you want to achieve? Quote Link to comment Share on other sites More sharing options...
lihis Posted October 9, 2017 Author Share Posted October 9, 2017 @Deltakosh Have a separate action with Left and Right click when i click on a GUI Rectangle. Edit: For example left click to move element left and right click to move element right. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 9, 2017 Share Posted October 9, 2017 Ok so you need to have more info in the OnPointerDOwn or onPointerUp obersavables I guess, right? Quote Link to comment Share on other sites More sharing options...
lihis Posted October 9, 2017 Author Share Posted October 9, 2017 Yes i suppose. Action manager has: BABYLON.ActionManager.OnPickTrigger: BABYLON.ActionManager.OnLeftPickTrigger: BABYLON.ActionManager.OnRightPickTrigger: and i use the left and right pick triggers, not the first one that triggers on both. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 9, 2017 Share Posted October 9, 2017 Ok understood. Here is a change for you: https://www.babylonjs-playground.com/#XCPP9Y#281 The onPointerDownObservable now contains x, y and buttonIndex (0 = left, 2 = right) lihis, Givo and Arte 3 Quote Link to comment Share on other sites More sharing options...
lihis Posted October 9, 2017 Author Share Posted October 9, 2017 Thank you! I downloaded the latest version using the version builder and was able to make left and right clicks. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted October 10, 2017 Share Posted October 10, 2017 @lihis - If you're going to use right mouse events to trigger 'something', your browser will pop up the default context menu for each specific browser; which makes right mouse events annoying at best. However, you can disable the browser's default context menu by returning "false" in the event handler when capturing the onContextMenu event. Example: <body oncontextmenu="return false;"> If this is something you're already aware of, great. However, it's good for others to know as most Devs don't use right mouse events due to the various browser's displaying the context menu by default. DB Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 10, 2017 Share Posted October 10, 2017 @dbawel You can also add onselectstart : <body onselectstart="return false" oncontextmenu="return false"> The semicolons after false is not useful. It can also be done with javascript in addition. document.oncontextmenu = function() { return false }; Spankied, Dieterich, Arte and 1 other 3 1 Quote Link to comment Share on other sites More sharing options...
lihis Posted October 10, 2017 Author Share Posted October 10, 2017 Ah, yes, nice tips. I had indeed already done something very similar as it was annoying having that pesky browser context menu popping up! Thankfully it was a problem easily solved with the help of google and copy paste. Probably used right click for that... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.