graphics-svg-debug.js revision 28068e1b6c8a9d683ee060e9bdd94f2905ced3c3
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Indicates the type of shape
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @property _type
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @readOnly
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a bezier curve.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method curveTo
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cp1x x-coordinate for the first control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cp1y y-coordinate for the first control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cp2x x-coordinate for the second control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cp2y y-coordinate for the second control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp currentArray = this._pathArray[Math.max(0, this._pathArray.length - 1)];
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this._pathArray[pathArrayLen] = this._pathArray[pathArrayLen].concat([Math.round(cp1x), Math.round(cp1y), Math.round(cp2x) , Math.round(cp2y), x, y]);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a quadratic bezier curve.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method quadraticCurveTo
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cpx x-coordinate for the control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cpy y-coordinate for the control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp currentArray = this._pathArray[Math.max(0, this._pathArray.length - 1)];
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this._pathArray[pathArrayLen] = this._pathArray[pathArrayLen].concat([Math.round(cpx), Math.round(cpy), Math.round(x), Math.round(y)]);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a rectangle.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method drawRect
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} w width
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} h height
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp drawRect: function(x, y, w, h) {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.moveTo(x, y);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.lineTo(x + w, y);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.lineTo(x + w, y + h);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.lineTo(x, y + h);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.lineTo(x, y);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a rectangle with rounded corners.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method drawRect
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} w width
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} h height
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} ew width of the ellipse used to draw the rounded corners
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} eh height of the ellipse used to draw the rounded corners
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this.quadraticCurveTo(x + w, y + h, x + w, y + h - eh);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a wedge.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate of the wedge's center point
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate of the wedge's center point
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} startAngle starting angle in degrees
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} arc sweep of the wedge. Negative values draw clockwise.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} radius radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} yRadius [optional] y radius for wedge.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp drawWedge: function(x, y, startAngle, arc, radius, yRadius)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // limit sweep to reasonable numbers
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // First we calculate how many segments are needed
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // for a smooth arc.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // Now calculate the sweep of each segment.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // The math requires radians rather than degrees. To convert from degrees
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // use the formula (degrees/180)*Math.PI to get radians.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // convert angle startAngle to radians
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp // draw a line from the center to the start of the curve
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp ax = x + Math.cos(startAngle / 180 * Math.PI) * radius;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp ay = y + Math.sin(startAngle / 180 * Math.PI) * yRadius;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp for(; i < segs; ++i)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp cx = x + Math.cos(angleMid) * (radius / Math.cos(theta / 2));
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp cy = y + Math.sin(angleMid) * (yRadius / Math.cos(theta / 2));
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp return this;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method lineTo
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} point1 x-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} point2 y-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if (typeof point1 === 'string' || typeof point1 === 'number') {
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp var currentArray = this._pathArray[Math.max(0, this._pathArray.length - 1)];
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Moves the current drawing position to specified x and y coordinates.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method moveTo
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x x-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y y-coordinate for the end point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp moveTo: function(x, y) {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this._pathArray[pathArrayLen] = this._pathArray[pathArrayLen].concat([x, y]);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Completes a drawing operation.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method end
38346051f48f13ebda9f86657ed3a6d19255e6beTripp end: function()
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Clears the path.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method clear
38346051f48f13ebda9f86657ed3a6d19255e6beTripp clear: function()
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Draws the path.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method _closePath
38346051f48f13ebda9f86657ed3a6d19255e6beTripp //Use transform to handle positioning.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp this._transformArgs.translate = [left + tx, top + ty];
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Updates the size of the graphics object
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method _trackSize
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} w width
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} h height
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp _trackSize: function(w, h) {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if (w > this._right) {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if(w < this._left)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if (h < this._top)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if (h > this._bottom)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Base class for creating shapes.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @class SVGShape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp SVGShape.superclass.constructor.apply(this, arguments);
180e0891171a381ce4fa08d3867f7226180b8282Tripp init: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Initializes the shape
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _initialize
180e0891171a381ce4fa08d3867f7226180b8282Tripp var host = this;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Add a class name to each node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method addClass
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {String} className the class name to add to the node's class attribute
180e0891171a381ce4fa08d3867f7226180b8282Tripp node.className.baseVal = Y_LANG.trim([node.className.baseVal, className].join(' '));
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Removes a class name from each node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method removeClass
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {String} className the class name to remove from the node's class attribute
180e0891171a381ce4fa08d3867f7226180b8282Tripp classString = classString.replace(new RegExp(className + ' '), className).replace(new RegExp(className), '');
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Gets the current position of the node in page coordinates.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method getXY
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Array The XY position of the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp getXY: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Set the position of the shape in page coordinates, regardless of how the node is positioned.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method setXY
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Array} Contains X & Y values for new position (coordinates are page-based)
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method contains
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {SVGShape | HTMLElement} needle The possible node or descendent
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Boolean Whether or not this shape is the needle or its ancestor.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Compares nodes to determine if they match.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Node instances can be compared to each other and/or HTMLElements.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method compareTo
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {HTMLElement | Node} refNode The reference node to compare to the node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return {Boolean} True if the nodes match, false if they do not.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Test if the supplied node matches the supplied selector.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method test
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {String} selector The CSS selector to test against.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Boolean Wheter or not the shape matches the selector.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Value function for fill attribute
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _getDefaultFill
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Object
180e0891171a381ce4fa08d3867f7226180b8282Tripp _getDefaultFill: function() {
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Value function for stroke attribute
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _getDefaultStroke
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Object
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Creates the dom node for the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return HTMLElement
11ba9f1486f8345f4ed99c74d8b58be3be37a40eTripp var node = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg:" + this._type),
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp this.addClass("yui3-" + SHAPE + " yui3-" + this.name);
180e0891171a381ce4fa08d3867f7226180b8282Tripp if(type.indexOf('mouse') > -1 || type.indexOf('click') > -1)
180e0891171a381ce4fa08d3867f7226180b8282Tripp return true;
180e0891171a381ce4fa08d3867f7226180b8282Tripp return false;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Adds a stroke to the shape node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _strokeChangeHandler
180e0891171a381ce4fa08d3867f7226180b8282Tripp dash = Y_LANG.isArray(dashstyle) ? dashstyle.toString() : dashstyle;
180e0891171a381ce4fa08d3867f7226180b8282Tripp stroke.opacity = Y_LANG.isNumber(strokeOpacity) ? strokeOpacity : 1;
180e0891171a381ce4fa08d3867f7226180b8282Tripp node.setAttribute("stroke-miterlimit", Math.max(linejoin, 1));
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Adds a fill to the shape node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _fillChangeHandler
180e0891171a381ce4fa08d3867f7226180b8282Tripp node.setAttribute("fill", "url(#grad" + this.get("id") + ")");
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp fillOpacity = Y_LANG.isNumber(fillOpacity) ? fillOpacity : 1;
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * Creates a gradient fill
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @method _setGradientFill
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {String} type gradient type
180e0891171a381ce4fa08d3867f7226180b8282Tripp gradientNode = graphic.getGradientNode("grad" + this.get("id"), type),
df9b19c757881bdddda4a3b2094bac020aa00bceTripp sinRadians = parseFloat(parseFloat(Math.sin(rotation * radCon)).toFixed(8)),
df9b19c757881bdddda4a3b2094bac020aa00bceTripp cosRadians = parseFloat(parseFloat(Math.cos(rotation * radCon)).toFixed(8)),
df9b19c757881bdddda4a3b2094bac020aa00bceTripp tanRadians = parseFloat(parseFloat(Math.tan(rotation * radCon)).toFixed(8)),
df9b19c757881bdddda4a3b2094bac020aa00bceTripp gradientNode.setAttribute("x1", Math.round(100 * x1/w) + "%");
df9b19c757881bdddda4a3b2094bac020aa00bceTripp gradientNode.setAttribute("y1", Math.round(100 * y1/h) + "%");
df9b19c757881bdddda4a3b2094bac020aa00bceTripp gradientNode.setAttribute("x2", Math.round(100 * x2/w) + "%");
df9b19c757881bdddda4a3b2094bac020aa00bceTripp gradientNode.setAttribute("y2", Math.round(100 * y2/h) + "%");
180e0891171a381ce4fa08d3867f7226180b8282Tripp set: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp var host = this;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies translate transformation.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method translate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} x The x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} y The y-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp translate: function(x, y)
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies translate transformation.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method translate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} x The x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} y The y-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @protected
180e0891171a381ce4fa08d3867f7226180b8282Tripp _translate: function(x, y)
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a skew to the x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method skewX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} x x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp skewX: function(x)
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a skew to the x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method skewX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} x x-coordinate
180e0891171a381ce4fa08d3867f7226180b8282Tripp skewY: function(y)
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a rotation.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method rotate
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a scale transform
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method scale
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {Number} val
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a matrix transformation
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method matrix
180e0891171a381ce4fa08d3867f7226180b8282Tripp matrix: function(a, b, c, d, e, f)
180e0891171a381ce4fa08d3867f7226180b8282Tripp this._transformArgs[type] = Array.prototype.slice.call(args, 0);
180e0891171a381ce4fa08d3867f7226180b8282Tripp args[1] = this.get("x") + (this.get("width") * transformOrigin[0]);
180e0891171a381ce4fa08d3867f7226180b8282Tripp args[2] = this.get("y") + (this.get("height") * transformOrigin[1]);
180e0891171a381ce4fa08d3867f7226180b8282Tripp val = key + "(" + this._transformArgs[key].toString() + ")";
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Updates the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _draw
180e0891171a381ce4fa08d3867f7226180b8282Tripp _draw: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Change event listener
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _updateHandler
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Storage for translateX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Storage for translateY
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Returns the bounds for a shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method getBounds
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @return Object
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp sinRadians = parseFloat(parseFloat(Math.sin(rotation * radCon)).toFixed(8)),
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp cosRadians = parseFloat(parseFloat(Math.cos(rotation * radCon)).toFixed(8)),
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp tlx = this._getRotatedCornerX(x, y, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp tly = this._getRotatedCornerY(x, y, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp blx = this._getRotatedCornerX(x, bottom, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bly = this._getRotatedCornerY(x, bottom, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp brx = this._getRotatedCornerX(right, bottom, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bry = this._getRotatedCornerY(right, bottom, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp trx = this._getRotatedCornerX(right, y, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp trY = this._getRotatedCornerY(right, y, tox, toy, cosRadians, sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bounds.left = Math.min(tlx, Math.min(blx, Math.min(brx, trx)));
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bounds.right = Math.max(tlx, Math.max(blx, Math.max(brx, trx)));
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bounds.top = Math.min(tly, Math.min(bly, Math.min(bry, trY)));
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp bounds.bottom = Math.max(tly, Math.max(bly, Math.max(bry, trY)));
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Returns the x coordinate for a bounding box's corner based on the corner's original x/y coordinates, rotation and transform origin of the rotation.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _getRotatedCornerX
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} x original x-coordinate of corner
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} y original y-coordinate of corner
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} tox transform origin x-coordinate of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} toy transform origin y-coordinate of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} cosRadians cosine (in radians) of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} sinRadians sin (in radians) or rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @return Number
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp _getRotatedCornerX: function(x, y, tox, toy, cosRadians, sinRadians)
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return (tox + (x - tox) * cosRadians + (y - toy) * sinRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Returns the y coordinate for a bounding box's corner based on the corner's original x/y coordinates, rotation and transform origin of the rotation.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _getRotatedCornerY
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} x original x-coordinate of corner
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} y original y-coordinate of corner
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} tox transform origin x-coordinate of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} toy transform origin y-coordinate of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} cosRadians cosine (in radians) of rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Number} sinRadians sin (in radians) or rotation
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @return Number
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp _getRotatedCornerY: function(x, y, tox, toy, cosRadians, sinRadians)
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return (toy - (x - tox) * sinRadians + (y - toy) * cosRadians);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp destroy: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * 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
180e0891171a381ce4fa08d3867f7226180b8282Tripp * fraction of the shape's corresponding bounding box dimension. The default value is [0.5, 0.5].
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute transformOrigin
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Array
180e0891171a381ce4fa08d3867f7226180b8282Tripp valueFn: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * The rotation (in degrees) of the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute rotation
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this._rotation;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Unique id for class instance.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute id
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type String
180e0891171a381ce4fa08d3867f7226180b8282Tripp valueFn: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return Y.guid();
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the x position of shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute x
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the y position of shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute y
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the width of the shape
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute width
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the height of the shape
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute height
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates whether the shape is visible.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute visible
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Boolean
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Contains information about the fill of the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>color</dt><dd>The color of the fill.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>type</dt><dd>Type of fill.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>solid</dt><dd>Solid single color fill. (default)</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>linear</dt><dd>Linear gradient fill.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>radial</dt><dd>Radial gradient fill.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <p>If a gradient (linear or radial) is specified as the fill type. The following properties are used:
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>stops</dt><dd>An array of objects containing the following properties:
c76f20e944f13ab46599248085dce274728c2c94Tripp * <dt>color</dt><dd>The color of the stop.</dd>
c76f20e944f13ab46599248085dce274728c2c94Tripp * <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 <= 8</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>offset</dt><dd>Number between 0 and 1 indicating where the color stop is positioned.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt></dt><dd></dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt></dt><dd></dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt></dt><dd></dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute fill
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Object
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Contains information about the stroke of the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>color</dt><dd>The color of the stroke.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>weight</dt><dd>Number that indicates the width of the stroke.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stroke. The default value is 1.</dd>
180e0891171a381ce4fa08d3867f7226180b8282Tripp * <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
180e0891171a381ce4fa08d3867f7226180b8282Tripp * length of the dash. The second index indicates the length of gap.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute stroke
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Object
180e0891171a381ce4fa08d3867f7226180b8282Tripp var tmpl = this.get("stroke") || this._getDefaultStroke();
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates whether or not the instance will size itself based on its contents.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute autoSize
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Boolean
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Determines whether the instance will receive mouse events.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute pointerEvents
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type string
180e0891171a381ce4fa08d3867f7226180b8282Tripp valueFn: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Performs a translate on the x-coordinate. When translating x and y coordinates,
180e0891171a381ce4fa08d3867f7226180b8282Tripp * use the <code>translate</code> method.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute translateX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this._translateX;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Performs a translate on the y-coordinate. When translating x and y coordinates,
180e0891171a381ce4fa08d3867f7226180b8282Tripp * use the <code>translate</code> method.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute translateX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this._translateY;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * The node used for gradient fills.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute gradientNode
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type HTMLElement
c76f20e944f13ab46599248085dce274728c2c94Tripp * Indicates whether to automatically refresh.
c76f20e944f13ab46599248085dce274728c2c94Tripp * @attribute autoDraw
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type Boolean
c76f20e944f13ab46599248085dce274728c2c94Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
c76f20e944f13ab46599248085dce274728c2c94Tripp * Dom node for the shape.
c76f20e944f13ab46599248085dce274728c2c94Tripp * @attribute node
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type HTMLElement
c76f20e944f13ab46599248085dce274728c2c94Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this.node;
c76f20e944f13ab46599248085dce274728c2c94Tripp * Reference to the parent graphic instance
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type SVGGraphic
c76f20e944f13ab46599248085dce274728c2c94Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this._graphic;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * The SVGPath class creates a shape through the use of drawing methods.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @class SVGPath
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @extends SVGShape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp SVGPath.superclass.constructor.apply(this, arguments);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Left edge of the path
c76f20e944f13ab46599248085dce274728c2c94Tripp * @property _left
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Right edge of the path
c76f20e944f13ab46599248085dce274728c2c94Tripp * @property _right
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Top edge of the path
c76f20e944f13ab46599248085dce274728c2c94Tripp * @property _top
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Bottom edge of the path
c76f20e944f13ab46599248085dce274728c2c94Tripp * @property _bottom
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Indicates the type of shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @property _type
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @readOnly
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Applies translate transformation.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method translate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} x The x-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} y The y-coordinate
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp translate: function(x, y)
38346051f48f13ebda9f86657ed3a6d19255e6beTripp _draw: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Returns the bounds for a shape.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method getBounds
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @return Object
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Path string of the shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute path
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp return this._path;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Indicates the height of the shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute height
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Indicates the height of the shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute height
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws rectangles
09ae00ccf51dc05697a0d0f54341917314ab06d1TrippSVGRect = function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp SVGRect.superclass.constructor.apply(this, arguments);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Indicates the type of shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @property _type
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @readOnly
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws an ellipse
180e0891171a381ce4fa08d3867f7226180b8282Tripp SVGEllipse.superclass.constructor.apply(this, arguments);
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the type of shape
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _type
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type String
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Updates the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _draw
180e0891171a381ce4fa08d3867f7226180b8282Tripp _draw: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Horizontal radius for the ellipse.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute xRadius
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Vertical radius for the ellipse.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute yRadius
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws an circle
180e0891171a381ce4fa08d3867f7226180b8282Tripp SVGCircle.superclass.constructor.apply(this, arguments);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Indicates the type of shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @property _type
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @readOnly
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Updates the shape.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method _draw
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp _draw: function()
c76f20e944f13ab46599248085dce274728c2c94Tripp * Indicates the width of the shape
c76f20e944f13ab46599248085dce274728c2c94Tripp * @attribute width
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
c76f20e944f13ab46599248085dce274728c2c94Tripp * Indicates the height of the shape
c76f20e944f13ab46599248085dce274728c2c94Tripp * @attribute height
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Radius of the circle
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute radius
c76f20e944f13ab46599248085dce274728c2c94Tripp * @type Number
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Draws pie slices
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp SVGPieSlice.superclass.constructor.apply(this, arguments);
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Indicates the type of shape
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @property _type
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @readOnly
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type String
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Change event listener
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @method _updateHandler
38346051f48f13ebda9f86657ed3a6d19255e6beTripp _draw: function(e)
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Starting angle in relation to a circle in which to begin the pie slice drawing.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute startAngle
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Arc of the slice.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute arc
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * Radius of the circle in which the pie slice is drawn
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute radius
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Graphic is a simple drawing api that allows for basic drawing operations.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @class Graphic
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @constructor
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp SVGGraphic.superclass.constructor.apply(this, arguments);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Unique id for class instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute id
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type String
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp valueFn: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return Y.guid();
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Key value pairs in which a shape instance is associated with its id.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute shapes
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Object
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @readOnly
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._shapes;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Object containing size and coordinate data for the content of a Graphic in relation to the coordSpace node.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute contentBounds
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Object
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @readOnly
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * The html element that represents to coordinate system of the Graphic instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute node
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type HTMLElement
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @readOnly
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._node;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Determines how the size of instance is calculated. If true, the width and height are determined by the size of the contents.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * If false, the width and height values are either explicitly set or determined by the size of the parent node's dimensions.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute autoSize
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @default false
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * When overflow is set to true, by default, the contentBounds will resize to greater values but not to smaller values. (for performance)
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * When resizing the contentBounds down is desirable, set the resizeDown value to true.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute resizeDown
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._resizeDown;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates the x-coordinate for the instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute x
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Number
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._x;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates the y-coordinate for the instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute y
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Number
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._y;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates whether or not the instance will automatically redraw after a change is made to a shape.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * This property will get set to false when batching operations.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute autoDraw
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @default true
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates the pointer-events setting for the svg:svg element.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute pointerEvents
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type String
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Gets the current position of the graphic instance in page coordinates.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method getXY
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @return Array The XY position of the shape.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getXY: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @property _resizeDown
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Initializes the class.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method initializer
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp initializer: function() {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Adds the graphics node to the dom.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method render
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {HTMLElement} parentNode node in which to render the graphics node into.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp w = this.get("width") || parseInt(parentNode.getComputedStyle("width"), 10),
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp h = this.get("height") || parseInt(parentNode.getComputedStyle("height"), 10);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp return this;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Removes all nodes.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method destroy
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp destroy: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Generates a shape instance by type.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method getShape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {String} type type of shape to generate.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Object} cfg attributes for the shape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @return Shape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Adds a shape instance to the graphic instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method addShape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Shape} shape The shape instance to be added to the graphic.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Removes a shape instance from from the graphic instance.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method removeShape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Shape|String}
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Removes all shape instances from the dom.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method removeAllShapes
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Removes all child nodes.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _removeChildren
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {HTMLElement} node
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Clears the graphics object.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method clear
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp clear: function() {
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Toggles visibility
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _toggleVisible
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Boolean} val indicates visibilitye
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Returns a shape based on the id of its dom node.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method getShapeById
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {String} id Dom id of the shape's node attribute.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @return Shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Allows for creating multiple shapes in order to batch appending and redraw operations.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method batch
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Function} method Method to execute.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._frag;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp _redraw: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp var box = this.get("resizeDown") ? this._getUpdatedContentBounds() : this._contentBounds;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp this._contentNode.setAttribute("viewBox", "" + box.left + " " + box.top + " " + box.width + " " + box.height + "");
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp this._frag = null;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Adds a shape to the redraw queue and calculates the contentBounds.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method addToRedrawQueue
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param shape {SVGShape}
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp box.left = box.left < shapeBox.left ? box.left : shapeBox.left;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp box.top = box.top < shapeBox.top ? box.top : shapeBox.top;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp box.right = box.right > shapeBox.right ? box.right : shapeBox.right;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp box.bottom = box.bottom > shapeBox.bottom ? box.bottom : shapeBox.bottom;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Creates a contentNode element
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _createGraphics
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp _createGraphics: function() {
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp contentNode.setAttribute("pointer-events", pointerEvents);
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Creates a graphic node
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method _createGraphicNode
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {String} type node type to create
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {String} pe specified pointer-events value
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @return HTMLElement
11ba9f1486f8345f4ed99c74d8b58be3be37a40eTripp var node = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg:" + type),
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp if(type !== "defs" && type !== "stop" && type !== "linearGradient" && type != "radialGradient")
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Returns a reference to a gradient definition based on an id and type.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method getGradientNode
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @key {String} id that references the gradient definition
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type {String} description of the gradient type
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @return HTMLElement
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if(gradients.hasOwnProperty(key) && gradients[key].tagName.indexOf(type) > -1)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp key = key || "gradient" + Math.round(100000 * Math.random());
c76f20e944f13ab46599248085dce274728c2c94Tripp}, '@VERSION@' ,{requires:['graphics'], skinnable:false});