diff options
author | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
commit | ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 (patch) | |
tree | 7ef2b853640f99807fba7fd3f2a28bda81727297 /html/lib/canvas/Rectangle.js |
Init commit
Diffstat (limited to 'html/lib/canvas/Rectangle.js')
-rw-r--r-- | html/lib/canvas/Rectangle.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/html/lib/canvas/Rectangle.js b/html/lib/canvas/Rectangle.js new file mode 100644 index 0000000..8f53412 --- /dev/null +++ b/html/lib/canvas/Rectangle.js @@ -0,0 +1,25 @@ +/** + Canvas control that draws a rectangle fitting the parameters specified in + the _bounds_ property. +*/ +enyo.kind({ + name: "enyo.canvas.Rectangle", + kind: enyo.canvas.Shape, + published: { + clear: false + }, + //* @protected + renderSelf: function(ctx) { + if (this.clear) { + ctx.clearRect(this.bounds.l, this.bounds.t, this.bounds.w, this.bounds.h); + } else { + this.draw(ctx); + } + }, + fill: function(ctx) { + ctx.fillRect(this.bounds.l, this.bounds.t, this.bounds.w, this.bounds.h); + }, + outline: function(ctx) { + ctx.strokeRect(this.bounds.l, this.bounds.t, this.bounds.w, this.bounds.h); + } +}); |