+ 4

[Solved]HTML canvas behaving abnormally

I have made a simple canvas code. But if I increase the height/width of the canvas the shapes changes their scale and behave abnormally. For example : I have a line ctx.moveTo(10, 10); ctx.lineTo(10, 20); This should create a straight line. Now if I increase the width of the canvas and re run the code the line gets longer.

24th Apr 2021, 8:16 AM
Krish
Krish - avatar
6 ответов
24th Apr 2021, 10:34 AM
Krish
Krish - avatar
+ 4
Can you send your code?
24th Apr 2021, 8:20 AM
Սոֆի
+ 4
Canvas size and canvas element size are two different properties See: https://www.sololearn.com/post/119555/?ref=app
24th Apr 2021, 8:36 AM
Gordon
Gordon - avatar
+ 3
I was just doing that Tejas 😊😊
24th Apr 2021, 10:42 AM
Krish
Krish - avatar