Fix artboard tool and remove old artboard code

This commit is contained in:
0hypercube
2023-10-17 11:02:06 -07:00
committed by Keavon Chambers
parent 9a39c4a0cc
commit b52f831b21
27 changed files with 196 additions and 553 deletions
@@ -2,7 +2,7 @@ use crate::messages::frontend::utility_types::{ExportBounds, FileType};
use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::prelude::*;
use document_legacy::LayerId;
use document_legacy::document_metadata::LayerNodeIdentifier;
/// A dialog to allow users to customize their file export.
#[derive(Debug, Clone, Default)]
@@ -11,7 +11,7 @@ pub struct ExportDialogMessageHandler {
pub scale_factor: f64,
pub bounds: ExportBounds,
pub transparent_background: bool,
pub artboards: HashMap<LayerId, String>,
pub artboards: HashMap<LayerNodeIdentifier, String>,
pub has_selection: bool,
}
@@ -86,7 +86,20 @@ impl LayoutHolder for ExportDialogMessageHandler {
.widget_holder(),
];
let artboards = self.artboards.iter().map(|(&val, name)| (ExportBounds::Artboard(val), name.to_string(), false));
let resolution = vec![
TextLabel::new("Scale Factor").table_align(true).min_width(100).widget_holder(),
Separator::new(SeparatorType::Unrelated).widget_holder(),
NumberInput::new(Some(self.scale_factor))
.unit("")
.min(0.)
.max((1u64 << std::f64::MANTISSA_DIGITS) as f64)
.disabled(self.file_type == FileType::Svg)
.on_update(|number_input: &NumberInput| ExportDialogMessage::ScaleFactor(number_input.value.unwrap()).into())
.min_width(200)
.widget_holder(),
];
let artboards = self.artboards.iter().map(|(&layer, name)| (ExportBounds::Artboard(layer), name.to_string(), false));
let mut export_area_options = vec![
(ExportBounds::AllArtwork, "All Artwork".to_string(), false),
(ExportBounds::Selection, "Selection".to_string(), !self.has_selection),