OSDN Git Service

Modify the setSmilEvent method
authordhrname <dhrname@users.sourceforge.jp>
Mon, 7 Nov 2016 13:58:01 +0000 (22:58 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 7 Nov 2016 13:58:01 +0000 (22:58 +0900)
org/w3c/dom/smil.js

index b6b9796..d77b3ec 100644 (file)
@@ -1066,7 +1066,7 @@ base("$calcMode").up("$attribute").mix( {
   _repeatCount: 0,\r
   \r
   /*SMILイベント関連を発火させるためのメソッド\r
-   * もっぱら、push メソッドで使われる*/\r
+   * もっぱら、$attributeオブジェクトのpush メソッドで使われる*/\r
    setSmilEvent: function($list) {\r
     $list.addEvent("begin", function($list) {\r
         var target = this._ele,\r
@@ -1077,42 +1077,44 @@ base("$calcMode").up("$attribute").mix( {
         target.dispatchEvent(evt);\r
         /*repeatイベントのために、_repeatListプロパティを初期化する*/\r
         var list = this._repeatList = [],\r
+            active = $list.activeTime,\r
             begin = $list.begin,\r
-            end = $list.end,\r
             simpleDuration = this.timeline.simpleDuration;\r
-            if (simpleDuration && (simpleDuration !== end - begin)) {\r
+            if (simpleDuration && (simpleDuration !== active)\r
+                  && (active !== Number.MAX_VALUE) ) {\r
               /*活動継続時間と単純持続時間が異なるとき、repeatイベントを設定*/\r
-              for (var m= begin + simpleDuration, n=1;m < end; m+=simpleDuration) {\r
+              for (var m= simpleDuration, n=1;m < active ; m+=simpleDuration) {\r
                 list.push( {\r
-                  frame: m,\r
+                  frame: begin + m,\r
                   /*リピートの回数 (n >= 1)*/\r
                   count: n\r
                 } );\r
                 ++n;\r
               }\r
-              $list.addEvent("play", function($list) {\r
-                var target = this._ele,\r
-                    detail = 0,\r
-                    frame = $list.currentFrame,\r
-                    list = this._repeatList;\r
-                if (!list.length) {\r
-                  return;\r
-                }\r
-                for (var i=0;i<list.length;++i) {\r
-                  if ( (this._repaetCount >= i+1)\r
-                      || (list[i].frame >= frame) ) {\r
-                    this._repeatCount = detail;\r
-                    break;\r
-                  } \r
-                  detail = list[i].count;\r
-                  var evt = target.ownerDocument.createEvent("MouseEvents");\r
-                  evt.initMouseEvent("repeatEvent" ,true, true, window, detail, 0, 0, 0, 0, false, false, false, false, 0, target);\r
-                  target.dispatchEvent(evt);\r
-                }\r
-              }.bind(this) );\r
             }\r
     }.bind(this) );\r
     \r
+    $list.addEvent("play", function($list) {\r
+      var target = this._ele,\r
+          detail = 0,\r
+          frame = $list.currentFrame,\r
+          list = this._repeatList;\r
+      if (!list.length) {\r
+        return;\r
+      }\r
+      for (var i=0;i<list.length;++i) {\r
+        if ( (this._repaetCount >= i+1)\r
+            || (list[i].frame >= frame) ) {\r
+          this._repeatCount = detail;\r
+          break;\r
+        } \r
+        detail = list[i].count;\r
+        var evt = target.ownerDocument.createEvent("MouseEvents");\r
+        evt.initMouseEvent("repeatEvent" ,true, true, window, detail, 0, 0, 0, 0, false, false, false, false, 0, target);\r
+        target.dispatchEvent(evt);\r
+      }\r
+    }.bind(this) );\r
+    \r
     $list.addEvent("end", function() {\r
         var target = this._ele,\r
             detail = 0;\r