Rename Shape tool to Polygon tool

This commit is contained in:
Keavon Chambers
2023-08-01 01:28:14 -07:00
parent b9e49623a3
commit 2b05e1c270
15 changed files with 104 additions and 106 deletions
+2 -4
View File
@@ -6,10 +6,8 @@ pub enum DocumentError {
LayerNotFound(Vec<LayerId>),
InvalidPath,
IndexOutOfBounds,
NotAFolder,
NonReorderableSelection,
NotFolder,
NotShape,
NotText,
NotNodeGraph,
NotLayer,
InvalidFile(String),
}
+6 -6
View File
@@ -20,7 +20,7 @@ use std::fmt::Write;
pub enum LayerDataType {
/// A layer that wraps a [FolderLayer] struct.
Folder(FolderLayer),
/// A layer that wraps a [ShapeLayer] struct.
/// A layer that wraps a [ShapeLayer] struct. Still used by the overlays system, but will be removed in the future.
Shape(ShapeLayer),
/// A layer that wraps an [LayerLayer] struct.
Layer(LayerLayer),
@@ -438,7 +438,7 @@ impl Layer {
pub fn as_folder_mut(&mut self) -> Result<&mut FolderLayer, DocumentError> {
match &mut self.data {
LayerDataType::Folder(f) => Ok(f),
_ => Err(DocumentError::NotAFolder),
_ => Err(DocumentError::NotFolder),
}
}
@@ -461,7 +461,7 @@ impl Layer {
pub fn as_folder(&self) -> Result<&FolderLayer, DocumentError> {
match &self.data {
LayerDataType::Folder(f) => Ok(f),
_ => Err(DocumentError::NotAFolder),
_ => Err(DocumentError::NotFolder),
}
}
@@ -470,7 +470,7 @@ impl Layer {
pub fn as_layer_network_mut(&mut self) -> Result<&mut graph_craft::document::NodeNetwork, DocumentError> {
match &mut self.data {
LayerDataType::Layer(layer) => Ok(&mut layer.network),
_ => Err(DocumentError::NotNodeGraph),
_ => Err(DocumentError::NotLayer),
}
}
@@ -479,14 +479,14 @@ impl Layer {
pub fn as_layer_network(&self) -> Result<&graph_craft::document::NodeNetwork, DocumentError> {
match &self.data {
LayerDataType::Layer(layer) => Ok(&layer.network),
_ => Err(DocumentError::NotNodeGraph),
_ => Err(DocumentError::NotLayer),
}
}
pub fn as_layer(&self) -> Result<&LayerLayer, DocumentError> {
match &self.data {
LayerDataType::Layer(layer) => Ok(layer),
_ => Err(DocumentError::NotNodeGraph),
_ => Err(DocumentError::NotLayer),
}
}
+3 -3
View File
@@ -3,8 +3,8 @@
//! Layers allow the user to mutate part of the document while leaving the rest unchanged.
//! There are currently these different types of layers:
//! * [Folder layers](folder_layer::FolderLayer), which encapsulate sub-layers
//! * [Shape layers](shape_layer::ShapeLayer), which contain generic SVG [`<path>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path)s
//! * [Layer layers](layer_layer::NodegraphLayer), which contain a node graph layer
//! * [Shape layers](shape_layer::ShapeLayer), which contain generic SVG [`<path>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path)s (deprecated but still used by the overlays system).
//! * [Layer layers](layer_layer::LayerLayer), which contain a node graph layer
//!
//! Refer to the module-level documentation for detailed information on each layer.
//!
@@ -20,7 +20,7 @@ pub mod blend_mode;
pub mod folder_layer;
/// Contains the base [Layer](layer_info::Layer) type, an abstraction over the different types of layers.
pub mod layer_info;
/// Contains the [NodegraphLayer](nodegraph_layer::NodegraphLayer) type that contains a node graph.
/// Contains the [LayerLayer](nodegraph_layer::LayerLayer) type that contains a node graph.
pub mod layer_layer;
// TODO: Remove shape layers after rewriting the overlay system
/// Contains the [ShapeLayer](shape_layer::ShapeLayer) type, a generic SVG element defined using Bezier paths.