Clean up .graphite file serde encoding
This commit is contained in:
parent
8f9371dad0
commit
3e35abd377
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -38,8 +38,6 @@ pub struct Document {
|
||||||
pub collapsed_folders: Vec<LayerNodeIdentifier>,
|
pub collapsed_folders: Vec<LayerNodeIdentifier>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub metadata: DocumentMetadata,
|
pub metadata: DocumentMetadata,
|
||||||
#[serde(default)]
|
|
||||||
pub commit_hash: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for Document {
|
impl PartialEq for Document {
|
||||||
|
|
@ -108,7 +106,6 @@ impl Default for Document {
|
||||||
},
|
},
|
||||||
metadata: Default::default(),
|
metadata: Default::default(),
|
||||||
collapsed_folders: Vec::new(),
|
collapsed_folders: Vec::new(),
|
||||||
commit_hash: String::new(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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 auto_saved_document_identifier: u64,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub commit_hash: String,
|
||||||
|
|
||||||
pub document_mode: DocumentMode,
|
pub document_mode: DocumentMode,
|
||||||
pub view_mode: ViewMode,
|
pub view_mode: ViewMode,
|
||||||
|
|
@ -62,11 +64,13 @@ pub struct DocumentMessageHandler {
|
||||||
|
|
||||||
#[serde(with = "vectorize_layer_metadata")]
|
#[serde(with = "vectorize_layer_metadata")]
|
||||||
pub layer_metadata: HashMap<Vec<LayerId>, LayerMetadata>,
|
pub layer_metadata: HashMap<Vec<LayerId>, LayerMetadata>,
|
||||||
|
#[serde(skip)]
|
||||||
layer_range_selection_reference: Option<LayerNodeIdentifier>,
|
layer_range_selection_reference: Option<LayerNodeIdentifier>,
|
||||||
|
|
||||||
navigation_handler: NavigationMessageHandler,
|
navigation_handler: NavigationMessageHandler,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
overlays_message_handler: OverlaysMessageHandler,
|
overlays_message_handler: OverlaysMessageHandler,
|
||||||
|
#[serde(skip)]
|
||||||
properties_panel_message_handler: PropertiesPanelMessageHandler,
|
properties_panel_message_handler: PropertiesPanelMessageHandler,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
node_graph_handler: NodeGraphMessageHandler,
|
node_graph_handler: NodeGraphMessageHandler,
|
||||||
|
|
@ -74,16 +78,13 @@ pub struct DocumentMessageHandler {
|
||||||
|
|
||||||
impl Default for DocumentMessageHandler {
|
impl Default for DocumentMessageHandler {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let document_legacy = DocumentLegacy {
|
|
||||||
commit_hash: crate::application::GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
Self {
|
Self {
|
||||||
document_legacy,
|
document_legacy: DocumentLegacy::default(),
|
||||||
saved_document_identifier: 0,
|
saved_document_identifier: 0,
|
||||||
auto_saved_document_identifier: 0,
|
auto_saved_document_identifier: 0,
|
||||||
name: String::from("Untitled Document"),
|
name: String::from("Untitled Document"),
|
||||||
version: GRAPHITE_DOCUMENT_VERSION.to_string(),
|
version: GRAPHITE_DOCUMENT_VERSION.to_string(),
|
||||||
|
commit_hash: crate::application::GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
||||||
|
|
||||||
document_mode: DocumentMode::DesignMode,
|
document_mode: DocumentMode::DesignMode,
|
||||||
view_mode: ViewMode::default(),
|
view_mode: ViewMode::default(),
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,22 @@ use document_legacy::document::Document;
|
||||||
use glam::{DAffine2, DVec2};
|
use glam::{DAffine2, DVec2};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
enum TransformOperation {
|
enum TransformOperation {
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
Pan { pre_commit_pan: DVec2 },
|
Pan {
|
||||||
Rotate { pre_commit_tilt: f64, snap_tilt: bool, snap_tilt_released: bool },
|
pre_commit_pan: DVec2,
|
||||||
Zoom { pre_commit_zoom: f64, snap_zoom_enabled: bool },
|
},
|
||||||
|
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)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
|
@ -27,8 +37,11 @@ pub struct NavigationMessageHandler {
|
||||||
pub tilt: f64,
|
pub tilt: f64,
|
||||||
pub zoom: f64,
|
pub zoom: f64,
|
||||||
|
|
||||||
|
#[serde(skip)]
|
||||||
transform_operation: TransformOperation,
|
transform_operation: TransformOperation,
|
||||||
|
#[serde(skip)]
|
||||||
mouse_position: ViewportPosition,
|
mouse_position: ViewportPosition,
|
||||||
|
#[serde(skip)]
|
||||||
finish_operation_with_click: bool,
|
finish_operation_with_click: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ impl NodeGraphExecutor {
|
||||||
"Layer"
|
"Layer"
|
||||||
}
|
}
|
||||||
.to_string(),
|
.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()),
|
visible: !document.document_network.disabled.contains(&layer.to_node()),
|
||||||
layer_type: if document.metadata.is_artboard(layer) {
|
layer_type: if document.metadata.is_artboard(layer) {
|
||||||
LayerDataTypeDiscriminant::Artboard
|
LayerDataTypeDiscriminant::Artboard
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm run build-wasm && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm\" || (npm run print-building-help && exit 1)",
|
"start": "npm run build-wasm && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm\" || (npm run print-building-help && exit 1)",
|
||||||
"profiling": "npm run build-wasm-profiling && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm-profiling\" || (npm run print-building-help && exit 1)",
|
"profiling": "npm run build-wasm-profiling && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm-profiling\" || (npm run print-building-help && exit 1)",
|
||||||
|
"production": "npm run build-wasm-prod && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm\" || (npm run print-building-help && exit 1)",
|
||||||
"build": "npm run build-wasm-prod && vite build || (npm run print-building-help && exit 1)",
|
"build": "npm run build-wasm-prod && vite build || (npm run print-building-help && exit 1)",
|
||||||
"build-profiling": "npm run build-wasm-profiling && vite build || (npm run print-building-help && exit 1)",
|
"build-profiling": "npm run build-wasm-profiling && vite build || (npm run print-building-help && exit 1)",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
if (!editor.instance.inDevelopmentMode()) return { name };
|
if (!editor.instance.inDevelopmentMode()) return { name };
|
||||||
|
|
||||||
const tooltip = `Document ID ${doc.id}`;
|
const tooltip = `Document ID: ${doc.id}`;
|
||||||
return { name, tooltip };
|
return { name, tooltip };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
|
host: "0.0.0.0",
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue