Canvas on resize - keep a maximal width or height without stretching/padding
问题 I have a question for a html5 game using canvas in javascript. I would like that the canvas showed to the player contains either 1920 of canvas.width, either 1080 of canvas.height in order to not see the padding. That means that I don't want to keep the (optimal) game ratio 16/9 if the player resize his screen with an other ratio, but I want to keep the viewport ratio 16/9 to avoid stretching (using canvas.style.***) Let me take an example of a player with a resizable screen (window