ui: add hline_with_width

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-06-17 16:58:33 -04:00
parent 41c2c048a8
commit c3b8823f72

View File

@@ -46,12 +46,16 @@ pub fn padding<R>(
}
pub fn hline(ui: &egui::Ui) {
hline_with_width(ui, ui.available_rect_before_wrap().x_range());
}
pub fn hline_with_width(ui: &egui::Ui, range: egui::Rangef) {
// pixel perfect horizontal line
let rect = ui.available_rect_before_wrap();
#[allow(deprecated)]
let resize_y = ui.painter().round_to_pixel(rect.top()) - 0.5;
let stroke = ui.style().visuals.widgets.noninteractive.bg_stroke;
ui.painter().hline(rect.x_range(), resize_y, stroke);
ui.painter().hline(range, resize_y, stroke);
}
pub fn show_pointer(ui: &egui::Ui) {