uxebu / bonsai

BonsaiJS is a graphics library and renderer
http://bonsaijs.org
Other
1.96k stars 189 forks source link

textAlign #208

Closed basecode closed 11 years ago

basecode commented 11 years ago

This pull-request introduces support for textAlign attribute on Text. It can be set via attr and allows one of the following values: "left", "center", "right". Default is "left". Partially addresses #84.

new Text('my Text').attr('textAlign', 'left');

Why not "start" and "end"?

It makes sense to implement "start" and "end" as soon as Bonsai also supports text direction (e.g. from right to left) similar to the SVG or Canvas2d spec for example.

iamdustan commented 11 years ago

Code looks clean as butter to me. I just tested in latest Chrome, Safari and Firefox with consistent results.

:thumbsup: from me.

basecode commented 11 years ago

Thanks for reviewing @iamdustan!

klipstein commented 11 years ago

@basecode please also change the Text-documentation here https://github.com/uxebu/bonsai-docs/blob/gh-pages/overview/Text.md.

basecode commented 11 years ago

Good point. I updated the Text documentation https://github.com/uxebu/bonsai-docs/pull/37.