Skip to main content

PointerOwnership

Enum PointerOwnership 

Source
pub enum PointerOwnership {
    Elsewhere,
    Inside,
    Owned,
    Grabbed,
}
Expand description

Who owns the pointer for this frame, as the application’s own routing decided.

The application hit-tests its widgets, resolves its z-order, and honours any gesture already in flight; the result is one of these. The viewport never makes this decision (it cannot see the application’s widgets), it only acts on it.

Two questions hide behind the one word “hovered”, and this separates them: whether the pointer is geometrically inside the viewport, and whether the viewport won the input. Chrome drawn over a viewport makes the second false while the first stays true, which is the Inside case and the one most easily missed.

Variants§

§

Elsewhere

The pointer is outside the viewport and no gesture of ours is in flight.

§

Inside

The pointer is inside the viewport’s rect, but something drawn over it owns the input this frame: a tool button, a gizmo handle, an open menu.

Ambient events still reach the viewport, so the wheel keeps zooming while the cursor is over a tool handle. Contested ones do not, so a press on that handle is not also a press on the scene behind it.

§

Owned

The viewport owns the input this frame; everything reaches it.

§

Grabbed

The pointer is grabbed by the viewport, as for mouselook. Everything reaches it, hover has no meaning, and ViewportEvent::PointerLeft is suppressed: a grabbed pointer has no rect to leave, and the event releases every held button, which would end the session.

Implementations§

Source§

impl PointerOwnership

Source

pub fn pointer_inside(self) -> bool

Whether the pointer is geometrically inside the viewport. True for every state except Elsewhere. Gates the wheel and the trackpad gestures.

Source

pub fn owns_input(self) -> bool

Whether the viewport won the input this frame. True for Owned and Grabbed. Gates contested events (see ViewportEvent::is_contested).

Trait Implementations§

Source§

impl Clone for PointerOwnership

Source§

fn clone(&self) -> PointerOwnership

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 PointerOwnership

Source§

impl Debug for PointerOwnership

Source§

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

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

impl Default for PointerOwnership

Source§

fn default() -> PointerOwnership

Returns the “default value” for a type. Read more
Source§

impl Eq for PointerOwnership

Source§

impl Hash for PointerOwnership

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PointerOwnership

Source§

fn eq(&self, other: &PointerOwnership) -> 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 PointerOwnership

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.