nbody-wasm-sim icon indicating copy to clipboard operation
nbody-wasm-sim copied to clipboard

Canvas doesn't dynamically resize

Open simbleau opened this issue 3 years ago • 1 comments

When you resize the browser, you get distortion of the viewport.

Normally, and on page load, we get a ResizeEvent which allows us to set the canvas size: image

However, on browser resize, we don't get these events anymore, leaving me unsure of how to resize the canvas and aspect ratio itself. For now I've added CSS rules on index.html to keep it fullscreen, but I'm not entirely sure how to fix this without ResizeEvents from winit.

simbleau avatar Aug 07 '22 16:08 simbleau

Bevy seems to accomplish this with 'fit_to_canvas: true' somehow. I recently discovered it and would advise any future onlookers to start there.

simbleau avatar Aug 18 '22 18:08 simbleau