SVGPath.js revision a75ebc38c1de401b679953a9b87bd323f0f48d02
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp/**
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * <a href="http://www.w3.org/TR/SVG/">SVG</a> implementation of the <a href="Path.html">`Path`</a> class.
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * `SVGPath` is not intended to be used directly. Instead, use the <a href="Path.html">`Path`</a> class.
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * If the browser has <a href="http://www.w3.org/TR/SVG/">SVG</a> capabilities, the <a href="Path.html">`Path`</a>
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * class will point to the `SVGPath` class.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * @module graphics
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @class SVGPath
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @extends SVGShape
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @constructor
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
9eaaa502227248d304ac9170902697d02158c1d9TrippSVGPath = function(cfg)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp{
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp SVGPath.superclass.constructor.apply(this, arguments);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp};
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippSVGPath.NAME = "svgPath";
5ecb8c8b041752f6b716054ff5cfc2c9992365c6TrippY.extend(SVGPath, Y.SVGShape, {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Left edge of the path
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @property _left
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @type Number
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @private
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _left: 0,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Right edge of the path
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @property _right
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @type Number
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @private
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _right: 0,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Top edge of the path
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @property _top
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @type Number
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @private
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _top: 0,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Bottom edge of the path
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @property _bottom
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @type Number
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @private
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _bottom: 0,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Indicates the type of shape
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @property _type
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @readOnly
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type String
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @private
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _type: "path",
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
5ecb8c8b041752f6b716054ff5cfc2c9992365c6Tripp /**
cec703a844d9691646231634fe709f4ea41d278aTripp * Storage for path
cec703a844d9691646231634fe709f4ea41d278aTripp *
cec703a844d9691646231634fe709f4ea41d278aTripp * @property _path
cec703a844d9691646231634fe709f4ea41d278aTripp * @type String
cec703a844d9691646231634fe709f4ea41d278aTripp * @private
5ecb8c8b041752f6b716054ff5cfc2c9992365c6Tripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _path: ""
5ecb8c8b041752f6b716054ff5cfc2c9992365c6Tripp});
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippSVGPath.ATTRS = Y.merge(Y.SVGShape.ATTRS, {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * Indicates the path used for the node.
9eaaa502227248d304ac9170902697d02158c1d9Tripp *
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * @config path
9eaaa502227248d304ac9170902697d02158c1d9Tripp * @type String
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * @readOnly
0fdefaa9ca017edfb76b736c825b34186f33045aTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp path: {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp readOnly: true,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp getter: function()
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return this._path;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp },
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Indicates the height of the shape
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * @config height
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type Number
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp width: {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp getter: function()
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp var val = Math.max(this._right - this._left, 0);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return val;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp },
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp /**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Indicates the height of the shape
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * @config height
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type Number
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp height: {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp getter: function()
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return Math.max(this._bottom - this._top, 0);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp});
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippY.SVGPath = SVGPath;