svnno****@sourc*****
svnno****@sourc*****
2011年 1月 13日 (木) 23:38:20 JST
Revision: 2297 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2297 Author: dhrname Date: 2011-01-13 23:38:20 +0900 (Thu, 13 Jan 2011) Log Message: ----------- SVGLengthの修正を追加 Modified Paths: -------------- branches/06x/sie.js Modified: branches/06x/sie.js =================================================================== --- branches/06x/sie.js 2011-01-13 14:35:33 UTC (rev 2296) +++ branches/06x/sie.js 2011-01-13 14:38:20 UTC (rev 2297) @@ -2876,7 +2876,7 @@ /*attribute float*/ this.valueInSpecifiedUnits = SVGLength.SVG_LENGTHTYPE_UNKNOWN; //unitTypeにおける値 /*attribute DOMString*/ this.valueAsString; this._percent = 0.01; //単位に%が使われていた場合、このプロパティの数値を1%として使う -}; + return this;}; // Length Unit Types /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_UNKNOWN = 0; /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_NUMBER = 1; @@ -2890,43 +2890,43 @@ /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PT = 9; /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PC = 10; -/*newValueSpedifiedUnitsメソッド +SVGLength.prototype = {/*newValueSpedifiedUnitsメソッド *新しくunitTypeにおける値を設定する *例:2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる */ -SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { - var n = 1, _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す - if (unitType === SVGLength.SVG_LENGTHTYPE_NUMBER) { - } else if (unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { - n = this._percent; - _s = "%" - } else if (unitType === SVGLength.SVG_LENGTHTYPE_EMS) { - n = this._percent * 100; - _s = "em"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_EXS) { - _s = "ex"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_CM) { - n = 35.43307; - _s = "cm"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_MM) { - n = 3.543307; - _s = "mm"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_IN) { - n = 90; - _s = "in"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_PT) { - n = 1.25; - _s = "pt"; - } else if (unitType === SVGLength.SVG_LENGTHTYPE_PC) { - n = 15; - _s = "pc"; - } - this.unitType = unitType; - this.value = valueInSpecifiedUnits * n; - this.valueInSpecifiedUnits = valueInSpecifiedUnits; - this.valuAsString = valueInSpecifiedUnits + _s; - n = _s = null; -}; + newValueSpecifiedUnits : function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { + var n = 1, _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す + if (unitType === SVGLength.SVG_LENGTHTYPE_NUMBER) { + } else if (unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { + n = this._percent; + _s = "%" + } else if (unitType === SVGLength.SVG_LENGTHTYPE_EMS) { + n = this._percent * 100; + _s = "em"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_EXS) { + _s = "ex"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_CM) { + n = 35.43307; + _s = "cm"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_MM) { + n = 3.543307; + _s = "mm"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_IN) { + n = 90; + _s = "in"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_PT) { + n = 1.25; + _s = "pt"; + } else if (unitType === SVGLength.SVG_LENGTHTYPE_PC) { + n = 15; + _s = "pc"; + } + this.unitType = unitType; + this.value = valueInSpecifiedUnits * n; + this.valueInSpecifiedUnits = valueInSpecifiedUnits; + this.valuAsString = valueInSpecifiedUnits + _s; + n = _s = null; + }, /*convertToSpecifiedUnitsメソッド *valueプロパティを書き換えずに、単位だけを変換する *例:2cmをmmに変換したい場合 @@ -2934,10 +2934,9 @@ * x.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_MM); * alert(x.valueAsString); //20mm */ -SVGLength.prototype.convertToSpecifiedUnits = function (/*unsigned short*/ unitType) { - this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits); -}; - + convertToSpecifiedUnits : function (/*unsigned short*/ unitType) { + this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits); + }}; function SVGAnimatedLength() { /*readonly SVGLength*/ this.animVal; this.baseVal = new SVGLength(); @@ -3538,7 +3537,7 @@ }; /*SVGLength*/ SVGSVGElement.prototype.createSVGLength = function(){ var s = new SVGLength(); - return s; + s.unitType = /*SVG_LENGTHTYPE_NUMBER*/ 1; return s; }; /*SVGPoint*/ SVGSVGElement.prototype.createSVGPoint = function(){ var s = new SVGPoint();