Struct ambient_ui::clickarea::ClickArea
source · pub struct ClickArea {
pub inner: Element,
pub on_mouse_enter: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>,
pub on_mouse_leave: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>,
pub on_mouse_hover: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>,
pub on_mouse_input: Vec<Cb<dyn Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send>>,
pub on_mouse_wheel: Vec<Cb<dyn Fn(&mut World, EntityId, Vec2, bool) + Sync + Send>>,
}
Expand description
An area that tracks mouse events.
Fields§
§inner: Element
The inner element.
on_mouse_enter: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>
Callback for when the mouse enters the area.
on_mouse_leave: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>
Callback for when the mouse leaves the area.
on_mouse_hover: Vec<Cb<dyn Fn(&mut World, EntityId) + Sync + Send>>
Callback for when the mouse hovers over the area.
on_mouse_input: Vec<Cb<dyn Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send>>
Callback for when a mouse button is.
on_mouse_wheel: Vec<Cb<dyn Fn(&mut World, EntityId, Vec2, bool) + Sync + Send>>
Callback for when the mouse wheel is scrolled.
Implementations§
source§impl ClickArea
impl ClickArea
sourcepub fn on_mouse_hover<F: Fn(&mut World, EntityId) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_hover<F: Fn(&mut World, EntityId) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when the mouse hovers over the area.
sourcepub fn on_mouse_enter<F: Fn(&mut World, EntityId) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_enter<F: Fn(&mut World, EntityId) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when the mouse enters the area.
sourcepub fn on_mouse_leave<F: Fn(&mut World, EntityId) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_leave<F: Fn(&mut World, EntityId) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when the mouse leaves the area.
sourcepub fn on_mouse_input<F: Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_input<F: Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when a mouse button is pressed or released.
sourcepub fn on_mouse_wheel<F: Fn(&mut World, EntityId, Vec2, bool) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_wheel<F: Fn(&mut World, EntityId, Vec2, bool) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when the mouse wheel is scrolled.
sourcepub fn on_mouse_down<F: Fn(&mut World, EntityId, MouseButton) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_down<F: Fn(&mut World, EntityId, MouseButton) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when a mouse button is pressed.
sourcepub fn on_mouse_up<F: Fn(&mut World, EntityId, MouseButton) + Sync + Send + 'static>(
self,
handle: F
) -> Self
pub fn on_mouse_up<F: Fn(&mut World, EntityId, MouseButton) + Sync + Send + 'static>( self, handle: F ) -> Self
Set the callback for when a mouse button is released.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ClickArea
impl Send for ClickArea
impl Sync for ClickArea
impl Unpin for ClickArea
impl !UnwindSafe for ClickArea
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for T
impl<T> Downcast for T
source§impl<T> ElementComponentExt for Twhere
T: ElementComponent + 'static,
impl<T> ElementComponentExt for Twhere
T: ElementComponent + 'static,
source§impl<T> ElementComponentName for T
impl<T> ElementComponentName for T
source§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing ElementComponent.