xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
25.81k stars 1.66k forks source link

`getIntersectingNodes` does not work for nodes with a depth of 2 or more #4781

Closed frouene closed 18 minutes ago

frouene commented 4 days ago

What platform were you using when you found the bug?

Live code example

https://codesandbox.io/p/devbox/musing-microservice-sfcpd5

Describe the Bug

With 3 nested nodes, when moving the highest-level one, the result of getIntersectingNodes is not correct (if the position of the nodes is different from (0,0)). I think the problem comes from evaluateAbsolutePosition, where we shouldn't be summing up the positionAbsolute of all the parents, but rather the position

Steps to reproduce the bug or issue

  1. Create 3 nested nodes
  2. Try to use getIntersectingNodes on the last child
  3. The result is not correct

Expected behavior

getIntersectingNodes should evaluate intersecting nodes correctly, whatever the depth of the nodes

Screenshots or Videos

getIntersectingNodes

Additional context

No response

peterkogo commented 4 days ago

Thanks so much for reporting this! Fixed in #4782 and will land in next release.