THU-MAIC / THU-MAIC/OpenMAIC

feat: Whiteboard element overlap detection and auto-layout

Open
#38 0 comments 3 reactions 0 assignees View on GitHub
area:editor enhancement priority:P2 status:icebox
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.

Image

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.