svnno****@sourc*****
svnno****@sourc*****
2011年 3月 31日 (木) 23:37:35 JST
Revision: 2544 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2544 Author: dhrname Date: 2011-03-31 23:37:34 +0900 (Thu, 31 Mar 2011) Log Message: ----------- SVGPathElementの修正 Modified Paths: -------------- branches/07x/074/org/w3c/dom/svg.js Modified: branches/07x/074/org/w3c/dom/svg.js =================================================================== --- branches/07x/074/org/w3c/dom/svg.js 2011-03-31 14:11:40 UTC (rev 2543) +++ branches/07x/074/org/w3c/dom/svg.js 2011-03-31 14:37:34 UTC (rev 2544) @@ -2554,8 +2554,6 @@ */ var taco = tar._com, sgs = taco.isSp, - tccc = tar.createSVGPathSegCurvetoCubicAbs, - tcla = tar.createSVGPathSegLinetoAbs, dd = evt.newValue .replace(taco.isRa, " -") .replace(taco.isRb, " ") @@ -2582,13 +2580,13 @@ s = tar.createSVGPathSegMovetoRel(di[j], di[j+1]); ++j; } else if (isL[dii]) { - s = tcla(di[j], di[j+1]); + s = tar.createSVGPathSegLinetoAbs(di[j], di[j+1]); ++j; } else if (dii === "l") { s = tar.createSVGPathSegLinetoRel(di[j], di[j+1]); ++j; } else if (isC[dii]) { - s = tccc(di[j+4], di[j+5], di[j], di[j+1], di[j+2], di[j+3]); + s = tar.createSVGPathSegCurvetoCubicAbs(di[j+4], di[j+5], di[j], di[j+1], di[j+2], di[j+3]); j += 5; } else if (dii === "c") { s = tar.createSVGPathSegCurvetoCubicRel(di[j+4], di[j+5], di[j], di[j+1], di[j+2], di[j+3]); @@ -2666,7 +2664,7 @@ */ var tg = tlist.getItem(j-1); if (tg.pathSegTypeAsLetter === "M") { - tnl.appendItem(tcla(cx, cy)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(cx, cy)); continue; } } @@ -2677,7 +2675,7 @@ if (j !== 0) { var tg = tlist.getItem(j-1); if (tg.pathSegTypeAsLetter === "m") { - tnl.appendItem(tcla(cx, cy)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(cx, cy)); continue; } } @@ -2685,9 +2683,9 @@ starty = cy; tnl.appendItem(tar.createSVGPathSegMovetoAbs(cx, cy)); } else if (dii === "l") { - tnl.appendItem(tcla(cx, cy)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(cx, cy)); } else if (dii === "c") { - tnl.appendItem(tccc(cx, cy, ti.x1+rx, ti.y1+ry, ti.x2+rx, ti.y2+ry)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, ti.x1+rx, ti.y1+ry, ti.x2+rx, ti.y2+ry)); } else if (isZ[dii]) { cx = startx; cy = starty; @@ -2696,12 +2694,12 @@ xn = 2*cx - ti.x1; yn = 2*cy - ti.y1; //2次スプライン曲線は近似的な3次ベジェ曲線に変換している - tnl.appendItem(tccc(cx, cy, (rx + 2*ti.x1) / 3, (ry + 2*ti.y1) / 3, (2*ti.x1 + cx) / 3, (2*ti.y1 + cy) / 3)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, (rx + 2*ti.x1) / 3, (ry + 2*ti.y1) / 3, (2*ti.x1 + cx) / 3, (2*ti.y1 + cy) / 3)); } else if (dii === "q") { var x1 = ti.x1 + rx, y1 = ti.y1 + ry; xn = 2*cx - x1; yn = 2*cy - y1; - tnl.appendItem(tccc(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, (rx + 2*x1) / 3, (ry + 2*y1) / 3, (2*x1 + cx) / 3, (2*y1 + cy) / 3)); x1 = y1 = null; } else if (dii === "A" || dii === "a") { (function(ti, cx, cy, rx, ry, tar, tnl) { //変数を隠蔽するためのfunction @@ -2768,7 +2766,7 @@ y3 = spsir1*mc + cpsir2*ms + ty, dx = -t * (cpsir1*ms + spsir2*mc), dy = -t * (spsir1*ms - cpsir2*mc); - tnl.appendItem(tccc(x3, y3, x2, y2, x3-dx, y3-dy)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(x3, y3, x2, y2, x3-dx, y3-dy)); x2 = x3 + dx; y2 = y3 + dy; } @@ -2787,7 +2785,7 @@ var x1 = rx, y1 = ry; } - tnl.appendItem(tccc(cx, cy, x1, y1, ti.x2, ti.y2)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, x1, y1, ti.x2, ti.y2)); x1 = y1 = null; } else if (dii === "s") { if (j !== 0) { @@ -2803,7 +2801,7 @@ var x1 = rx, y1 = ry; } - tnl.appendItem(tccc(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, x1, y1, ti.x2+rx, ti.y2+ry)); x1 = y1 = null; } else if (dii === "T" || dii === "t") { if (j !== 0) { @@ -2815,21 +2813,21 @@ } else { xn = rx, yn = ry; } - tnl.appendItem(tccc(cx, cy, (rx + 2*xn) / 3, (ry + 2*yn) / 3, (2*xn + cx) / 3, (2*yn + cy) / 3)); + tnl.appendItem(tar.createSVGPathSegCurvetoCubicAbs(cx, cy, (rx + 2*xn) / 3, (ry + 2*yn) / 3, (2*xn + cx) / 3, (2*yn + cy) / 3)); xn = 2*cx - xn; yn = 2*cy - yn; xx1 = yy1 = null; } else if (dii === "H" || dii === "h") { - tnl.appendItem(tcla(cx, ry)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(cx, ry)); cy = ry; //勝手にti.yが0としているため } else if (dii === "V" || dii === "v") { - tnl.appendItem(tcla(rx, cy)); + tnl.appendItem(tar.createSVGPathSegLinetoAbs(rx, cy)); cx = rx; } } } } - evt = tar = taco = cx = cy = xn = yn = startx = starty = tnl = tlist = ti = dii = ts = isZ = isM = isL = isC = s = tcla = tccc = null; + evt = tar = taco = cx = cy = xn = yn = startx = starty = tnl = tlist = ti = dii = ts = isZ = isM = isL = isC = s = null; }, false); /*以下の処理は、このpath要素ノードがDOMツリーに追加されて初めて、 *描画が開始されることを示す。つまり、appendChildで挿入されない限り、描画をしない。