VMLPath.js revision 828c58761d90445b8b9d20a82d85dc1479317f71
/**
* The VMLPath class creates a graphic object with editable
* properties.
*
* @class VMLPath
* @extends VMLShape
*/
VMLPath = function()
{
VMLPath.superclass.constructor.apply(this, arguments);
};
VMLPath.NAME = "vmlPath";
Y.extend(VMLPath, Y.VMLShape, Y.merge(Y.VMLDrawing.prototype, {
/**
* Indicates the type of shape
*
* @property _type
* @readOnly
* @type String
*/
_type: "shape",
/**
* Draws the graphic.
*
* @method _draw
* @private
*/
_draw: function()
{
var fill = this.get("fill"),
stroke = this.get("stroke"),
node = this.node,
w = this.get("width"),
h = this.get("height"),
path = this.get("path"),
pathEnd = "";
node.style.visible = "hidden";
this._fillChangeHandler();
this._strokeChangeHandler();
if(path)
{
if(fill && fill.color)
{
pathEnd += ' x';
}
if(stroke)
{
pathEnd += ' e';
}
}
if(path)
{
node.path = path + pathEnd;
}
if(w && h)
{
node.coordSize = w + ', ' + h;
node.style.position = "absolute";
node.style.width = w + "px";
node.style.height = h + "px";
}
this._path = path;
node.style.visible = "visible";
this._updateTransform();
},
/**
* Completes a drawing operation.
*
* @method end
*/
end: function()
{
this._draw();
},
/**
* Clears the path.
*
* @method clear
*/
clear: function()
{
this._path = "";
}
}));
VMLPath.ATTRS = Y.merge(Y.VMLShape.ATTRS, {
/**
*
* @attribute width
*/
width: {
getter: function()
{
return this._width;
},
setter: function(val)
{
this._width = val;
return val;
}
},
/**
*
* @attribute height
*/
height: {
getter: function()
{
return this._height;
},
setter: function(val)
{
this._height = val;
return val;
}
},
/**
* Indicates the path used for the node.
*
* @attribute path
* @type String
*/
path: {
readOnly: true,
getter: function()
{
return this._path;
}
}
});
Y.VMLPath = VMLPath;