feat(core,nodes): pass node intersections when dragging a single node

This commit is contained in:
braks
2022-11-04 23:44:11 +01:00
committed by Braks
parent 8a51391c31
commit 632fa93272
4 changed files with 78 additions and 70 deletions
+7 -10
View File
@@ -467,18 +467,15 @@ export default (state: State, getters: ComputedGetters): Actions => {
if (!nodeRect) return []
return (
nodes ||
state.nodes.filter((n) => {
if (!isRect && (n.id === node!.id || !n.computedPosition)) return false
return (nodes || state.nodes).filter((n) => {
if (!isRect && (n.id === node!.id || !n.computedPosition)) return false
const currNodeRect = nodeToRect(n)
const overlappingArea = getOverlappingArea(currNodeRect, nodeRect)
const partiallyVisible = partially && overlappingArea > 0
const currNodeRect = nodeToRect(n)
const overlappingArea = getOverlappingArea(currNodeRect, nodeRect)
const partiallyVisible = partially && overlappingArea > 0
return partiallyVisible || overlappingArea >= Number(nodeOrRect.width) * Number(nodeOrRect.height)
})
)
return partiallyVisible || overlappingArea >= Number(nodeOrRect.width) * Number(nodeOrRect.height)
})
}
const isNodeIntersecting: Actions['isNodeIntersecting'] = (nodeOrRect, area, partially = true) => {