Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/lib/canvas/Rectangle.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/lib/canvas/Rectangle.js')
-rw-r--r--html/lib/canvas/Rectangle.js25
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);
+ }
+});