Gallery view (#488)

* WIP: gallery view

* Adjust gallery view to design

* Update dialog to better match gallery design
This commit is contained in:
Jeremy Soller 2024-09-23 15:56:32 -06:00 committed by GitHub
parent eda1189f08
commit 7b2e448947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 216 additions and 61 deletions

View file

@ -1360,6 +1360,14 @@ impl Application for App {
return Command::none();
}
// Close gallery mode if open
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
if tab.gallery {
tab.gallery = false;
return Command::none();
}
}
// Close menus and context panes in order per message
// Why: It'd be weird to close everything all at once
// Usually, the Escape key (for example) closes menus and panes one by one instead
@ -2392,6 +2400,9 @@ impl Application for App {
tab::Command::PreviewCancel => {
self.preview_opt = None;
}
tab::Command::WindowDrag => {
commands.push(window::drag(self.main_window_id()));
}
}
}
return Command::batch(commands);
@ -2772,6 +2783,17 @@ impl Application for App {
}
fn dialog(&self) -> Option<Element<Message>> {
//TODO: should gallery view just be a dialog?
let entity = self.tab_model.active();
if let Some(tab) = self.tab_model.data::<Tab>(entity) {
if tab.gallery {
return Some(
tab.gallery_view()
.map(move |tab_message| Message::TabMessage(Some(entity), tab_message)),
);
}
}
let dialog_page = match self.dialog_pages.front() {
Some(some) => some,
None => return None,