pub struct TimeAxis {
pub start: f64,
pub end: f64,
pub min: f64,
pub max: f64,
pub min_span: f64,
}Expand description
The shared time window (TIME-1). [start, end] is what’s visible; [min, max]
is the hard clamp (the data’s full extent); min_span caps how far you can
zoom in.
Fields§
§start: f64Left edge of the visible window (axis units).
end: f64Right edge of the visible window (axis units); always > start.
min: f64Hard clamp: the window never pans/zooms outside [min, max].
max: f64§min_span: f64Smallest allowed visible span (max zoom-in).
Implementations§
Source§impl TimeAxis
impl TimeAxis
Sourcepub fn to_frac(&self, t: f64) -> f64
pub fn to_frac(&self, t: f64) -> f64
Map an axis-unit time to a 0.0..=1.0 fraction of the visible window
(<0 / >1 = off-screen left/right). The renderer multiplies by pixel
width to place a bar/event.
Sourcepub fn pan(&mut self, delta: f64)
pub fn pan(&mut self, delta: f64)
Pan by a delta in axis units (positive slides later), clamped so the
window stays inside [min, max].
Sourcepub fn zoom(&mut self, factor: f64, pivot: f64)
pub fn zoom(&mut self, factor: f64, pivot: f64)
Zoom toward a pivot time by factor (>1 narrows / zooms in), keeping
the pivot time at the same on-screen fraction — the natural map/plot feel
applied to time. Clamps the new span to [min_span, max_span].
Sourcepub fn fit(&mut self, start: f64, end: f64)
pub fn fit(&mut self, start: f64, end: f64)
Snap the window to [start, end] (fit-to-range), clamped to bounds.
Sourcepub fn set_bounds(&mut self, min: f64, max: f64)
pub fn set_bounds(&mut self, min: f64, max: f64)
Widen (or reset) the clamp bounds, then re-clamp the window into them.
Sourcepub fn sync_from(&mut self, other: &TimeAxis)
pub fn sync_from(&mut self, other: &TimeAxis)
Link to another axis: copy its visible window (a shared scrubber scrolls several facets together, TIME-1). Bounds/min_span stay this axis’s own.
Sourcepub fn update(&mut self, msg: TimeMsg) -> Vec<TimeEffect>
pub fn update(&mut self, msg: TimeMsg) -> Vec<TimeEffect>
The single mutation path (FC-2 / FC-8). Apply one TimeMsg; return a
TimeEffect::WindowChanged iff the visible window actually moved (empty
otherwise), so linked axes only re-sync on a real change.
Sourcepub fn state_json(&self) -> Value
pub fn state_json(&self) -> Value
Observable state as JSON (the state_json discipline).