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).
Trait Implementations§
impl Copy for TimeAxis
Source§impl<'de> Deserialize<'de> for TimeAxis
impl<'de> Deserialize<'de> for TimeAxis
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for TimeAxis
Auto Trait Implementations§
impl Freeze for TimeAxis
impl RefUnwindSafe for TimeAxis
impl Send for TimeAxis
impl Sync for TimeAxis
impl Unpin for TimeAxis
impl UnsafeUnpin for TimeAxis
impl UnwindSafe for TimeAxis
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more