Open rdurnin opened 2 years ago
Hey! HammerJS is intended to handle touch events however a quick search on Stackoverflow offers a solution to your problem: https://stackoverflow.com/questions/27609969/how-to-enable-right-click-and-middle-click-of-mouse-in-hammer-js
Hey, and I found that link as well, but it requires editing the npm package contents and isn't ideal. The hammerjs package also seems to override Babylon.js context menu prevention, so I'm not sure it will allow me to easily add m & r mouse click functionality. Perhaps an easier strategy would be to leave the left mouse button functionality with hammerjs and build a second ICameraInput to handle the other two mouse buttons.
I don't think you need to edit the NPM package. You just have to put the code from StackOverflow somewhere in your startup code. However the question is what would you like to achieve?
Thanks, and I was able use that code to extend the hammerjs behaviour. I am still having issues with the context menu popping up though (right-click), despite setting the following in the camera input constructor:
scene.preventDefaultOnPointerDown = true; scene.preventDefaultOnPointerUp = true;
Do you know how I can suppress the menu when I use right-click? There is a mention of noPreventDefault in the source, but I have seen no change from modifying the value.
The easy way to do so is:
<body oncontextmenu="return false">
Pardon me if this is more an issue with hammerjs, but is there a way to have the mouse input accept middle and right click inputs?