Jump to content

Resizing


mwatt
 Share

Recommended Posts

I've tried calling the resize method on the canvas renderer but it is not working (probably I am doing something silly, or not doing something I should).  What are folks doing to handle resizing in the browser or an orientation change event on a mobile device?  Is there some technique to use in conjunction with resize or perhaps it is ok just to destroy and recreate the renderer?

Link to comment
Share on other sites

You know, I was in fact re-sizing the canvas (my drawingArea below) in addition to re-sizing the renderer with code that looked something like this:

 

    renderer.resize(width, height);
    drawingArea.style.width = width + "px";
    drawingArea.style.height = height + "px";
 
Inexplicably (at least to me), when I remove the call to renderer.resize, and only resize the actual canvas, it works!  So once again you have solved my problem.  I am in your debt sir.
Link to comment
Share on other sites

  • 4 years later...
On 12/12/2013 at 2:59 AM, bubamara said:

renderer.resize(800,600) will resize whole viewport and canvas, so new bottom-right corner of the stage is 800,600

changing canvas drawingArea.style.width / height scales up viewport and bottom-right corner of the stage is still 400,300

hope my explanation makes sense

Wow thank you so much, several days stuck on this issue, thanks.

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...