CanvasPieSlice.js revision 66ca16dd76367c074fe4df1dcf7b555489a9bf85
09c638a157dd9d2ed9027215d9e254badfa019b8Dav Glass/**
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * Draws pie slices
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass *
daeb6d531149c45a2ceb543ae2cf1e56e5235bbeDav Glass * @module graphics
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @class CanvasPieSlice
09c638a157dd9d2ed9027215d9e254badfa019b8Dav Glass * @constructor
09c638a157dd9d2ed9027215d9e254badfa019b8Dav Glass */
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav GlassCanvasPieSlice = function()
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass{
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass CanvasPieSlice.superclass.constructor.apply(this, arguments);
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass};
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav GlassCanvasPieSlice.NAME = "canvasPieSlice";
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav GlassY.extend(CanvasPieSlice, Y.CanvasShape, {
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass /**
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * Indicates the type of shape
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass *
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @property _type
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @readOnly
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @type String
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass */
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass _type: "path",
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass /**
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * Change event listener
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass *
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @private
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @method _updateHandler
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass */
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass _draw: function(e)
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass {
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass var x = this.get("cx"),
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass y = this.get("cy"),
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass startAngle = this.get("startAngle"),
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass arc = this.get("arc"),
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass radius = this.get("radius");
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this.clear();
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this._left = x;
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this._right = radius;
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this._top = y;
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this._bottom = radius;
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this.drawWedge(x, y, startAngle, arc, radius);
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass this.end();
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass }
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass });
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav GlassCanvasPieSlice.ATTRS = Y.mix({
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass cx: {
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass value: 0
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass },
0083a85467aaec586c9609a224503db91ddc238dDav Glass
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass cy: {
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass value: 0
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass },
b357b56da58949fa86ab8e56983972e0db5cbffbDav Glass /**
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * Starting angle in relation to a circle in which to begin the pie slice drawing.
b9bc793332c43ca5a4d2c836f912781c5d3974f7Dav Glass *
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @attribute startAngle
029cb6cc7c47ef456b545670a3ec835dc57e8859Dav Glass * @type Number
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass */
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass startAngle: {
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass value: 0
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass },
1e44d35dd310d594ecc977ee4ed7cf6ef3746045Dav Glass
1e44d35dd310d594ecc977ee4ed7cf6ef3746045Dav Glass /**
1e44d35dd310d594ecc977ee4ed7cf6ef3746045Dav Glass * Arc of the slice.
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass *
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass * @attribute arc
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass * @type Number
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass */
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass arc: {
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass value: 0
6e43f558138d36538a82459ec79e0279ffae22e0Dav Glass },
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass /**
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass * Radius of the circle in which the pie slice is drawn
5cbdc947eb0c9c5e840d59ff8e1dd49a0e2a1887Dav Glass *
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @attribute radius
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass * @type Number
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass */
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass radius: {
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass value: 0
}
}, Y.CanvasShape.ATTRS);
Y.CanvasPieSlice = CanvasPieSlice;