I use on_gui_hover and on_gui_leave for custom tooltips - hover creates them, leave hides them.
Since 2.0 this doesn't work, because while both events are called on the same tick, on_gui_hover is called first, so on_gui_leave immediately hides a newly created tooltip. Which is a bit suboptimal.
Video demonstration:
Expected behaviour:
- on_gui_leave called before on_gui_hover when switching between touching elements.
[2.0.9] on_gui_leave is called after on_gui_hover when switching between touching elements
-
- Manual Inserter
- Posts: 1
- Joined: Thu Oct 03, 2024 11:28 am
- Contact:
Re: [2.0.9] on_gui_leave is called after on_gui_hover when switching between touching elements
Thanks for the report. I looked into the widget logic and it looks like it has worked that way from what I can tell since over 6 years ago (?) which makes no sense to me if you say this was not happening in 1.1. But, I also didn't verify the behavior in 1.1. What I can do is offer a solution for your use-case:
Just track what the last hovered widget is and when on_gui_leave is called if it's not for your currently hovered widget, ignore it. on_gui_hover you move the tooltip to that element and on_gui_leave you remove it, if it's the one last hovered.
Just track what the last hovered widget is and when on_gui_leave is called if it's not for your currently hovered widget, ignore it. on_gui_hover you move the tooltip to that element and on_gui_leave you remove it, if it's the one last hovered.
If you want to get ahold of me I'm almost always on Discord.