Skip to content

Instantly share code, notes, and snippets.

@tripp
Created August 19, 2013 21:42
Show Gist options
  • Save tripp/6274537 to your computer and use it in GitHub Desktop.
Save tripp/6274537 to your computer and use it in GitHub Desktop.
iedasharraypatch.js
if(Y.VMLShape) {
Y.Shape.prototype._getStrokeProps = function()
{
var props,
stroke = this.get("stroke"),
strokeOpacity,
dashstyle,
dash = "",
val,
i = 0,
len,
linecap,
linejoin;
if(stroke && stroke.weight && stroke.weight > 0)
{
props = {};
linecap = stroke.linecap || "flat";
linejoin = stroke.linejoin || "round";
if(linecap !== "round" && linecap !== "square")
{
linecap = "flat";
}
strokeOpacity = parseFloat(stroke.opacity);
dashstyle = stroke.dashstyle || "none";
stroke.color = stroke.color || "#000000";
stroke.weight = stroke.weight || 1;
stroke.opacity = Y.Lang.isNumber(strokeOpacity) ? strokeOpacity : 1;
props.stroked = true;
props.color = stroke.color;
props.weight = stroke.weight;
props.endcap = linecap;
props.opacity = stroke.opacity;
if(Y.Lang.isArray(dashstyle))
{
dash = [];
len = dashstyle.length;
for(i = 0; i < len; ++i)
{
val = dashstyle[i];
dash[i] = Math.round(val / stroke.weight);
}
}
if(linejoin === "round" || linejoin === "bevel")
{
props.joinstyle = linejoin;
}
else
{
linejoin = parseInt(linejoin, 10);
if(Y.Lang.isNumber(linejoin))
{
props.miterlimit = Math.max(linejoin, 1);
props.joinstyle = "miter";
}
}
props.dashstyle = dash;
}
return props;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment