Polygon: Standard-Modus + Schließen-Button

- Polygon ist jetzt der Standard-Modus beim Öffnen
- Neuer Button "Polygon schließen" erscheint im Polygon-Modus
- Button aktiviert sich nach dem 2. gesetzten Punkt
- Klick schließt das Polygon automatisch (kein Doppelklick mehr nötig)
- Auswahl hinzufügen schließt offenes Polygon ebenfalls automatisch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:07:51 +02:00
parent 83fdce80c7
commit 8219a5445c
2 changed files with 24 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ export default function DrawIt() {
const [userNotes, setUserNotes] = useState('')
const [parentId, setParentId] = useState<string | null>(null)
const [editingNotes, setEditingNotes] = useState<{ id: string; notes: string } | null>(null)
const [mode, setMode] = useState<'rect' | 'polygon'>('rect')
const [mode, setMode] = useState<'rect' | 'polygon'>('polygon')
const [hasSelection, setHasSelection] = useState(false)
const [saving, setSaving] = useState(false)
const [status, setStatus] = useState('')
@@ -258,6 +258,15 @@ export default function DrawIt() {
</label>
</div>
<div className="action-group">
{mode === 'polygon' && (
<button
className="btn-primary btn-sm btn-block"
onClick={() => canvasRef.current?.closePolygon()}
disabled={!hasSelection}
>
Polygon schließen
</button>
)}
<button className="btn-ghost btn-sm btn-block" onClick={() => canvasRef.current?.resetSelection()}>
Auswahl zurücksetzen
</button>