#[non_exhaustive]pub struct TransformDelta {
pub pivot: Point,
pub basis: f32,
pub scale: Vec2,
pub rotation: f32,
pub translation: Vec2,
}Expand description
What one in-flight gesture asks of the selection, stated once in scene coordinates.
The preview paints it, the commit applies it, the scene’s geometry constraint rewrites it and the announcement describes it — so those four can never disagree.
The affine it denotes is, innermost first: move the pivot to the origin,
rotate into the frame’s basis, scale, rotate back out, rotate by
rotation, move the pivot back, translate. The scale is
therefore taken along the frame’s own axes, which is what makes a
rotated single-item frame resize exactly rather than shear.
#[non_exhaustive]: the crate hands this to consumer code — a
ProposedChange reads it and
TransformConfig::on_end records it — and the affine it denotes may grow
a term. Build one with new, IDENTITY or
between; the fields stay public and assignable.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pivot: PointScene-space point every scale and rotation is taken about.
basis: f32The frame’s angle, in radians — the basis the scale is
expressed in.
scale: Vec2Multiplier along the frame’s axes. Never negative: a resize stops at
the controller’s min_size rather than mirroring, because a
negative-extent Rect is silently un-hit-testable and un-indexable.
rotation: f32Additive rotation, in radians.
translation: Vec2Scene-space translation, applied last.
Implementations§
Source§impl TransformDelta
impl TransformDelta
Sourcepub fn new(
pivot: Point,
basis: f32,
scale: Vec2,
rotation: f32,
translation: Vec2,
) -> Self
pub fn new( pivot: Point, basis: f32, scale: Vec2, rotation: f32, translation: Vec2, ) -> Self
A delta stated field by field — the constructor
#[non_exhaustive] takes the place of a struct literal for.
The one an app reaches for to apply a programmatic transform through
Scene::apply_transform_delta
without driving a gesture. See the type’s own documentation for the
order the five terms compose in.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Whether applying this delta would leave every item where it is.
Sourcepub fn to_scene_transform(&self) -> Transform2D
pub fn to_scene_transform(&self) -> Transform2D
The scene-space affine this delta denotes.
Sourcepub fn between(
start: &TransformFrame,
end: &TransformFrame,
pivot: Point,
) -> Self
pub fn between( start: &TransformFrame, end: &TransformFrame, pivot: Point, ) -> Self
The delta that takes start to end about pivot.
The inverse of frame_after, and the reason a
geometry constraint can hand back an adjusted
frame and have the applied delta follow it exactly.
Sourcepub fn frame_after(&self, start: &TransformFrame) -> TransformFrame
pub fn frame_after(&self, start: &TransformFrame) -> TransformFrame
The frame start becomes under this delta.
Trait Implementations§
Source§impl Clone for TransformDelta
impl Clone for TransformDelta
Source§fn clone(&self) -> TransformDelta
fn clone(&self) -> TransformDelta
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TransformDelta
Source§impl Debug for TransformDelta
impl Debug for TransformDelta
Source§impl PartialEq for TransformDelta
impl PartialEq for TransformDelta
impl StructuralPartialEq for TransformDelta
Auto Trait Implementations§
impl Freeze for TransformDelta
impl RefUnwindSafe for TransformDelta
impl Send for TransformDelta
impl Sync for TransformDelta
impl Unpin for TransformDelta
impl UnsafeUnpin for TransformDelta
impl UnwindSafe for TransformDelta
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq 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
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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 more