OSDN Git Service

Override the _setFrame method of the
authordhrname <dhrname@users.sourceforge.jp>
Wed, 4 May 2016 12:28:47 +0000 (21:28 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 4 May 2016 12:28:47 +0000 (21:28 +0900)
org/w3c/dom/smil.js

index 0768f8b..1588594 100644 (file)
@@ -1588,9 +1588,9 @@ base("$calcMode").up("$attribute").mix( {
        throw new Error("Number of The List Error");\r
      }\r
      var list = this.element.__transformList,\r
-         currentList = list[this.numberOfList];\r
-     currentList.value = this.type+ "(" +this.$animateElement.tocall.call(this, advance)+ ")";\r
-     currentList.isPlaying = true;\r
+         currentItem = list[this.numberOfList];\r
+     currentItem.value = this.type+ "(" +this.$animateElement.tocall.call(this, advance)+ ")";\r
+     currentItem.isPlaying = true;\r
      var playList = list.filter( function(x) {\r
            /*playListは現在、再生中の項目のみをピックアップしたリスト*/\r
              return (x && x.isPlaying);\r
@@ -1611,6 +1611,26 @@ base("$calcMode").up("$attribute").mix( {
      return s;\r
    },\r
    \r
+   /*後の_setFrameメソッドで使うダミー*/\r
+   __setAttribute: function(){},\r
+   \r
+   _setFrame: function(currentTime) {\r
+     /*__transformListの中で、自分より後の項目に再生中のものがあれば、\r
+      *アニメーションを再生させないで、後に続く項目に任せる*/\r
+     var list = this.element.__transformList,\r
+         isActive = false;\r
+     for (var i=this.numberOfList;i<list.length;++i) {\r
+       if (list[i].isPlaying) {\r
+         isActive = true;\r
+       }\r
+     }\r
+     /*__setAttributeはダミーなので、アニメーションが再生されない*/\r
+     this.setAttribute = isActive ? this.__setAttribute\r
+                                    : this.$animateElement.setAttribute;\r
+     /*上書きされたメソッドを呼び出す*/\r
+     this.$animateElement._setFrame.call(this, currentTime);\r
+   },\r
+   \r
    _setEndFrame: function(frame) {\r
      /*上書きされたメソッドを呼び出してアニメーションの凍結作業をする*/\r
      this.$animateElement._setEndFrame.call(this, frame);\r