From d165e98b5be5cdf6a7f974153a3895eae76cd976 Mon Sep 17 00:00:00 2001 From: Olaf Leidinger Date: Tue, 5 Nov 2013 11:46:58 +0100 Subject: [PATCH] calculate time step --- src/extension.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/extension.js b/src/extension.js index 406bad3..c2f41db 100644 --- a/src/extension.js +++ b/src/extension.js @@ -163,7 +163,6 @@ const TeaTime = new Lang.Class({ this.actor.add_actor(this._logo); - this._dt = 1; this._idleTimeout = null; this._createMenu(); @@ -254,13 +253,15 @@ const TeaTime = new Lang.Class({ this._stopTime = new Date(); this._cntdownStart = time; this._progress = 0; + let dt = Math.max(0.1, time / 180); // change time step to fit animation + this._stopTime.setTime(this._startTime.getTime() + time*1000); // in msec this.actor.remove_actor(this._logo); // show timer instead of default icon this.actor.add_actor(this._timer); this._showNotification(_("Timer set!"), _("%ss to go").format(time)); - this._idleTimeout = Mainloop.timeout_add_seconds(this._dt, Lang.bind(this, this._doCountdown)); + this._idleTimeout = Mainloop.timeout_add_seconds(dt, Lang.bind(this, this._doCountdown)); }, _getRemainingSec: function() { let a = new Date();