mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 10:58:11 +08:00
Add Isometric Fountain demo artwork
This commit is contained in:
@@ -5,11 +5,12 @@ use crate::messages::prelude::*;
|
||||
pub struct DemoArtworkDialog;
|
||||
|
||||
/// `(name, thumbnail, filename)`
|
||||
pub const ARTWORK: [(&str, &str, &str); 4] = [
|
||||
pub const ARTWORK: [(&str, &str, &str); 5] = [
|
||||
("Valley of Spires", "ThumbnailValleyOfSpires", "valley-of-spires.graphite"),
|
||||
("Red Dress", "ThumbnailRedDress", "red-dress.graphite"),
|
||||
("Just a Potted Cactus", "ThumbnailJustAPottedCactus", "just-a-potted-cactus.graphite"),
|
||||
("Isometric Fountain", "ThumbnailIsometricFountain", "isometric-fountain.graphite"),
|
||||
("Procedural String Lights", "ThumbnailProceduralStringLights", "procedural-string-lights.graphite"),
|
||||
("Just a Potted Cactus", "ThumbnailJustAPottedCactus", "just-a-potted-cactus.graphite"),
|
||||
];
|
||||
|
||||
impl DialogLayoutHolder for DemoArtworkDialog {
|
||||
@@ -25,30 +26,40 @@ impl DialogLayoutHolder for DemoArtworkDialog {
|
||||
|
||||
impl LayoutHolder for DemoArtworkDialog {
|
||||
fn layout(&self) -> Layout {
|
||||
let images = ARTWORK
|
||||
let mut rows_of_images_with_buttons: Vec<_> = ARTWORK
|
||||
.chunks(3)
|
||||
.into_iter()
|
||||
.map(|(_, thumbnail, _)| ImageLabel::new(thumbnail.to_string()).width(Some("256px".into())).widget_holder())
|
||||
.collect();
|
||||
.map(|chunk| {
|
||||
let images = chunk
|
||||
.into_iter()
|
||||
.map(|(_, thumbnail, _)| ImageLabel::new(*thumbnail).width(Some("256px".into())).widget_holder())
|
||||
.collect();
|
||||
|
||||
let buttons = ARTWORK
|
||||
.into_iter()
|
||||
.map(|(name, _, filename)| {
|
||||
TextButton::new(name)
|
||||
.min_width(256)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
|
||||
name: name.to_string(),
|
||||
filename: filename.to_string(),
|
||||
}
|
||||
.into()],
|
||||
}
|
||||
.into()
|
||||
let buttons = chunk
|
||||
.into_iter()
|
||||
.map(|(name, _, filename)| {
|
||||
TextButton::new(*name)
|
||||
.min_width(256)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
|
||||
name: name.to_string(),
|
||||
filename: filename.to_string(),
|
||||
}
|
||||
.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_holder()
|
||||
})
|
||||
.widget_holder()
|
||||
})
|
||||
.collect();
|
||||
.collect();
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets: images }, LayoutGroup::Row { widgets: buttons }]))
|
||||
vec![LayoutGroup::Row { widgets: images }, LayoutGroup::Row { widgets: buttons }, LayoutGroup::Row { widgets: vec![] }]
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
let _ = rows_of_images_with_buttons.pop();
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(rows_of_images_with_buttons))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user