fix issue with applying gradient to stroke

This commit is contained in:
Michael Deal 2017-01-06 16:56:12 -08:00
parent 214f8f2a1a
commit f9d5e2b68e

View File

@ -356,7 +356,7 @@
value = this[keys[i]]; value = this[keys[i]];
if (style.apply) { if (style.apply) {
//is this a gradient or pattern? //is this a gradient or pattern?
if (style.apply.indexOf("fill") !== -1 && value instanceof CanvasPattern) { if (value instanceof CanvasPattern) {
//pattern //pattern
if (value.__ctx) { if (value.__ctx) {
//copy over defs //copy over defs
@ -366,11 +366,11 @@
this.__defs.appendChild(value.__ctx.__defs.childNodes[0]); this.__defs.appendChild(value.__ctx.__defs.childNodes[0]);
} }
} }
currentElement.setAttribute("fill", format("url(#{id})", {id:value.__root.getAttribute("id")})); currentElement.setAttribute(style.apply, format("url(#{id})", {id:value.__root.getAttribute("id")}));
} }
else if (style.apply.indexOf("fill")!==-1 && value instanceof CanvasGradient) { else if (value instanceof CanvasGradient) {
//gradient //gradient
currentElement.setAttribute("fill", format("url(#{id})", {id:value.__root.getAttribute("id")})); currentElement.setAttribute(style.apply, format("url(#{id})", {id:value.__root.getAttribute("id")}));
} else if (style.apply.indexOf(type)!==-1 && style.svg !== value) { } else if (style.apply.indexOf(type)!==-1 && style.svg !== value) {
if ((style.svgAttr === "stroke" || style.svgAttr === "fill") && value.indexOf("rgba") !== -1) { if ((style.svgAttr === "stroke" || style.svgAttr === "fill") && value.indexOf("rgba") !== -1) {
//separate alpha value, since illustrator can't handle it //separate alpha value, since illustrator can't handle it