hellopaso Posted February 27, 2014 Share Posted February 27, 2014 Hi there, I am newbie to HTML5. I have just create a game, run smoothly, but have only one issue with canvas size. My game is in Portrait mode, and have 640 max width and 960 max height.I add listener:var htmlCanvas = document.getElementById('context'),context = htmlCanvas.getContext('2d');window.addEventListener('resize', resizeCanvas, false); function resizeCanvas() { htmlCanvas.height = Math.min(960, window.innerHeight); scale = htmlCanvas.height / 960; htmlCanvas.width = parseInt(640 * scale);}Works fine in Browser and Android device. But have problems with my IPhone 4s. Please check attached Image - canvas do not fill all browser. Any idea? Quote Link to comment Share on other sites More sharing options...
MichaelD Posted March 7, 2014 Share Posted March 7, 2014 Is the function called when rotating the device? You could test that with Ripple chrome app I think it supports 4S and device rotation as a test. 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.