Merge pull request #4877 from xyflow/fix/intersection-origin2
Fix intersection for various node origins
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@xyflow/react': patch
|
||||
'@xyflow/svelte': patch
|
||||
---
|
||||
|
||||
Fix intersections for nodes with origins other than [0,0]. Thanks [@gmvrpw](https://github.com/gmvrpw)!
|
||||
@@ -55,11 +55,10 @@ export function useReactFlow<NodeType extends Node = Node, EdgeType extends Edge
|
||||
: nodeToUse.position;
|
||||
|
||||
const nodeWithPosition = {
|
||||
id: nodeToUse.id,
|
||||
...nodeToUse,
|
||||
position,
|
||||
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
||||
height: nodeToUse.measured?.height ?? nodeToUse.height,
|
||||
data: nodeToUse.data,
|
||||
};
|
||||
|
||||
return nodeToRect(nodeWithPosition);
|
||||
|
||||
@@ -293,11 +293,10 @@ export function useSvelteFlow(): {
|
||||
: nodeToUse.position;
|
||||
|
||||
const nodeWithPosition = {
|
||||
id: nodeToUse.id,
|
||||
...nodeToUse,
|
||||
position,
|
||||
width: nodeToUse.measured?.width ?? nodeToUse.width,
|
||||
height: nodeToUse.measured?.height ?? nodeToUse.height,
|
||||
data: nodeToUse.data
|
||||
height: nodeToUse.measured?.height ?? nodeToUse.height
|
||||
};
|
||||
|
||||
return nodeToRect(nodeWithPosition);
|
||||
|
||||
Reference in New Issue
Block a user