nbody-wasm-sim
nbody-wasm-sim copied to clipboard
Canvas doesn't dynamically resize
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:

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.
Bevy seems to accomplish this with 'fit_to_canvas: true' somehow. I recently discovered it and would advise any future onlookers to start there.