bbox/polygon durch selections ersetzen

- bbox und polygon Felder in Directus versteckt (Daten bleiben)
- Alle Auswahlen laufen nur noch über das selections-Feld
- CanvasObject, DirectusObject, API und Zeichenlogik umgestellt
- Objekte mit mehreren Auswahlen werden korrekt auf Canvas gezeichnet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:36:22 +02:00
parent 807c733770
commit e18d9a5796
5 changed files with 31 additions and 47 deletions

View File

@@ -50,8 +50,7 @@ export default function DrawIt() {
const canvasObjects: CanvasObject[] = objects.map((obj, i) => ({
id: obj.id,
visible: obj.visible !== false,
bbox: obj.bbox,
polygon: obj.polygon,
selections: obj.selections,
index: i + 1,
hierarchy: 1,
}))
@@ -88,11 +87,8 @@ export default function DrawIt() {
if (!currentPicture || !token || currentSelections.length === 0) return
setSaving(true)
try {
const first = currentSelections[0]
const obj = await createDirectusObject({
picture: currentPicture.id,
bbox: first.mode === 'rect' ? (first.bbox ?? null) : null,
polygon: first.mode === 'polygon' ? (first.polygon ?? null) : null,
selections: currentSelections,
user_notes: userNotes.trim() || null,
parent: parentId,
@@ -182,7 +178,7 @@ export default function DrawIt() {
/>
<div className="object-item-text">
<strong>Objekt {i + 1}</strong>
<span>{obj.bbox ? `Rect ${Math.round(obj.bbox.width)}×${Math.round(obj.bbox.height)}` : obj.polygon ? `Poly ${obj.polygon.length} Pkt.` : ''}</span>
<span>{obj.selections?.length ? `${obj.selections.length} Auswahl(en)` : ''}</span>
{obj.parent && <span style={{ color: 'var(--primary-muted-fg)', fontSize: 11 }}> Kind von #{objects.findIndex(o => o.id === obj.parent) + 1}</span>}
</div>
<button