Sign in to follow this  

How to redraw/ update when window resize?

Recommended Posts

I have a very simple Pixijs project that display a image.

There is no animation or anything in it.

I wrote simple code to adjust the app size when the user resize the browser window.

function resize() {
  var dis = Math.min(window.innerHeight, window.innerWidth);

  app.view.width = dis;
  app.view.height = dis;

window.onresize = function(event) {

The problem I have is the canvas get resized, but the content inside it does not redraw.

Is there a function in pixi that I can call to redraw or update the canvas?

Share this post

Link to post
Share on other sites

I have never used pixi.js but I guess you're just resizing the element and not redrawing it after. I am also assuming whatever the canvas is drawing is based on these dimensions so just recall the draw function.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.