[2.0.9] on_gui_leave is called after on_gui_hover when switching between touching elements

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
GlumGlimmer
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Oct 03, 2024 11:28 am
Contact:

[2.0.9] on_gui_leave is called after on_gui_hover when switching between touching elements

Post by GlumGlimmer »

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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14800
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.9] on_gui_leave is called after on_gui_hover when switching between touching elements

Post by Rseding91 »

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.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Minor issues”