OSDN Git Service

Add the mode property to the
authordhrname <dhrname@users.sourceforge.jp>
Sat, 7 May 2016 14:41:23 +0000 (23:41 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sat, 7 May 2016 14:41:23 +0000 (23:41 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 2c1acc2..83674b6 100644 (file)
@@ -118,7 +118,7 @@ base("$frame").mix ( {
    * ただし、引数objのobj.beginとobj.activeTimeが定まっていない場合はfalseを返す*/\r
   addLine: function( /*$frame*/ obj ) {\r
     if(!obj || (!obj.begin && (obj.begin !== 0))\r
-      || (!obj.activeTime && (obj.activeTime !== 0)) ) {\r
+    || (!obj.activeTime && (obj.activeTime !== 0)) ) {\r
       /*どちらのプロパティも未確認の場合、タイムラインは追加されない*/\r
       return false;\r
     }\r
@@ -127,14 +127,7 @@ base("$frame").mix ( {
       this.removeLine(obj);\r
     }\r
     if (obj.isBegin) {\r
-      var i=0;\r
-      while (i<timelines.length) {\r
-        if (!timelines[i].isBegin) {\r
-          break;\r
-        }\r
-        ++i;\r
-      }\r
-      timelines.splice(i, 0, obj);\r
+      timelines.unshift(obj);\r
     } else {\r
       /*終了処理をするフレームはリストの末尾に追加*/\r
       timelines.push(obj);\r
@@ -638,7 +631,18 @@ base("$from").of( {
          tkey = void 0;\r
          return isNaN(t) ? this.string\r
                          : this.to.advance(t);\r
-     }\r
+     },\r
+     \r
+     /*discreteモードのときには、上記の_f関数の代わりに、以下の関数を用いる*/\r
+     funcForDiscrete: function (t) {\r
+        if (isNaN(t)) {\r
+          return this.string;\r
+        } else if (t === 1) {\r
+          return this.to.string;\r
+        } else {\r
+          return this.to.advance(0);\r
+        }\r
+      }\r
  }).of( {\r
    \r
    /*全体の行列ノルム(距離)*/\r
@@ -723,15 +727,7 @@ base("$from").of( {
       };\r
     } else if (this.mode === "discrete") {\r
       this.to.call();\r
-      return function (t) {\r
-        if (isNaN(t)) {\r
-          return this.string;\r
-        } else if (t === 1) {\r
-          return this.to.string;\r
-        } else {\r
-          return this.to.advance(0);\r
-        }\r
-      }.bind(this);\r
+      return this.funcForDiscrete.bind(this);\r
     }\r
   }\r
 } ).to = base("$from").$to;\r
@@ -788,6 +784,9 @@ base("$calcMode").up("$attribute").mix( {
   /*attributeType属性がCSSだったときや、autoで属性名がCSSプロパティ名だったときには、true*/\r
   isCSS: false,\r
   \r
+  /*計算モードdicreteやsplineなど*/\r
+  mode: "linear",\r
+  \r
   /*指定した要素の属性値を取得するメソッド*/\r
   getAttr: function(/*string*/ name, def) {\r
     var nameSpace = null;\r
index 8a2876b..d11f004 100644 (file)
@@ -190,7 +190,7 @@ describe("SMIL Animation Spec", function() {
       } );\r
       expect(frame.timelines[0].isBegin).toBeTruthy();\r
       expect(frame.timelines[1].isBegin).toBeTruthy();\r
-      expect(frame.timelines[1].activeTime).toBe(2)\r
+      expect(frame.timelines[0].activeTime).toBe(2)\r
       expect(frame.timelines[2].isBegin).toBeFalsy();\r
     });\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r