Self-intersecting polygons: valid but fill may look odd
Very small polygons: minimum size constraints
Open polygon vs closed: always close the shape
## Overview
Add support for freeform polygon shapes with custom vertices.
## Current State
- Fixed shapes: Rectangle, Circle, Triangle
- No support for arbitrary polygons
- Triangle has 3 fixed vertices based on position
## Implementation Plan
### 1. SPolygon class
- Create new SPolygon extending AbstractShape
- Store list of Point vertices
- Calculate bounds from vertices
### 2. Polygon creation
- Click multiple points to define vertices
- Press Enter or double-click to complete
- Minimum 3 points for valid polygon
### 3. Resizing polygons
- Scale proportionally when resized
- Or adjust individual vertices (advanced)
- Initial implementation: scale all vertices from center
### 4. Rendering
- ShapeDraftman: draw polygon with Graphics2D.drawPolygon()
- SVGDraftman: emit <polygon points="...">
- HTMLDraftman: use clip-path polygon or SVG background
### 5. ShapeVisitor updates
- Add visitPolygon(SPolygon) to ShapeVisitor interface
- Update all visitor implementations
### 6. Attributes support
- ColorAttributes: fill and stroke colors
- SelectionAttributes: selection state
- Hit testing: use Polygon.contains() or ray casting
## Files to create/modify
- Create: shapes/SPolygon.java
- Modify: ShapeVisitor.java - add visitPolygon method
- Modify: ui/ShapeDraftman.java - implement visitPolygon
- Modify: ui/visitors/SVGDraftman.java - implement visitPolygon
- Modify: ui/visitors/HTMLDraftman.java - implement visitPolygon
- Modify: App.java - add Add Polygon menu item
## Edge cases
- Less than 3 points: invalid, do not create
- Self-intersecting polygons: valid but fill may look odd
- Very small polygons: minimum size constraints
- Open polygon vs closed: always close the shape
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Overview
Add support for freeform polygon shapes with custom vertices.
Current State
Implementation Plan
1. SPolygon class
2. Polygon creation
3. Resizing polygons
4. Rendering
5. ShapeVisitor updates
6. Attributes support
Files to create/modify
Edge cases