Struct SelectionHandles
pub struct SelectionHandles {
pub bounds: Rect,
pub angle: f64,
/* private fields */
}Expand description
The frame around a selection, in content coordinates: bounds turned by
angle about its centre.
Fields§
§bounds: Rect§angle: f64Radians, clockwise on a y-down canvas.
Implementations§
§impl SelectionHandles
impl SelectionHandles
pub fn new(bounds: Rect, metrics: &Metrics) -> SelectionHandles
pub fn new(bounds: Rect, metrics: &Metrics) -> SelectionHandles
The frame around bounds, its handles as easy to hit as any control
under metrics.
pub fn with_edges(self) -> SelectionHandles
pub fn with_edges(self) -> SelectionHandles
Offer the edge handles however small the frame is on screen, for a one-axis resize that must always be there (a crop, a text box’s width).
pub fn without_rotation(self) -> SelectionHandles
pub fn without_rotation(self) -> SelectionHandles
No rotation handle: for what cannot turn (a crop, a clip, a frame aligned to its page).
pub fn turned(self, angle: f64) -> SelectionHandles
pub fn turned(self, angle: f64) -> SelectionHandles
The same frame turned by angle radians about its centre.
pub fn orientation(&self) -> Affine
pub fn orientation(&self) -> Affine
Frame space to content space.
pub fn handles(&self, zoom: f64) -> impl Iterator<Item = Handle>
pub fn handles(&self, zoom: f64) -> impl Iterator<Item = Handle>
The handles that can be grabbed at zoom, the rotation handle first.
pub fn position(&self, handle: Handle, zoom: f64) -> Point
pub fn position(&self, handle: Handle, zoom: f64) -> Point
Where handle sits in content coordinates at zoom.
pub fn handle_at(&self, point: Point, zoom: f64) -> Option<Handle>
pub fn handle_at(&self, point: Point, zoom: f64) -> Option<Handle>
The handle under point (content coordinates), if any.
pub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
Whether point (content coordinates) is inside the frame.
pub fn scale_for(&self, handle: Handle, from: Point, to: Point) -> (f64, Point)
pub fn scale_for(&self, handle: Handle, from: Point, to: Point) -> (f64, Point)
The uniform scale a drag of handle from from to to asks of an
upright frame, about the opposite corner, and that corner. Never
below a tenth. Self::stretch_for answers a turned frame.
pub fn resize_for(
&self,
handle: Handle,
from: Point,
to: Point,
) -> (f64, f64, Point)
pub fn resize_for( &self, handle: Handle, from: Point, to: Point, ) -> (f64, f64, Point)
The scale on each axis a drag of handle from from to to asks
of an upright frame, about the opposite corner or edge, and that
anchor: a corner scales both axes alike, an edge only its own. Never
below a tenth.
pub fn stretch_for(
&self,
handle: Handle,
_: (Point, Point),
keep_aspect: bool,
from_centre: bool,
) -> Affine
pub fn stretch_for( &self, handle: Handle, _: (Point, Point), keep_aspect: bool, from_centre: bool, ) -> Affine
The resize a drag of handle from from to to asks for, as an
affine in content space. The opposite side stays still, or the centre
with from_centre; keep_aspect scales both ways alike. A drag past
the anchor flips; the frame never collapses below half a unit.
pub fn rotation_for(&self, from: Point, to: Point, snap: bool) -> f64
pub fn rotation_for(&self, from: Point, to: Point, snap: bool) -> f64
The rotation in degrees, clockwise, a drag of the rotation handle from
from to to asks for about the centre; with snap, the frame’s
resulting angle lands on steps of 15.
pub fn rotation_affine(&self, from: Point, to: Point, snap: bool) -> Affine
pub fn rotation_affine(&self, from: Point, to: Point, snap: bool) -> Affine
The rotation a drag asks for, as an affine about the frame’s centre.
pub fn draw(
&self,
scene: &mut Scene,
to_screen: Affine,
zoom: f64,
theme: &Theme,
)
pub fn draw( &self, scene: &mut Scene, to_screen: Affine, zoom: f64, theme: &Theme, )
Draw the frame and its handles; to_screen maps content to screen.
pub fn draw_moved(
&self,
scene: &mut Scene,
to_screen: Affine,
preview: Affine,
zoom: f64,
theme: &Theme,
)
pub fn draw_moved( &self, scene: &mut Scene, to_screen: Affine, preview: Affine, zoom: f64, theme: &Theme, )
Draw the frame as preview (content space) carries it during a
drag: the outline follows the preview, the grips stay upright and
the same size on screen.
pub fn moved(&self, offset: Vec2) -> SelectionHandles
pub fn moved(&self, offset: Vec2) -> SelectionHandles
The frame moved by offset, as during a drag.
Trait Implementations§
§impl Clone for SelectionHandles
impl Clone for SelectionHandles
§fn clone(&self) -> SelectionHandles
fn clone(&self) -> SelectionHandles
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for SelectionHandles
impl Debug for SelectionHandles
§impl PartialEq for SelectionHandles
impl PartialEq for SelectionHandles
§fn eq(&self, other: &SelectionHandles) -> bool
fn eq(&self, other: &SelectionHandles) -> bool
self and other values to be equal, and is used by ==.impl Copy for SelectionHandles
impl StructuralPartialEq for SelectionHandles
Auto Trait Implementations§
impl Freeze for SelectionHandles
impl RefUnwindSafe for SelectionHandles
impl Send for SelectionHandles
impl Sync for SelectionHandles
impl Unpin for SelectionHandles
impl UnsafeUnpin for SelectionHandles
impl UnwindSafe for SelectionHandles
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
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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