Why does the canvas not do anything for fillText(text, 0,0)
but works for fillText(text, 10, 10)
?
fillText(text, 0,0):
http://jsfiddle.net/kFhQm/4/
fillText(text, 10, 10):
http://jsfiddle.net/kFhQm/5/
The second argument is the Y coordinate for the baseline of the text (the default textBaseline
is "alphabetic"
)
, so the text is being drawn above the visible canvas
element when you use 0
.
jsFiddle.
You could use a different number or alternatively, change the textBaseline
property to something suitable, such as "top"
.
ctx.textBaseline = "top";
jsFiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With