diff --git a/frontend/contexts/ReportDesignerContext.tsx b/frontend/contexts/ReportDesignerContext.tsx index 7d0af59a..95eb564a 100644 --- a/frontend/contexts/ReportDesignerContext.tsx +++ b/frontend/contexts/ReportDesignerContext.tsx @@ -783,7 +783,8 @@ export function ReportDesignerProvider({ reportId, children }: { reportId: strin setComponents((prev) => prev.map((c) => { if (idsToUpdate.includes(c.id)) { - return { ...c, zIndex: minZIndex - 1 }; + // zIndex는 최소 1로 제한 (0이면 캔버스 배경 뒤로 가버림) + return { ...c, zIndex: Math.max(1, minZIndex - 1) }; } return c; }), @@ -821,11 +822,12 @@ export function ReportDesignerProvider({ reportId, children }: { reportId: strin setComponents((prev) => { const sorted = [...prev].sort((a, b) => a.zIndex - b.zIndex); - const updated = sorted.map((c, index) => ({ ...c, zIndex: index })); + const updated = sorted.map((c, index) => ({ ...c, zIndex: index + 1 })); return updated.map((c) => { if (idsToUpdate.includes(c.id)) { - return { ...c, zIndex: Math.max(c.zIndex - 1, 0) }; + // zIndex는 최소 1로 제한 + return { ...c, zIndex: Math.max(c.zIndex - 1, 1) }; } return c; });