chore(core): correct action name
This commit is contained in:
@@ -3,3 +3,18 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
Add intersection utils to help with checking if a node intersects with either other nodes or a given area
|
Add intersection utils to help with checking if a node intersects with either other nodes or a given area
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { onNodeDrag, getIntersectingNodes, getNodes } = useVueFlow()
|
||||||
|
|
||||||
|
onNodeDrag(({ node }) => {
|
||||||
|
const intersections = getIntersectingNodes(node).map((n) => n.id)
|
||||||
|
|
||||||
|
getNodes.value.forEach((n) => {
|
||||||
|
// highlight nodes that are intersecting with the dragged node
|
||||||
|
n.class = intersections.includes(n.id) ? 'highlight' : ''
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
|||||||
return [nodeRect, node, isRectObj]
|
return [nodeRect, node, isRectObj]
|
||||||
}
|
}
|
||||||
|
|
||||||
const getIntersectionNodes: Actions['getIntersectionNodes'] = (nodeOrRect, partially = true, nodes) => {
|
const getIntersectingNodes: Actions['getIntersectingNodes'] = (nodeOrRect, partially = true, nodes) => {
|
||||||
const [nodeRect, node, isRect] = getNodeRect(nodeOrRect)
|
const [nodeRect, node, isRect] = getNodeRect(nodeOrRect)
|
||||||
|
|
||||||
if (!nodeRect) return []
|
if (!nodeRect) return []
|
||||||
@@ -574,7 +574,7 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
|||||||
endConnection,
|
endConnection,
|
||||||
setInteractive,
|
setInteractive,
|
||||||
setState,
|
setState,
|
||||||
getIntersectionNodes,
|
getIntersectingNodes,
|
||||||
isNodeIntersecting,
|
isNodeIntersecting,
|
||||||
fitView: async (params = { padding: 0.1 }) => {
|
fitView: async (params = { padding: 0.1 }) => {
|
||||||
const { fitView } = await paneReady()
|
const { fitView } = await paneReady()
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ export interface Actions extends ViewportFunctions {
|
|||||||
updateNodeDimensions: UpdateNodeDimensions
|
updateNodeDimensions: UpdateNodeDimensions
|
||||||
|
|
||||||
/** returns all node intersections */
|
/** returns all node intersections */
|
||||||
getIntersectionNodes: GetIntersectingNodes
|
getIntersectingNodes: GetIntersectingNodes
|
||||||
/** check if a node is intersecting with a defined area */
|
/** check if a node is intersecting with a defined area */
|
||||||
isNodeIntersecting: IsNodeIntersecting
|
isNodeIntersecting: IsNodeIntersecting
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user