mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
calculate time step
This commit is contained in:
parent
90b5773a18
commit
d165e98b5b
@ -163,7 +163,6 @@ const TeaTime = new Lang.Class({
|
|||||||
|
|
||||||
this.actor.add_actor(this._logo);
|
this.actor.add_actor(this._logo);
|
||||||
|
|
||||||
this._dt = 1;
|
|
||||||
this._idleTimeout = null;
|
this._idleTimeout = null;
|
||||||
|
|
||||||
this._createMenu();
|
this._createMenu();
|
||||||
@ -254,13 +253,15 @@ const TeaTime = new Lang.Class({
|
|||||||
this._stopTime = new Date();
|
this._stopTime = new Date();
|
||||||
this._cntdownStart = time;
|
this._cntdownStart = time;
|
||||||
this._progress = 0;
|
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._stopTime.setTime(this._startTime.getTime() + time*1000); // in msec
|
||||||
|
|
||||||
this.actor.remove_actor(this._logo); // show timer instead of default icon
|
this.actor.remove_actor(this._logo); // show timer instead of default icon
|
||||||
this.actor.add_actor(this._timer);
|
this.actor.add_actor(this._timer);
|
||||||
|
|
||||||
this._showNotification(_("Timer set!"), _("%ss to go").format(time));
|
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() {
|
_getRemainingSec: function() {
|
||||||
let a = new Date();
|
let a = new Date();
|
||||||
|
Loading…
Reference in New Issue
Block a user