pub enum Rotation {
None,
Cw90,
Cw180,
Cw270,
}Expand description
How far the UI is turned clockwise on its way to the window.
A quarter turn trades the screen’s width and height, so egui lays out for a portrait screen on a landscape panel (and the other way round). Pointer and touch positions travel back the same way, so a tap lands where it looks.
Variants§
None
Cw90
A quarter turn clockwise: the screen’s top edge runs down the window’s right side.
Cw180
Upside down, for a panel mounted that way.
Cw270
A quarter turn anticlockwise: the screen’s top edge runs up the window’s left side.
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub fn quarter_turns(self) -> u8
pub fn quarter_turns(self) -> u8
Quarter turns clockwise, 0 to 3.
Sourcepub fn from_quarter_turns(turns: i32) -> Self
pub fn from_quarter_turns(turns: i32) -> Self
Wrapping, and negative turns count anticlockwise, so callers may add turns without normalising first.
Sourcepub fn swaps_axes(self) -> bool
pub fn swaps_axes(self) -> bool
Whether width and height trade places.
Sourcepub fn screen_size(self, window: Vec2) -> Vec2
pub fn screen_size(self, window: Vec2) -> Vec2
The screen egui lays out for, inside a window of window.
Sourcepub fn to_window(self, p: Pos2, window: Vec2) -> Pos2
pub fn to_window(self, p: Pos2, window: Vec2) -> Pos2
Where a point of the turned screen lands in the window. window is the
window’s size in the same unit as p — points for geometry egui laid
out, pixels for a frame being presented.
Sourcepub fn from_window(self, p: Pos2, window: Vec2) -> Pos2
pub fn from_window(self, p: Pos2, window: Vec2) -> Pos2
Where a point of the window falls in the turned screen — the way pointer input travels.
Sourcepub fn rect_to_window(self, rect: Rect, window: Vec2) -> Rect
pub fn rect_to_window(self, rect: Rect, window: Vec2) -> Rect
A quarter turn maps an axis-aligned rect onto another one, so a clip rect survives the trip.
Sourcepub fn turn_primitives(self, jobs: &mut [ClippedPrimitive], window: Vec2)
pub fn turn_primitives(self, jobs: &mut [ClippedPrimitive], window: Vec2)
Turn a tessellated frame into window space, for backends that put their
geometry on screen as it comes. window is the window’s size in points.
Paint callbacks are moved but not turned: what they draw is the app’s own, out of reach here.
Trait Implementations§
impl Copy for Rotation
impl Eq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnsafeUnpin for Rotation
impl UnwindSafe for Rotation
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt 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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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