Jump to content

How to get fire onUp event when mouse up out side the game?


naveen
 Share

Recommended Posts

  • 1 year later...

The mouseOutCallback code works, but the question about firing the onInputUp listener was never answered. I'm guessing that Naveen was trying to figure out a workaround for browsers like IE11 that do not detect if the user releases the mouse outside of the canvas. One way to deal with that would be to automatically trigger a mouse up event when leaving the canvas to avoid the complications that arise if a user releases the mouse outside the canvas and the event is not detected.

If I do this by calling the function specified in onInputUp, my onInputDown listener only responds on the second mouse down. Is there a way to trigger onInputUp without actually releasing the mouse?

 

car.events.onInputDown.add(onGrabCar, this);car.events.onInputUp.add(onReleaseCar, this);game.input.mouse.mouseOutCallback = function() {	console.log("Mouse left game canvas");	onReleaseCar();//have to click twice to grab again};
See related post http://www.html5gamedevs.com/topic/16304-sprites-oninputup-doesnt-fire-if-off-canvas-in-ie11-is-there-a-fix/
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...