feat: Whiteboard element overlap detection and auto-layout
- Dominant language
- TypeScript
- Stars
- 37.2k
- Forks
- 5.9k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 195
Description
## Problem
When AI generates whiteboard content, elements (LaTeX formulas, text annotations, shapes) frequently overlap because the LLM-generated coordinates (`left`/`top`) are too close together. This makes complex content like chemical equations hard to read.
Example: α/β/γ ray annotations overlapping with LaTeX formulas
## Proposed Solution
Add a **post-processing collision detection** step before elements are rendered on the whiteboard:
1. After AI generates element positions, run a simple AABB (axis-aligned bounding box) overlap check
2. If overlap is detected, auto-nudge elements apart (e.g., push down/right with margin)
3. Optionally, improve the AI prompt to encourage better spatial layout
### Alternative / Complementary
- Add layout hints to the system prompt (e.g., "leave at least 40px between elements")
- Implement a simple grid-snapping or auto-arrange button for users
## Context
Discovered while working on #32 (whiteboard history). The overlap issue is independent of history/undo functionality — it's in the AI action generation layer.
Contributor guide
Assessment
This issue has not been assessed yet.