svnno****@sourc*****
svnno****@sourc*****
2010年 3月 3日 (水) 23:35:52 JST
Revision: 1694 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1694 Author: dhrname Date: 2010-03-03 23:35:52 +0900 (Wed, 03 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-03-03 13:37:17 UTC (rev 1693) +++ branches/ufltima/dom/svg.js 2010-03-03 14:35:52 UTC (rev 1694) @@ -292,12 +292,9 @@ */ function SVGLength() { /*readonly attribute unsigned short*/ this.unitType = SVGLength.SVG_LENGTHTYPE_UNKNOWN; - /*attribute float*/ this.value = 0; - // raises DOMException on setting - /*attribute float*/ this.valueInSpecifiedUnits = 0; - // raises DOMException on setting + /*attribute float*/ this.value = 0; //利用単位における値 + /*attribute float*/ this.valueInSpecifiedUnits = 0; //unitTypeにおける値 /*attribute DOMString*/ this.valueAsString; - // raises DOMException on setting return this; }; // Length Unit Types /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_UNKNOWN = 0; @@ -312,14 +309,22 @@ /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PT = 9; /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PC = 10; +/*newValueSpedifiedUnitsメソッド + *新しくunitTypeにおける値を設定する + *2pxならば、x.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 2);となる + */ SVGLength.prototype.newValueSpecifiedUnits = function (/*unsigned short*/ unitType, /*float*/ valueInSpecifiedUnits) { - this.unitType = unitType; - /*float*/ this.value = valueInSpecifiedUnits * this._n[unitType-1]; - /*float*/ this.valueInSpecifiedUnits = valueInSpecifiedUnits; -} + this.value = 1; + this.convertToSpecifiedUnits((unitType); + this.value *= this.valueInSpecifiedUnits; + this.valueInSpecifiedUnits = valueInSpecifiedUnits; + this.valuAsString = valueInSpecifiedUnits + this._s[unitType-1]; +}; SVGLength.prototype.convertToSpecifiedUnits = function (/*unsigned short*/ unitType) { this.unitType = unitType; + //[1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15] this.valueInSpecifiedUnits = this.value / this._n[unitType-1]; + this.valuAsString = this.valueInSpecifedUnits + this._s[unitType-1]; }; function SVGAnimatedLength() { @@ -601,10 +606,10 @@ *それぞれ、svg要素の同名属性に対応。たとえば、xならば、x属性に対応している *1000というのは、W3Cで触れていないため、独自の初期値を採用 */ - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*DOMString*/ this.contentScriptType = "application/ecmascript"; //古い仕様では、text/ecmascript /*DOMString*/ this.contentStyleType = "text/css"; /*readonly SVGRect*/ this.viewport = this.createSVGRect(); @@ -1000,10 +1005,10 @@ function SVGUseElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); //use要素のx属性に対応(以下、同様) - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); //use要素のx属性に対応(以下、同様) + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGElementInstance*/ this.instanceRoot = new SVGElementInstance(); //参照先インスタンスのルート /*readonly SVGElementInstance*/ this.animatedInstanceRoot = this.instanceRoot;//アニメの最中のインスタンス。静止中は通常 this._xlink = new SVGURIReference(this); //XLink言語のURI参照 @@ -1042,10 +1047,10 @@ function SVGImageElement() { SVGElement.apply(this, arguments); //以下は、与えられた属性の値に対応する - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = new SVGAnimatedPreserveAspectRatio(); return this; }; @@ -1764,12 +1769,12 @@ function SVGRectElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(-1); - /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(-1); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); return this; }; SVGRectElement.constructor = SVGElement; @@ -1777,9 +1782,9 @@ function SVGCircleElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); return this; }; SVGCircleElement.constructor = SVGElement; @@ -1787,10 +1792,10 @@ function SVGEllipseElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.rx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.ry = new SVGAnimatedLength(); return this; }; SVGEllipseElement.constructor = SVGElement; @@ -1798,10 +1803,10 @@ function SVGLineElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); return this; }; SVGLineElement.constructor = SVGElement; @@ -1827,7 +1832,7 @@ function SVGTextContentElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.textLength = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.textLength = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.lengthAdjust = new SVGAnimatedEnumeration(SVGTextContentElement.LENGTHADJUST_UNKNOWN); return this; }; @@ -2009,11 +2014,11 @@ function SVGMarkerElement(){ SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.refX = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.refY = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.refX = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.refY = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.markerUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.markerWidth = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.markerHeight = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.markerWidth = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.markerHeight = new SVGAnimatedLength(); /*readonly SVGAnimatedEnumeration*/ this.orientType = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedAngle*/ this.orientAngle = new SVGAnimatedAngle(); //SVGFitToViewBoxのインターフェースを用いる @@ -2082,10 +2087,10 @@ function SVGLinearGradientElement() { SVGGradientElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y1 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.x2 = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y2 = new SVGAnimatedLength(); return this; }; SVGLinearGradientElement.constructor = SVGGradientElement; @@ -2093,11 +2098,11 @@ function SVGRadialGradientElement() { SVGGradientElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.cx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.cy = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength(); return this; }; SVGRadialGradientElement.constructor = SVGGradientElement; @@ -2116,10 +2121,10 @@ /*readonly SVGAnimatedEnumeration*/ this.patternUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.patternContentUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedTransformList*/ this.patternTransform = new SVGAnimatedTransformList(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(1000); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(1000); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); this._xlink = new SVGURIReference(this); //SVGFitToViewBoxのインターフェースを用いる /*readonly SVGAnimatedRect*/ this.viewBox = new SVGAnimatedRect(); @@ -2142,10 +2147,10 @@ SVGElement.apply(this, arguments); /*readonly SVGAnimatedEnumeration*/ this.maskUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.maskContentUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); return this; }; SVGMaskElement.constructor = SVGElement; @@ -2155,10 +2160,10 @@ SVGElement.apply(this, arguments); /*readonly SVGAnimatedEnumeration*/ this.filterUnits = new SVGAnimatedEnumeration(); /*readonly SVGAnimatedEnumeration*/ this.primitiveUnits = new SVGAnimatedEnumeration(); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); /*readonly SVGAnimatedInteger*/ this.filterResX = new SVGAnimatedInteger(); /*readonly SVGAnimatedInteger*/ this.filterResY = new SVGAnimatedInteger(); this._xlink = new SVGURIReference(this); @@ -2171,11 +2176,11 @@ function SVGFilterPrimitiveStandardAttributes(ele) { SVGStylable.apply(this, arguments); this._tar = ele; - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(0); - /*readonly SVGAnimatedString*/ this.result = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.width = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.height = new SVGAnimatedLength(); + /*readonly SVGAnimatedString*/ this.result = new SVGAnimatedLength(); }; SVGFilterPrimitiveStandardAttributes.constructor = SVGStylable; SVGFilterPrimitiveStandardAttributes.prototype = new SVGStylable(); @@ -2214,8 +2219,8 @@ function SVGCursorElement() { SVGElement.apply(this, arguments); - /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(0); - /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(0); + /*readonly SVGAnimatedLength*/ this.x = new SVGAnimatedLength(); + /*readonly SVGAnimatedLength*/ this.y = new SVGAnimatedLength(); this._xlink = new SVGURIReference(this); return this; };