I am using react-dnd package in Next.js for my dnd project. In the canDrop function I want a javascript function which can return me some value based on some parameter. Here is the problem:
Inputs: function will have 3 parameters. dragX, dragY and childrenArray. dragX and dragY are the co-ordinates of x and y position of the mouse when an element is being dragged and childrenArray I am making it from domNodes, which can be very deeply nested.
Outputs : I want 3 outputs.
- If cursor is on a childNode return that node or if not return null.
- closestNode according to the cursor position from left or right or bottom or top
- closestCorner of the colosestNode ( corners are left, right , bottom and top )