notedeck

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

commit ade6f57fd5c6d1d26b7d62bd2770e4d62514669b
parent e8444f10b37cbd93f00469a76bec264ac2342768
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 11 Jul 2025 14:21:26 -0700

anim: animate show/hide of compose button

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mcrates/notedeck_columns/src/app.rs | 24+++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/crates/notedeck_columns/src/app.rs b/crates/notedeck_columns/src/app.rs @@ -542,7 +542,7 @@ fn render_damus_mobile( ) -> Option<AppAction> { //let routes = app.timelines[0].routes.clone(); - let mut rect = ui.available_rect_before_wrap(); + let rect = ui.available_rect_before_wrap(); let mut app_action: Option<AppAction> = None; let active_col = app.columns_mut(app_ctx.accounts).selected as usize; @@ -570,13 +570,29 @@ fn render_damus_mobile( } } + hovering_post_button(ui, app, app_ctx, rect); + + app_action +} + +fn hovering_post_button( + ui: &mut egui::Ui, + app: &mut Damus, + app_ctx: &mut AppContext, + mut rect: egui::Rect, +) { + let should_show_compose = should_show_compose_button(&app.decks_cache, app_ctx.accounts); + let btn_id = ui.id().with("hover_post_btn"); + let button_y = ui + .ctx() + .animate_bool_responsive(btn_id, should_show_compose); rect.min.x = rect.max.x - if is_narrow(ui.ctx()) { 60.0 } else { 100.0 }; - rect.min.y = rect.max.y - 100.0; + rect.min.y = rect.max.y - 100.0 * button_y; let darkmode = ui.ctx().style().visuals.dark_mode; // only show the compose button on profile pages and on home - if should_show_compose_button(&app.decks_cache, app_ctx.accounts) { + if should_show_compose { let compose_resp = ui.put(rect, ui::post::compose_note_button(darkmode)); if compose_resp.hovered() { notedeck_ui::show_pointer(ui); @@ -590,8 +606,6 @@ fn render_damus_mobile( ); } } - - app_action } /// Should we show the compose button? When in threads we should hide it, etc