Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text: Fixed position bug; added shadow effects #83

Merged
merged 2 commits into from
Jul 10, 2013
Merged

Text: Fixed position bug; added shadow effects #83

merged 2 commits into from
Jul 10, 2013

Conversation

videlais
Copy link
Contributor

I've been using Text a great deal more for descriptions of things in the adventure game I'm working on and noticed that the positioning kept being slightly off. After working with it some, I found out the initial translate to its x and y was then pushing the final fillText call off by the difference between the origin and the translate. (The problem is fixed by removing the translate.)

I've also added shadow effects to Text. While any canvas drawing call can use them, they work much better (and have a more general use case) for drawing text than for sprites or even lines.

This adds shadow effects to Text with options for the color, blur, and
offset for both x and y.

It also changes two default settings: textAlign  to "start" and style to
"normal". (Visually, the changes only appear if the browser is set to
right-to-left in its language settings.)
Finally fixed a bug in Text I noticed a few days ago by removing the
initial translate before the drawing of the text.

Because test is drawn using a x and y, the additional translate (unlike
sprites) frequently moves the final drawing position to incorrect
values. This is much more noticeable when drawing texts within
viewports.
ippa pushed a commit that referenced this pull request Jul 10, 2013
Text: Fixed position bug; added shadow effects
@ippa ippa merged commit ba8a346 into ippa:master Jul 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants