fix extra triggering mouse leave on child elements
Before I merge it - could you please check whether there isn't the same problem within the "true branch"? (Or why there is not?).
In other words - I'm just not quite sure why there is problem only with mouseleave and not with mouseover. And I don't remember clearly why I've chosen mouseover over mouseenter. It was and still is a bit messy so I would like to have it implemented correctly and another pair of eyes could help a lot here :)
(Also please rename the commit, I rebase PRs and fix is too general, thanks!)
this is no longer reproducible on main both
El::new()
.on_hovered_change(|is_hovered| eprintln!("{}", is_hovered))
.child(El::new().child("text"))
and
El::new()
.child(
El::new()
.on_hovered_change(|is_hovered| eprintln!("{}", is_hovered))
.child("text")
)
print true false as expected
but i found an adjacent issue with mouseenter, which retriggers on children e.g. hovering across this
El::new()
.s(Borders::all(Border::new()))
.s(Align::center())
.s(Padding::all(10))
.on_hovered_change(|is_hovered| println!("{}", is_hovered))
.child(El::new().child("text"))
prints true true true false, as opposed to true false as expected, also using the mouseleave strategy doesn't work ...
potentially relevant thread from Pauan https://discord.com/channels/716581000800632853/716581000800632856/1147724389115232286, .on_hovered_change uses MouseLeave, but uses MouseOver instead of MouseEnter
Closing in favor of PR https://github.com/MoonZoon/MoonZoon/pull/183