3 ms·
> The concern is not "how do I keep track of just devicePixelRatio?" It's "how do I fill this window with a canvas at native resolution?" Not everyone's canvas
by Dylan16807 5y ago
> The concern is not "how do I keep track of just devicePixelRatio?" It's "how do I fill this window with a canvas at native resolution?"
Not everyone's canvas is filling the window.
- moron4hire 5y agoAll the ways in which you will care about how to buffer dimensions of your canvas to avoid aliasing artifacts can be handled with just the window.onresize event, whether your canvas is fixed or proportionally sized. https://codepen.io/SeanMcBeth/pen/QWOoLNX https://codepen.io/SeanMcBeth/pen/QWOoLNX Throw a check in there to make sure the native dimensions actually did change so you don't needlessly redraw. Debounce it with setTimeout if you're super worried about people waggling their windows around or whatever.