mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Break apart and improve the JS for rasterizing SVGs and downloading files (#786)
It now uses a blob URL instead of a data URL in the download process, which is cleaner and better performance.
This commit is contained in:
@@ -91,7 +91,7 @@ impl MessageHandler<DialogMessage, &PortfolioMessageHandler> for DialogMessageHa
|
||||
DialogMessage::RequestNewDocumentDialog => {
|
||||
self.new_document_dialog = NewDocumentDialogMessageHandler {
|
||||
name: portfolio.generate_new_document_name(),
|
||||
infinite: true,
|
||||
infinite: false,
|
||||
dimensions: glam::UVec2::new(1920, 1080),
|
||||
};
|
||||
self.new_document_dialog.register_properties(responses, LayoutTarget::DialogDetails);
|
||||
|
||||
@@ -63,7 +63,7 @@ pub enum FrontendMessage {
|
||||
TriggerOpenDocument,
|
||||
TriggerPaste,
|
||||
TriggerRasterDownload {
|
||||
document: String,
|
||||
svg: String,
|
||||
name: String,
|
||||
mime: String,
|
||||
size: (f64, f64),
|
||||
|
||||
@@ -314,7 +314,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
||||
self.graphene_document.root.transform = DAffine2::IDENTITY;
|
||||
GrapheneDocument::mark_children_as_dirty(&mut self.graphene_document.root);
|
||||
|
||||
// Calculates the bounding box of the region to be exported
|
||||
// Calculate the bounding box of the region to be exported
|
||||
use crate::messages::frontend::utility_types::ExportBounds;
|
||||
let bbox = match bounds {
|
||||
ExportBounds::AllArtwork => self.all_layer_bounds(font_cache),
|
||||
@@ -345,7 +345,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
||||
} else {
|
||||
let mime = file_type.to_mime().to_string();
|
||||
let size = (size * scale_factor).into();
|
||||
responses.push_back(FrontendMessage::TriggerRasterDownload { document, name, mime, size }.into());
|
||||
responses.push_back(FrontendMessage::TriggerRasterDownload { svg: document, name, mime, size }.into());
|
||||
}
|
||||
}
|
||||
FlipSelectedLayers { flip_axis } => {
|
||||
|
||||
Reference in New Issue
Block a user