kleepklep Posted August 13, 2015 Share Posted August 13, 2015 Is there any way to force my game to be in focus if it loses it so I don't have to click on it before I can start interacting with it? This happens if I click on the game, drag off of it, and mouse up in IE. Link to comment Share on other sites More sharing options...
drhayes Posted August 13, 2015 Share Posted August 13, 2015 I've been watching your thread but haven't (and still don't) have anything useful to add from a raw IE11/mouse event standpoint. Thanks for documenting it, though. I bet a steak dinner that there's no way to focus a canvas element quite like there is for input elements, i.e. calling ".focus()" on it. You might be better off making a small buffer zone around the edge of the canvas and, in IE11, if the mouse goes into that buffer zone it does the same thing it would do if it received a mouse up event. That wouldn't mitigate the problem entirely, but it might help? You could call "game.input.reset(false);" to reset the values under those conditions. Link to comment Share on other sites More sharing options...
JRVisualsLLC Posted August 20, 2015 Share Posted August 20, 2015 I'm having a (possibly) similar issue. Originally I was experiencing odd behavior in IE9 -- click and drag out of canvas, then click and drag within canvas.... would produce serious lag. Preventing the default event on the canvas div (<div id="gameCanvas" onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false">) fixed that and everything seemed ok until we tested in IE11. Also since this is a pull back and release to launch kind of game... I added a mouseOutCallback... which basically sees the mouse leaving the canvas then does the same thing that onInputUp was doing. (Similar to what @drhayes suggested above) This way if the user drags out of the game the loss of the mouseUp in IE isn't a big deal. game.input.mouse.mouseOutCallback = (function(scope){return function(){scope.launchBall();};})(this) The problem that remains is that coming back into the game after releasing the mouse outside forces the user to have to click twice -- once (seemingly) to regain focus... then again to actually interact with the game. The only other solution that I can think of so far... and it's not really what I would want to do... is force the game to pause when the mouse goes out of frame... and have a "Click to Continue" button appear... that way the user has to click in the frame to regain focus (even if it might still be twice) before they are actually playing again. A true technical solution for this would be amazing though. Link to comment Share on other sites More sharing options...
kleepklep Posted August 24, 2015 Author Share Posted August 24, 2015 Though I never could figure out the focus thing, I posted the mouse up / onInputUp after dragging off the canvas issue in the Phaser issues forum and it was resolved: https://github.com/photonstorm/phaser/issues/2000 This was my 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 More sharing options...
JRVisualsLLC Posted August 26, 2015 Share Posted August 26, 2015 Thanks @kleepklep -- lucky for us. Link to comment Share on other sites More sharing options...
Recommended Posts