handleComponentClick(component, e)}
- onDragStart={(e) => startComponentDrag(component, e)}
- onDragEnd={endDrag}
+
- {children.map((child) => {
- // 자식 컴포넌트에도 드래그 피드백 적용
- const isChildDraggingThis = dragState.isDragging && dragState.draggedComponent?.id === child.id;
- const isChildBeingDragged =
- dragState.isDragging && dragState.draggedComponents.some((dragComp) => dragComp.id === child.id);
-
- let displayChild = child;
-
- if (isChildBeingDragged) {
- if (isChildDraggingThis) {
- // 주 드래그 자식 컴포넌트
- displayChild = {
- ...child,
- position: dragState.currentPosition,
- style: {
- ...child.style,
- opacity: 0.8,
- transform: "scale(1.02)",
- transition: "none",
- zIndex: 9999,
- },
- };
- } else {
- // 다른 선택된 자식 컴포넌트들
- const originalChildComponent = dragState.draggedComponents.find(
- (dragComp) => dragComp.id === child.id,
- );
- if (originalChildComponent) {
- const deltaX = dragState.currentPosition.x - dragState.originalPosition.x;
- const deltaY = dragState.currentPosition.y - dragState.originalPosition.y;
-
- displayChild = {
- ...child,
- position: {
- x: originalChildComponent.position.x + deltaX,
- y: originalChildComponent.position.y + deltaY,
- z: originalChildComponent.position.z || 1,
- } as Position,
- style: {
- ...child.style,
- opacity: 0.8,
- transition: "none",
- zIndex: 8888,
- },
- };
- }
- }
+
handleComponentClick(component, e)}
+ onDragStart={(e) => startComponentDrag(component, e)}
+ onDragEnd={endDrag}
+ >
+ {/* 컨테이너 및 그룹의 자식 컴포넌트들 렌더링 */}
+ {(component.type === "group" || component.type === "container") &&
+ layout.components
+ .filter((child) => child.parentId === component.id)
+ .map((child) => {
+ // 자식 컴포넌트에도 드래그 피드백 적용
+ const isChildDraggingThis = dragState.isDragging && dragState.draggedComponent?.id === child.id;
+ const isChildBeingDragged =
+ dragState.isDragging &&
+ dragState.draggedComponents.some((dragComp) => dragComp.id === child.id);
- return (
- handleComponentClick(child, e)}
- onDragStart={(e) => startComponentDrag(child, e)}
- onDragEnd={endDrag}
- />
- );
- })}
-
+ let displayChild = child;
+
+ if (isChildBeingDragged) {
+ if (isChildDraggingThis) {
+ // 주 드래그 자식 컴포넌트
+ displayChild = {
+ ...child,
+ position: dragState.currentPosition,
+ style: {
+ ...child.style,
+ opacity: 0.8,
+ transform: "scale(1.02)",
+ transition: "none",
+ zIndex: 9999,
+ },
+ };
+ } else {
+ // 다른 선택된 자식 컴포넌트들
+ const originalChildComponent = dragState.draggedComponents.find(
+ (dragComp) => dragComp.id === child.id,
+ );
+ if (originalChildComponent) {
+ const deltaX = dragState.currentPosition.x - dragState.originalPosition.x;
+ const deltaY = dragState.currentPosition.y - dragState.originalPosition.y;
+
+ displayChild = {
+ ...child,
+ position: {
+ x: originalChildComponent.position.x + deltaX,
+ y: originalChildComponent.position.y + deltaY,
+ z: originalChildComponent.position.z || 1,
+ } as Position,
+ style: {
+ ...child.style,
+ opacity: 0.8,
+ transition: "none",
+ zIndex: 8888,
+ },
+ };
+ }
+ }
+ }
+
+ return (
+
+ handleComponentClick(child, e)}
+ onDragStart={(e) => startComponentDrag(child, e)}
+ onDragEnd={endDrag}
+ />
+
+ );
+ })}
+
+
);
})}
@@ -2475,7 +2576,40 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
updateComponentProperty(selectedComponent.id, "style", newStyle)}
+ onStyleChange={(newStyle) => {
+ console.log("🔧 StyleEditor 크기 변경:", {
+ componentId: selectedComponent.id,
+ newStyle,
+ currentSize: selectedComponent.size,
+ hasWidth: !!newStyle.width,
+ hasHeight: !!newStyle.height,
+ });
+
+ // 스타일 업데이트
+ updateComponentProperty(selectedComponent.id, "style", newStyle);
+
+ // 크기가 변경된 경우 component.size도 업데이트
+ if (newStyle.width || newStyle.height) {
+ const width = newStyle.width
+ ? parseInt(newStyle.width.replace("px", ""))
+ : selectedComponent.size.width;
+ const height = newStyle.height
+ ? parseInt(newStyle.height.replace("px", ""))
+ : selectedComponent.size.height;
+
+ console.log("📏 크기 업데이트:", {
+ originalWidth: selectedComponent.size.width,
+ originalHeight: selectedComponent.size.height,
+ newWidth: width,
+ newHeight: height,
+ styleWidth: newStyle.width,
+ styleHeight: newStyle.height,
+ });
+
+ updateComponentProperty(selectedComponent.id, "size.width", width);
+ updateComponentProperty(selectedComponent.id, "size.height", height);
+ }
+ }}
/>
) : (
diff --git a/frontend/components/screen/StyleEditor.tsx b/frontend/components/screen/StyleEditor.tsx
index 749c51d5..8d45013e 100644
--- a/frontend/components/screen/StyleEditor.tsx
+++ b/frontend/components/screen/StyleEditor.tsx
@@ -8,7 +8,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Separator } from "@/components/ui/separator";
-import { Palette, Layout, Type, Square, Box, Eye, RotateCcw } from "lucide-react";
+import { Palette, Type, Square, Box, Eye, RotateCcw } from "lucide-react";
import { ComponentStyle } from "@/types/screen";
interface StyleEditorProps {
@@ -62,12 +62,8 @@ export default function StyleEditor({ style, onStyleChange, className }: StyleEd