Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback for when a submenu is opened #6439

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

nekodex
Copy link
Contributor

@nekodex nekodex commented Nov 28, 2024

To be used by lazer for improved menu audio feedback (ppy/osu#30910)

Comment on lines +586 to +588
// Check if submenu has changed before firing, to prevent extraneous callbacks (e.g. re-hovering the triggeringItem of an already open submenu)
if (submenuChanged)
OnSubmenuOpen?.Invoke(submenu);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like you want to be triggering this event inside the conditional above in the else branch where the submenu was closed and becomes open?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that submenu gets reused (assumedly as an optimisation?), so in some cases the state is already set to 'open' and the item list just gets updated (e.g. switching between menus in EditorMenuBar)

@peppy peppy self-requested a review December 4, 2024 07:53
@peppy peppy merged commit 648fb69 into ppy:master Dec 4, 2024
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants