MoonZoon icon indicating copy to clipboard operation
MoonZoon copied to clipboard

fix extra triggering mouse leave on child elements

Open databasedav opened this issue 3 years ago • 2 comments

copied from pointer_event_aware

discussion starts here

databasedav avatar Jul 17 '22 23:07 databasedav

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 :)

MartinKavik avatar Jul 18 '22 16:07 MartinKavik

(Also please rename the commit, I rebase PRs and fix is too general, thanks!)

MartinKavik avatar Jul 18 '22 16:07 MartinKavik

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

databasedav avatar Oct 26 '22 06:10 databasedav

potentially relevant thread from Pauan https://discord.com/channels/716581000800632853/716581000800632856/1147724389115232286, .on_hovered_change uses MouseLeave, but uses MouseOver instead of MouseEnter

databasedav avatar Sep 03 '23 06:09 databasedav

Closing in favor of PR https://github.com/MoonZoon/MoonZoon/pull/183

MartinKavik avatar Sep 08 '23 21:09 MartinKavik