Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/lib/canvas/Text.js
diff options
context:
space:
mode:
authorLionel LASKE <llaske@c2s.fr>2012-08-25 20:23:36 (GMT)
committer Lionel LASKE <llaske@c2s.fr>2012-08-25 20:23:36 (GMT)
commitca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 (patch)
tree7ef2b853640f99807fba7fd3f2a28bda81727297 /html/lib/canvas/Text.js
Init commit
Diffstat (limited to 'html/lib/canvas/Text.js')
-rw-r--r--html/lib/canvas/Text.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/html/lib/canvas/Text.js b/html/lib/canvas/Text.js
new file mode 100644
index 0000000..a470be9
--- /dev/null
+++ b/html/lib/canvas/Text.js
@@ -0,0 +1,25 @@
+//* Canvas control that draws a text string.
+enyo.kind({
+ name: "enyo.canvas.Text",
+ kind: enyo.canvas.Shape,
+ published: {
+ //* The text to draw
+ text: "",
+ //* CSS font specification used to select a font for drawing
+ font: "12pt Arial",
+ //* Text alignment within the rectangle specified by the _bounds_ property
+ align: "left"
+ },
+ //* @protected
+ renderSelf: function(ctx) {
+ ctx.textAlign = this.align;
+ ctx.font = this.font;
+ this.draw(ctx);
+ },
+ fill: function(ctx) {
+ ctx.fillText(this.text, this.bounds.l, this.bounds.t);
+ },
+ outline: function(ctx) {
+ ctx.strokeText(this.text, this.bounds.l, this.bounds.t);
+ }
+});