pub struct Viewport {
pub curr_left: Relative,
pub curr_right: Relative,
target_left: Relative,
target_right: Relative,
move_start_left: Relative,
move_start_right: Relative,
move_duration: Option<f32>,
pub move_strategy: ViewportStrategy,
edge_space: f64,
min_width: Absolute,
}
Fields§
§curr_left: Relative
§curr_right: Relative
§target_left: Relative
§target_right: Relative
§move_start_left: Relative
§move_start_right: Relative
§move_duration: Option<f32>
§move_strategy: ViewportStrategy
§edge_space: f64
§min_width: Absolute
Implementations§
Source§impl Viewport
impl Viewport
pub fn new() -> Self
pub fn left_edge_time(self, num_timestamps: &BigInt) -> BigInt
pub fn right_edge_time(self, num_timestamps: &BigInt) -> BigInt
pub fn as_absolute_time( &self, x: f64, view_width: f32, num_timestamps: &BigInt, ) -> Absolute
pub fn as_time_bigint( &self, x: f32, view_width: f32, num_timestamps: &BigInt, ) -> BigInt
pub fn to_time_f64( &self, x: f64, view_width: f32, num_timestamps: &BigInt, ) -> Absolute
pub fn to_time_bigint( &self, x: f32, view_width: f32, num_timestamps: &BigInt, ) -> BigInt
Sourcepub fn pixel_from_time(
&self,
time: &BigInt,
view_width: f32,
num_timestamps: &BigInt,
) -> f32
pub fn pixel_from_time( &self, time: &BigInt, view_width: f32, num_timestamps: &BigInt, ) -> f32
Computes which x-pixel corresponds to the specified time adduming the viewport is rendered
into a viewport of view_width
pub fn pixel_from_time_f64( &self, time: Absolute, view_width: f32, num_timestamps: &BigInt, ) -> f32
pub fn pixel_from_absolute_time( &self, time: Absolute, view_width: f32, num_timestamps: &BigInt, ) -> f32
Sourcepub fn clip_to(
&self,
old_num_timestamps: &BigInt,
new_num_timestamps: &BigInt,
) -> Viewport
pub fn clip_to( &self, old_num_timestamps: &BigInt, new_num_timestamps: &BigInt, ) -> Viewport
Return new viewport for a different file length
Tries to keep the current zoom level and position. If zoom is not possible it will zoom in as much as needed to keep border margins. If the new waveform is too short, the viewport will be moved to the left as much as needed for the zoom level.
fn width(&self) -> Relative
fn width_absolute(&self, num_timestamps: &BigInt) -> Absolute
pub fn go_to_time(&mut self, center: &BigInt, num_timestamps: &BigInt)
pub fn zoom_to_fit(&mut self)
pub fn go_to_start(&mut self)
pub fn go_to_end(&mut self)
pub fn handle_canvas_zoom( &mut self, mouse_ptr_timestamp: Option<BigInt>, delta: f64, num_timestamps: &BigInt, )
pub fn handle_canvas_scroll(&mut self, deltay: f64)
fn set_viewport_to_clipped( &mut self, target_left: Relative, target_right: Relative, num_timestamps: &BigInt, )
fn set_viewport_to_clipped_no_width_check( &mut self, target_left: Relative, target_right: Relative, )
fn midpoint(&self) -> Relative
fn half_width(&self) -> Relative
fn half_width_absolute(&self, num_timestamps: &BigInt) -> Absolute
pub fn zoom_to_range( &mut self, left: &BigInt, right: &BigInt, num_timestamps: &BigInt, )
pub fn go_to_cursor_if_not_in_view( &mut self, cursor: &BigInt, num_timestamps: &BigInt, ) -> bool
pub fn go_to_time_f64(&mut self, center: Absolute, num_timestamps: &BigInt)
fn set_target_left(&mut self, target_left: Relative)
fn set_target_right(&mut self, target_right: Relative)
pub fn move_viewport(&mut self, frame_time: f32)
pub fn is_moving(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Viewport
impl<'de> Deserialize<'de> for Viewport
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnwindSafe for Viewport
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self
file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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