Skip to main content

Edge

Enum Edge 

Source
pub enum Edge {
    Left,
    Right,
    Top,
    Bottom,
}
Expand description

Which side of a window was grabbed.

Not an axis, and the difference is the whole of #120. A window that is the right-hand child of a vertical split has that split’s seam on its left. Dragging its left edge moves that seam; dragging its right edge must find a different seam, or none at all. An axis cannot tell those two apart, so a layout handed only “horizontal” moves whichever seam the walk to the root meets first — which for a right-edge drag is the seam on the far side, and the window’s left edge then jumps while the edge under the pointer sits still. Measured: the slot’s x moved 209px in one frame while its width did not change at all.

The compositor has known the side all along — ResizeEdge in state.rs, which the floating path already uses — and reduced it to a pair of booleans on the way to the layout.

Variants§

§

Left

The low-x side, which a vertical split’s seam bounds from the left.

§

Right

The high-x side.

§

Top

The low-y side, which a horizontal split’s seam bounds from above.

§

Bottom

The high-y side.

Implementations§

Source§

impl Edge

Source

pub const fn axis(self) -> Axis

The axis a seam along this side is cut on.

Source

const fn child(self) -> usize

Which child of a split has that split’s seam on this side.

A split’s seam lies between its two children, so the child that has the seam on its left — or above it — is the second one, and the child that has it on its right or below is the first. This single index is what turns “a branch cut the right way” into “the branch whose seam is actually under the pointer”.

Trait Implementations§

Source§

impl Clone for Edge

Source§

fn clone(&self) -> Edge

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Edge

Source§

impl Debug for Edge

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Edge

Source§

impl PartialEq for Edge

Source§

fn eq(&self, other: &Edge) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Edge

Auto Trait Implementations§

§

impl Freeze for Edge

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl Sync for Edge

§

impl Unpin for Edge

§

impl UnsafeUnpin for Edge

§

impl UnwindSafe for Edge

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.