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
impl PointerOwnership
Sourcepub fn pointer_inside(self) -> bool
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.
Sourcepub fn owns_input(self) -> bool
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
impl Clone for PointerOwnership
Source§fn clone(&self) -> PointerOwnership
fn clone(&self) -> PointerOwnership
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more