Skip to content

Commit

Permalink
Merge "ui: Treat events with undefined dur as instants when zooming/m…
Browse files Browse the repository at this point in the history
…arking" into main
  • Loading branch information
stevegolton authored and Gerrit Code Review committed Jan 27, 2025
2 parents 0a55324 + 6851206 commit 15c5391
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ui/src/core/selection_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,15 @@ export class SelectionManagerImpl implements SelectionManager {
}
}
} else if (sel.kind === 'track_event') {
if (sel.dur === undefined) return undefined;
// Pretend incomplete slices are instants. The -1 duration here is just a
// flag, and doesn't actually represent the duration of the event.
// Besides, TimeSpan's will throw if created with a negative duration.
const dur = sel.dur === -1n ? 0n : sel.dur;
return TimeSpan.fromTimeAndDuration(sel.ts, dur);
switch (sel.dur) {
case undefined:
case -1n:
// Events without a duration or with duration -1 (DNF) slices are just
// treated as if they were instant events.
return TimeSpan.fromTimeAndDuration(sel.ts, 0n);
default:
return TimeSpan.fromTimeAndDuration(sel.ts, sel.dur);
}
}

return undefined;
Expand Down

0 comments on commit 15c5391

Please sign in to comment.