stamas47 Posted May 29, 2015 Share Posted May 29, 2015 I have a canvas with a set aspect ratio of 16:9 and I am resizing the renderer every time the window size changes game.resize = function() { var original = _default_screenWidth / _default_screenHeight; var designer = window.innerWidth / window.innerHeight; if ( window.innerWidth < _default_screenWidth || window.innerHeight < _default_screenHeight ) { if ( original > designer ) { game.renderer.resize(window.innerWidth,window.innerWidth/original); } else { game.renderer.resize(window.innerHeight*original,window.innerHeight); } _DOM.style.width = game.renderer.width; _DOM.style.height = game.renderer.height; game.stage.scale.x = game.renderer.width / _default_screenWidth; game.stage.scale.y = game.renderer.height / _default_screenHeight; } }; window.addEventListener("resize",game.resize);Problem is if I tap certain buttons (PIXI.Container) , they are not firing, only if i tap a little bit lower, so it's only the Y axis that's off. Here is the code for the buttonif ( Game.mobile ) { button.container.interactive = true; button.container.buttonMode = true; button.container.tap = function() { button.Press(); }; }If the window does not need any scaling then everything works fine. Quote Link to comment Share on other sites More sharing options...
FFJohannes Posted June 4, 2015 Share Posted June 4, 2015 I'm seeing this problem too, on pixi.js v3.0.6. Clicks seem to work fine; only touch-events stop working properly. I worked around this temporarily by setting the correct resolution, width and height on the renderer when starting up PIXI. Touch events will probably stop working again if the window is resized for any reason though. Note: my project is also using renderer.resolution > 1. Not sure if this is required to encounter the problem. 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.