remvst Posted March 20, 2013 Share Posted March 20, 2013 Thank you very much!Interesting, your code does basically the same as what I already had in place.This is helpful because it means I must have just made an error somewhere - at least now I can be confident that the approach I am using is valid!Thanks a lot for your help.I didn't say that it was working, I only said that's what I'm using Quote Link to comment Share on other sites More sharing options...
alex_h Posted March 20, 2013 Share Posted March 20, 2013 Well nevertheless it helped for me to see your code!Here's my new resize method: function resizeGame() { var gameArea = document.getElementById('game'); var windowW = window.innerWidth; var windowH = window.innerHeight; var dstW = windowW; var dstH = windowH; var aspectRatio = statics.STAGE_W / statics.STAGE_H; var w = dstW; var h = dstH; if (dstW > aspectRatio * dstH) { w = Math.ceil(aspectRatio * dstH); } else { h = Math.ceil(dstW / aspectRatio); } var x = w * -0.5; var y = h * -0.5; // gameArea.style.width = '' + w + 'px'; gameArea.style.height = '' + h + 'px'; // gameArea.style.marginLeft = '' + x + 'px'; gameArea.style.marginTop = '' + y + 'px'; // screens.screenManager.resize(w,h);} I tested it on an iPad1 running iOS5 and an iPad mini running iOS6 and it worked perfectly on both of them.I'm running the method after a setTimeout on load with a delay of 1 sec, also on orientationchanged an on window resize. bfmags 1 Quote Link to comment Share on other sites More sharing options...
IvanK Posted March 20, 2013 Author Share Posted March 20, 2013 There probably is a bug in WebKit. Did someone of you report it? It is very sad to see, that instead of reporting the bug, users try to overcome it 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.