svnno****@sourc*****
svnno****@sourc*****
2009年 10月 3日 (土) 19:41:54 JST
Revision: 1308 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1308 Author: dhrname Date: 2009-10-03 19:41:54 +0900 (Sat, 03 Oct 2009) Log Message: ----------- さらにgetCTMを修正 Modified Paths: -------------- branches/DOM/org/w3c/dom/svg.js Modified: branches/DOM/org/w3c/dom/svg.js =================================================================== --- branches/DOM/org/w3c/dom/svg.js 2009-10-03 10:20:39 UTC (rev 1307) +++ branches/DOM/org/w3c/dom/svg.js 2009-10-03 10:41:54 UTC (rev 1308) @@ -1228,32 +1228,35 @@ t = this.ownerDocument.documentElement.createSVGTransform(); degli = deg.length; if (degli === 6) { - a = parseFloat(deg[0]); b = parseFloat(deg[1]); c = parseFloat(deg[2]); d = parseFloat(deg[3]); e = parseFloat(deg[4]); f = parseFloat(deg[5]); + var m = this.ownerDocument.documentElement.createSVGMatrix() + m.a = parseFloat(deg[0]); b = parseFloat(deg[1]); m.c = parseFloat(deg[2]); m.d = parseFloat(deg[3]); m.e = parseFloat(deg[4]); m.f = parseFloat(deg[5]); + t.setMatrix(m); } else { rad = parseFloat(deg[0]) / 180 * Math.PI; if (degli === 3) { - var cx = parseFloat(deg[1]), cy = parseFloat(deg[2]); - a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = (1-a)*cx-c*cy; f = -b*cx+(1-d)*cy; + t.setRotate(rad, parseFloat(deg[1]), parseFloat(deg[2])); + } else if (degli <= 2) { switch (com) { case "translate": - a = 1; b = 0; c = 0; d = 1; e = parseFloat(deg[0]); f = parseFloat(deg[1] || 0); + t.setTranslate(parseFloat(deg[0]); parseFloat(deg[1] || 0)); break; case "scale": - a = parseFloat(deg[0]); b = 0; c = 0; d = parseFloat(deg[1] || deg[0]); e = 0; f = 0; + t.setScale(parseFloat(deg[0]), parseFloat(deg[1] || deg[0])); break; case "rotate": - a = Math.cos(rad); b = Math.sin(rad); c = -b; d = a; e = 0; f = 0; + t.setRotate(rad, 0, 0); break; case "skewX": - a = 1; b = 0; c = Math.tan(rad); d = 1; e = 0; f = 0; + t.setSkewX(rad); break; case "skewY": - a = 1; b = Math.tan(rad); c = 0; d = 1; e = 0; f = 0; + t.setSkewY(rad); break; } } } + this.transform.animVal.appendItem(t); lis = com = deg = rad = null; } list = coma = mat = null; @@ -1261,7 +1264,7 @@ } catch(e) {stlog.add(e,816);} } var n = this.transform.animVal.consolidate(); - n = n ? n.matrix : this.documentElement.createSVGMatrix(); + n = n ? n.matrix : this.ownerDocument.documentElement.createSVGMatrix(); this.transform._matrix = this.parentNode.getCTM().multiply(n); } return (this.transform._matrix);