Add star/polygon gizmos and refactor the separate shape drawing tools into a unified Shape tool (#2683)

* no trait ,not to fix line

* add hints

* line modification even when other shapes are selected

* added transform and anchor overlays

* removed old code

* fixed transform added hints need to fix modifier keys use

* refactored select-tool

* add point-handle-gizmo

* fix rotate bug

* implement angle snapping gizmo , fix overlay and refactor the code

* implement snapping for point-handle gizmo and implement no of point gizmo need to refactor

* implemented the gizmo for polygon, added tests , brackets to increase sides

* formatting-fix

* small nit-picks

* Make it compile

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0SlowPoke0
2025-06-22 00:53:49 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent e520c21b66
commit 8e5abf65cb
34 changed files with 3231 additions and 2137 deletions
+7 -2
View File
@@ -89,7 +89,7 @@ impl EditorTestUtils {
}
pub async fn draw_polygon(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) {
self.drag_tool(ToolType::Polygon, x1, y1, x2, y2, ModifierKeys::default()).await;
self.drag_tool(ToolType::Shape, x1, y1, x2, y2, ModifierKeys::default()).await;
}
pub async fn draw_ellipse(&mut self, x1: f64, y1: f64, x2: f64, y2: f64) {
@@ -218,7 +218,12 @@ impl EditorTestUtils {
}
pub async fn select_tool(&mut self, tool_type: ToolType) {
self.handle_message(Message::Tool(ToolMessage::ActivateTool { tool_type })).await;
match tool_type {
ToolType::Line => self.handle_message(Message::Tool(ToolMessage::ActivateToolShapeLine)).await,
ToolType::Rectangle => self.handle_message(Message::Tool(ToolMessage::ActivateToolShapeRectangle)).await,
ToolType::Ellipse => self.handle_message(Message::Tool(ToolMessage::ActivateToolShapeEllipse)).await,
_ => self.handle_message(Message::Tool(ToolMessage::ActivateTool { tool_type })).await,
}
}
pub async fn select_primary_color(&mut self, color: Color) {