diff --git a/.changeset/afraid-lies-deny.md b/.changeset/afraid-lies-deny.md new file mode 100644 index 00000000..982e3bab --- /dev/null +++ b/.changeset/afraid-lies-deny.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Calculate overlapping area in getNodeIntersections correctly. diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 83c5520e..5019c616 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -662,7 +662,11 @@ export function useActions(state: State, nodeLookup: ComputedRef, ed const overlappingArea = getOverlappingArea(currNodeRect, nodeRect) const partiallyVisible = partially && overlappingArea > 0 - if (partiallyVisible || overlappingArea >= Number(nodeRect.width) * Number(nodeRect.height)) { + if ( + partiallyVisible || + overlappingArea >= currNodeRect.width * currNodeRect.height || + overlappingArea >= Number(nodeRect.width) * Number(nodeRect.height) + ) { intersections.push(n) } }