컴포넌트 잠금기능 구현

This commit is contained in:
dohyeons
2025-10-01 16:23:20 +09:00
parent 172ecf34b3
commit a1ddf4678d
5 changed files with 151 additions and 9 deletions

View File

@@ -103,10 +103,10 @@ export function ReportDesignerCanvas() {
const idsToMove =
selectedComponentIds.length > 0 ? selectedComponentIds : ([selectedComponentId].filter(Boolean) as string[]);
// 각 컴포넌트 이동
// 각 컴포넌트 이동 (잠긴 컴포넌트는 제외)
idsToMove.forEach((id) => {
const component = components.find((c) => c.id === id);
if (!component) return;
if (!component || component.locked) return;
let newX = component.x;
let newY = component.y;
@@ -132,12 +132,20 @@ export function ReportDesignerCanvas() {
return;
}
// Delete 키: 삭제
// Delete 키: 삭제 (잠긴 컴포넌트는 제외)
if (e.key === "Delete") {
if (selectedComponentIds.length > 0) {
selectedComponentIds.forEach((id) => removeComponent(id));
selectedComponentIds.forEach((id) => {
const component = components.find((c) => c.id === id);
if (component && !component.locked) {
removeComponent(id);
}
});
} else if (selectedComponentId) {
removeComponent(selectedComponentId);
const component = components.find((c) => c.id === selectedComponentId);
if (component && !component.locked) {
removeComponent(selectedComponentId);
}
}
}