Expand description
Timeline layout helpers shared by time-vs-event UI (tick placement and lane packing).
StructsΒ§
- Indexed
Interval π - Timeline
Geometry - Layout + viewport inputs for a timeline (pixels and milliseconds;
zoom/pan_msare clamped by the math). - Timeline
Metrics - Derived pixel/time geometry for one render of a timeline.
- Timeline
Viewport - A timeline viewport: the committed pan offset and zoom factor.
ConstantsΒ§
- DEFAULT_
TARGET_ PIXELS_ PER_ TICK - Target pixel gap between adjacent ticks when no caller preference is set.
- FALLBACK_
STEP_ πMS - NICE_
STEPS_ πMS
FunctionsΒ§
- assign_
timeline_ lanes - Pack
(start, end)intervals into non-overlapping lanes via greedy scheduling, returning lanes in input order. - clamp π
- compute_
timeline_ metrics - Derive all pixel/time geometry (including axis ticks) for one timeline render; the source of truth for px<->ms.
- compute_
timeline_ ticks - Pick βniceβ tick positions (ms) inside
[0, duration_ms]for a timeline axis. - normalized_
interval π - pan_
timeline_ by - Compute the new viewport after dragging the track by
delta_pxpixels (zoom unchanged). - reserve_
lane π - zoom_
timeline_ at - Compute the new viewport after a cursor-anchored zoom step (
local_xpixels from the track left, cursor time fixed).