pub struct TimelineViewport {
px_per_frame: f64,
scroll_frame: f64,
width_px: f64,
fps: u32,
duration_frames: u64,
}Expand description
Maps between project frames and timeline pixels at a zoom + scroll.
Fields§
§px_per_frame: f64§scroll_frame: f64§width_px: f64§fps: u32§duration_frames: u64Implementations§
Source§impl TimelineViewport
impl TimelineViewport
Sourcepub fn fit(duration_frames: u64, fps: u32, width_px: f64) -> Self
pub fn fit(duration_frames: u64, fps: u32, width_px: f64) -> Self
A viewport zoomed so the whole clip fits in width_px.
Sourcepub fn px_per_frame(&self) -> f64
pub fn px_per_frame(&self) -> f64
Pixels per frame (the zoom level).
Sourcepub fn scroll_frame(&self) -> f64
pub fn scroll_frame(&self) -> f64
Leftmost visible frame.
Sourcepub fn frame_to_px(&self, frame: f64) -> f64
pub fn frame_to_px(&self, frame: f64) -> f64
Pixel x of a frame within the viewport.
Sourcepub fn px_to_frame(&self, px: f64) -> f64
pub fn px_to_frame(&self, px: f64) -> f64
Frame at a pixel x within the viewport.
Sourcepub fn frame_to_fraction(&self, frame: f64) -> f64
pub fn frame_to_fraction(&self, frame: f64) -> f64
Fraction 0..=1 of the viewport width for frame (for percent-based
CSS positioning of a responsive, fit-to-width ruler).
Sourcepub fn visible_range(&self) -> (f64, f64)
pub fn visible_range(&self) -> (f64, f64)
Visible frame range (first, last).
Sourcepub fn zoom_at(&mut self, factor: f64, anchor_px: f64)
pub fn zoom_at(&mut self, factor: f64, anchor_px: f64)
Zoom by factor (>1 = in) keeping the frame under anchor_px fixed —
so zooming centred on the playhead keeps the playhead put.
fn clamp_scroll(&mut self)
Sourcepub fn ruler_ticks(&self) -> Vec<RulerTick>
pub fn ruler_ticks(&self) -> Vec<RulerTick>
Labeled ruler ticks across the visible range, at a “nice” second
interval chosen so labels stay at least MIN_TICK_SPACING_PX apart.
Frame-correct at every zoom level.
Trait Implementations§
Source§impl Clone for TimelineViewport
impl Clone for TimelineViewport
Source§fn clone(&self) -> TimelineViewport
fn clone(&self) -> TimelineViewport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimelineViewport
impl Debug for TimelineViewport
Source§impl PartialEq for TimelineViewport
impl PartialEq for TimelineViewport
Source§fn eq(&self, other: &TimelineViewport) -> bool
fn eq(&self, other: &TimelineViewport) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TimelineViewport
impl StructuralPartialEq for TimelineViewport
Auto Trait Implementations§
impl Freeze for TimelineViewport
impl RefUnwindSafe for TimelineViewport
impl Send for TimelineViewport
impl Sync for TimelineViewport
impl Unpin for TimelineViewport
impl UnsafeUnpin for TimelineViewport
impl UnwindSafe for TimelineViewport
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
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>
Converts
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>
Converts
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§impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
§impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
§impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
§impl<T> SerializableKey for T
impl<T> SerializableKey for T
§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.