SVGCircle.js revision 828c58761d90445b8b9d20a82d85dc1479317f71
b7de308d8bc28d42249256bddb16bbace71f60favboxsync/**
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * Draws an circle
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync */
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync SVGCircle = function(cfg)
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync SVGCircle.superclass.constructor.apply(this, arguments);
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync };
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync SVGCircle.NAME = "svgCircle";
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync Y.extend(SVGCircle, Y.SVGShape, {
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync /**
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Indicates the type of shape
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * @property _type
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * @readOnly
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * @type String
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync */
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync _type: "circle",
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync /**
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Updates the shape.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @method _draw
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @private
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync */
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync _draw: function()
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync var node = this.node,
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync x = this.get("x"),
881b5ff6bc55e1fb0f4ef42f9782ccec79c0a138vboxsync y = this.get("y"),
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync radius = this.get("radius"),
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsync cx = x + radius,
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync cy = y + radius;
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync node.setAttribute("r", radius);
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync node.setAttribute("cx", cx);
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync node.setAttribute("cy", cy);
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync this._fillChangeHandler();
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync this._strokeChangeHandler();
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync this._updateTransform();
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync }
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync });
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsyncSVGCircle.ATTRS = Y.merge(Y.SVGShape.ATTRS, {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync /**
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @attribute width
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @readOnly
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync */
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync width: {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync readOnly:true,
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync getter: function()
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync return this.get("radius") * 2;
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync }
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync },
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync /**
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @attribute height
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @readOnly
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync */
c5d2523548cc57504b829f53f1362b848a84542cvboxsync height: {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync readOnly:true,
c5d2523548cc57504b829f53f1362b848a84542cvboxsync
c5d2523548cc57504b829f53f1362b848a84542cvboxsync getter: function()
c5d2523548cc57504b829f53f1362b848a84542cvboxsync {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync return this.get("radius") * 2;
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync }
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync },
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync /**
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * Radius of the circle
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync *
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync * @attribute radius
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync */
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync radius: {
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync value: 0
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync }
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync});
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsyncY.SVGCircle = SVGCircle;
b4f03aea544c9a58d8959658b31f7bd716a3f097vboxsync