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

Make a Tooltip class #9864

Open
Amazinite opened this issue Feb 25, 2024 · 0 comments
Open

Make a Tooltip class #9864

Amazinite opened this issue Feb 25, 2024 · 0 comments
Labels
refactor A request to refactor the engine code

Comments

@Amazinite
Copy link
Collaborator

Problem Description

Tooltips exist in a few different UI panels in the game, but the code for the creation of tooltips is currently custom to each UI panel that has them. Tooltip code currently exists in ShopPanel, ItemInfoDisplay, PreferencesPanel, MissionPanel, and LoadPanel, and there are slight differences between each of them.

Having a Tooltip class would make adding tooltips to new locations simpler.

Related Issue Links

#9825 Noticed this while adding a new tooltip to the shop.

Desired Solution

Create a Tooltip class that controls the drawing of a tooltip. Tooltips would have a max width, but automatically resize to account for shorter text. They could follow the mouse, or appear at a set location like how the ship check warnings in the outfitter/shipyard work. We could also control whether they display to the left or the right of the drawing location by default, with shared code handling cases where a tooltip may run off the edge of the screen and need to move its location.

The Tooltip class could also be in charge of the hover zone where tooltips should appear, and the hover timer for when they should appear, instead of each class that implement tooltips needing to keep track of where and when to display them.

Alternative Approaches

N/A

Additional Context

No response

@Amazinite Amazinite added the refactor A request to refactor the engine code label Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A request to refactor the engine code
Projects
None yet
Development

No branches or pull requests

1 participant