pub struct CurveTransform {
pub position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
pub scale: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
pub bounds: Rect<f32>,
pub curve_to_local: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
pub local_to_curve: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
pub screen_to_curve: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
pub curve_to_screen: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
}Expand description
This object represents the transformation curve coordinates into the local coordinates of the curve editor widget and into the coordinates of the screen. Using this object allows other widgets to align themselves perfectly with the coordinates of a curve editor.
Since widgets are not mutable during layout and rendering, a CurveTransform is intended to be used within a CurveTransformCell which provides interior mutability.
Fields§
§position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>Position of the center of the curve editor in the curve coordinate space.
scale: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>Scape of the curve editor: multiply curve space units by this to get screen space units.
bounds: Rect<f32>Location of the curve editor on the screen, in screen space units.
curve_to_local: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>Transform a point on a curve into a point in the local space of the curve editor. Before applying this transformation, (0,0) is the origin of the curve, and positive-y is up. After the transform, (0,0) is the top-left corner of the editor, and positive-y is down.
local_to_curve: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>The inverse of curve_to_local, transforming a point in the local space
of the editor widget into a point in the space of the curve.
screen_to_curve: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>Transform a point on the screen into a point in the space of the curve. For example, a mouse click position would be transformed into the corresponding (x,y) coordinates of a cure key that would result from the click.
curve_to_screen: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>Transform a point on the curve into a point on the screen.
Implementations§
Source§impl CurveTransform
impl CurveTransform
Sourcepub fn update_transform(&mut self)
pub fn update_transform(&mut self)
Construct the transformations matrices for the current position, scale, and bounds.
Sourcepub fn x_step_iter(&self, grid_size: f32) -> StepIterator ⓘ
pub fn x_step_iter(&self, grid_size: f32) -> StepIterator ⓘ
Just like CurveTransform::y_step_iter but for x-coordinates.
Iterate through a list of x-coordinates across the width of the bounds.
The x-coordinates are in curve-space, but their distance apart should be
at least grid_size in screen-space.
This iterator indates where grid lines should be drawn to make a curve easier to read for the user.
Sourcepub fn y_step_iter(&self, grid_size: f32) -> StepIterator ⓘ
pub fn y_step_iter(&self, grid_size: f32) -> StepIterator ⓘ
Just like CurveTransform::x_step_iter but for y-coordinates.
Iterate through a list of y-coordinates across the width of the bounds.
The y-coordinates are in curve-space, but their distance apart should be
at least grid_size in screen-space.
This iterator indates where grid lines should be drawn to make a curve easier to read for the user.
Trait Implementations§
Source§impl Clone for CurveTransform
impl Clone for CurveTransform
Source§fn clone(&self) -> CurveTransform
fn clone(&self) -> CurveTransform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CurveTransform
impl Debug for CurveTransform
Source§impl Default for CurveTransform
impl Default for CurveTransform
Source§fn default() -> CurveTransform
fn default() -> CurveTransform
Auto Trait Implementations§
impl Freeze for CurveTransform
impl RefUnwindSafe for CurveTransform
impl Send for CurveTransform
impl Sync for CurveTransform
impl Unpin for CurveTransform
impl UnwindSafe for CurveTransform
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult 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
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>
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>
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)
&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)
&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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> ScriptMessagePayload for T
impl<T> ScriptMessagePayload for T
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self as &dyn AnySource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self as &dyn AnySource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.