How can I stop the canvas shrinking to half-height | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I stop the canvas shrinking to half-height

Occasionally when I load the canvas, it shrinks to half it's height. This only happens when it's on innerWidth and innerHeight. I am using window.onload AND a loader to ensure it loads correct but it still does it. https://code.sololearn.com/W8uEIWw1Ex0N/?ref=app

1st Jul 2020, 9:58 AM
Clueless Coder
Clueless Coder - avatar
2 Answers
+ 12
It works fine as I see. How to reproduce the bug?
5th Jul 2020, 8:10 PM
Igor Makarsky
Igor Makarsky - avatar
+ 1
Igor Makarsky I'm on Android if that helps. It doesn't happen all the time, but sometimes (especially after a editing the code then running) the canvas won't load properly, all the elements are squished and the canvas is half the size of the page. This is probably due to SoloLearn because it won't happen on Brackets. It only happens when it is set to innerWidth, innerHeight etc. This isn't a one off, it happens to all my canvas codes. Hence why I always set to 350, 530 (fit for my device and a little room at the bottom).
5th Jul 2020, 8:13 PM
Clueless Coder
Clueless Coder - avatar