Time & Duration refactor.
- Rename `TPTime` type to `time`.
- Rename `TPDuration` type to `duration`.
- Remove `TPTimestamp` type (in favour of `time`).
- Brand `time` type.
- Add `Time` and `Duration` static classes for functions that operate on
time and duration types.
- Remove free functions like `toNs` and `fromNs`.
Change-Id: I7651b97e44ded76d23fe2f566da10690e80c47be
diff --git a/ui/src/frontend/track_panel.ts b/ui/src/frontend/track_panel.ts
index ae9c208..a7d87b5 100644
--- a/ui/src/frontend/track_panel.ts
+++ b/ui/src/frontend/track_panel.ts
@@ -17,7 +17,7 @@
import {Actions} from '../common/actions';
import {TrackState} from '../common/state';
-import {Span, TPDuration, TPTime} from '../common/time';
+import {duration, Span, time} from '../common/time';
import {raf} from '../core/raf_scheduler';
import {SELECTION_FILL_COLOR, TRACK_SHELL_WIDTH} from './css_constants';
@@ -380,7 +380,7 @@
if (selectedArea.tracks.includes(trackState.id)) {
ctx.fillStyle = SELECTION_FILL_COLOR;
ctx.fillRect(
- visibleTimeScale.tpTimeToPx(selectedArea.start) + TRACK_SHELL_WIDTH,
+ visibleTimeScale.timeToPx(selectedArea.start) + TRACK_SHELL_WIDTH,
0,
visibleTimeScale.durationToPx(selectedAreaDuration),
size.height);
@@ -461,9 +461,9 @@
}
getSliceRect(
- visibleTimeScale: TimeScale, visibleWindow: Span<TPTime, TPDuration>,
- windowSpan: PxSpan, tStart: TPTime, tDur: TPTime,
- depth: number): SliceRect|undefined {
+ visibleTimeScale: TimeScale, visibleWindow: Span<time, duration>,
+ windowSpan: PxSpan, tStart: time, tDur: time, depth: number): SliceRect
+ |undefined {
if (this.track === undefined) {
return undefined;
}