mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
Invert overtime (#1715)
* refactor: invert offset calculation * chore: update tests * chore: flip offset in UI * fix seconds display on group target duration * update comment * fix rebase
This commit is contained in:
committed by
Carlos Valente
parent
4665f9c2f7
commit
e0149c1cbf
@@ -314,7 +314,7 @@ export function updateLoaded(event?: PlayableEvent): string | undefined {
|
||||
|
||||
// handle edge cases with roll
|
||||
if (runtimeState.timer.playback === Playback.Roll) {
|
||||
const offsetClock = runtimeState.clock + runtimeState.runtime.offsetAbs;
|
||||
const offsetClock = runtimeState.clock - runtimeState.runtime.offsetAbs;
|
||||
// if waiting to roll, we update the targets and potentially start the timer
|
||||
if (runtimeState._timer.secondaryTarget !== null) {
|
||||
if (runtimeState.eventNow.timeStart < offsetClock && offsetClock < runtimeState.eventNow.timeEnd) {
|
||||
@@ -391,7 +391,6 @@ export function start(state: RuntimeState = runtimeState): boolean {
|
||||
state.timer.expectedFinish = getExpectedFinish(state);
|
||||
state.timer.elapsed = 0;
|
||||
|
||||
// update runtime delays: over - under
|
||||
if (state.runtime.actualStart === null) {
|
||||
state.runtime.actualStart = state.clock;
|
||||
}
|
||||
@@ -521,7 +520,6 @@ export function update(): UpdateResult {
|
||||
const { offsetAbs, offsetRel } = getRuntimeOffset(runtimeState);
|
||||
runtimeState.runtime.offsetAbs = offsetAbs;
|
||||
runtimeState.runtime.offsetRel = offsetRel;
|
||||
// runtimeState.runtime.expectedEnd = getExpectedEnd(runtimeState);
|
||||
|
||||
const finishedNow =
|
||||
Boolean(runtimeState._timer.forceFinish) ||
|
||||
@@ -596,7 +594,7 @@ export function roll(
|
||||
runtimeState.timer.expectedFinish = normalisedEndTime;
|
||||
|
||||
//account for offset
|
||||
const offsetClock = runtimeState.clock + runtimeState.runtime.offsetAbs;
|
||||
const offsetClock = runtimeState.clock - runtimeState.runtime.offsetAbs;
|
||||
|
||||
// state catch up
|
||||
runtimeState.timer.duration = calculateDuration(runtimeState.eventNow.timeStart, normalisedEndTime);
|
||||
@@ -635,7 +633,7 @@ export function roll(
|
||||
|
||||
//account for offset but we only keep it if passed to us
|
||||
runtimeState.runtime.offsetAbs = offset;
|
||||
const offsetClock = runtimeState.clock + runtimeState.runtime.offsetAbs;
|
||||
const offsetClock = runtimeState.clock - runtimeState.runtime.offsetAbs;
|
||||
|
||||
const { index, isPending } = loadRoll(rundown, metadata, offsetClock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user