Jump to content

canvas size - iphone


hellopaso
 Share

Recommended Posts

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?

 

 

post-7222-0-17214800-1393521119.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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