초기 position 세팅 수정

This commit is contained in:
minsik 2024-11-06 15:47:04 +09:00
parent dbbb575fdd
commit b0a9e91d07
2 changed files with 7 additions and 7 deletions

View File

@ -1,18 +1,18 @@
'use client'
import { useEffect, useState } from 'react'
import { useState } from 'react'
import Draggable from 'react-draggable'
export default function WithDraggable({ isShow, children, pos, handle = '' }) {
const [position, setPosition] = useState({ x: 0, y: 0 })
export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 }, handle = '' }) {
const [position, setPosition] = useState(pos)
const handleOnDrag = (e, data) => {
e.stopPropagation()
setPosition({ x: data.x, y: data.y })
}
useEffect(() => {
setPosition({ ...pos })
}, [])
// useEffect(() => {
// setPosition({ ...pos })
// }, [])
return (
<>

View File

@ -240,7 +240,7 @@ export default function PlacementSurfaceSetting({ id, pos = { x: 50, y: 230 } })
}, [])
return (
<WithDraggable isShow={true} pos={{ x: 50, y: 230 }}>
<WithDraggable isShow={true} pos={pos}>
<div className={`modal-pop-wrap lr-2`}>
<div className="modal-head">
<h1 className="title">{getMessage('plan.menu.placement.surface.arrangement')} </h1>