OSDN Git Service

Modify the setFrame method
authordhrname <dhrname@users.sourceforge.jp>
Thu, 10 Nov 2016 13:47:34 +0000 (22:47 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 10 Nov 2016 13:47:34 +0000 (22:47 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 350ece6..45ed0f7 100644 (file)
@@ -34,7 +34,8 @@ base("$frame").mix ( {
   timelines: [],\r
 \r
   /*開始フレーム数の候補。アニメーションの開始条件となる\r
-   * 単位はフレーム数であって、秒数ではない*/\r
+   * 単位はフレーム数であって、秒数ではない\r
+   * なお、初期値については、開始フレームが負の値を考慮しているため*/\r
   begin: -Number.MAX_VALUE,\r
 \r
   /*活動継続時間 (Active Duration)のフレーム数。アニメーションの継続条件となる\r
@@ -62,9 +63,6 @@ base("$frame").mix ( {
    * フレーム数を数値num まで進めるか、戻す*/\r
   setFrame: function( /*number*/ num) {\r
     this.currentFrame = num;\r
-    if((num < this.begin) || (num >= (this.begin+this.activeTime))) {\r
-      return;\r
-    }\r
     var timelines = this.timelines;\r
     for (var i=0;i<timelines.length;++i) {\r
       if (timelines[i] === this) {\r
@@ -196,9 +194,10 @@ base("$frame").mix ( {
        * だから、f以下の値の中から、最大値を探して、\r
        * それをbeginプロパティの値cacheBeginと比較する*/\r
       var startTime = this.getMaxList(f, this.beginList);\r
-      //if (startTime === -Number.MAX_VALUE) {\r
-      //  return this;\r
-      //}\r
+      if (startTime === -Number.MAX_VALUE) {\r
+        (state > post) && (this.state = begin);\r
+        return this;\r
+      }\r
       var endTime = this.getMaxList(f, this.endList),\r
           isWait = (state === wait),\r
           cacheBegin = this.begin;\r
index 8a48c31..9d11f73 100644 (file)
@@ -148,8 +148,9 @@ describe("SMIL Animation Spec", function() {
     });\r
   } );\r
   describe("the $frame.$list object", function() {\r
-    var frame = base("$frame").$list.up("$2");\r
+    var frame;\r
     beforeEach( function() {\r
+        frame = base("$frame").$list.up();\r
         frame.timelines = [];\r
         frame.isPaused = false;\r
         frame.state = frame.WAITING;\r
@@ -324,6 +325,18 @@ describe("SMIL Animation Spec", function() {
     it("should be this for the value (the invalid partion)", function() {\r
       expect(frame.updateState()).toBe(frame);\r
       expect(frame.updateState(null)).toBe(frame);\r
+      \r
+      function appendBegin(num) {\r
+        frame.state = frame.WAITING;\r
+        frame.beginList = {\r
+          value: num,\r
+          next: frame.beginList\r
+        };\r
+      };\r
+      appendBegin(100);\r
+      appendBegin(10000);\r
+      expect(frame.updateState(0).state).toBe(frame.WAITING);\r
+      expect(frame.updateState(99).state).toBe(frame.WAITING);\r
     });\r
     describe("the setFrame method (override)", function() {\r
       var frame = base("$frame").$list.up("$3");\r