zeebo Posted May 20, 2017 Share Posted May 20, 2017 I am having issues with mouse events firing properly. If the left mouse button is held down and you right click it is not fired and vice versa. I have them working properly solo. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted May 20, 2017 Share Posted May 20, 2017 Right click isn't a valid event in the browser, whatever you're using the shim it is listening for the context menu event, which won't fire if the left click is depressed, without a genuine right click event in the browser (which won't happen as its a reserved action, hijacking it is not encouraged) I doubt you can make it happen. edit: actually, I've just checked and I can listen for the contextmenu event (fired on right click) even when my left button is depressed. Only issue would be that I don't think there is any way to register 'un'-clicking the right button (mouseup), so it would still be impossible to accurately track when both buttons are depressed. Quote Link to comment Share on other sites More sharing options...
zeebo Posted May 20, 2017 Author Share Posted May 20, 2017 Thanks. Looks like it's a bug with PointerEvents because if I set window.PointerEvent = null it falls back to mouse events and works. I opened an issue on GitHub. Mouseup also tracks onContextMenu up. mattstyles and Herbert 2 Quote Link to comment Share on other sites More sharing options...
mattstyles Posted May 20, 2017 Share Posted May 20, 2017 There is no contextMenu up and contextMenu works like select inputs in that it 'steals' the mouse event when it fires so you'll get a mousedown but no mouseup. I tried shimming a mouseup by playing with focus but it was dreadfully inconsistent, usually wrong, so I'm not sure how you'd grab a right click mouseup event. edit: ha ha, worked it out, you just have to prevent default action for context menu and you'll get a mouseup! You'd have to assume it was from the right button though, you couldn't be 100% sure. Quote Link to comment Share on other sites More sharing options...
zeebo Posted May 20, 2017 Author Share Posted May 20, 2017 onmouseup(e){ e.which == 3} will be the right click link to issue https://github.com/pixijs/pixi.js/issues/4048 Quote Link to comment Share on other sites More sharing options...
Herbert Posted May 24, 2017 Share Posted May 24, 2017 On 2017-5-20 at 11:34 PM, zeebo said: Thanks. Looks like it's a bug with PointerEvents because if I set window.PointerEvent = null it falls back to mouse events and works. I opened an issue on GitHub. Mouseup also tracks onContextMenu up. hi zeebo, i have the same problem, setting window.PointerEvent = null seems work for me, thanks. Is it your final solution? is there any side effect doing this? Quote Link to comment Share on other sites More sharing options...
zeebo Posted May 24, 2017 Author Share Posted May 24, 2017 1 minute ago, Herbert said: hi zeebo, i have the same problem, setting window.PointerEvent = null seems work for me, thanks. Is it your final solution? is there any side effect doing this? Yeah it's the solution I'm going with for now. It's a little dirty, but it works. Firefox has PointerEvents disabled by default so Pixi falls back to mouse event callbacks if they are disabled / not supported by the current browser. Quote Link to comment Share on other sites More sharing options...
Herbert Posted May 24, 2017 Share Posted May 24, 2017 5 minutes ago, zeebo said: Yeah it's the solution I'm going with for now. It's a little dirty, but it works. Firefox has PointerEvents disabled by default so Pixi falls back to mouse event callbacks if they are disabled / not supported by the current browser. ok thanks, if it is the bug from PointerEvent, I suppose this is a good choice. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted May 24, 2017 Share Posted May 24, 2017 On 2017-5-20 at 4:34 PM, zeebo said: Mouseup also tracks onContextMenu up. Not on Chrome it doesn't, as there is no up to track (I'm assuming this is the case everywhere). You have to disable the context menu to get a mouseup (which makes sense as the browser won't hijack your mouse event). 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.