How put percentage width into html canvas (no css)

前端 未结 5 2232
旧时难觅i
旧时难觅i 2020-12-05 10:13

I have an image and have overlaid a canvas on top of it so that I can draw \'on\' the image without modifying the image itself.

5条回答
  •  庸人自扰
    2020-12-05 11:11

    You could resize the canvas to fit the width of the image in pixels via JavaScript. Since you're using a canvas you are probably using JavaScript already so this should not be a problem.

    See Resize HTML5 canvas to fit window, although not identical, a similar solution should work.

提交回复
热议问题