Merge pull request #587 from nathansgithub/location-toggle-improvements

Update location edit selection behavior
This commit is contained in:
Jeremy Soller 2024-10-14 12:02:48 -06:00 committed by GitHub
commit 55724cb488
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 8 deletions

View file

@ -153,7 +153,7 @@ impl Action {
Action::DesktopViewOptions => Message::DesktopViewOptions,
Action::EditHistory => Message::ToggleContextPage(ContextPage::EditHistory),
Action::EditLocation => {
Message::TabMessage(entity_opt, tab::Message::EditLocationToggle)
Message::TabMessage(entity_opt, tab::Message::EditLocationEnable)
}
Action::ExtractHere => Message::ExtractHere(entity_opt),
Action::Gallery => Message::TabMessage(entity_opt, tab::Message::GalleryToggle),
@ -1550,6 +1550,11 @@ impl Application for App {
return Command::none();
}
if tab.edit_location.is_some() {
tab.edit_location = None;
return Command::none();
}
let had_focused_button = tab.select_focus_id().is_some();
if tab.select_none() {
if had_focused_button {
@ -2937,6 +2942,12 @@ impl Application for App {
// Tracks which nav bar item to show a context menu for.
Message::NavBarContext(entity) => {
// Close location editing if enabled
let tab_entity = self.tab_model.active();
if let Some(tab) = self.tab_model.data_mut::<Tab>(tab_entity) {
tab.edit_location = None;
}
self.nav_bar_context_id = entity;
}