While developing the HTML5 DICOM Viewer I got some problems while designing the UI in HTML.
One of those problems was how to manage the canvas resize according to the browser size.
At least for me it wasn’t so much trivial :) so I decided to post it so it could be useful for someone else.
Basically what you have to do is to bind the onresize event to your body, once you catch the event you just need to resize the canvas using window.innerWidth and window.innerHeight.
I just needed to add little functionality to preserve aspect ratio and manage the toolbar div.
If you want to try it just click here or check the following video to see how it works: