Add the File > Export dialog and PNG/JPG downloading (#629)

* Add export dialog

* Code review changes

* More code review feedback

* Fix compilation on stable Rust

* Fixes to problems

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2022-05-09 07:35:22 +01:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent e3e506ecfb
commit 060182fd31
19 changed files with 445 additions and 59 deletions
+1
View File
@@ -27,6 +27,7 @@ pub enum FrontendMessage {
TriggerFontLoadDefault,
TriggerIndexedDbRemoveDocument { document_id: u64 },
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
TriggerRasterDownload { document: String, name: String, mime: String, size: (f64, f64) },
TriggerTextCommit,
TriggerTextCopy { copy_text: String },
TriggerViewportResize,
+36 -1
View File
@@ -31,6 +31,41 @@ pub enum MouseCursorIcon {
impl Default for MouseCursorIcon {
fn default() -> Self {
Self::Default
MouseCursorIcon::Default
}
}
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
pub enum FileType {
Svg,
Png,
Jpg,
}
impl Default for FileType {
fn default() -> Self {
FileType::Svg
}
}
impl FileType {
pub fn to_mime(self) -> &'static str {
match self {
FileType::Svg => "image/svg+xml",
FileType::Png => "image/png",
FileType::Jpg => "image/jpeg",
}
}
}
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
pub enum ExportBounds {
AllArtwork,
Artboard(LayerId),
}
impl Default for ExportBounds {
fn default() -> Self {
ExportBounds::AllArtwork
}
}