Ver código fonte

Adding index-- to iterate over all events - TS

Temechon 9 anos atrás
pai
commit
d586dd23a8
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      src/Animations/babylon.animation.ts

+ 2 - 0
src/Animations/babylon.animation.ts

@@ -106,6 +106,7 @@
             for (var index = 0; index < this._events.length; index++) {
             for (var index = 0; index < this._events.length; index++) {
                 if (this._events[index].frame === frame) {
                 if (this._events[index].frame === frame) {
                     this._events.splice(index, 1);
                     this._events.splice(index, 1);
+                    index--;
                 }
                 }
             }
             }
         }
         }
@@ -458,6 +459,7 @@
                     // If event should be done only once, remove it.
                     // If event should be done only once, remove it.
                     if (event.onlyOnce) {
                     if (event.onlyOnce) {
                         this._events.splice(index, 1);
                         this._events.splice(index, 1);
+                        index--;
                     }
                     }
                     event.action();
                     event.action();
                 }
                 }