pub struct Protractor { /* private fields */ }Expand description
A band of ticks along an arc that sets an angle, by a drag from anywhere on it. A double click goes back to zero. The arrows change it by a step (with Shift, ten), Home and End go to the ends, and Delete goes back to zero.
use ravenrs_reactive::State;
use ravenrs_widgets::Protractor;
let angle = State::new(0.0_f32);
let straighten = Protractor::new(angle.binding()).range(-45.0, 45.0).label("Straighten");Implementations§
Source§impl Protractor
impl Protractor
Sourcepub fn new(value: Binding<f32>) -> Protractor
pub fn new(value: Binding<f32>) -> Protractor
A band bound to value, in degrees, from -45 to 45 in steps of 0.1.
Sourcepub fn range(self, least: f32, most: f32) -> Protractor
pub fn range(self, least: f32, most: f32) -> Protractor
The least and the most it reaches, in degrees.
Sourcepub fn step(self, step: f32) -> Protractor
pub fn step(self, step: f32) -> Protractor
The smallest change, in degrees (0.1 by default).
Sourcepub fn width(self, width: f32) -> Protractor
pub fn width(self, width: f32) -> Protractor
Its width in logical pixels (260 by default).
Sourcepub fn on_commit(self, handler: impl Fn(f32) + 'static) -> Protractor
pub fn on_commit(self, handler: impl Fn(f32) + 'static) -> Protractor
Runs handler with the angle when a drag ends or a key or double click changes it: one
step to undo.
Sourcepub fn disabled(self, disabled: bool) -> Protractor
pub fn disabled(self, disabled: bool) -> Protractor
Shows the angle without letting it change.
Trait Implementations§
Source§impl Debug for Protractor
impl Debug for Protractor
Auto Trait Implementations§
impl !RefUnwindSafe for Protractor
impl !Send for Protractor
impl !Sync for Protractor
impl !UnwindSafe for Protractor
impl Freeze for Protractor
impl Unpin for Protractor
impl UnsafeUnpin for Protractor
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
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.