Module tooltip
Expand description
Tooltip primitive — a small label revealed after a short hover delay.
on_hover_enter/on_hover_leave/tick drive the timing state so the
primitive is unit-testable without a winit event loop or a wall clock.
Structs§
- Tooltip
- Tooltip
Host - One controller owned by
crate::app::App— not one tooltip widget per control — is what makes tooltips work for every widget exposingWidget::tooltipwith zero per-app wiring, and guarantees at most one chip on screen. Timing is wall-clock through an injectednow: Instant, so it’s unit-testable.
Enums§
- Tooltip
Side - Which side of its control a tooltip prefers. A control in a row has its neighbours beside it, so its chip goes below; one in a vertical rail has them above and below, so its chip goes beside it, where it hides none of them.
Constants§
- DEFAULT_
DELAY - HOVER_
DWELL - Middle of the 400-600ms comfort band: shows help promptly on a deliberate hover without firing on a pointer merely passing through.
Functions§
- chip_
paint_ bounds - Every pixel
draw_chipcan paint for a chip atrect: the chip, its edge and snapping, and the floating shadow under it. - chip_
rect - Preferred placement is centred just below the anchor; flips above if that would spill past the bottom edge, and clamps to the bottom edge if neither side has room. Clamped horizontally too, so a control at the far edge gets a chip that hugs it instead of painting off-screen.
- chip_
rect_ on chip_recton the preferredsideof the anchor.- chip_
size - The chip’s size for
label: wrappedCaptiontext plus the chip’s pads. - chip_
size_ in_ viewport - Measure the complete hint at the width its viewport can actually hold.
- draw_
chip - The floating material every floating surface is made of (blurred where the renderer runs the backdrop pass, the opaque panel ground otherwise), with the panel edge, at the control radius: a tooltip is a small floating Panel, not a card.
- draw_
hover_ tooltip - Composes
chip_size,chip_rectanddraw_chip— the one callTooltipHostuses to render a tooltip. - draw_
hover_ tooltip_ on draw_hover_tooltipon the side of its anchor the control prefers.- hover_
chip_ rect_ on - Where
draw_hover_tooltip_onplaces the chip forlabel.