shaharyar.ahmed Posted January 27, 2014 Share Posted January 27, 2014 Mouse click event is not working on Mozilla FireFox. It is not picking any mesh. But if I click on empty area it raises the event. It's working fine on Chrome and Internet explorer 11. Code: renderCanvas.addEventListener("click", function (evt) {// We try to pick an objectvar pickResult = newScene.pick(evt.offsetX, evt.offsetY);// if the click hits the ground object, we change the impact positionif (pickResult.hit) {document.getElementById('status').innerHTML = pickResult.pickedMesh.name;}elsedocument.getElementById('status').innerHTML = 'Nothing Selected';});You can check it here Quote Link to comment Share on other sites More sharing options...
shaharyar.ahmed Posted January 27, 2014 Author Share Posted January 27, 2014 I mistakenly created this topic. How to delete it? Quote Link to comment Share on other sites More sharing options...
Nico Posted January 27, 2014 Share Posted January 27, 2014 Hi, you can try this :renderCanvas.addEventListener("click", function (evt) { //offsetX/Y are not implemented on FireFox var offsetX = (e.offsetX || e.clientX - $(e.target).offset().left + window.pageXOffset ); var offsetY = (e.offsetY || e.clientY - $(e.target).offset().top + window.pageYOffset ); var pickResult = newScene.pick(offsetX, offsetY); // if the click hits the ground object, we change the impact position if (pickResult.hit) { document.getElementById('status').innerHTML = pickResult.pickedMesh.name; } else document.getElementById('status').innerHTML = 'Nothing Selected';});I've found this trick by quickly searching on Google, on this topic : http://stackoverflow.com/questions/11334452/event-offsetx-in-firefox 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.