From ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 Mon Sep 17 00:00:00 2001 From: Lionel LASKE Date: Sat, 25 Aug 2012 20:23:36 +0000 Subject: Init commit --- (limited to 'html/lib/canvas/Rectangle.js') 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); + } +}); -- cgit v0.9.1