fix(core): pass valid connection func params
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,7 @@ export default function useHandle({
|
|||||||
endConnection,
|
endConnection,
|
||||||
emits,
|
emits,
|
||||||
viewport,
|
viewport,
|
||||||
|
edges,
|
||||||
} = useVueFlow()
|
} = useVueFlow()
|
||||||
|
|
||||||
function handlePointerDown(event: MouseEvent | TouchEvent) {
|
function handlePointerDown(event: MouseEvent | TouchEvent) {
|
||||||
@@ -134,6 +135,8 @@ export default function useHandle({
|
|||||||
isTarget ? 'target' : 'source',
|
isTarget ? 'target' : 'source',
|
||||||
validConnectFunc,
|
validConnectFunc,
|
||||||
doc,
|
doc,
|
||||||
|
edges.value,
|
||||||
|
findNode,
|
||||||
)
|
)
|
||||||
|
|
||||||
updateConnection(
|
updateConnection(
|
||||||
@@ -174,6 +177,8 @@ export default function useHandle({
|
|||||||
isTarget ? 'target' : 'source',
|
isTarget ? 'target' : 'source',
|
||||||
validConnectFunc,
|
validConnectFunc,
|
||||||
doc,
|
doc,
|
||||||
|
edges.value,
|
||||||
|
findNode,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
@@ -236,6 +241,8 @@ export default function useHandle({
|
|||||||
connectionClickStartHandle.value.type,
|
connectionClickStartHandle.value.type,
|
||||||
validConnectFunc,
|
validConnectFunc,
|
||||||
doc,
|
doc,
|
||||||
|
edges.value,
|
||||||
|
findNode,
|
||||||
)
|
)
|
||||||
|
|
||||||
const isOwnHandle = connection.source === connection.target
|
const isOwnHandle = connection.source === connection.target
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
import { ConnectionMode } from '~/types'
|
import { ConnectionMode } from '~/types'
|
||||||
import type { Connection, GraphNode, HandleType, NodeHandleBounds, ValidConnectionFunc, XYPosition } from '~/types'
|
import type {
|
||||||
|
Actions,
|
||||||
|
Connection,
|
||||||
|
GraphEdge,
|
||||||
|
GraphNode,
|
||||||
|
HandleType,
|
||||||
|
NodeHandleBounds,
|
||||||
|
ValidConnectionFunc,
|
||||||
|
XYPosition,
|
||||||
|
} from '~/types'
|
||||||
|
|
||||||
export interface ConnectionHandle {
|
export interface ConnectionHandle {
|
||||||
id: string | null
|
id: string | null
|
||||||
@@ -71,9 +80,9 @@ export function isValidHandle(
|
|||||||
fromType: string,
|
fromType: string,
|
||||||
isValidConnection: ValidConnectionFunc,
|
isValidConnection: ValidConnectionFunc,
|
||||||
doc: Document | ShadowRoot,
|
doc: Document | ShadowRoot,
|
||||||
|
edges: GraphEdge[],
|
||||||
|
findNode: Actions['findNode'],
|
||||||
) {
|
) {
|
||||||
const { edges, findNode } = useVueFlow()
|
|
||||||
|
|
||||||
const isTarget = fromType === 'target'
|
const isTarget = fromType === 'target'
|
||||||
|
|
||||||
const handleDomNode = doc.querySelector(`.vue-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`)
|
const handleDomNode = doc.querySelector(`.vue-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`)
|
||||||
@@ -108,7 +117,7 @@ export function isValidHandle(
|
|||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
result.isValid = isValidConnection(connection, {
|
result.isValid = isValidConnection(connection, {
|
||||||
edges: edges.value,
|
edges,
|
||||||
sourceNode: findNode(connection.source)!,
|
sourceNode: findNode(connection.source)!,
|
||||||
targetNode: findNode(connection.target)!,
|
targetNode: findNode(connection.target)!,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user