Tooltips would help players understand the usage of DFHack interface elements. Previous attempts at "tooltip-like" elements added text as a peer widget below the widget that they were annotating. This proved to be inflexible and it wasn't used outside of the gui/blueprint proof of concept.
Now that we have the overlay system, we have a mechanism for displaying ephemeral widgets outside the bounding box of the annotated widget, so we can have a lot more flexibility in how they are displayed and managed.
Here's an idea for an architecture:
gui.Widget gets a tooltip property, which can be in the format of the gui.Labeltext attribute
Add mouse hover detection to gui.Widget. when the mouse is hovered for a configurable delay, the tooltip is triggered. the value of the tooltip property and the global screen coordinates of the associated Widget are passed to the tooltips overlay.
the tooltips overlay hides any existing tooltip and then finds a screen position where it can display the given tooltip such that it is adjacent to the widget, near the mouse cursor, and still on-screen
the tooltips overlay monitors mouse position and hides the tooltip when the mouse moves off the associated widget
we don't have a keyboard-specific method of triggering tooltips, though. I'm not sure how that can be handled.
Tooltips would help players understand the usage of DFHack interface elements. Previous attempts at "tooltip-like" elements added text as a peer widget below the widget that they were annotating. This proved to be inflexible and it wasn't used outside of the
gui/blueprint
proof of concept.Now that we have the
overlay
system, we have a mechanism for displaying ephemeral widgets outside the bounding box of the annotated widget, so we can have a lot more flexibility in how they are displayed and managed.Here's an idea for an architecture:
gui.Widget
gets atooltip
property, which can be in the format of thegui.Label
text
attributegui.Widget
. when the mouse is hovered for a configurable delay, the tooltip is triggered. the value of thetooltip
property and the global screen coordinates of the associated Widget are passed to thetooltips
overlay.tooltips
overlay hides any existing tooltip and then finds a screen position where it can display the given tooltip such that it is adjacent to the widget, near the mouse cursor, and still on-screentooltips
overlay monitors mouse position and hides the tooltip when the mouse moves off the associated widgetwe don't have a keyboard-specific method of triggering tooltips, though. I'm not sure how that can be handled.