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 a Popup Location property to MenuButton #11439

Open
RobertBColton opened this issue Dec 29, 2024 · 2 comments
Open

Add a Popup Location property to MenuButton #11439

RobertBColton opened this issue Dec 29, 2024 · 2 comments

Comments

@RobertBColton
Copy link

Describe the project you are working on

It's top secret, but heavily UI based with trees of nested menus.

Describe the problem or limitation you are having in your project

MenuButtons on my bottom toolbar appear over top of the mouse position instead of above the button.

This is sort of an issue with the Godot editor too.
In Qt and other frameworks this doesn't happen if say we're at the bottom of the screen. It will push it up like Godot, but also push it above the button/control so its not covering the control.
Qt Tooltip Offscreen

Describe the feature / enhancement and how it helps to overcome the problem or limitation

MenuButton should have a "popup_location" property like other frameworks that lets you set the default popup location. Also, none of the modes should ever allow the popup to cover its parent that showed it by default, unless it absolutely has too.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

There would be a "popup_location" property on MenuButton, with current BELOW behavior the default. When the popup is about to show it will take the enum into account.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It's hacky but the only way I found was to calculate it myself and set the popup menu location in _process.

Is there a reason why this should be core and not an add-on in the asset library?

Yes, it's very important to have normal popup menus that don't get in the way. Toolbars in game UI aren't always at the top of the screen. It's kind of an issue in the Godot editor too where tooltips appear right under the mouse.

@Calinou
Copy link
Member

Calinou commented Jan 2, 2025

Can't we just change the default behavior so the popup doesn't overlap the MenuButton anymore unless it has to? I would prefer this over adding an extra opt-in property that just ensures we match Qt's usability here.

@Calinou Calinou changed the title Feature: MenuButton Popup Location Property Add a Popup Location property to MenuButton Jan 2, 2025
@RobertBColton
Copy link
Author

RobertBColton commented Jan 2, 2025

I'd be ok with that as long as it recognizes also to put left anchored button tooltips to the right and vice versa just like bottom toolbars should be above. In other words, AUTO should move the tooltip inwards opposite the direction of the screen edge until it no longer covers the control.

The only exception is OptionButton (the combo control), although I don't personally need it, I can see some people wanting to use a combo with up/left/right arrow instead of simply a down arrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants