task(CAD-6): background rendering fix - bgConfig was never wired to render engine (import worked but never drew), canvas area setOptions + pixi sprite implementation

This commit is contained in:
Agent Zero
2026-08-31 08:43:13 +02:00
parent 7fe6cd127e
commit bcb0fcefe1
3 changed files with 110 additions and 3 deletions
+14 -1
View File
@@ -378,6 +378,19 @@ const CanvasArea: React.FC<CanvasAreaProps> = ({
renderEngine.setOptions({ showOrtho: orthoEnabled });
renderEngine.setOptions({ gridSize, unit, scaleFactor, showGridLabels: true });
renderEngine.setOptions({ canvasBgColor, gridColor, rulerEnabled });
// ── Task CAD-6: Hintergrund-Grundriss (bgConfig) an RenderEngine geben ──
// Vorher wurde bgConfig als Prop uebergeben aber NIE genutzt — der
// importierte Grundriss wurde nicht gezeichnet.
renderEngine.setOptions({
backgroundSrc: bgConfig?.visible ? (bgConfig.src || undefined) : undefined,
backgroundScale: bgConfig?.scale ?? 1,
backgroundOffsetX: bgConfig?.offsetX ?? 0,
backgroundOffsetY: bgConfig?.offsetY ?? 0,
backgroundRotation: ((bgConfig?.rotation ?? 0) * Math.PI) / 180,
backgroundOpacity: bgConfig?.opacity ?? 0.5,
});
renderEngine.render();
interaction.setSnapEnabled(snapEnabled);
interaction.setOrthoEnabled(orthoEnabled);
interaction.setPolarEnabled(polarEnabled);
@@ -385,7 +398,7 @@ const CanvasArea: React.FC<CanvasAreaProps> = ({
interaction.setGridSize(gridSize);
renderEngine.render();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [gridEnabled, snapEnabled, orthoEnabled, polarEnabled, unit, gridSize, scaleFactor, canvasBgColor, gridColor, rulerEnabled]);
}, [gridEnabled, snapEnabled, orthoEnabled, polarEnabled, unit, gridSize, scaleFactor, canvasBgColor, gridColor, rulerEnabled, bgConfig]);
// Sync active tool
useEffect(() => {