Struct ambient_api::prelude::ClickArea
source · pub struct ClickArea {
pub inner: Element,
pub on_mouse_enter: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>,
pub on_mouse_leave: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>,
pub on_mouse_hover: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>,
pub on_mouse_input: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send>>>,
pub on_mouse_wheel: Vec<Arc<CbDebuggable<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<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>
Callback for when the mouse enters the area.
on_mouse_leave: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>
Callback for when the mouse leaves the area.
on_mouse_hover: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId) + Sync + Send>>>
Callback for when the mouse hovers over the area.
on_mouse_input: Vec<Arc<CbDebuggable<dyn Fn(&mut World, EntityId, MouseInput, MouseButton) + Sync + Send>>>
Callback for when a mouse button is.
on_mouse_wheel: Vec<Arc<CbDebuggable<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>(self, handle: F) -> ClickArea
pub fn on_mouse_hover<F>(self, handle: F) -> ClickArea
Set the callback for when the mouse hovers over the area.
sourcepub fn on_mouse_enter<F>(self, handle: F) -> ClickArea
pub fn on_mouse_enter<F>(self, handle: F) -> ClickArea
Set the callback for when the mouse enters the area.
sourcepub fn on_mouse_leave<F>(self, handle: F) -> ClickArea
pub fn on_mouse_leave<F>(self, handle: F) -> ClickArea
Set the callback for when the mouse leaves the area.
sourcepub fn on_mouse_input<F>(self, handle: F) -> ClickArea
pub fn on_mouse_input<F>(self, handle: F) -> ClickArea
Set the callback for when a mouse button is pressed or released.
sourcepub fn on_mouse_wheel<F>(self, handle: F) -> ClickArea
pub fn on_mouse_wheel<F>(self, handle: F) -> ClickArea
Set the callback for when the mouse wheel is scrolled.
sourcepub fn on_mouse_down<F>(self, handle: F) -> ClickArea
pub fn on_mouse_down<F>(self, handle: F) -> ClickArea
Set the callback for when a mouse button is pressed.
sourcepub fn on_mouse_up<F>(self, handle: F) -> ClickArea
pub fn on_mouse_up<F>(self, handle: F) -> ClickArea
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.