From 989311bcde2f4821e22f1c521a4310481910adf2 Mon Sep 17 00:00:00 2001 From: dhrname Date: Sun, 21 Apr 2013 23:51:46 +0900 Subject: [PATCH] =?utf8?q?=E3=82=B0=E3=83=A9=E3=83=87=E3=83=BC=E3=82=B7?= =?utf8?q?=E3=83=A7=E3=83=B3=E3=81=AE=E8=A4=87=E6=95=B0=E3=81=AE=E9=85=8D?= =?utf8?q?=E8=89=B2=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- org/w3c/dom/svg.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/org/w3c/dom/svg.js b/org/w3c/dom/svg.js index 766e826..d139d93 100644 --- a/org/w3c/dom/svg.js +++ b/org/w3c/dom/svg.js @@ -4679,7 +4679,7 @@ function SVGGradientElement() { color = [], colors = [], opacity = [], - stop, sstyle, ci; + stop, sstyle, ci, o1, o2; if (!ele || !grad) { //まだ、path要素などが設定されていない場合 grad = ele = t = grad2 = href = stops = length = color = colors = opacity = void 0; return; @@ -4702,23 +4702,30 @@ function SVGGradientElement() { sstyle.setProperty("color", sstyle.getPropertyValue("color")); } color[i] = "rgb(" +ci.rgbColor.red.getFloatValue(1)+ "," +ci.rgbColor.green.getFloatValue(1)+ "," +ci.rgbColor.blue.getFloatValue(1)+ ")"; - colors[i] = stop.offset.baseVal + " " + color[i]; + colors[i] = stop.offset.baseVal.toPrecision(2) + " " + color[i]; opacity[i] = (sstyle.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity"); } ele["method"] = "none"; ele["color"] = color[0]; ele["color2"] = color[length-1]; - ele["colors"] = colors.join(","); + if (length > 2) { + ele["colors"] = colors.slice(1, -1).join(","); //配列colorsの先頭と最後の項目は除いておく + o1 = opacity[length-1]+ ""; + o2 = opacity[0]+ ""; + } else { + o2 = opacity[length-1]+ ""; + o1 = opacity[0]+ ""; + } // When colors attribute is used, the meanings of opacity and o:opacity2 are reversed. - ele["opacity"] = opacity[length-1]+ ""; - ele["o:opacity2"] = opacity[0]+ ""; + ele["opacity"] = o1; + ele["o:opacity2"] = o2; /*SVGRadialGradientElementインターフェースで利用する*/ grad._color = color; var gt = grad2.getAttributeNS(null, "gradientTransform"); if (gt) { grad.setAttributeNS(null, "transform", gt); } - grad = grad2 = ele = stops = length = color = colors = opacity = evt = t = href = stop = sstyle = ci = void 0; + grad = grad2 = ele = stops = length = color = colors = opacity = evt = t = href = stop = sstyle = ci = o1 = o2 = void 0; }, false); }; SVGGradientElement.prototype = Object._create(SVGElement); -- 2.11.0