@@ -33,6 +33,26 @@ export default function EditorNodeWrapper({
3333 const isStackItem = parentNode ?. type === "Stack" ;
3434 const hasRelativePosition = node . style . position === "relative" ;
3535
36+ const { id } = node ;
37+ const isSelected = selectedId === node . id ;
38+ const isGroup = node . type === "Group" ;
39+
40+ // โโโ ๋ชจ๋ hooks๋ ์กฐ๊ฑด ๋ถ๊ธฐ(early return) ์ ์ ํธ์ถ โโโ
41+ const [ isTransformActive , setIsTransformActive ] = useState ( false ) ;
42+ const [ dragPosition , setDragPosition ] = useState < {
43+ x : number ;
44+ y : number ;
45+ } > ( {
46+ x : 0 ,
47+ y : 0 ,
48+ } ) ;
49+
50+ // ํ์ํ ๋ฐ์ดํฐ๋ง ๊ตฌ๋
51+ const draggingId = useDragStore ( ( s ) => s . draggingNodeId ) ;
52+ const hoveredStackId = useDragStore ( ( s ) => s . hoveredStackId ) ;
53+ const setDraggingId = useDragStore ( ( s ) => s . setDraggingId ) ;
54+ const setHoveredStackId = useDragStore ( ( s ) => s . setHoveredStackId ) ;
55+
3656 // Stack ๋ด๋ถ flow ์์ดํ
์ FlowNodeWrapper๋ก ๋ ๋๋ง
3757 const isFlowItem = isStackItem && hasRelativePosition ;
3858 if ( isFlowItem ) {
@@ -52,35 +72,17 @@ export default function EditorNodeWrapper({
5272
5373 const isSwitchItems = isStackItem && hasRelativePosition ;
5474
55- const isSelected = selectedId === node . id ;
56- const isGroup = node . type === "Group" ;
5775 const wrapperStyle : React . CSSProperties = {
5876 cursor : "move" ,
5977 } ;
6078
61- const [ isTransformActive , setIsTransformActive ] = useState ( false ) ;
62- const [ dragPosition , setDragPosition ] = useState < {
63- x : number ;
64- y : number ;
65- } > ( {
66- x : 0 ,
67- y : 0 ,
68- } ) ;
69-
70- const { id } = node ;
7179 const { width, height, x, y, zIndex } = node . layout ;
7280 const selectedNodeGuideClasses = {
7381 // ์๊ฐ์ ํธ๋ค์ SelectionOverlay ํฌํ์์ ๋ ๋๋ง.
7482 // Rnd์ ํธ๋ค์ ์ธํฐ๋์
๋ง ๋ด๋น (ํฌ๋ช
ํ๊ฒ ์ ์ง)
7583 handle : "opacity-0 !w-3 !h-3 " ,
7684 } ;
7785
78- // ํ์ํ ๋ฐ์ดํฐ๋ง ๊ตฌ๋
79- const draggingId = useDragStore ( ( s ) => s . draggingNodeId ) ;
80- const hoveredStackId = useDragStore ( ( s ) => s . hoveredStackId ) ;
81- const setDraggingId = useDragStore ( ( s ) => s . setDraggingId ) ;
82- const setHoveredStackId = useDragStore ( ( s ) => s . setHoveredStackId ) ;
83-
8486 //๋ฐ์ดํฐ๋ฅผ ๋ฐํ์ผ๋ก ๊ฐ์ด๋ ํ์ ์ฌ๋ถ ๊ฒฐ์
8587 const isDraggingMyself = draggingId === id ;
8688 const isHoveredStack = hoveredStackId === id ;
0 commit comments