[Sie-announce] SIEコード [2296] SVGLengthの修正

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2011年 1月 13日 (木) 23:35:33 JST


Revision: 2296
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2296
Author:   dhrname
Date:     2011-01-13 23:35:33 +0900 (Thu, 13 Jan 2011)

Log Message:
-----------
SVGLengthの修正

Modified Paths:
--------------
    branches/06x/org/w3c/dom/svg.js

Property Changed:
----------------
    branches/06x/org/w3c/dom/svg.js

Modified: branches/06x/org/w3c/dom/svg.js
===================================================================
--- branches/06x/org/w3c/dom/svg.js	2011-01-13 14:17:10 UTC (rev 2295)
+++ branches/06x/org/w3c/dom/svg.js	2011-01-13 14:35:33 UTC (rev 2296)
@@ -497,6 +497,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;
@@ -511,43 +512,44 @@
   /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PT         = 9;
   /*const unsigned short*/ SVGLength.SVG_LENGTHTYPE_PC         = 10;
 
+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に変換したい場合
@@ -555,10 +557,10 @@
  * 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();
@@ -1159,6 +1161,7 @@
 };
 /*SVGLength*/     SVGSVGElement.prototype.createSVGLength = function(){
   var s = new SVGLength();
+  s.unitType = /*SVG_LENGTHTYPE_NUMBER*/ 1;
   return s;
 };
 /*SVGPoint*/      SVGSVGElement.prototype.createSVGPoint = function(){


Property changes on: branches/06x/org/w3c/dom/svg.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c/dom/svg.js:1864-2067
/branches/06x/062/org/w3c/dom/svg.js:2071-2106
/branches/06x/063/org/w3c/dom/svg.js:2110-2146
/branches/06x/064/org/w3c/dom/svg.js:2149-2177
/branches/06x/065/org/w3c/dom/svg.js:2179-2209
/branches/06x/066/org/w3c/dom/svg.js:2211-2239
/branches/06x/067/org/w3c/dom/svg.js:2257-2282
/branches/ufltima/dom/svg.js:1621-1856
   + /branches/06x/061/org/w3c/dom/svg.js:1864-2067
/branches/06x/062/org/w3c/dom/svg.js:2071-2106
/branches/06x/063/org/w3c/dom/svg.js:2110-2146
/branches/06x/064/org/w3c/dom/svg.js:2149-2177
/branches/06x/065/org/w3c/dom/svg.js:2179-2209
/branches/06x/066/org/w3c/dom/svg.js:2211-2239
/branches/06x/067/org/w3c/dom/svg.js:2257-2282
/branches/06x/068/org/w3c/dom/svg.js:2287
/branches/ufltima/dom/svg.js:1621-1856




Sie-announce メーリングリストの案内
アーカイブの一覧に戻る