mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 05:48:12 +08:00
Clean up .graphite file serde encoding
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -43,6 +43,8 @@ pub struct DocumentMessageHandler {
|
||||
pub auto_saved_document_identifier: u64,
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
#[serde(default)]
|
||||
pub commit_hash: String,
|
||||
|
||||
pub document_mode: DocumentMode,
|
||||
pub view_mode: ViewMode,
|
||||
@@ -62,11 +64,13 @@ pub struct DocumentMessageHandler {
|
||||
|
||||
#[serde(with = "vectorize_layer_metadata")]
|
||||
pub layer_metadata: HashMap<Vec<LayerId>, LayerMetadata>,
|
||||
#[serde(skip)]
|
||||
layer_range_selection_reference: Option<LayerNodeIdentifier>,
|
||||
|
||||
navigation_handler: NavigationMessageHandler,
|
||||
#[serde(skip)]
|
||||
overlays_message_handler: OverlaysMessageHandler,
|
||||
#[serde(skip)]
|
||||
properties_panel_message_handler: PropertiesPanelMessageHandler,
|
||||
#[serde(skip)]
|
||||
node_graph_handler: NodeGraphMessageHandler,
|
||||
@@ -74,16 +78,13 @@ pub struct DocumentMessageHandler {
|
||||
|
||||
impl Default for DocumentMessageHandler {
|
||||
fn default() -> Self {
|
||||
let document_legacy = DocumentLegacy {
|
||||
commit_hash: crate::application::GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
Self {
|
||||
document_legacy,
|
||||
document_legacy: DocumentLegacy::default(),
|
||||
saved_document_identifier: 0,
|
||||
auto_saved_document_identifier: 0,
|
||||
name: String::from("Untitled Document"),
|
||||
version: GRAPHITE_DOCUMENT_VERSION.to_string(),
|
||||
commit_hash: crate::application::GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
||||
|
||||
document_mode: DocumentMode::DesignMode,
|
||||
view_mode: ViewMode::default(),
|
||||
|
||||
@@ -13,12 +13,22 @@ use document_legacy::document::Document;
|
||||
use glam::{DAffine2, DVec2};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
||||
enum TransformOperation {
|
||||
#[default]
|
||||
None,
|
||||
Pan { pre_commit_pan: DVec2 },
|
||||
Rotate { pre_commit_tilt: f64, snap_tilt: bool, snap_tilt_released: bool },
|
||||
Zoom { pre_commit_zoom: f64, snap_zoom_enabled: bool },
|
||||
Pan {
|
||||
pre_commit_pan: DVec2,
|
||||
},
|
||||
Rotate {
|
||||
pre_commit_tilt: f64,
|
||||
snap_tilt: bool,
|
||||
snap_tilt_released: bool,
|
||||
},
|
||||
Zoom {
|
||||
pre_commit_zoom: f64,
|
||||
snap_zoom_enabled: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
@@ -27,8 +37,11 @@ pub struct NavigationMessageHandler {
|
||||
pub tilt: f64,
|
||||
pub zoom: f64,
|
||||
|
||||
#[serde(skip)]
|
||||
transform_operation: TransformOperation,
|
||||
#[serde(skip)]
|
||||
mouse_position: ViewportPosition,
|
||||
#[serde(skip)]
|
||||
finish_operation_with_click: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ impl NodeGraphExecutor {
|
||||
"Layer"
|
||||
}
|
||||
.to_string(),
|
||||
tooltip: format!("Layer id: {node_id}"),
|
||||
tooltip: if cfg!(debug_assertions) { format!("Layer ID: {node_id}") } else { "".into() },
|
||||
visible: !document.document_network.disabled.contains(&layer.to_node()),
|
||||
layer_type: if document.metadata.is_artboard(layer) {
|
||||
LayerDataTypeDiscriminant::Artboard
|
||||
|
||||
Reference in New Issue
Block a user