commit d06e790cd21261d79d6e10a6b3bbfd8b3e01b82d
parent edd71c1a2a50795d17889aaeb01cda31cef77a93
Author: William Casarin <jb55@jb55.com>
Date: Thu, 5 Dec 2024 13:29:52 -0800
column: only show delete button when not navigating
This is pretty confusing otherwise
Changelog-Changed: Only show column delete button when not navigating
Fixes: https://github.com/damus-io/notedeck/issues/548
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/ui/column/header.rs b/src/ui/column/header.rs
@@ -65,7 +65,7 @@ impl<'a> NavTitle<'a> {
let delete_button_resp =
self.title(ui, self.routes.last().unwrap(), back_button_resp.is_some());
- if delete_button_resp.clicked() {
+ if delete_button_resp.map_or(false, |r| r.clicked()) {
Some(RenderNavAction::RemoveColumn)
} else if back_button_resp.map_or(false, |r| r.clicked()) {
Some(RenderNavAction::Back)
@@ -203,19 +203,25 @@ impl<'a> NavTitle<'a> {
);
}
- fn title(&mut self, ui: &mut egui::Ui, top: &Route, right: bool) -> egui::Response {
+ fn title(
+ &mut self,
+ ui: &mut egui::Ui,
+ top: &Route,
+ navigating: bool,
+ ) -> Option<egui::Response> {
self.title_pfp(ui, top);
- if !right {
+ if !navigating {
self.title_label(ui, top);
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- let r = self.delete_column_button(ui, 32.0);
- if right {
+ if navigating {
self.title_label(ui, top);
+ None
+ } else {
+ Some(self.delete_column_button(ui, 32.0))
}
- r
})
.inner
}