pub struct Ruler { /* private fields */ }Expand description
A horizontal or vertical ruler in the caller’s units. It picks a round step for the scale, so marks never crowd as the zoom changes. Numbers on a vertical ruler stack digit over digit, since text does not rotate.
use ravenrs_widgets::Ruler;
// 2.5 screen pixels per unit, with unit 120 at the start and the pointer at unit 180.
let top = Ruler::horizontal().scale(2.5).origin(120.0).marker(180.0);
let side = Ruler::vertical().scale(2.5).whole_units();Implementations§
Source§impl Ruler
impl Ruler
Sourcepub fn horizontal() -> Ruler
pub fn horizontal() -> Ruler
A ruler across its parent, with one pixel per unit and zero at the start.
Sourcepub fn vertical() -> Ruler
pub fn vertical() -> Ruler
A ruler down its parent, with one pixel per unit and zero at the top.
Sourcepub fn origin(self, units: f32) -> Ruler
pub fn origin(self, units: f32) -> Ruler
The value in units at the ruler’s start, which panning moves.
Sourcepub fn marker(self, units: f32) -> Ruler
pub fn marker(self, units: f32) -> Ruler
Marks this value in units, such as where the pointer is.
Sourcepub fn min_spacing(self, pixels: f32) -> Ruler
pub fn min_spacing(self, pixels: f32) -> Ruler
The least distance between numbered marks, in logical pixels (64 by default).
Sourcepub fn whole_units(self) -> Ruler
pub fn whole_units(self) -> Ruler
Never divides below one unit, for what comes in whole pieces, such as pixels.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ruler
impl RefUnwindSafe for Ruler
impl Send for Ruler
impl Sync for Ruler
impl Unpin for Ruler
impl UnsafeUnpin for Ruler
impl UnwindSafe for Ruler
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
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<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.