svnno****@sourc*****
svnno****@sourc*****
2010年 4月 4日 (日) 00:17:48 JST
Revision: 1777 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1777 Author: dhrname Date: 2010-04-04 00:17:48 +0900 (Sun, 04 Apr 2010) Log Message: ----------- style属性の解析に関するバグの修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-04-03 15:17:15 UTC (rev 1776) +++ branches/ufltima/dom/svg.js 2010-04-03 15:17:48 UTC (rev 1777) @@ -209,7 +209,9 @@ var a = sc.split(";"); for (var i=0, ali=a.length;i<ali;++i) { var ai = a[i], m = ai.split(":"); - style.setProperty(m[0], m[1]); + if (ai !== "") { + style.setProperty(m[0], m[1]); + } ai = m = null; } a = sc = null; @@ -217,7 +219,7 @@ } else if (name === "class") { tar.className = evt.newValue; } else if (name.indexOf("on") === 0) { //event属性ならば - var s = eval("(function(){" +evt.newValue+ "})"); + var s = eval("(function(evt){" +evt.newValue+ "})"); tar.addEventListener(name.substring(2, name.length), s, false); } else if (evt.relatedNode.nodeName === "xml:base") { //xml:base属性ならば tar.xmlbase = evt.newValue; @@ -1152,6 +1154,9 @@ + "v\\:shape{width:100%;height:100%;" +vmlUrl; } if (xmlhttp) { + var oba = document.createElement("div"); + oba.setAttribute("id","_NAIBU_outline"); + document.body.appendChild(oba); //HTML内のobject要素を探し出して、メソッドを結びつける var obje = document.getElementsByTagName("object"); for (var i=0, objli=1;i<objli;++i) { @@ -1690,7 +1695,7 @@ }; for (var prop in SVGStringList.prototype) { //prototypeのコピーで継承を行う SVGPathSegList.prototype[prop] = SVGStringList.prototype[prop]; -} +}; function SVGPathElement() { SVGElement.apply(this, arguments); @@ -2611,7 +2616,7 @@ if (grad) { var grad2 = grad; while (grad2 && !grad2.hasChildNodes()) { //stopを子要素に持つgradient要素を探す - grad2.getAttributeNS("http://www.w3.org/xlink/1999", "xlink:href").match(/#(.+)/); + grad2.getAttributeNS("http://www.w3.org/1999/xlink", "href").match(/#(.+)/); grad2 = evt.target.ownerDocument.getElementById(RegExp.$1); } var stops = grad2.getElementsByTagNameNS("http://www.w3.org/svg/2000", "stop"); @@ -2659,7 +2664,7 @@ if (!!!ele) { //まだ、path要素などが設定されていない場合 return; } - angle = 270 - Math.atan2(this.y2.baseVal.value-this.y1.baseVal.value, this.x2.baseVal.value-this.x1.baseVal.value) * 180 / Math.PI; + angle = 270 - Math.atan2(grad.y2.baseVal.value-grad.y1.baseVal.value, grad.x2.baseVal.value-grad.x1.baseVal.value) * 180 / Math.PI; if (angle >= 360) { angle -= 360; } @@ -2687,13 +2692,13 @@ ele.setAttribute("type", "gradientTitle"); ele.setAttribute("focus", "100%"); ele.setAttribute("focusposition", "0.5 0.5"); - if (this.tar.getAttribute("tag") === "rect") { - var cx = parseFloat((grad.getAttribute("cx") || "0.5")); - var cy = parseFloat((grad.getAttribute("cy") || "0.5")); - var r = rx = ry = parseFloat((grad.getAttribute("r") || "0.5")); + if (ele.localName === "rect") { + var cx = parseFloat((grad.getAttributeNS(null, "cx") || "0.5")); + var cy = parseFloat((grad.getAttribute(null, "cy") || "0.5")); + var r = rx = ry = parseFloat((grad.getAttributeNS(null, "r") || "0.5")); var el = this.w, et = this.h, er = 0, eb = 0; var data = this.tar.path.value; - var units = grad.getAttribute("gradientUnits"); + var units = grad.getAttributeNS(null, "gradientUnits"); if (!units || units === "objectBoundingBox") { //%の場合は小数点に変換(10% -> 0.1) cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r; @@ -2709,10 +2714,10 @@ degis = null; cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et); } - var gt = grad.getAttribute("gradientTransform"); + var gt = grad.getAttributeNS(null, "gradientTransform"); if (gt) { - grad.setAttribute("transform",gt); - matrix = NAIBU.transformToCTM(grad, matrix); + grad.setAttributeNS(null, "transform",gt); + matrix = grad.getCTM(); } el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry; var rrx = rx * 0.55228, rry = ry * 0.55228; @@ -2733,8 +2738,8 @@ background.filters[0].apply(); background.innerHTML = circle; background.filters[0].play(); - this.tar.parentNode.insertBefore(background, this.tar); - this.tar.filled = "false"; + ele._tar.parentNode.insertBefore(background, ele.tar); + ele._tar.filled = "false"; ellipse = circle = data = list = pl = plm = gt = cx = cy = r = null; } }, false);