File: graphics/js/CanvasRect.js
/**
* <a href="http://www.w3.org/TR/html5/the-canvas-element.html">Canvas</a> implementation of the <a href="Rect.html">`Rect`</a> class.
* `CanvasRect` is not intended to be used directly. Instead, use the <a href="Rect.html">`Rect`</a> class.
* If the browser lacks <a href="http://www.w3.org/TR/SVG/">SVG</a> capabilities but has
* <a href="http://www.w3.org/TR/html5/the-canvas-element.html">Canvas</a> capabilities, the <a href="Rect.html">`Rect`</a>
* class will point to the `CanvasRect` class.
*
* @module graphics
* @class CanvasRect
* @constructor
*/
CanvasRect = function()
{
CanvasRect.superclass.constructor.apply(this, arguments);
};
CanvasRect.NAME = "rect";
Y.extend(CanvasRect, Y.CanvasShape, {
/**
* Indicates the type of shape
*
* @property _type
* @type String
* @private
*/
_type: "rect",
/**
* Draws the shape.
*
* @method _draw
* @private
*/
_draw: function()
{
var w = this.get("width"),
h = this.get("height");
this.clear();
this.drawRect(0, 0, w, h);
this._closePath();
}
});
CanvasRect.ATTRS = Y.CanvasShape.ATTRS;
Y.CanvasRect = CanvasRect;