mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-06 01:44:21 +01:00
ui: add feathering-resistant hline separator fn
"pixel-aligned" Separators get feathered into a blurry mess. This seems to help. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -99,7 +99,8 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
||||
let textmode = app.textmode;
|
||||
let note_ui = ui::Note::new(app, ¬e).note_previews(!textmode);
|
||||
ui.add(note_ui);
|
||||
ui.add(egui::Separator::default().spacing(0.0));
|
||||
ui::hline(ui);
|
||||
//ui.add(egui::Separator::default().spacing(0.0));
|
||||
|
||||
1
|
||||
});
|
||||
|
||||
@@ -39,6 +39,14 @@ pub fn padding<R>(
|
||||
.show(ui, add_contents)
|
||||
}
|
||||
|
||||
pub fn hline(ui: &egui::Ui) {
|
||||
// pixel perfect horizontal line
|
||||
let rect = ui.available_rect_before_wrap();
|
||||
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);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unreachable_code)]
|
||||
pub fn is_mobile(_ctx: &egui::Context) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user