svnno****@sourc*****
svnno****@sourc*****
2010年 10月 23日 (土) 23:56:05 JST
Revision: 2089 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2089 Author: dhrname Date: 2010-10-23 23:56:05 +0900 (Sat, 23 Oct 2010) Log Message: ----------- SVGPathSegxxに関して、一部に最適化をした Modified Paths: -------------- branches/06x/062/org/w3c/dom/svg.js Modified: branches/06x/062/org/w3c/dom/svg.js =================================================================== --- branches/06x/062/org/w3c/dom/svg.js 2010-10-23 10:40:39 UTC (rev 2088) +++ branches/06x/062/org/w3c/dom/svg.js 2010-10-23 14:56:05 UTC (rev 2089) @@ -1960,38 +1960,48 @@ *軽量化のために、SVGPathSegの継承をしない。また、{}オブジェクトで代用する予定 */ function SVGPathSegClosePath() { - this.pathSegType = SVGPathSeg.PATHSEG_CLOSEPATH; - this.pathSegTypeAsLetter = "z"; return this; }; +SVGPathSegClosePath.prototype = { + pathSegType : SVGPathSeg.PATHSEG_CLOSEPATH, + pathSegTypeAsLetter : "z" +}; function SVGPathSegMovetoAbs() { /*float*/ this.x; /*float*/ this.y; - this.pathSegType = SVGPathSeg.PATHSEG_MOVETO_ABS; - this.pathSegTypeAsLetter = "M"; return this; }; +SVGPathSegMovetoAbs.prototype = { + pathSegType : SVGPathSeg.PATHSEG_MOVETO_ABS, + pathSegTypeAsLetter : "M" +}; function SVGPathSegMovetoRel() { /*float*/ this.x; /*float*/ this.y; - this.pathSegType = SVGPathSeg.PATHSEG_MOVETO_REL; - this.pathSegTypeAsLetter = "m"; return this; }; +SVGPathSegMovetoRel.prototype = { + pathSegType : SVGPathSeg.PATHSEG_MOVETO_REL, + pathSegTypeAsLetter : "m" +}; function SVGPathSegLinetoAbs() { /*float*/ this.x; /*float*/ this.y; - this.pathSegType = SVGPathSeg.PATHSEG_LINETO_ABS; - this.pathSegTypeAsLetter = "L"; return this; }; +SVGPathSegLinetoAbs.prototype = { + pathSegType : SVGPathSeg.PATHSEG_LINETO_ABS, + pathSegTypeAsLetter : "L" +}; function SVGPathSegLinetoRel() { /*float*/ this.x; /*float*/ this.y; - this.pathSegType = SVGPathSeg.PATHSEG_LINETO_REL; - this.pathSegTypeAsLetter = "l"; return this; }; +SVGPathSegLinetoRel.prototype = { + pathSegType : SVGPathSeg.PATHSEG_LINETO_REL, + pathSegTypeAsLetter : "l" +}; function SVGPathSegCurvetoCubicAbs() { /*float*/ this.x; /*float*/ this.y; @@ -1999,10 +2009,12 @@ /*float*/ this.y1; /*float*/ this.x2; /*float*/ this.y2; - this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS; - this.pathSegTypeAsLetter = "C"; return this; }; +SVGPathSegCurvetoCubicAbs.prototype = { + pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, + pathSegTypeAsLetter : "C" +}; function SVGPathSegCurvetoCubicRel() { /*float*/ this.x; /*float*/ this.y; @@ -2010,10 +2022,12 @@ /*float*/ this.y1; /*float*/ this.x2; /*float*/ this.y2; - this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL; - this.pathSegTypeAsLetter = "c"; return this; }; +SVGPathSegCurvetoCubicRel.prototype = { + pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, + pathSegTypeAsLetter : "c" +}; function SVGPathSegCurvetoQuadraticAbs() { /*float*/ this.x; /*float*/ this.y; @@ -2039,26 +2053,28 @@ /*float*/ this.r1; /*float*/ this.r2; /*float*/ this.angle; - /*boolean*/ this.largeArcFlag = true; - /*boolean*/ this.sweepFlag = true; - this.pathSegType = SVGPathSeg.PATHSEG_ARC_ABS; - this.pathSegTypeAsLetter = "A"; return this; }; - +SVGPathSegArcAbs.prototype = { + /*boolean*/ largeArcFlag : true, + /*boolean*/ sweepFlag : true, + pathSegType : SVGPathSeg.PATHSEG_ARC_ABS, + pathSegTypeAsLetter : "A" +}; function SVGPathSegArcRel() { /*float*/ this.x; /*float*/ this.y; /*float*/ this.r1; /*float*/ this.r2; /*float*/ this.angle; - /*boolean*/ this.largeArcFlag = true; - /*boolean*/ this.sweepFlag = true; - this.pathSegType = SVGPathSeg.PATHSEG_ARC_REL; - this.pathSegTypeAsLetter = "a"; return this; }; - +SVGPathSegArcRel.prototype = { + /*boolean*/ largeArcFlag : true, + /*boolean*/ sweepFlag : true, + pathSegType : SVGPathSeg.PATHSEG_ARC_REL, + pathSegTypeAsLetter : "a" +}; function SVGPathSegLinetoHorizontalAbs() { /*float*/ this.x; this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS; @@ -2241,7 +2257,7 @@ el.style.cursor = cursor; } var vis = style.getPropertyValue("visibility"); - if (!!!vis._n) { //初期値でないならば + if (vis !== "visiblee") { //初期値でないならば el.style.visibility = vis; } var disp = style.getPropertyValue("display"); @@ -2263,7 +2279,7 @@ this.animatedNormalizedPathSegList = this.normalizedPathSegList; /*readonly SVGAnimatedNumber*/ this.pathLength = new SVGAnimatedNumber(); //以下は、d属性に変更があった場合の処理 - var ra = /\-/g, rb = /,/g, rc = /([a-yA-Y])/g, rd = /([zZ])/g, re = /,/, sgs = /\S+/g; + var ra = /\-/g, rb = /,/g, rc = /([a-yA-Y])/g, rd = /([zZ])/g, re = /,/; this.addEventListener("DOMAttrModified", function(evt){ var tar = evt.target; if (evt.attrName === "d" && evt.newValue !== ""){ @@ -2283,13 +2299,14 @@ .replace(rd, ",$1 1") .replace(re, "") .split(","); + var sgs = /\S+/g; for (var i=0, dli=dd.length;i<dli;++i) { D[i] = dd[i].match(sgs); for (var j=1, dili=D[i].length;j<dili;++j) { D[i][j] = _parseFloat(D[i][j]); //_parseFloatは高速化のためのAlias } } - dd = null; + sgs = dd = null; for (var i=0, Dli=D.length; i < Dli; ++i) { var di = D[i], s; for (var j=1, dii=di[0], dili=di.length; j < dili; ++j) { @@ -3749,7 +3766,7 @@ tar._tar.style.cursor = cursor; } var vis = style.getPropertyValue("visibility"); - if (!!!vis._n) { + if (vis !== "visiblee") { tar._tar.style.visibility = vis; } var isRect = true;