mr_pinc Posted November 1, 2017 Share Posted November 1, 2017 It appears with the latest build the babylon canvas element no longer fires mousedown, or mouseup events. Element still responds to touch events and click events but adding your own mouse down or mouse up handlers do not fire. Mouse move works as well. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 1, 2017 Share Posted November 1, 2017 Hi @mr_pinc Can you create a PG repo please? Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 1, 2017 Author Share Posted November 1, 2017 Done https://playground.babylonjs.com/#Y0QJPK Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 1, 2017 Share Posted November 1, 2017 Hello, I suggest to directly use pointer events: https://playground.babylonjs.com/#Y0QJPK#1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 1, 2017 Share Posted November 1, 2017 Most newer browsers have long deprecated mousedown & mouseup, they use pointer as Deltakosh posted. I only know of firefox that still use mouse prefix, but they also support pointer. Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 1, 2017 Author Share Posted November 1, 2017 Maybe I should use pointer events but the above example worked just a few weeks ago. Something changed recently that stopped that. I consider that a bug. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 2, 2017 Share Posted November 2, 2017 Hi again @mr_pinc I stand corrected Javascript events, e.g. eventListeners like you are using in your example, has nothing to do with babylon if you updated your browser recently, the old mouse prefix was probably deprecated and removed. I would suggest using both prefixes depending on the users browser support; https://playground.babylonjs.com/#Y0QJPK#3 Have a nice day. Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 2, 2017 Author Share Posted November 2, 2017 It does have something to do with babylon. If I use a babylon nightly from 2 weeks ago (roughly, I can try to get more detailed date) the mouseDown event works. If I switch to the current nightly it does not work. This is using the same browser (electron 1.8.1) Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 2, 2017 Author Share Posted November 2, 2017 This issue is bringing to light another problem - unless it's somewhere I don't know about - there's not engine build number so it makes it hard to distinguish builds. It might be useful to add a build number that can be more easily tied to a nightly. Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 2, 2017 Author Share Posted November 2, 2017 Also can someone provide some reference for mouse events being "depreciated"? According to these docs - mouse events seem to be alive and kicking https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent https://www.w3schools.com/jsref/event_onmousedown.asp Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 2, 2017 Share Posted November 2, 2017 you are right: there is something that changed in bjs and I'm investigating But in the meantime pointer events should do the job Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 2, 2017 Share Posted November 2, 2017 Ok I found why https://playground.babylonjs.com/#Y0QJPK#4 the preventDefaultOnPointerDown was introduced to call preventDefault() on pointer down in order to block unwanted artifacts like system double clicks Gijs 1 Quote Link to comment Share on other sites More sharing options...
mr_pinc Posted November 2, 2017 Author Share Posted November 2, 2017 That works great. Thanks! 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.