diff --git a/docs/design/inputs-and-keybindings.md b/docs/design/inputs-and-keybindings.md
index 059ed7e0..a7e50eb5 100644
--- a/docs/design/inputs-and-keybindings.md
+++ b/docs/design/inputs-and-keybindings.md
@@ -95,7 +95,7 @@ Spline Tool | | P |
Line Tool | L | U | \\ | **L** | P | | |
Rectangle Tool | M | U/**M** | **M** | R | **M** | | |
Ellipse Tool | E | U/M | L | **E** | M | | |
-Shape Tool | Y | U | | **Y** | | | |
+Polygon Tool | Y | U | | **Y** | | | |
Text Tool | T | **T** | **T** | **T** | **T** | | |
Brush Tool | B | **B** | **B** | | **B** | | |
Heal Tool | J | **J** | | | | | |
@@ -138,7 +138,7 @@ Excluding mouse inputs and modifier keys.
##### Ellipse Tool
-##### Shape Tool
+##### Polygon Tool
##### Text Tool
diff --git a/document-legacy/src/error.rs b/document-legacy/src/error.rs
index e64e16fd..f574ba89 100644
--- a/document-legacy/src/error.rs
+++ b/document-legacy/src/error.rs
@@ -6,10 +6,8 @@ pub enum DocumentError {
LayerNotFound(Vec),
InvalidPath,
IndexOutOfBounds,
- NotAFolder,
- NonReorderableSelection,
+ NotFolder,
NotShape,
- NotText,
- NotNodeGraph,
+ NotLayer,
InvalidFile(String),
}
diff --git a/document-legacy/src/layers/layer_info.rs b/document-legacy/src/layers/layer_info.rs
index 0a3f3525..9042c082 100644
--- a/document-legacy/src/layers/layer_info.rs
+++ b/document-legacy/src/layers/layer_info.rs
@@ -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),
}
}
diff --git a/document-legacy/src/layers/mod.rs b/document-legacy/src/layers/mod.rs
index d08ee447..3ac300ce 100644
--- a/document-legacy/src/layers/mod.rs
+++ b/document-legacy/src/layers/mod.rs
@@ -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 [``](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 [``](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.
diff --git a/editor/src/dispatcher.rs b/editor/src/dispatcher.rs
index 58897b8c..d6cbb3c8 100644
--- a/editor/src/dispatcher.rs
+++ b/editor/src/dispatcher.rs
@@ -282,7 +282,7 @@ mod test {
editor.draw_rect(100., 200., 300., 400.);
editor.select_primary_color(Color::BLUE);
- editor.draw_shape(10., 1200., 1300., 400.);
+ editor.draw_polygon(10., 1200., 1300., 400.);
editor.select_primary_color(Color::GREEN);
editor.draw_ellipse(104., 1200., 1300., 400.);
diff --git a/editor/src/messages/input_mapper/default_mapping.rs b/editor/src/messages/input_mapper/default_mapping.rs
index d8892b28..6c5d67ff 100644
--- a/editor/src/messages/input_mapper/default_mapping.rs
+++ b/editor/src/messages/input_mapper/default_mapping.rs
@@ -159,12 +159,12 @@ pub fn default_mapping() -> Mapping {
entry!(KeyDown(Escape); action_dispatch=EllipseToolMessage::Abort),
entry!(PointerMove; refresh_keys=[Alt, Shift], action_dispatch=EllipseToolMessage::Resize { center: Alt, lock_ratio: Shift }),
//
- // ShapeToolMessage
- entry!(KeyDown(Lmb); action_dispatch=ShapeToolMessage::DragStart),
- entry!(KeyUp(Lmb); action_dispatch=ShapeToolMessage::DragStop),
- entry!(KeyDown(Rmb); action_dispatch=ShapeToolMessage::Abort),
- entry!(KeyDown(Escape); action_dispatch=ShapeToolMessage::Abort),
- entry!(PointerMove; refresh_keys=[Alt, Shift], action_dispatch=ShapeToolMessage::Resize { center: Alt, lock_ratio: Shift }),
+ // PolygonToolMessage
+ entry!(KeyDown(Lmb); action_dispatch=PolygonToolMessage::DragStart),
+ entry!(KeyUp(Lmb); action_dispatch=PolygonToolMessage::DragStop),
+ entry!(KeyDown(Rmb); action_dispatch=PolygonToolMessage::Abort),
+ entry!(KeyDown(Escape); action_dispatch=PolygonToolMessage::Abort),
+ entry!(PointerMove; refresh_keys=[Alt, Shift], action_dispatch=PolygonToolMessage::Resize { center: Alt, lock_ratio: Shift }),
//
// LineToolMessage
entry!(KeyDown(Lmb); action_dispatch=LineToolMessage::DragStart),
@@ -253,7 +253,7 @@ pub fn default_mapping() -> Mapping {
entry!(KeyDown(KeyL); action_dispatch=ToolMessage::ActivateToolLine),
entry!(KeyDown(KeyM); action_dispatch=ToolMessage::ActivateToolRectangle),
entry!(KeyDown(KeyE); action_dispatch=ToolMessage::ActivateToolEllipse),
- entry!(KeyDown(KeyY); action_dispatch=ToolMessage::ActivateToolShape),
+ entry!(KeyDown(KeyY); action_dispatch=ToolMessage::ActivateToolPolygon),
entry!(KeyDown(KeyB); action_dispatch=ToolMessage::ActivateToolBrush),
entry!(KeyDown(KeyX); modifiers=[Shift, Accel], action_dispatch=ToolMessage::ResetColors),
entry!(KeyDown(KeyX); modifiers=[Shift], action_dispatch=ToolMessage::SwapColors),
diff --git a/editor/src/messages/prelude.rs b/editor/src/messages/prelude.rs
index dca6d742..e36370bd 100644
--- a/editor/src/messages/prelude.rs
+++ b/editor/src/messages/prelude.rs
@@ -44,9 +44,9 @@ pub use crate::messages::tool::tool_messages::line_tool::{LineToolMessage, LineT
pub use crate::messages::tool::tool_messages::navigate_tool::{NavigateToolMessage, NavigateToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::path_tool::{PathToolMessage, PathToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::pen_tool::{PenToolMessage, PenToolMessageDiscriminant};
+pub use crate::messages::tool::tool_messages::polygon_tool::{PolygonToolMessage, PolygonToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::rectangle_tool::{RectangleToolMessage, RectangleToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::select_tool::{SelectToolMessage, SelectToolMessageDiscriminant};
-pub use crate::messages::tool::tool_messages::shape_tool::{ShapeToolMessage, ShapeToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::spline_tool::{SplineToolMessage, SplineToolMessageDiscriminant};
pub use crate::messages::tool::tool_messages::text_tool::{TextToolMessage, TextToolMessageDiscriminant};
diff --git a/editor/src/messages/tool/tool_message.rs b/editor/src/messages/tool/tool_message.rs
index 8e3e7f98..4603bbf4 100644
--- a/editor/src/messages/tool/tool_message.rs
+++ b/editor/src/messages/tool/tool_message.rs
@@ -56,7 +56,7 @@ pub enum ToolMessage {
Ellipse(EllipseToolMessage),
#[remain::unsorted]
#[child]
- Shape(ShapeToolMessage),
+ Polygon(PolygonToolMessage),
#[remain::unsorted]
#[child]
Text(TextToolMessage),
@@ -117,7 +117,7 @@ pub enum ToolMessage {
#[remain::unsorted]
ActivateToolEllipse,
#[remain::unsorted]
- ActivateToolShape,
+ ActivateToolPolygon,
#[remain::unsorted]
ActivateToolBrush,
diff --git a/editor/src/messages/tool/tool_message_handler.rs b/editor/src/messages/tool/tool_message_handler.rs
index bdba4041..73d7008e 100644
--- a/editor/src/messages/tool/tool_message_handler.rs
+++ b/editor/src/messages/tool/tool_message_handler.rs
@@ -67,7 +67,7 @@ impl MessageHandler responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Ellipse }),
#[remain::unsorted]
- ToolMessage::ActivateToolShape => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Shape }),
+ ToolMessage::ActivateToolPolygon => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Polygon }),
#[remain::unsorted]
ToolMessage::ActivateToolBrush => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Brush }),
@@ -282,7 +282,7 @@ impl MessageHandler Self {
Self {
vertices: 5,
@@ -42,9 +42,9 @@ impl Default for ShapeOptions {
}
#[remain::sorted]
-#[impl_message(Message, ToolMessage, Shape)]
+#[impl_message(Message, ToolMessage, Polygon)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
-pub enum ShapeToolMessage {
+pub enum PolygonToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
@@ -58,7 +58,7 @@ pub enum ShapeToolMessage {
center: Key,
lock_ratio: Key,
},
- UpdateOptions(ShapeOptionsUpdate),
+ UpdateOptions(PolygonOptionsUpdate),
}
#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize, specta::Type)]
@@ -69,7 +69,7 @@ pub enum PrimitiveShapeType {
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
-pub enum ShapeOptionsUpdate {
+pub enum PolygonOptionsUpdate {
FillColor(Option),
FillColorType(ToolColorType),
LineWeight(f64),
@@ -80,15 +80,15 @@ pub enum ShapeOptionsUpdate {
WorkingColors(Option, Option),
}
-impl ToolMetadata for ShapeTool {
+impl ToolMetadata for PolygonTool {
fn icon_name(&self) -> String {
- "VectorShapeTool".into()
+ "VectorPolygonTool".into()
}
fn tooltip(&self) -> String {
- "Shape Tool".into()
+ "Polygon Tool".into()
}
fn tool_type(&self) -> crate::messages::tool::utility_types::ToolType {
- ToolType::Shape
+ ToolType::Polygon
}
}
@@ -99,14 +99,14 @@ fn create_sides_widget(vertices: u32) -> WidgetHolder {
.min(3.)
.max(1000.)
.mode(NumberInputMode::Increment)
- .on_update(|number_input: &NumberInput| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::Vertices(number_input.value.unwrap() as u32)).into())
+ .on_update(|number_input: &NumberInput| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::Vertices(number_input.value.unwrap() as u32)).into())
.widget_holder()
}
fn create_star_option_widget(primitive_shape_type: PrimitiveShapeType) -> WidgetHolder {
let entries = vec![
- RadioEntryData::new("Polygon").on_update(move |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Polygon)).into()),
- RadioEntryData::new("Star").on_update(move |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Star)).into()),
+ RadioEntryData::new("Polygon").on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Polygon)).into()),
+ RadioEntryData::new("Star").on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Star)).into()),
];
RadioInput::new(entries).selected_index(primitive_shape_type as u32).widget_holder()
}
@@ -116,11 +116,11 @@ fn create_weight_widget(line_weight: f64) -> WidgetHolder {
.unit(" px")
.label("Weight")
.min(0.)
- .on_update(|number_input: &NumberInput| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::LineWeight(number_input.value.unwrap())).into())
+ .on_update(|number_input: &NumberInput| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::LineWeight(number_input.value.unwrap())).into())
.widget_holder()
}
-impl LayoutHolder for ShapeTool {
+impl LayoutHolder for PolygonTool {
fn layout(&self) -> Layout {
let mut widgets = vec![
create_star_option_widget(self.options.primitive_shape_type),
@@ -133,9 +133,9 @@ impl LayoutHolder for ShapeTool {
widgets.append(&mut self.options.fill.create_widgets(
"Fill",
true,
- |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::FillColor(None)).into(),
- |color_type: ToolColorType| WidgetCallback::new(move |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::FillColorType(color_type.clone())).into()),
- |color: &ColorInput| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::FillColor(color.value)).into(),
+ |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::FillColor(None)).into(),
+ |color_type: ToolColorType| WidgetCallback::new(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::FillColorType(color_type.clone())).into()),
+ |color: &ColorInput| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::FillColor(color.value)).into(),
));
widgets.push(Separator::new(SeparatorType::Section).widget_holder());
@@ -143,9 +143,9 @@ impl LayoutHolder for ShapeTool {
widgets.append(&mut self.options.stroke.create_widgets(
"Stroke",
true,
- |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::StrokeColor(None)).into(),
- |color_type: ToolColorType| WidgetCallback::new(move |_| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::StrokeColorType(color_type.clone())).into()),
- |color: &ColorInput| ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::StrokeColor(color.value)).into(),
+ |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::StrokeColor(None)).into(),
+ |color_type: ToolColorType| WidgetCallback::new(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::StrokeColorType(color_type.clone())).into()),
+ |color: &ColorInput| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::StrokeColor(color.value)).into(),
));
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
widgets.push(create_weight_widget(self.options.line_weight));
@@ -153,24 +153,24 @@ impl LayoutHolder for ShapeTool {
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
}
}
-impl<'a> MessageHandler> for ShapeTool {
+impl<'a> MessageHandler> for PolygonTool {
fn process_message(&mut self, message: ToolMessage, responses: &mut VecDeque, tool_data: &mut ToolActionHandlerData<'a>) {
- if let ToolMessage::Shape(ShapeToolMessage::UpdateOptions(action)) = message {
+ if let ToolMessage::Polygon(PolygonToolMessage::UpdateOptions(action)) = message {
match action {
- ShapeOptionsUpdate::Vertices(vertices) => self.options.vertices = vertices,
- ShapeOptionsUpdate::PrimitiveShapeType(primitive_shape_type) => self.options.primitive_shape_type = primitive_shape_type,
- ShapeOptionsUpdate::FillColor(color) => {
+ PolygonOptionsUpdate::Vertices(vertices) => self.options.vertices = vertices,
+ PolygonOptionsUpdate::PrimitiveShapeType(primitive_shape_type) => self.options.primitive_shape_type = primitive_shape_type,
+ PolygonOptionsUpdate::FillColor(color) => {
self.options.fill.custom_color = color;
self.options.fill.color_type = ToolColorType::Custom;
}
- ShapeOptionsUpdate::FillColorType(color_type) => self.options.fill.color_type = color_type,
- ShapeOptionsUpdate::LineWeight(line_weight) => self.options.line_weight = line_weight,
- ShapeOptionsUpdate::StrokeColor(color) => {
+ PolygonOptionsUpdate::FillColorType(color_type) => self.options.fill.color_type = color_type,
+ PolygonOptionsUpdate::LineWeight(line_weight) => self.options.line_weight = line_weight,
+ PolygonOptionsUpdate::StrokeColor(color) => {
self.options.stroke.custom_color = color;
self.options.stroke.color_type = ToolColorType::Custom;
}
- ShapeOptionsUpdate::StrokeColorType(color_type) => self.options.stroke.color_type = color_type,
- ShapeOptionsUpdate::WorkingColors(primary, secondary) => {
+ PolygonOptionsUpdate::StrokeColorType(color_type) => self.options.stroke.color_type = color_type,
+ PolygonOptionsUpdate::WorkingColors(primary, secondary) => {
self.options.stroke.primary_working_color = primary;
self.options.stroke.secondary_working_color = secondary;
self.options.fill.primary_working_color = primary;
@@ -187,13 +187,13 @@ impl<'a> MessageHandler> for ShapeTo
}
fn actions(&self) -> ActionList {
- use ShapeToolFsmState::*;
+ use PolygonToolFsmState::*;
match self.fsm_state {
- Ready => actions!(ShapeToolMessageDiscriminant;
+ Ready => actions!(PolygonToolMessageDiscriminant;
DragStart,
),
- Drawing => actions!(ShapeToolMessageDiscriminant;
+ Drawing => actions!(PolygonToolMessageDiscriminant;
DragStop,
Abort,
Resize,
@@ -202,31 +202,31 @@ impl<'a> MessageHandler> for ShapeTo
}
}
-impl ToolTransition for ShapeTool {
+impl ToolTransition for PolygonTool {
fn event_to_message_map(&self) -> EventToMessageMap {
EventToMessageMap {
- tool_abort: Some(ShapeToolMessage::Abort.into()),
- working_color_changed: Some(ShapeToolMessage::WorkingColorChanged.into()),
+ tool_abort: Some(PolygonToolMessage::Abort.into()),
+ working_color_changed: Some(PolygonToolMessage::WorkingColorChanged.into()),
..Default::default()
}
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
-enum ShapeToolFsmState {
+enum PolygonToolFsmState {
#[default]
Ready,
Drawing,
}
#[derive(Clone, Debug, Default)]
-struct ShapeToolData {
+struct PolygonToolData {
data: Resize,
}
-impl Fsm for ShapeToolFsmState {
- type ToolData = ShapeToolData;
- type ToolOptions = ShapeOptions;
+impl Fsm for PolygonToolFsmState {
+ type ToolData = PolygonToolData;
+ type ToolOptions = PolygonOptions;
fn transition(
self,
@@ -242,18 +242,18 @@ impl Fsm for ShapeToolFsmState {
tool_options: &Self::ToolOptions,
responses: &mut VecDeque,
) -> Self {
- use ShapeToolFsmState::*;
- use ShapeToolMessage::*;
+ use PolygonToolFsmState::*;
+ use PolygonToolMessage::*;
- let shape_data = &mut tool_data.data;
+ let polygon_data = &mut tool_data.data;
- if let ToolMessage::Shape(event) = event {
+ if let ToolMessage::Polygon(event) = event {
match (self, event) {
(Ready, DragStart) => {
- shape_data.start(responses, document, input, render_data);
+ polygon_data.start(responses, document, input, render_data);
responses.add(DocumentMessage::StartTransaction);
let layer_path = document.get_path_for_new_layer();
- shape_data.path = Some(layer_path.clone());
+ polygon_data.path = Some(layer_path.clone());
let subpath = match tool_options.primitive_shape_type {
PrimitiveShapeType::Polygon => bezier_rs::Subpath::new_regular_polygon(DVec2::ZERO, tool_options.vertices as u64, 1.),
@@ -275,27 +275,27 @@ impl Fsm for ShapeToolFsmState {
Drawing
}
(state, Resize { center, lock_ratio }) => {
- if let Some(message) = shape_data.calculate_transform(responses, document, input, center, lock_ratio, false) {
+ if let Some(message) = polygon_data.calculate_transform(responses, document, input, center, lock_ratio, false) {
responses.add(message);
}
state
}
(Drawing, DragStop) => {
- input.mouse.finish_transaction(shape_data.viewport_drag_start(document), responses);
- shape_data.cleanup(responses);
+ input.mouse.finish_transaction(polygon_data.viewport_drag_start(document), responses);
+ polygon_data.cleanup(responses);
Ready
}
(Drawing, Abort) => {
responses.add(DocumentMessage::AbortTransaction);
- shape_data.cleanup(responses);
+ polygon_data.cleanup(responses);
Ready
}
(_, WorkingColorChanged) => {
- responses.add(ShapeToolMessage::UpdateOptions(ShapeOptionsUpdate::WorkingColors(
+ responses.add(PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::WorkingColors(
Some(global_tool_data.primary_color),
Some(global_tool_data.secondary_color),
)));
@@ -310,12 +310,12 @@ impl Fsm for ShapeToolFsmState {
fn update_hints(&self, responses: &mut VecDeque) {
let hint_data = match self {
- ShapeToolFsmState::Ready => HintData(vec![HintGroup(vec![
- HintInfo::mouse(MouseMotion::LmbDrag, "Draw Shape"),
+ PolygonToolFsmState::Ready => HintData(vec![HintGroup(vec![
+ HintInfo::mouse(MouseMotion::LmbDrag, "Draw Polygon"),
HintInfo::keys([Key::Shift], "Constrain 1:1 Aspect").prepend_plus(),
HintInfo::keys([Key::Alt], "From Center").prepend_plus(),
])]),
- ShapeToolFsmState::Drawing => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Shift], "Constrain 1:1 Aspect"), HintInfo::keys([Key::Alt], "From Center")])]),
+ PolygonToolFsmState::Drawing => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Shift], "Constrain 1:1 Aspect"), HintInfo::keys([Key::Alt], "From Center")])]),
};
responses.add(FrontendMessage::UpdateInputHints { hint_data });
diff --git a/editor/src/messages/tool/utility_types.rs b/editor/src/messages/tool/utility_types.rs
index 716c7807..e5d8adcf 100644
--- a/editor/src/messages/tool/utility_types.rs
+++ b/editor/src/messages/tool/utility_types.rs
@@ -348,7 +348,7 @@ pub enum ToolType {
Line,
Rectangle,
Ellipse,
- Shape,
+ Polygon,
Text,
// Raster tool group
@@ -388,7 +388,7 @@ fn list_tools_in_groups() -> Vec> {
ToolAvailability::Available(Box::::default()),
ToolAvailability::Available(Box::::default()),
ToolAvailability::Available(Box::::default()),
- ToolAvailability::Available(Box::::default()),
+ ToolAvailability::Available(Box::::default()),
ToolAvailability::Available(Box::::default()),
],
vec![
@@ -423,7 +423,7 @@ pub fn tool_message_to_tool_type(tool_message: &ToolMessage) -> ToolType {
ToolMessage::Line(_) => ToolType::Line,
ToolMessage::Rectangle(_) => ToolType::Rectangle,
ToolMessage::Ellipse(_) => ToolType::Ellipse,
- ToolMessage::Shape(_) => ToolType::Shape,
+ ToolMessage::Polygon(_) => ToolType::Polygon,
ToolMessage::Text(_) => ToolType::Text,
// Raster tool group
@@ -460,7 +460,7 @@ pub fn tool_type_to_activate_tool_message(tool_type: ToolType) -> ToolMessageDis
ToolType::Line => ToolMessageDiscriminant::ActivateToolLine,
ToolType::Rectangle => ToolMessageDiscriminant::ActivateToolRectangle,
ToolType::Ellipse => ToolMessageDiscriminant::ActivateToolEllipse,
- ToolType::Shape => ToolMessageDiscriminant::ActivateToolShape,
+ ToolType::Polygon => ToolMessageDiscriminant::ActivateToolPolygon,
ToolType::Text => ToolMessageDiscriminant::ActivateToolText,
// Raster tool group
@@ -582,14 +582,14 @@ mod tool_crash_on_layer_delete_tests {
use test_case::test_case;
- #[test_case(ToolType::Pen; "while using pen tool")]
- #[test_case(ToolType::Freehand; "while using freehand tool")]
- #[test_case(ToolType::Spline; "while using spline tool")]
- #[test_case(ToolType::Line; "while using line tool")]
- #[test_case(ToolType::Rectangle; "while using rectangle tool")]
- #[test_case(ToolType::Ellipse; "while using ellipse tool")]
- #[test_case(ToolType::Shape; "while using shape tool")]
- #[test_case(ToolType::Path; "while using path tool")]
+ #[test_case(ToolType::Pen; "while using Pen tool")]
+ #[test_case(ToolType::Freehand; "while using Freehand tool")]
+ #[test_case(ToolType::Spline; "while using Spline tool")]
+ #[test_case(ToolType::Line; "while using Line tool")]
+ #[test_case(ToolType::Rectangle; "while using Rectangle tool")]
+ #[test_case(ToolType::Ellipse; "while using Ellipse tool")]
+ #[test_case(ToolType::Polygon; "while using Polygon tool")]
+ #[test_case(ToolType::Path; "while using Path tool")]
fn should_not_crash_when_layer_is_deleted(tool: ToolType) {
set_uuid_seed(0);
let mut test_editor = Editor::new();
diff --git a/editor/src/test_utils.rs b/editor/src/test_utils.rs
index 8b6657e8..a00cee7f 100644
--- a/editor/src/test_utils.rs
+++ b/editor/src/test_utils.rs
@@ -15,7 +15,7 @@ pub trait EditorTestUtils {
fn new_document(&mut self);
fn draw_rect(&mut self, x1: f64, y1: f64, x2: f64, y2: f64);
- fn draw_shape(&mut self, x1: f64, y1: f64, x2: f64, y2: f64);
+ fn draw_polygon(&mut self, x1: f64, y1: f64, x2: f64, y2: f64);
fn draw_ellipse(&mut self, x1: f64, y1: f64, x2: f64, y2: f64);
/// Select given tool and drag it from (x1, y1) to (x2, y2)
@@ -52,8 +52,8 @@ impl EditorTestUtils for Editor {
self.drag_tool(ToolType::Rectangle, x1, y1, x2, y2);
}
- fn draw_shape(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) {
- self.drag_tool(ToolType::Shape, x1, y1, x2, y2);
+ fn draw_polygon(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) {
+ self.drag_tool(ToolType::Polygon, x1, y1, x2, y2);
}
fn draw_ellipse(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) {
diff --git a/frontend/assets/icon-24px-two-tone/vector-shape-tool.svg b/frontend/assets/icon-24px-two-tone/vector-polygon-tool.svg
similarity index 100%
rename from frontend/assets/icon-24px-two-tone/vector-shape-tool.svg
rename to frontend/assets/icon-24px-two-tone/vector-polygon-tool.svg
diff --git a/frontend/src/utility-functions/icons.ts b/frontend/src/utility-functions/icons.ts
index 12c9fc3f..5ed3245a 100644
--- a/frontend/src/utility-functions/icons.ts
+++ b/frontend/src/utility-functions/icons.ts
@@ -251,7 +251,7 @@ import VectorLineTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-
import VectorPathTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-path-tool.svg";
import VectorPenTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-pen-tool.svg";
import VectorRectangleTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-rectangle-tool.svg";
-import VectorShapeTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-shape-tool.svg";
+import VectorPolygonTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-polygon-tool.svg";
import VectorSplineTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-spline-tool.svg";
import VectorTextTool from "@graphite-frontend/assets/icon-24px-two-tone/vector-text-tool.svg";
@@ -276,7 +276,7 @@ const TWO_TONE_24PX = {
VectorPathTool: { svg: VectorPathTool, size: 24 },
VectorPenTool: { svg: VectorPenTool, size: 24 },
VectorRectangleTool: { svg: VectorRectangleTool, size: 24 },
- VectorShapeTool: { svg: VectorShapeTool, size: 24 },
+ VectorPolygonTool: { svg: VectorPolygonTool, size: 24 },
VectorSplineTool: { svg: VectorSplineTool, size: 24 },
VectorTextTool: { svg: VectorTextTool, size: 24 },
} as const;