OSDN Git Service

beginElementメソッドを修正して、再起動時の振る舞いを処理
authordhrname <dhrname@users.sourceforge.jp>
Wed, 11 Jan 2012 11:00:54 +0000 (20:00 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 11 Jan 2012 11:00:54 +0000 (20:00 +0900)
org/w3c/dom/svg.js

index fd7be8f..59102e0 100644 (file)
@@ -5343,6 +5343,18 @@ SVGAnimationElement.prototype = new SVGElement();
   var ttd = this.ownerDocument,
       evt = ttd.createEvent("TimeEvents");
   this._starting = ttd.documentElement.getCurrentTime(); //getStartTimeメソッドで使う開始時刻
+  if (this.getCurrentTime() > 0) {
+    /*アニメーションの最中で、beginEventが起きるときは、endEventが前もって起こされる。SVG1.1の仕様を参照
+     * 
+     * 19.4.2 Interface TimeEvent
+     * Note that if an element is restarted while it is currently playing, the element will raise an end event and another begin event, as the element restarts. 
+     * 
+     * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
+     * 
+     */
+    this.endElement();
+    this._currentFrame = 0;
+  }
   evt.initTimeEvent("beginEvent", ttd.defaultView, 0);
   this.dispatchEvent(evt);
   /*新しくリストの頭を更新して、別の値も実行させるようにする*/
@@ -5461,18 +5473,6 @@ NAIBU.Time = {
           if (nci._start) {
               var sti = nci._start[0];
               if ((sti || (sti === 0)) && s1 <= sti && sti < s) {
-                if (nci.getCurrentTime() > 0) {
-                  /*アニメーションの最中で、beginEventが起きるときは、endEventが前もって起こされる。SVG1.1の仕様を参照
-                   * 
-                   * 19.4.2 Interface TimeEvent
-                   * Note that if an element is restarted while it is currently playing, the element will raise an end event and another begin event, as the element restarts. 
-                   * 
-                   * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
-                   * 
-                   */
-                  nci.endElement();
-                  nci._currentFrame = 0;
-                }
                 nci.beginElement();
               }
               sti = void 0;