mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-24 00:19:21 +00:00
handle timer < 0
This commit is contained in:
@@ -12,6 +12,7 @@ class Timer {
|
|||||||
_pausedInterval = null;
|
_pausedInterval = null;
|
||||||
_pausedTotal = null;
|
_pausedTotal = null;
|
||||||
state = 'pause';
|
state = 'pause';
|
||||||
|
showNegative = false;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
@@ -45,7 +46,11 @@ class Timer {
|
|||||||
switch (this.state) {
|
switch (this.state) {
|
||||||
case 'start':
|
case 'start':
|
||||||
// update current timer
|
// update current timer
|
||||||
this._current = this._finishAt + this._pausedTotal - now;
|
if (!this.showNegative) {
|
||||||
|
this._current = Math.max(this._finishAt + this._pausedTotal - now, 0);
|
||||||
|
} else {
|
||||||
|
(this._current = this._finishAt + this._pausedTotal - now), 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'pause':
|
case 'pause':
|
||||||
// update paused time
|
// update paused time
|
||||||
|
|||||||
Reference in New Issue
Block a user