diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-16 16:15:44 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-16 16:15:44 +0000 |
| commit | 0cec8e39b8d5bdbfbda046212fa822b79f2f276b (patch) | |
| tree | 59ad4782f42e751b9a8d1f9f8a8e0e690d618c51 | |
| parent | f98cb2a7439f96c83f63e6dd4689d57489c13e67 (diff) | |
| download | mullvadvpn-0cec8e39b8d5bdbfbda046212fa822b79f2f276b.tar.xz mullvadvpn-0cec8e39b8d5bdbfbda046212fa822b79f2f276b.zip | |
Update currentIndex based on .reverse option
| -rw-r--r-- | app/lib/tray-animator.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/lib/tray-animator.js b/app/lib/tray-animator.js index 03522fedbe..0245a6eca1 100644 --- a/app/lib/tray-animator.js +++ b/app/lib/tray-animator.js @@ -89,6 +89,18 @@ export class TrayAnimation { return this._nativeImages[this._currentFrame]; } + /** + * Prepare initial state for animation before running it. + * @memberOf TrayAnimation + */ + prepare() { + this._currentFrame = this._reverse ? this._numFrames - 1 : 0; + } + + /** + * Advance animation frame + * @memberOf TrayAnimation + */ advanceFrame() { // do not advance frame when animation is finished if(this._isFinished) { return; } @@ -117,8 +129,6 @@ export class TrayAnimation { } } - console.log('nextFrame: %d', nextFrame); - this._currentFrame = nextFrame; } @@ -139,7 +149,6 @@ export class TrayAnimation { /** * Tray icon animator - * * @class TrayAnimator */ export class TrayAnimator { @@ -177,6 +186,9 @@ export class TrayAnimator { this._timer = this._nextFrame(); this._started = true; + // prepare animation + this._animation.prepare(); + // update from initial frame this._updateTrayIcon(); } |
