Tizen Developers

Menu
Sites
Language
HTML5 canvas ignores width and height set in JavaScript (solved)

Hello,

I'm using a HTML5 canvas to draw on but everything is scaled to 150% and positioned at 150% of what is specified. For example, on the screen the canvas has size (450, 450) although in the JavaScript source the size is set to (300, 300).

Adding the viewport tag to the head tag in the index.html file solved the problem: meta name="viewport" content="width=480, height=800, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"

Edited on 18 03, 2014

Responses

4 Replies
Lakshmi Grandhi
Thanks Vandersteene for share this information
Lakshmi Grandhi
Thanks Vandersteene for sharing this information
Lakshmi Prathyusha
Thanks for sharing Vandersteene. By default the tag looks like : in tag.
Lakshmi Prathyusha
Thanks for sharing Vandersteene. By default the tag looks like: in head tag.