widget event handling into macro

This commit is contained in:
galister
2025-06-21 21:13:33 +09:00
parent 9759dff8b9
commit cd05818465
8 changed files with 86 additions and 155 deletions

View File

@@ -147,7 +147,7 @@ pub fn construct(
// Highlight background on mouse enter
{
let button = button.clone();
widget.add_event_listener(EventListener::MouseEnter(Box::new(move |data| {
widget.add_event_listener(EventListener::MouseEnter(Box::new(move |data, _| {
data
.animations
.push(anim_hover_in(button.clone(), data.widget_id));
@@ -157,7 +157,7 @@ pub fn construct(
// Bring back old color on mouse leave
{
let button = button.clone();
widget.add_event_listener(EventListener::MouseLeave(Box::new(move |data| {
widget.add_event_listener(EventListener::MouseLeave(Box::new(move |data, _| {
data
.animations
.push(anim_hover_out(button.clone(), data.widget_id));
@@ -165,4 +165,4 @@ pub fn construct(
}
Ok(button)
}
}