graphics-svg-debug.js revision 4d8e74ffdfdb705ce94fa85c56257fccb211a9c0
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Draws a bezier curve.
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @method curveTo
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @param {Number} cp1x x-coordinate for the first control point.
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @param {Number} cp1y y-coordinate for the first control point.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cp2x x-coordinate for the second control point.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @param {Number} cp2y y-coordinate for the second control point.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @param {Number} x x-coordinate for the end point.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @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)
44eaa331ba010d74773764d60f79d2c87c700698Tripp // limit sweep to reasonable numbers
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp // First we calculate how many segments are needed
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp // for a smooth arc.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp // Now calculate the sweep of each segment.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp // The math requires radians rather than degrees. To convert from degrees
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp // 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.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp if (typeof point1 === 'string' || typeof point1 === 'number') {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp var currentArray = this._pathArray[Math.max(0, this._pathArray.length - 1)];
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * 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.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp moveTo: function(x, y) {
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this._pathArray[pathArrayLen] = this._pathArray[pathArrayLen].concat([x, y]);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Completes a drawing operation.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method end
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp end: function() {
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * 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)
38346051f48f13ebda9f86657ed3a6d19255e6beTripp if (h < this._top)
38346051f48f13ebda9f86657ed3a6d19255e6beTripp if (h > this._bottom)
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Base class for creating shapes.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @class SVGShape
38346051f48f13ebda9f86657ed3a6d19255e6beTripp SVGShape.superclass.constructor.apply(this, arguments);
38346051f48f13ebda9f86657ed3a6d19255e6beTripp init: function()
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Initializes the shape
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method _initialize
38346051f48f13ebda9f86657ed3a6d19255e6beTripp var host = this;
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Add a class name to each node.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method addClass
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @param {String} className the class name to add to the node's class attribute
38346051f48f13ebda9f86657ed3a6d19255e6beTripp node.className.baseVal = Y_LANG.trim([node.className.baseVal, className].join(' '));
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Removes a class name from each node.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method removeClass
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @param {String} className the class name to remove from the node's class attribute
38346051f48f13ebda9f86657ed3a6d19255e6beTripp classString = classString.replace(new RegExp(className + ' '), className).replace(new RegExp(className), '');
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * Gets the current position of the node in page coordinates.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method getXY
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @return Array The XY position of the shape.
38346051f48f13ebda9f86657ed3a6d19255e6beTripp getXY: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Set the position of the shape in page coordinates, regardless of how the node is positioned.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method setXY
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Array} Contains X & Y values for new position (coordinates are page-based)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method contains
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {SVGShape | HTMLElement} needle The possible node or descendent
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @return Boolean Whether or not this shape is the needle or its ancestor.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Compares nodes to determine if they match.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Node instances can be compared to each other and/or HTMLElements.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method compareTo
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @param {HTMLElement | Node} refNode The reference node to compare to the node.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {String} selector The CSS selector to test against.
c0d736f643bba150d30a442eefae7f29f7148724Tripp * @return Boolean Wheter or not the shape matches the selector.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Value function for fill attribute
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _getDefaultFill
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @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
180e0891171a381ce4fa08d3867f7226180b8282Tripp var node = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg:" + this._type),
180e0891171a381ce4fa08d3867f7226180b8282Tripp 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));
11ba9f1486f8345f4ed99c74d8b58be3be37a40eTripp * Adds a fill to the shape node.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _fillChangeHandler
45be085c4155ae7ef409ffa4d79457928742f18fTripp node.setAttribute("fill", "url(#grad" + this.get("id") + ")");
180e0891171a381ce4fa08d3867f7226180b8282Tripp fillOpacity = Y_LANG.isNumber(fillOpacity) ? fillOpacity : 1;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Creates a gradient fill
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _setGradientFill
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @param {String} type gradient type
180e0891171a381ce4fa08d3867f7226180b8282Tripp gradientNode = graphic.getGradientNode("grad" + this.get("id"), type),
180e0891171a381ce4fa08d3867f7226180b8282Tripp sinRadians = parseFloat(parseFloat(Math.sin(rotation * radCon)).toFixed(8)),
180e0891171a381ce4fa08d3867f7226180b8282Tripp cosRadians = parseFloat(parseFloat(Math.cos(rotation * radCon)).toFixed(8)),
180e0891171a381ce4fa08d3867f7226180b8282Tripp tanRadians = parseFloat(parseFloat(Math.tan(rotation * radCon)).toFixed(8)),
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp gradientNode.setAttribute("x1", Math.round(100 * x1/w) + "%");
180e0891171a381ce4fa08d3867f7226180b8282Tripp gradientNode.setAttribute("y1", Math.round(100 * y1/h) + "%");
180e0891171a381ce4fa08d3867f7226180b8282Tripp gradientNode.setAttribute("x2", Math.round(100 * x2/w) + "%");
180e0891171a381ce4fa08d3867f7226180b8282Tripp gradientNode.setAttribute("y2", Math.round(100 * y2/h) + "%");
df9b19c757881bdddda4a3b2094bac020aa00bceTripp set: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp var host = this;
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * Applies translate transformation.
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @method translate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @param {Number} x The x-coordinate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @param {Number} y The y-coordinate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp translate: function(x, y)
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * Applies translate transformation.
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @method translate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @param {Number} x The x-coordinate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @param {Number} y The y-coordinate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @protected
df9b19c757881bdddda4a3b2094bac020aa00bceTripp _translate: function(x, y)
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * Applies a skew to the x-coordinate
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @method skewX
df9b19c757881bdddda4a3b2094bac020aa00bceTripp * @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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Applies a scale transform
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @method scale
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @param {Number} val
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Applies a matrix transformation
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method matrix
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp matrix: function(a, b, c, d, e, f)
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp this._transformArgs[type] = Array.prototype.slice.call(args, 0);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp args[1] = this.get("x") + (this.get("width") * transformOrigin[0]);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp args[2] = this.get("y") + (this.get("height") * transformOrigin[1]);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp val = key + "(" + this._transformArgs[key].toString() + ")";
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Updates the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _draw
180e0891171a381ce4fa08d3867f7226180b8282Tripp _draw: function()
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Change event listener
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _updateHandler
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Storage for translateX
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Storage for translateY
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Returns the bounds for a shape.
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @method getBounds
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @return Object
180e0891171a381ce4fa08d3867f7226180b8282Tripp sinRadians = parseFloat(parseFloat(Math.sin(rotation * radCon)).toFixed(8)),
180e0891171a381ce4fa08d3867f7226180b8282Tripp cosRadians = parseFloat(parseFloat(Math.cos(rotation * radCon)).toFixed(8)),
180e0891171a381ce4fa08d3867f7226180b8282Tripp tlx = this._getRotatedCornerX(x, y, tox, toy, cosRadians, sinRadians);
180e0891171a381ce4fa08d3867f7226180b8282Tripp tly = this._getRotatedCornerY(x, y, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp blx = this._getRotatedCornerX(x, bottom, tox, toy, cosRadians, sinRadians);
180e0891171a381ce4fa08d3867f7226180b8282Tripp bly = this._getRotatedCornerY(x, bottom, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp brx = this._getRotatedCornerX(right, bottom, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp bry = this._getRotatedCornerY(right, bottom, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp trx = this._getRotatedCornerX(right, y, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp trY = this._getRotatedCornerY(right, y, tox, toy, cosRadians, sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp bounds.left = Math.min(tlx, Math.min(blx, Math.min(brx, trx)));
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp bounds.right = Math.max(tlx, Math.max(blx, Math.max(brx, trx)));
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp bounds.top = Math.min(tly, Math.min(bly, Math.min(bry, trY)));
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp bounds.bottom = Math.max(tly, Math.max(bly, Math.max(bry, trY)));
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * 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.
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @method _getRotatedCornerX
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} x original x-coordinate of corner
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} y original y-coordinate of corner
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} tox transform origin x-coordinate of rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} toy transform origin y-coordinate of rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} cosRadians cosine (in radians) of rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} sinRadians sin (in radians) or rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @return Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp _getRotatedCornerX: function(x, y, tox, toy, cosRadians, sinRadians)
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp return (tox + (x - tox) * cosRadians + (y - toy) * sinRadians);
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * 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.
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @method _getRotatedCornerY
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} x original x-coordinate of corner
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} y original y-coordinate of corner
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} tox transform origin x-coordinate of rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} toy transform origin y-coordinate of rotation
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Number} cosRadians cosine (in radians) of rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @param {Number} sinRadians sin (in radians) or rotation
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @return Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp _getRotatedCornerY: function(x, y, tox, toy, cosRadians, sinRadians)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp return (toy - (x - tox) * sinRadians + (y - toy) * cosRadians);
180e0891171a381ce4fa08d3867f7226180b8282Tripp 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;
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Unique id for class instance.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute id
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type String
180e0891171a381ce4fa08d3867f7226180b8282Tripp valueFn: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return Y.guid();
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * Indicates the x position of shape.
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @attribute x
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * Indicates the y position of shape.
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @attribute y
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @type Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * Indicates the width of the shape
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @attribute width
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @type Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * Indicates the height of the shape
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @attribute height
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @type Number
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * Indicates whether the shape is visible.
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @attribute visible
16ce43caceb6f25725afe3076c38ccfa3b55fbb9Tripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Contains information about the fill of the shape.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>color</dt><dd>The color of the fill.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>type</dt><dd>Type of fill.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>solid</dt><dd>Solid single color fill. (default)</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>linear</dt><dd>Linear gradient fill.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>radial</dt><dd>Radial gradient fill.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <p>If a gradient (linear or radial) is specified as the fill type. The following properties are used:
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>stops</dt><dd>An array of objects containing the following properties:
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>color</dt><dd>The color of the stop.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <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>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt>offset</dt><dd>Number between 0 and 1 indicating where the color stop is positioned.</dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt></dt><dd></dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt></dt><dd></dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * <dt></dt><dd></dd>
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute fill
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @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>
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * <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
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp 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.
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * @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;
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * 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()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._translateY;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * The node used for gradient fills.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute gradientNode
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type HTMLElement
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates whether to automatically refresh.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute autoDraw
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Boolean
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Dom node for the shape.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute node
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type HTMLElement
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this.node;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Reference to the parent graphic instance
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type SVGGraphic
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp return this._graphic;
180e0891171a381ce4fa08d3867f7226180b8282Tripp * The SVGPath class creates a shape through the use of drawing methods.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @class SVGPath
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * @extends SVGShape
180e0891171a381ce4fa08d3867f7226180b8282Tripp SVGPath.superclass.constructor.apply(this, arguments);
180e0891171a381ce4fa08d3867f7226180b8282TrippY.extend(SVGPath, Y.SVGShape, Y.merge(Y.SVGDrawing.prototype, {
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Left edge of the path
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _left
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Right edge of the path
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _right
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Top edge of the path
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _top
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Bottom edge of the path
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _bottom
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Indicates the type of shape
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @property _type
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type String
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws the path.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @method _draw
180e0891171a381ce4fa08d3867f7226180b8282Tripp _draw: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp //Use transform to handle positioning.
180e0891171a381ce4fa08d3867f7226180b8282Tripp this._transformArgs.translate = [left + tx, top + ty];
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)
45be085c4155ae7ef409ffa4d79457928742f18fTripp //do nothing
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Completes a drawing operation.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method end
45be085c4155ae7ef409ffa4d79457928742f18fTripp end: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Clears the path.
45be085c4155ae7ef409ffa4d79457928742f18fTripp * @method clear
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp clear: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Returns the bounds for a shape.
c0d736f643bba150d30a442eefae7f29f7148724Tripp * @method getBounds
c0d736f643bba150d30a442eefae7f29f7148724Tripp * @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()
45be085c4155ae7ef409ffa4d79457928742f18fTripp * 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);
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Indicates the type of shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @property _type
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type String
180e0891171a381ce4fa08d3867f7226180b8282Tripp * 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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
180e0891171a381ce4fa08d3867f7226180b8282Tripp * Vertical radius for the ellipse.
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @attribute yRadius
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @type Number
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @readOnly
180e0891171a381ce4fa08d3867f7226180b8282Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Draws an circle
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp 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()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates the width of the shape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute width
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Number
c76f20e944f13ab46599248085dce274728c2c94Tripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Indicates the height of the shape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute height
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Number
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp getter: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Radius of the circle
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute radius
180e0891171a381ce4fa08d3867f7226180b8282Tripp * @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
38346051f48f13ebda9f86657ed3a6d19255e6beTripp * @method _updateHandler
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * Starting angle in relation to a circle in which to begin the pie slice drawing.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute startAngle
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * Arc of the slice.
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute arc
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
1dd0fc68c8d04a0df33c7d60d39d72911d34336fTripp * Radius of the circle in which the pie slice is drawn
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @attribute radius
656a34aea8d08b2d05d28ae23dfc89771293d27bTripp * @type Number
45be085c4155ae7ef409ffa4d79457928742f18fTripp * Graphic is a simple drawing api that allows for basic drawing operations.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @class Graphic
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @constructor
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp SVGGraphic.superclass.constructor.apply(this, arguments);
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * 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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type Object
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @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.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute contentBounds
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type Object
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @readOnly
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * The html element that represents to coordinate system of the Graphic instance.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute node
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type HTMLElement
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @readOnly
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp getter: function()
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp return this._node;
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * Determines how the size of instance is calculated. If true, the width and height are determined by the size of the contents.
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * If false, the width and height values are either explicitly set or determined by the size of the parent node's dimensions.
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * @attribute autoSize
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @default false
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * When overflow is set to true, by default, the contentBounds will resize to greater values but not to smaller values. (for performance)
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * When resizing the contentBounds down is desirable, set the resizeDown value to true.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @attribute resizeDown
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @type Boolean
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp 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.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * This property will get set to false when batching operations.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @attribute autoDraw
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @type Boolean
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @default true
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * 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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp initializer: function() {
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Adds the graphics node to the dom.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method render
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @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;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Removes all nodes.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method destroy
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp destroy: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Generates a shape instance by type.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method getShape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {String} type type of shape to generate.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param {Object} cfg attributes for the shape
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @return Shape
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Adds a shape instance to the graphic instance.
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * @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.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method removeShape
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * @param {Shape|String}
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * Removes all shape instances from the dom.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method removeAllShapes
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Removes all child nodes.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @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
4d8e74ffdfdb705ce94fa85c56257fccb211a9c0Tripp * Returns a shape based on the id of its dom node.
4d8e74ffdfdb705ce94fa85c56257fccb211a9c0Tripp * @method getShapeById
4d8e74ffdfdb705ce94fa85c56257fccb211a9c0Tripp * @param {String} id Dom id of the shape's node attribute.
4d8e74ffdfdb705ce94fa85c56257fccb211a9c0Tripp * @return Shape
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * Allows for creating multiple shapes in order to batch appending and redraw operations.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @method batch
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * @param {Function} method Method to execute.
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp return this._frag;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp _redraw: function()
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp var box = this.get("resizeDown") ? this._getUpdatedContentBounds() : this._contentBounds;
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp this._contentNode.setAttribute("viewBox", "" + box.left + " " + box.top + " " + box.width + " " + box.height + "");
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp this._frag = null;
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp * Adds a shape to the redraw queue and calculates the contentBounds.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method addToRedrawQueue
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @param shape {SVGShape}
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp box.left = box.left < shapeBox.left ? box.left : shapeBox.left;
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp 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() {
a674c2c1af7be192fa94e4401511641f5a95ee47Tripp contentNode.setAttribute("pointer-events", pointerEvents);
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * 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
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp var node = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg:" + type),
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp if(type !== "defs" && type !== "stop" && type !== "linearGradient" && type != "radialGradient")
09ae00ccf51dc05697a0d0f54341917314ab06d1Tripp * Returns a reference to a gradient definition based on an id and type.
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @method getGradientNode
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @key {String} id that references the gradient definition
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp * @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());
9ef05fa33949a0e91fa62aea328cc344e8a606caTripp}, '@VERSION@' ,{requires:['graphics'], skinnable:false});