Skip to main content

Module draw

Module draw 

Source
Expand description

fill_rect and thumb_geometry/offset_for_pos: the handful of things genuinely useful as standalone functions rather than Widgets.

fill_rect is a one-shot fill with no configuration worth building. thumb_geometry/offset_for_pos are pure position/size arithmetic with no Terminal involved, reused for hit-testing independently of drawing a Scrollbar.

Everything else that used to live here (panel, modal, progress_bar, print_line, log, gauge, stat_bar, sparkline, table, meter_ramp, scrollbar) is now a Widget (or StatefulWidget) struct under widget, one file each, so there’s a single way to draw each of them instead of a free function and a builder both doing the same thing.

Functions§

fill_rect
Fill rect with ch in the given style.
offset_for_pos
The offset a vertical scrollbar should jump to for a click/drag at pos.
thumb_geometry
The thumb’s row span within area ((start, len), both relative to area.top()) for a vertical scrollbar covering total_len items in a visible_len-row viewport currently starting at offset.