add line and polygon tools

This commit is contained in:
Skyler Lehmkuhl
2025-11-19 09:27:13 -05:00
parent 08f3c30b29
commit a0875b1bc0
3 changed files with 334 additions and 1 deletions
@@ -78,6 +78,11 @@ impl Action for PaintBucketAction {
for object in vector_layer.objects.iter().rev() {
// Find the corresponding shape
if let Some(shape) = vector_layer.shapes.iter().find(|s| s.id == object.shape_id) {
// Skip shapes without fill color (e.g., lines with only stroke)
if shape.fill_color.is_none() {
continue;
}
// Apply the object's transform to get the transformed path
let transform_affine = object.transform.to_affine();
@@ -85,6 +85,19 @@ pub enum ToolState {
current_mouse: Point, // Current mouse position during drag
original_bbox: vello::kurbo::Rect, // Bounding box at start of transform (fixed)
},
/// Creating a line
CreatingLine {
start_point: Point, // Starting point of the line
current_point: Point, // Current mouse position (end point)
},
/// Creating a polygon
CreatingPolygon {
center: Point, // Center point of the polygon
current_point: Point, // Current mouse position (determines radius)
num_sides: u32, // Number of sides (from properties, default 5)
},
}
/// Path simplification mode for the draw tool