mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 15:28:04 +08:00
Serve the demo artwork in each build (#1494)
* Serve local demo artwork * Disable restricted import lint * Revert * Switch approach to vite-multiple-assets plugin --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -4,17 +4,10 @@ use crate::messages::prelude::*;
|
||||
/// A dialog to let the user browse a gallery of demo artwork that can be opened.
|
||||
pub struct DemoArtworkDialog;
|
||||
|
||||
/// `(name, thumbnail, filename)`
|
||||
const ARTWORK: [(&str, &str, &str); 2] = [
|
||||
(
|
||||
"Valley of Spires",
|
||||
"ThumbnailValleyOfSpires",
|
||||
"https://raw.githubusercontent.com/GraphiteEditor/Graphite/master/demo-artwork/valley-of-spires-v2.graphite",
|
||||
),
|
||||
(
|
||||
"Just a Potted Cactus",
|
||||
"ThumbnailJustAPottedCactus",
|
||||
"https://raw.githubusercontent.com/GraphiteEditor/Graphite/master/demo-artwork/just-a-potted-cactus-v2.graphite",
|
||||
),
|
||||
("Valley of Spires", "ThumbnailValleyOfSpires", "valley-of-spires-v2.graphite"),
|
||||
("Just a Potted Cactus", "ThumbnailJustAPottedCactus", "just-a-potted-cactus-v2.graphite"),
|
||||
];
|
||||
|
||||
impl DialogLayoutHolder for DemoArtworkDialog {
|
||||
@@ -37,12 +30,16 @@ impl LayoutHolder for DemoArtworkDialog {
|
||||
|
||||
let buttons = ARTWORK
|
||||
.into_iter()
|
||||
.map(|(label, _, url)| {
|
||||
TextButton::new(label)
|
||||
.map(|(name, _, filename)| {
|
||||
TextButton::new(name)
|
||||
.min_width(256)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument { url: url.to_string() }.into()],
|
||||
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
|
||||
name: name.to_string(),
|
||||
filename: filename.to_string(),
|
||||
}
|
||||
.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
|
||||
@@ -67,7 +67,8 @@ pub enum FrontendMessage {
|
||||
name: String,
|
||||
},
|
||||
TriggerFetchAndOpenDocument {
|
||||
url: String,
|
||||
name: String,
|
||||
filename: String,
|
||||
},
|
||||
TriggerFontLoad {
|
||||
font: Font,
|
||||
|
||||
Reference in New Issue
Block a user