How to avoid HTML Canvas auto-stretching

前端 未结 5 1559
盖世英雄少女心
盖世英雄少女心 2021-01-01 11:12

I have the following piece of HTML:



&l         


        
5条回答
  •  一整个雨季
    2021-01-01 11:44

    If you're using JQuery, you shouldn't set the CSS (as the commenters above mentioned). You need to set the attribute so:

    $("canvas").attr('width', aWidth);
    $("canvas").attr('height', aHeight);
    

    works great.

提交回复
热议问题