Jump to content

Proper engine resize


paleRider
 Share

Recommended Posts

Hi everybody!

In order to have a consistent behaviour of resize of Canvas/Engine I'm needing to add some lines before the call to Engine.resize():

//resize
window.addEventListener("resize",function(){
    Canvas.style.height="100%";
    Canvas.style.width="100%";
    Canvas.height=Canvas.innerHeight;
    Canvas.width=Canvas.innerWidth;

    //
    Engine.resize();
});

Well I know that the Canvas is on the side of HTML5 specification and BabylonJS has nothing to do there but, honestly, I find it odd there is not mention of these added four lines (bold ones) in the documents.

Maybe I'm misunderstanding something?

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