notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit eb9d1adc01f68cc31f363001b184785537195ed5
parent e1ec8ae64aa6ad5fce7c18e36ac515e51aae5d32
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 26 Jan 2026 08:53:12 -0800

header: fix auto-hide regression in narrow mode

The previous commit (e1ec8ae64) incorrectly mapped "negligible animation
value" to "skip animation" which caused the header to snap back to full
size when the hide animation completed, breaking auto-hide in narrow mode.

Fix by making header_anim return Option<HeaderAnim>:
- Wide mode: Some(base) - always show full header
- Narrow + negligible: None - don't render (restores original behavior)
- Narrow + animating: Some(scaled) - animate normally

Fixes: e1ec8ae64aa6 ("header: skip hide animation on wide screens")
Signed-off-by: William Casarin <jb55@jb55.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_columns/src/ui/column/header.rs | 19+++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/crates/notedeck_columns/src/ui/column/header.rs b/crates/notedeck_columns/src/ui/column/header.rs @@ -48,25 +48,28 @@ fn toolbar_visibility_amount(ui: &mut egui::Ui) -> f32 { .animate_bool_responsive(toolbar_visible_id.with("anim"), toolbar_visible) } -fn header_anim(ui: &mut egui::Ui) -> HeaderAnim { +fn header_anim(ui: &mut egui::Ui) -> Option<HeaderAnim> { let base_padding = 8.0; let base_height = 48.0; let navbar_anim = toolbar_visibility_amount(ui); let is_wide = !notedeck::ui::is_narrow(ui.ctx()); - let anim_is_negligible = navbar_anim < 0.01; - let skip_animation = is_wide || anim_is_negligible; - if skip_animation { - HeaderAnim { + if is_wide { + // Wide mode: no animation, always show full header + Some(HeaderAnim { padding: base_padding, height: base_height, - } + }) + } else if navbar_anim < 0.01 { + // Narrow mode with negligible visibility: don't render + None } else { + // Narrow mode: animate let height = base_height * navbar_anim; let padding = base_padding * navbar_anim; - HeaderAnim { padding, height } + Some(HeaderAnim { padding, height }) } } @@ -101,7 +104,7 @@ impl<'a> NavTitle<'a> { // On mobile, animate navbar visibility in sync with the toolbar // (toolbar_visible is set in render_damus_mobile based on scroll direction) - let anim = header_anim(ui); + let anim = header_anim(ui)?; notedeck_ui::padding(anim.padding, ui, |ui| { let mut rect = ui.available_rect_before_wrap();