OSDN Git Service

Modify the setFrame method on the object
authordhrname <dhrname@users.sourceforge.jp>
Tue, 6 Oct 2015 14:13:58 +0000 (23:13 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 6 Oct 2015 14:13:58 +0000 (23:13 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index e5b3937..df589a3 100644 (file)
@@ -1193,11 +1193,21 @@ base("$calcMode").up("$attribute").mix( {
 base("$frame").up("$svgEvent").mix( {\r
   log: [],\r
   setFrame: function(num) {\r
-    if (this.timelines.length > 0) {\r
-      this.log.push( {\r
-        frame: 0,\r
-        target: this.timelines[0].target\r
-      } );\r
+    for (var i=0;i<this.log.length;++i) {\r
+      /*ログを検索して、過去にイベントを実行したものは除外する*/\r
+      if (this.log[i].frame <= num) {\r
+        return this.$frame.setFrame(num);\r
+      }\r
+    }\r
+    for (var i=0;i<this.timelines.length;++i) {\r
+      var timeline = this.timelines[i];\r
+      if (timeline.begin <= num) {\r
+        /*beginEventを発動させる*/\r
+        this.log.push( {\r
+          frame: num,\r
+          target: timeline.target\r
+        } );\r
+      }\r
     }\r
     return this.$frame.setFrame(num);\r
   }\r
index a62236f..27b7520 100644 (file)
@@ -4219,6 +4219,25 @@ describe("SMIL Animation Spec", function() {
             target: ele\r
           }\r
         ]);\r
+        frame.setFrame(0);\r
+        expect(frame.log).toEqual([\r
+          { frame: 0,\r
+            target: ele\r
+          }\r
+        ]);\r
+        \r
+        frame.setFrame(1);\r
+        expect(frame.log).toEqual([\r
+          { frame: 0,\r
+            target: ele\r
+          }\r
+        ]);\r
+        frame.setFrame(1);\r
+        expect(frame.log).toEqual([\r
+          { frame: 0,\r
+            target: ele\r
+          }\r
+        ]);\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion )", function() {\r