CanvasShape.js revision 828c58761d90445b8b9d20a82d85dc1479317f71
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp/**
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Base class for creating shapes.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp *
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @class CanvasShape
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp */
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape = function(cfg)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp{
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var host = this,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp PluginHost = Y.Plugin && Y.Plugin.Host;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (host._initPlugins && PluginHost) {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp PluginHost.call(host);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.name = host.constructor.NAME;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._eventPrefix = host.constructor.EVENT_PREFIX || host.constructor.NAME;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp AttributeLite.call(host);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.addAttrs(cfg);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.init.apply(this, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (host._initPlugins) {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp // Need to initPlugins manually, to handle constructor parsing, static Plug parsing
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._initPlugins(cfg);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.initialized = true;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp};
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape.NAME = "canvasShape";
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape.prototype = Y.merge(Y.CanvasDrawing.prototype, {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp init: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this.initializer.apply(this, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Initializes the shape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _initialize
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp initializer: function(cfg)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var host = this;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.createNode();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._graphic = cfg.graphic;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._xcoords = [0];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._ycoords = [0];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /*
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.get("stroke");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host.get("fill");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("width", host.get("width"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("height", host.get("height"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._updateHandler();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Add a class name to each node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method addClass
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} className the class name to add to the node's class attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp addClass: function(className)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = Y.one(this.get("node"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.addClass(className);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Removes a class name from each node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method removeClass
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} className the class name to remove from the node's class attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp removeClass: function(className)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = Y.one(this.get("node"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.removeClass(className);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Gets the current position of the node in page coordinates.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method getXY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Array The XY position of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getXY: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var graphic = this.get("graphic"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp parentXY = graphic.getXY(),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp x = this.get("x"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp y = this.get("y");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return [parentXY[0] + x, parentXY[1] + y];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Set the position of the shape in page coordinates, regardless of how the node is positioned.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method setXY
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Array} Contains X & Y values for new position (coordinates are page-based)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp setXY: function(xy)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var graphic = this.get("graphic"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp parentXY = graphic.getXY(),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp x = xy[0] - parentXY[0],
828c58761d90445b8b9d20a82d85dc1479317f71Tripp y = xy[1] - parentXY[1];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._set("x", x);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._set("y", y);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._updateNodePosition(x, y);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method contains
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {CanvasShape | HTMLElement} needle The possible node or descendent
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Boolean Whether or not this shape is the needle or its ancestor.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp contains: function(needle)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return needle === Y.one(this.node);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Test if the supplied node matches the supplied selector.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method test
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {String} selector The CSS selector to test against.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Boolean Wheter or not the shape matches the selector.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp test: function(selector)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.one(this.get("node")).test(selector);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp //return Y.Selector.test(this.node, selector);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Compares nodes to determine if they match.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Node instances can be compared to each other and/or HTMLElements.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method compareTo
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {HTMLElement | Node} refNode The reference node to compare to the node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return {Boolean} True if the nodes match, false if they do not.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp compareTo: function(refNode) {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = this.node;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return node === refNode;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Value function for fill attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _getDefaultFill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _getDefaultFill: function() {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp type: "solid",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp cx: 0.5,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp cy: 0.5,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fx: 0.5,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fy: 0.5,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp r: 0.5
828c58761d90445b8b9d20a82d85dc1479317f71Tripp };
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Value function for stroke attribute
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _getDefaultStroke
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _getDefaultStroke: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp weight: 1,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp dashstyle: "none",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp color: "#000",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp opacity: 1.0
828c58761d90445b8b9d20a82d85dc1479317f71Tripp };
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Left edge of the path
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _left: 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Right edge of the path
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _right: 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Top edge of the path
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _top: 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Bottom edge of the path
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _bottom: 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Creates the dom node for the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @return HTMLElement
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp createNode: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = Y.config.doc.createElement('canvas'),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp id = this.get("id");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._context = node.getContext('2d');
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("class", "yui3-" + SHAPE);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("class", "yui3-" + this.name);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("id", id);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp id = "#" + id;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this.node = node;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp isMouseEvent: function(type)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(type.indexOf('mouse') > -1 || type.indexOf('click') > -1)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return true;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return false;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp before: function(type, fn)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this.isMouseEvent(type))
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.before(type, fn, "#" + this.get("id"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.on.apply(this, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp on: function(type, fn)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this.isMouseEvent(type))
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.on(type, fn, "#" + this.get("id"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.on.apply(this, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp after: function(type, fn)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this.isMouseEvent(type))
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.after(type, fn, "#" + this.get("id"));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.on.apply(this, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Adds a stroke to the shape node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _strokeChangeHandler
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _setStrokeProps: function(stroke)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var color = stroke.color,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp weight = stroke.weight,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp opacity = stroke.opacity,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp linejoin = stroke.linejoin || "round",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp linecap = stroke.linecap || "butt",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp dashstyle = stroke.dashstyle;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._miterlimit = null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._dashstyle = (dashstyle && Y.Lang.isArray(dashstyle) && dashstyle.length > 1) ? dashstyle : null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._strokeWeight = weight;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (weight)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._stroke = 1;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._stroke = 0;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (opacity) {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._strokeStyle = this._2RGBA(color, opacity);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._strokeStyle = color;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._linecap = linecap;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(linejoin == "round" || linejoin == "square")
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._linejoin = linejoin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp linejoin = parseInt(linejoin, 10);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(Y.Lang.isNumber(linejoin))
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._miterlimit = Math.max(linejoin, 1);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._linejoin = "miter";
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp set: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var host = this,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp val = arguments[0];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp AttributeLite.prototype.set.apply(host, arguments);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(host.initialized && val != "x" && val != "y")
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp host._updateHandler();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Adds a fill to the shape node.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _fillChangeHandler
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _setFillProps: function(fill)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var isNumber = Y.Lang.isNumber,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp color = fill.color,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp opacity,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp type = fill.type;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(type == "linear" || type == "radial")
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._fillType = type;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else if(color)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp opacity = fill.opacity;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (isNumber(opacity))
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp opacity = Math.max(0, Math.min(1, opacity));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp color = this._2RGBA(color, opacity);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp color = this._2RGB(color);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._fillColor = color;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._fillType = 'solid';
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._fillColor = null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies translate transformation.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method translate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} x The x-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} y The y-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @protected
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp translate: function(x, y)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var translate = "translate(" + x + "px, " + y + "px)";
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._updateTransform("translate", /translate\(.*\)/, translate);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies a skew to the x-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method skewX:q
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} x x-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp skewX: function(x)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies a skew to the x-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method skewX:q
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} x x-coordinate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp skewY: function(y)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _rotation: 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies a rotation.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method rotate
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp rotate: function(deg)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var rotate = "rotate(" + deg + "deg)";
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._rotation = deg;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._updateTransform("rotate", /rotate\(.*\)/, rotate);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * 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
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * fraction of the shape's corresponding bounding box dimension. The default value is [0.5, 0.5].
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute transformOrigin
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Array
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _transformOrigin: function(x, y)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = this.get("node");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.MozTransformOrigin = (100 * x) + "% " + (100 * y) + "%";
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies a scale transform
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method scale
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} val
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp scale: function(val)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Applies a matrix transformation
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method matrix
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp matrix: function(a, b, c, d, e, f)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _updateTransform: function(type, test, val)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = this.get("node"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transform = node.style.MozTransform || node.style.webkitTransform || node.style.msTransform || node.style.OTransform,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transformOrigin = this.get("transformOrigin");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(transform && transform.length > 0)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(transform.indexOf(type) > -1)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transform = transform.replace(test, val);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transform += " " + val;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transform = val;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transformOrigin = (100 * transformOrigin[0]) + "% " + (100 * transformOrigin[1]) + "%";
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.MozTransformOrigin = transformOrigin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.webkitTransformOrigin = transformOrigin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.msTransformOrigin = transformOrigin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.OTransformOrigin = transformOrigin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.MozTransform = transform;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.webkitTransform = transform;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.msTransform = transform;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.style.OTransform = transform;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _updateHandler: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._draw();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _draw: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._paint();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Completes a shape or drawing
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _paint
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _paint: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(!this._methods)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var node = this.get("node"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp w = this.get("width") || this._width,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp h = this.get("height") || this._height,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context = this._context,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp methods = [],
828c58761d90445b8b9d20a82d85dc1479317f71Tripp cachedMethods = this._methods.concat(),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp i = 0,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp j,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp method,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp len = 0;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._context.clearRect(0, 0, w, h);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this._methods)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp len = cachedMethods.length;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(!len || len < 1)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp for(; i < len; ++i)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp methods[i] = cachedMethods[i].concat();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args = methods[i];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp for(j = 1; j < args.length; ++j)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(j % 2 === 0)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args[j] = args[j] - this._top;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args[j] = args[j] - this._left;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("width", w);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node.setAttribute("height", h);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.beginPath();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp for(i = 0; i < len; ++i)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args = methods[i].concat();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(args && args.length > 0)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp method = args.shift();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(method)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(method && method == "lineTo" && this._dashstyle)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp args.unshift(this._xcoords[i] - this._left, this._ycoords[i] - this._top);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._drawDashedLine.apply(this, args);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp else
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context[method].apply(context, args);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (this._fillType)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this._fillType == "linear")
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.fillStyle = this._getLinearGradient();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else if(this._fillType == "radial")
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.fillStyle = this._getRadialGradient();
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.fillStyle = this._fillColor;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.closePath();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.fill();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if (this._stroke) {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this._strokeWeight)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineWidth = this._strokeWeight;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineCap = this._linecap;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineJoin = this._linejoin;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(this._miterlimit)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.miterLimit = this._miterlimit;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.strokeStyle = this._strokeStyle;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.stroke();
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._drawingComplete = true;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._clearAndUpdateCoords();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._updateNodePosition();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._methods = cachedMethods;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Draws a dashed line between two points.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method _drawDashedLine
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} xStart The x position of the start of the line
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} yStart The y position of the start of the line
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} xEnd The x position of the end of the line
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @param {Number} yEnd The y position of the end of the line
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @private
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp _drawDashedLine: function(xStart, yStart, xEnd, yEnd)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var context = this._context,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp dashsize = this._dashstyle[0],
828c58761d90445b8b9d20a82d85dc1479317f71Tripp gapsize = this._dashstyle[1],
828c58761d90445b8b9d20a82d85dc1479317f71Tripp segmentLength = dashsize + gapsize,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp xDelta = xEnd - xStart,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp yDelta = yEnd - yStart,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp delta = Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2)),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp segmentCount = Math.floor(Math.abs(delta / segmentLength)),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp radians = Math.atan2(yDelta, xDelta),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp xCurrent = xStart,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp yCurrent = yStart,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp i;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp xDelta = Math.cos(radians) * segmentLength;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp yDelta = Math.sin(radians) * segmentLength;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp for(i = 0; i < segmentCount; ++i)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.moveTo(xCurrent, yCurrent);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineTo(xCurrent + Math.cos(radians) * dashsize, yCurrent + Math.sin(radians) * dashsize);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp xCurrent += xDelta;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp yCurrent += yDelta;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.moveTo(xCurrent, yCurrent);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp delta = Math.sqrt((xEnd - xCurrent) * (xEnd - xCurrent) + (yEnd - yCurrent) * (yEnd - yCurrent));
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(delta > dashsize)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineTo(xCurrent + Math.cos(radians) * dashsize, yCurrent + Math.sin(radians) * dashsize);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp else if(delta > 0)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.lineTo(xCurrent + Math.cos(radians) * delta, yCurrent + Math.sin(radians) * delta);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp context.moveTo(xEnd, yEnd);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Clears the graphics object.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @method clear
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp clear: function() {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var w = this.get("width"),
828c58761d90445b8b9d20a82d85dc1479317f71Tripp h = this.get("height");
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._initProps();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._context.clearRect(0, 0, w, h);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp});
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape.ATTRS = {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * 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
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * fraction of the shape's corresponding bounding box dimension. The default value is [0.5, 0.5].
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute transformOrigin
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Array
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp transformOrigin: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp valueFn: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return [0.5, 0.5];
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * The rotation (in degrees) of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute rotation
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Number
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp rotation: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp setter: function(val)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this.rotate(val);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp },
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this._rotation;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Dom node of the shape
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute node
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type HTMLElement
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @readOnly
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp node: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp readOnly: true,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this.node;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Unique id for class instance.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute id
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type String
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp id: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp valueFn: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return Y.guid();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute width
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp width: {},
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute height
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp height: {},
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * The x-coordinate for the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp x: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp value: 0
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * The x-coordinate for the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp y: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp value: 0
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates whether the shape is visible.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute visible
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Boolean
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp visible: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp value: true,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp setter: function(val){
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var visibility = val ? "visible" : "hidden";
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this.get("node").style.visibility = visibility;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return val;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Contains information about the fill of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dl>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>color</dt><dd>The color of the fill.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * </dl>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute fill
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fill: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp valueFn: "_getDefaultFill",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp setter: function(val)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var fill,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp tmpl = this.get("fill") || this._getDefaultFill();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fill = (val) ? Y.merge(tmpl, val) : null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(fill && fill.color)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp if(fill.color === undefined || fill.color == "none")
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp fill.color = null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._setFillProps(fill);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return fill;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Contains information about the stroke of the shape.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dl>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>color</dt><dd>The color of the stroke.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>weight</dt><dd>Number that indicates the width of the stroke.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stroke. The default value is 1.</dd>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * <dt>dashstyle</dt>Indicates whether to draw a dashed stroke. When set to "none", a solid stroke is drawn. When set to an array, the first index indicates the
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * length of the dash. The second index indicates the length of gap.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * </dl>
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute stroke
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Object
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp stroke: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp valueFn: "_getDefaultStroke",
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp setter: function(val)
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp var tmpl = this.get("stroke") || this._getDefaultStroke();
828c58761d90445b8b9d20a82d85dc1479317f71Tripp val = (val) ? Y.merge(tmpl, val) : null;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp this._setStrokeProps(val);
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return val;
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Indicates whether or not the instance will size itself based on its contents.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute autoSize
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Boolean
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp autoSize: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp value: false
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Determines whether the instance will receive mouse events.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute pointerEvents
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type string
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp pointerEvents: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp value: "visiblePainted"
828c58761d90445b8b9d20a82d85dc1479317f71Tripp },
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp /**
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * Reference to the container Graphic.
828c58761d90445b8b9d20a82d85dc1479317f71Tripp *
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @attribute graphic
828c58761d90445b8b9d20a82d85dc1479317f71Tripp * @type Graphic
828c58761d90445b8b9d20a82d85dc1479317f71Tripp */
828c58761d90445b8b9d20a82d85dc1479317f71Tripp graphic: {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp readOnly: true,
828c58761d90445b8b9d20a82d85dc1479317f71Tripp
828c58761d90445b8b9d20a82d85dc1479317f71Tripp getter: function()
828c58761d90445b8b9d20a82d85dc1479317f71Tripp {
828c58761d90445b8b9d20a82d85dc1479317f71Tripp return this._graphic;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp }
828c58761d90445b8b9d20a82d85dc1479317f71Tripp};
828c58761d90445b8b9d20a82d85dc1479317f71Tripp//Straightup augment, no wrapper functions
828c58761d90445b8b9d20a82d85dc1479317f71TrippY.mix(CanvasShape, Y.AttributeLite, false, null, 1);
828c58761d90445b8b9d20a82d85dc1479317f71TrippY.mix(CanvasShape, Y.EventTarget, false, null, 1);
828c58761d90445b8b9d20a82d85dc1479317f71TrippY.mix(CanvasShape, PluginHost, false, null, 1);
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape.plug = PluginHost.plug;
828c58761d90445b8b9d20a82d85dc1479317f71TrippCanvasShape.unplug = PluginHost.unplug;
828c58761d90445b8b9d20a82d85dc1479317f71TrippY.CanvasShape = CanvasShape;