I am dragging a button from the left side to a container but it is not getting exact where i dropped it here is the code what I am doing in a drop of dropTarget. As it is being dropped inside a container so i have to perform these calculations
const parent = ReactDOM.findDOMNode(component).getBoundingClientRect()
const child = (monitor.getInitialClientOffset());
const childTop = child.y - parent.top;
const childLeft = child.x - parent.left;
const difference = monitor.getDifferenceFromInitialOffset();
const exactLeft = difference.x + childLeft
const exactTop = difference.y + childTop
const positionObject = {
top: exactTop + "px",
left: exactLeft + "px"
}
i have attached the gif also of what happening why i it is not dropped on right target?