Support multiple tooltips for the same UI node
Opened this issue · 2 comments
For example, there might be a tooltip on the left and a tooltip on the right on hover.
In order to support this, the API should be adjusted to expect the Tooltip
component on children instead of on the parent. As a side effect, this will make rich text / fully custom tooltip support more natural; and it will allow the "hide animation" of a previous tooltip and the "show animation" of the next tooltip to overlap in time when switching between hovered nodes.
The "primary tooltip" theming feature could be replaced with a bundle? Like Tooltip::cursor("Hello").bundle()
. Not clear how the user could provide their own primary tooltip this way, though.
If tooltips are children, it'll be important to make sure they're set to PositionType::Absolute
during placement, and consider overflow clipping from the parent. Also it'll be important to ensure that the despawn/spawn trick that Blobo Party! does for the deck display doesn't regress to a 1-frame delay.
I've been thinking about implementing this:
Would you rather have one Tooltips(Vec<Tooltip>)
component, that onAdd adds all the children or should the user have to call .with_child(Tooltip::...)
for every tooltip they want to add?
Honestly I'm not sure. Ideally I'd like the single-tooltip API to remain the same or similar. Maybe replacing the current Tooltip
with a WithTooltip
component that adds the tooltip as a child entity, and WithTooltips
for multiple tooltips. Kind of like i-cant-believe-its-not-bsn's WithChild
and WithChildren
.