svnno****@sourc*****
svnno****@sourc*****
2011年 2月 5日 (土) 21:15:42 JST
Revision: 2369 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2369 Author: dhrname Date: 2011-02-05 21:15:42 +0900 (Sat, 05 Feb 2011) Log Message: ----------- SVGLineElementのループを展開させた Modified Paths: -------------- branches/07x/070/org/w3c/dom/svg.js Modified: branches/07x/070/org/w3c/dom/svg.js =================================================================== --- branches/07x/070/org/w3c/dom/svg.js 2011-02-05 11:53:40 UTC (rev 2368) +++ branches/07x/070/org/w3c/dom/svg.js 2011-02-05 12:15:42 UTC (rev 2369) @@ -3282,33 +3282,26 @@ tnext = tpar = null; tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target; - var list = ["m", tar.x1.baseVal.value, tar.y1.baseVal.value, "l", tar.x2.baseVal.value, tar.y2.baseVal.value]; //以下は、配列listそのものをCTMで座標変換していく処理 - var par = tar.ownerDocument.documentElement, ctm = tar.getScreenCTM(); - for (var i=0, lili=list.length;i<lili;) { - if (isNaN(list[i])) { //コマンド文字は読み飛ばす - ++i; - continue; - } - var p = par.createSVGPoint(); - p.x = list[i]; - p.y = list[i+1]; - var pmt = p.matrixTransform(ctm); - list[i] = pmt.x; - ++i; - list[i] = pmt.y; - ++i; - p = pmt = null; - } - var dat = list.join(" "); + var vi = tar.ownerDocument.documentElement, ctm = tar.getScreenCTM(); + var dat = "m "; + var p = vi.createSVGPoint(); + p.x = tar.x1.baseVal.value; + p.y = tar.y1.baseVal.value; + var pmt = p.matrixTransform(ctm); + dat += pmt.x+ " " +pmt.y+ " l "; + p.x = tar.x2.baseVal.value; + p.y = tar.y2.baseVal.value; + pmt = p.matrixTransform(ctm); + dat += pmt.x+ " " +pmt.y; + p = pmt = null; //VMLに結び付けていく - var ele = tar._tar, vi = tar.ownerDocument.documentElement; - var w = vi.width.baseVal.value, h = vi.height.baseVal.value; + var ele = tar._tar, w = vi.width.baseVal.value, h = vi.height.baseVal.value; ele.path = dat; ele.coordsize = w + " " + h; NAIBU._setPaint(tar, ctm); delete tar._cacheMatrix, tar._currentStyle; - evt = ele = tar = dat = list = ctm = w = h = null; + evt = ele = tar = dat = list = ctm = vi = w = h = null; }, false); evt = tar = null; }, false);