bugfix: timer negative on goto

when jumping events using goto, start time would not be set
This commit is contained in:
cv
2021-05-25 23:14:56 +02:00
parent 894b5e894a
commit e57cb0d831
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -50,6 +50,9 @@ class Timer {
// check playstate
switch (this.state) {
case 'start':
// ensure we have a start time
if (this._startedAt == null) this._startedAt = now;
// update current timer
this.current =
this._startedAt + this.duration + this._pausedTotal - now;
+1
View File
@@ -63,6 +63,7 @@ const initiateOSC = (config) => {
try {
let eventIndex = parseInt(args);
if (isNaN(eventIndex) || eventIndex <= 0) return;
global.timer.pause();
global.timer.loadEvent(eventIndex - 1, undefined, true);
} catch (error) {
console.log('error calling goto: ', error);