Skip to content

Commit 0298966

Browse files
committed
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 <[email protected]>
1 parent bc5ff48 commit 0298966

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/timeline.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
9999
let textmode = app.textmode;
100100
let note_ui = ui::Note::new(app, &note).note_previews(!textmode);
101101
ui.add(note_ui);
102-
ui.add(egui::Separator::default().spacing(0.0));
102+
ui::hline(ui);
103+
//ui.add(egui::Separator::default().spacing(0.0));
103104

104105
1
105106
});

src/ui/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ pub fn padding<R>(
3939
.show(ui, add_contents)
4040
}
4141

42+
pub fn hline(ui: &egui::Ui) {
43+
// pixel perfect horizontal line
44+
let rect = ui.available_rect_before_wrap();
45+
let resize_y = ui.painter().round_to_pixel(rect.top()) - 0.5;
46+
let stroke = ui.style().visuals.widgets.noninteractive.bg_stroke;
47+
ui.painter().hline(rect.x_range(), resize_y, stroke);
48+
}
49+
4250
#[inline]
4351
#[allow(unreachable_code)]
4452
pub fn is_mobile(_ctx: &egui::Context) -> bool {

0 commit comments

Comments
 (0)