svnno****@sourc*****
svnno****@sourc*****
2011年 2月 6日 (日) 20:59:45 JST
Revision: 2373 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2373 Author: dhrname Date: 2011-02-06 20:59:45 +0900 (Sun, 06 Feb 2011) Log Message: ----------- SVG1.1の解釈に誤解があったため、SVGTransformを修正 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-06 11:46:48 UTC (rev 2372) +++ branches/07x/070/org/w3c/dom/svg.js 2011-02-06 11:59:45 UTC (rev 2373) @@ -1905,9 +1905,7 @@ }; function SVGTransform() { - /*readonly unsigned short*/ this.type = SVGTransform.SVG_TRANSFORM_UNKNOWN; /*readonly SVGMatrix*/ this.matrix = new SVGMatrix(); - /*readonly float*/ this.angle = 0; return this; }; // Transform Types @@ -1919,34 +1917,38 @@ /*unsigned short*/ SVGTransform.SVG_TRANSFORM_SKEWX = 5; /*unsigned short*/ SVGTransform.SVG_TRANSFORM_SKEWY = 6; SVGTransform.prototype = { + /*ダミーの単位行列。各メソッドで使う*/ + _matrix : (new SVGMatrix()), + /*readonly unsigned short*/ type : SVGTransform.SVG_TRANSFORM_UNKNOWN, + /*readonly float*/ angle : 0, /*void*/ setMatrix : function(/*SVGMatrix*/ matrix ) { this.type = SVGTransform.SVG_TRANSFORM_MATRIX; - this.matrix = this.matrix.multiply(matrix); + this.matrix = this._matrix.multiply(matrix); }, /*void*/ setTranslate : function(/*float*/ tx, /*float*/ ty ) { this.type = SVGTransform.SVG_TRANSFORM_TRANSLATE; - this.matrix = this.matrix.translate(tx, ty); + this.matrix = this._matrix.translate(tx, ty); }, /*void*/ setScale : function(/*float*/ sx, /*float*/ sy ) { this.type = SVGTransform.SVG_TRANSFORM_SCALE; - this.matrix = this.matrix.scaleNonUniform(sx, sy); + this.matrix = this._matrix.scaleNonUniform(sx, sy); }, /*void*/ setRotate : function(/*float*/ angle, /*float*/ cx, /*float*/ cy ) { this.angle = angle; this.type = SVGTransform.SVG_TRANSFORM_ROTATE; - this.matrix = this.matrix.rotate(angle); + this.matrix = this._matrix.rotate(angle); this.matrix.e = (1-this.matrix.a)*cx - this.matrix.c*cy; this.matrix.f = -this.matrix.b*cx + (1-this.matrix.d)*cy; }, /*void*/ setSkewX : function(/*float*/ angle ) { this.angle = angle; this.type = SVGTransform.SVG_TRANSFORM_SKEWX; - this.matrix = this.matrix.skewX(angle); + this.matrix = this._matrix.skewX(angle); }, /*void*/ setSkewY : function(/*float*/ angle ) { this.angle = angle; this.type = SVGTransform.SVG_TRANSFORM_SKEWY; - this.matrix = this.matrix.skewY(angle); + this.matrix = this._matrix.skewY(angle); } };