Skip to main content

MouseTrackerAnnotation

Struct MouseTrackerAnnotation 

Source
pub struct MouseTrackerAnnotation {
    pub on_enter: Option<PointerEnterEventListener>,
    pub on_exit: Option<PointerExitEventListener>,
    pub cursor: MouseCursorRef,
    pub valid_for_mouse_tracker: bool,
}
Expand description

The annotation object used to annotate regions that are interested in mouse movements.

To use an annotation, return this object as a HitTestTarget in a hit test. Typically this is done using a RenderMouseRegion.

The MouseTracker uses this class as a label to filter the hit test results. Only hit test targets that have this annotation as their target will receive mouse events.

Dart’s constructor takes named optional arguments; write MouseTrackerAnnotation { on_enter: Some(..), ..Default::default() }.

Fields§

§on_enter: Option<PointerEnterEventListener>

Triggered when a mouse pointer, with or without buttons pressed, has entered the region and valid_for_mouse_tracker is true.

This callback is triggered when the pointer has started to be contained by the region, either due to a pointer event, or due to the movement or disappearance of the region. This method is always matched by a later on_exit.

§on_exit: Option<PointerExitEventListener>

Triggered when a mouse pointer, with or without buttons pressed, has exited the region and valid_for_mouse_tracker is true.

This callback is triggered when the pointer has stopped being contained by the region, either due to a pointer event, or due to the movement or disappearance of the region. This method always matches an earlier on_enter.

§cursor: MouseCursorRef

The mouse cursor for mouse pointers that are hovering over the region.

When a mouse enters the region, its cursor will be changed to the cursor. When the mouse leaves the region, the cursor will be set by the region found at the new location.

Defaults to MouseCursor.defer, deferring the choice of cursor to the next region behind it in hit-test order.

§valid_for_mouse_tracker: bool

Whether this is included when a MouseTracker collects the list of annotations.

If valid_for_mouse_tracker is false, this object is excluded from the current annotation list even if it’s included in the hit test, affecting mouse-related behavior such as enter events, exit events, and mouse cursors. The valid_for_mouse_tracker does not affect hit testing.

Defaults to true.

Trait Implementations§

Source§

impl Debug for MouseTrackerAnnotation

Source§

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

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

impl Default for MouseTrackerAnnotation

Source§

fn default() -> MouseTrackerAnnotation

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>