SVGShape.js revision 14bfa36e35102dbf271dcff98f773a01c75bd503
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * <a href="http://www.w3.org/TR/SVG/">SVG</a> implementation of the <a href="Shape.html">`Shape`</a> class.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * `SVGShape` is not intended to be used directly. Instead, use the <a href="Shape.html">`Shape`</a> class.
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * If the browser has <a href="http://www.w3.org/TR/SVG/">SVG</a> capabilities, the <a href="Shape.html">`Shape`</a>
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * class will point to the `SVGShape` class.
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @module graphics
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @class SVGShape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @constructor
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Object} cfg (optional) Attribute configs
828c58761d90445b8b9d20a82d85dc1479317f71Tripp SVGShape.superclass.constructor.apply(this, arguments);
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * Init method, invoked during construction.
e7c7565d9550eaa87043aef0df77125ada996deaTripp * Calls `initializer` method.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @method init
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @protected
828c58761d90445b8b9d20a82d85dc1479317f71Tripp init: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Initializes the shape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method initializer
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var host = this;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Add a class name to each node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method addClass
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} className the class name to add to the node's class attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.className.baseVal = Y_LANG.trim([node.className.baseVal, className].join(' '));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Removes a class name from each node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method removeClass
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} className the class name to remove from the node's class attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp classString = classString.replace(new RegExp(className + ' '), className).replace(new RegExp(className), '');
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Gets the current position of the node in page coordinates.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method getXY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Array The XY position of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getXY: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Set the position of the shape in page coordinates, regardless of how the node is positioned.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method setXY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Array} Contains x & y values for new position (coordinates are page-based)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method contains
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {SVGShape | HTMLElement} needle The possible node or descendent
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Boolean Whether or not this shape is the needle or its ancestor.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Compares nodes to determine if they match.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Node instances can be compared to each other and/or HTMLElements.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method compareTo
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {HTMLElement | Node} refNode The reference node to compare to the node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return {Boolean} True if the nodes match, false if they do not.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Test if the supplied node matches the supplied selector.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method test
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} selector The CSS selector to test against.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Boolean Wheter or not the shape matches the selector.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Value function for fill attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _getDefaultFill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _getDefaultFill: function() {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Value function for stroke attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _getDefaultStroke
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Object
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * Creates the dom node for the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method createNode
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return HTMLElement
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var node = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg:" + this._type),
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp this.addClass("yui3-" + SHAPE + " yui3-" + this.name);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Overrides default `on` method. Checks to see if its a dom interaction event. If so,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * return an event attached to the `node` element. If not, return the normal functionality.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @method on
080b31a43c2a1d068c28eaa3e243bdd6e8a89ffaTripp * @param {String} type event type
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Object} callback function
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Adds a stroke to the shape node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _strokeChangeHandler
828c58761d90445b8b9d20a82d85dc1479317f71Tripp dash = Y_LANG.isArray(dashstyle) ? dashstyle.toString() : dashstyle;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp stroke.opacity = Y_LANG.isNumber(strokeOpacity) ? strokeOpacity : 1;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("stroke-miterlimit", Math.max(linejoin, 1));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Adds a fill to the shape node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _fillChangeHandler
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp node.setAttribute("fill", "url(#grad" + this.get("id") + ")");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fillOpacity = Y_LANG.isNumber(fillOpacity) ? fillOpacity : 1;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Creates a gradient fill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _setGradientFill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} type gradient type
828c58761d90445b8b9d20a82d85dc1479317f71Tripp gradientNode = graphic.getGradientNode("grad" + this.get("id"), type),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp tanRadians = parseFloat(parseFloat(Math.tan(rotation * radCon)).toFixed(8)),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp gradientNode.setAttribute("x1", Math.round(100 * x1/w) + "%");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp gradientNode.setAttribute("y1", Math.round(100 * y1/h) + "%");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp gradientNode.setAttribute("x2", Math.round(100 * x2/w) + "%");
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp gradientNode.setAttribute("y2", Math.round(100 * y2/h) + "%");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Sets the value of an attribute.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method set
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @param {String|Object} name The name of the attribute. Alternatively, an object of key value pairs can
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * be passed in to set multiple attributes at once.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Any} value The value to set the attribute to. This value is ignored if an object is received as
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * the name param.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp set: function()
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp var host = this;
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Specifies a 2d translation.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @method translate
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @param {Number} x The value to transate on the x-axis.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @param {Number} y The value to translate on the y-axis.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp translate: function(x, y)
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Translates the shape along the x-axis. When translating x and y coordinates,
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * use the `translate` method.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @method translateX
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @param {Number} x The value to translate.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp translateX: function(x)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Translates the shape along the y-axis. When translating x and y coordinates,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * use the `translate` method.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method translateY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} y The value to translate.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp translateY: function(y)
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * Skews the shape around the x-axis and y-axis.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method skew
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} x The value to skew on the x-axis.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} y The value to skew on the y-axis.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp skew: function(x, y)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Skews the shape around the x-axis.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method skewX
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} x x-coordinate
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp skewX: function(x)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Skews the shape around the y-axis.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method skewY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} y y-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp skewY: function(y)
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Rotates the shape clockwise around it transformOrigin.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method rotate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} deg The degree of the rotation.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Specifies a 2d scaling operation.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method scale
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} val
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp scale: function(x, y)
9cc2c5945426b2b79c0a258026d750be74795924Tripp * Adds a transform to the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _addTransform
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} type The transform being applied.
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @param {Array} args The arguments for the transform.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._transform = Y_LANG.trim(this._transform + " " + type + "(" + args.join(", ") + ")");
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Applies all transforms.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @method _updateTransform
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp if(isPath || (this._transforms && this._transforms.length > 0))
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp //need to use translate for x/y coords
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp //adjust origin for custom shapes
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp if(!(this instanceof Y.SVGPath))
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp tx = this._left + (transformOrigin[0] * this.get("width"));
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp ty = this._top + (transformOrigin[1] * this.get("height"));
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp normalizedMatrix.init({dx: x + this._left, dy: y + this._top});
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp for(; i < len; ++i)
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp normalizedMatrix[key].apply(normalizedMatrix, this._transforms[i]);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Draws the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _draw
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _draw: function()
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * Updates `Shape` based on attribute changes.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _updateHandler
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Storage for the transform attribute.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @property _transform
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * @type String
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * Returns the bounds for a shape.
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * Calculates the a new bounding box from the original corner coordinates (base on size and position) and the transform matrix.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * The calculated bounding box is used by the graphic instance to calculate its viewBox.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method getBounds
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Object
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp return this._normalizedMatrix.getContentRect(w, h, x, y);
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Destroys the shape instance.
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @method destroy
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp destroy: function()
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * Implementation for shape destruction
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @method destroy
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp * @protected
ed59119d8c00addb07c7ee6c8aefcd1d9cb876f1Tripp this.node = null;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * An array of x, y values which indicates the transformOrigin in which to rotate the shape. Valid values range between 0 and 1 representing a
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * fraction of the shape's corresponding bounding box dimension. The default value is [0.5, 0.5].
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @config transformOrigin
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type Array
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp valueFn: function()
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <p>A string containing, in order, transform operations applied to the shape instance. The `transform` string can contain the following values:
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>rotate</dt><dd>Rotates the shape clockwise around it transformOrigin.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>translate</dt><dd>Specifies a 2d translation.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>skew</dt><dd>Skews the shape around the x-axis and y-axis.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>scale</dt><dd>Specifies a 2d scaling operation.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>translateX</dt><dd>Translates the shape along the x-axis.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>translateY</dt><dd>Translates the shape along the y-axis.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>skewX</dt><dd>Skews the shape around the x-axis.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>skewY</dt><dd>Skews the shape around the y-axis.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>matrix</dt><dd>Specifies a 2D transformation matrix comprised of the specified six values.</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <p>Applying transforms through the transform attribute will reset the transform matrix and apply a new transform. The shape class also contains corresponding methods for each transform
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * that will apply the transform to the current matrix. The below code illustrates how you might use the `transform` attribute to instantiate a recangle with a rotation of 45 degrees.</p>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var myRect = new Y.Rect({
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp type:"rect",
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp height: 40,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp transform: "rotate(45)"
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * <p>The code below would apply `translate` and `rotate` to an existing shape.</p>
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp myRect.set("transform", "translate(40, 50) rotate(45)");
66ca16dd76367c074fe4df1dcf7b555489a9bf85Tripp * @config transform
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @type String
5ecb8c8b041752f6b716054ff5cfc2c9992365c6Tripp this._transforms = this.matrix.getTransformArray(val);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this._transform;
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * Unique id for class instance.
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * @config id
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type String
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp valueFn: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.guid();
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * Indicates the x position of shape.
2ebe57b26e070070dacbe6e2b3351d5cefaee874Tripp * @config x
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Number
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates the y position of shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config y
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Number
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates the width of the shape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config width
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type Number
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates the height of the shape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config height
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Number
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates whether the shape is visible.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config visible
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Boolean
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Contains information about the fill of the shape.
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * <dt>color</dt><dd>The color of the fill.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>type</dt><dd>Type of fill.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>solid</dt><dd>Solid single color fill. (default)</dd>
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * <dt>linear</dt><dd>Linear gradient fill.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>radial</dt><dd>Radial gradient fill.</dd>
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * <p>If a `linear` or `radial` is specified as the fill type. The following additional property is used:
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>stops</dt><dd>An array of objects containing the following properties:
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>color</dt><dd>The color of the stop.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stop. The default value is 1. Note: No effect for IE 6 - 8</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>offset</dt><dd>Number between 0 and 1 indicating where the color stop is positioned.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p>Linear gradients also have the following property:</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>rotation</dt><dd>Linear gradients flow left to right by default. The rotation property allows you to change the flow by rotation. (e.g. A rotation of 180 would make the gradient pain from right to left.)</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p>Radial gradients have the following additional properties:</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>r</dt><dd>Radius of the gradient circle.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>fx</dt><dd>Focal point x-coordinate of the gradient.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>fy</dt><dd>Focal point y-coordinate of the gradient.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>cx</dt><dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p>The x-coordinate of the center of the gradient circle. Determines where the color stop begins. The default value 0.5.</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p><strong>Note: </strong>Currently, this property is not implemented for corresponding `CanvasShape` and `VMLShape` classes which are used on Android or IE 6 - 8.</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>cy</dt><dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p>The y-coordinate of the center of the gradient circle. Determines where the color stop begins. The default value 0.5.</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <p><strong>Note: </strong>Currently, this property is not implemented for corresponding `CanvasShape` and `VMLShape` classes which are used on Android or IE 6 - 8.</p>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config fill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Contains information about the stroke of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>color</dt><dd>The color of the stroke.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>weight</dt><dd>Number that indicates the width of the stroke.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stroke. The default value is 1.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>dashstyle</dt>Indicates whether to draw a dashed stroke. When set to "none", a solid stroke is drawn. When set to an array, the first index indicates the
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * length of the dash. The second index indicates the length of gap.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>linecap</dt><dd>Specifies the linecap for the stroke. The following values can be specified:
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>butt (default)</dt><dd>Specifies a butt linecap.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>square</dt><dd>Specifies a sqare linecap.</dd>
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * <dt>round</dt><dd>Specifies a round linecap.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>linejoin</dt><dd>Specifies a linejoin for the stroke. The following values can be specified:
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>round (default)</dt><dd>Specifies that the linejoin will be round.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>bevel</dt><dd>Specifies a bevel for the linejoin.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>miter limit</dt><dd>An integer specifying the miter limit of a miter linejoin. If you want to specify a linejoin of miter, you simply specify the limit as opposed to having
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * separate miter and miter limit values.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config stroke
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var tmpl = this.get("stroke") || this._getDefaultStroke(),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp //Not used. Remove in future.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp // Only implemented in SVG
c093c1aed867e18aa4778708592e1ceb45d18cffTripp // Determines whether the instance will receive mouse events.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp // @config pointerEvents
828c58761d90445b8b9d20a82d85dc1479317f71Tripp // @type string
828c58761d90445b8b9d20a82d85dc1479317f71Tripp valueFn: function()
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * The node used for gradient fills.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @config gradientNode
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type HTMLElement
c093c1aed867e18aa4778708592e1ceb45d18cffTripp //Not used. Remove in future.
e7c7565d9550eaa87043aef0df77125ada996deaTripp getter: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Dom node for the shape.
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @config node
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @type HTMLElement
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @readOnly
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return this.node;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Reference to the parent graphic instance
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @config graphic
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @type SVGGraphic
e7c7565d9550eaa87043aef0df77125ada996deaTripp * @readOnly
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this._graphic;