Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stagas/470774 to your computer and use it in GitHub Desktop.
Save stagas/470774 to your computer and use it in GitHub Desktop.
function onResize() {
var new_height = window.innerHeight;
messages.style.height = (new_height - 132) + 'px';
panel.style.height = new_height + 'px';
}
window.onresize = onResize;
onResize();
Resizing the canvas is a problem since if the window is small, and resized to be big, resizing the canvas will stretch the picture.
Solution is to init with a really big canvas (ie 1920x1080), since without scrollbars it'll be hidden until resizing the window.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment