refactor(core): allow ref for isValidConnection in useHandle
This commit is contained in:
@@ -58,7 +58,7 @@ const EdgeWrapper = defineComponent({
|
|||||||
nodeId,
|
nodeId,
|
||||||
handleId,
|
handleId,
|
||||||
type: edgeUpdaterType,
|
type: edgeUpdaterType,
|
||||||
isValidConnection: isValidConnection.value,
|
isValidConnection,
|
||||||
edgeUpdaterType,
|
edgeUpdaterType,
|
||||||
onEdgeUpdate,
|
onEdgeUpdate,
|
||||||
onEdgeUpdateEnd,
|
onEdgeUpdateEnd,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ interface UseHandleProps {
|
|||||||
handleId: MaybeComputedRef<string | null>
|
handleId: MaybeComputedRef<string | null>
|
||||||
nodeId: MaybeComputedRef<string>
|
nodeId: MaybeComputedRef<string>
|
||||||
type: MaybeComputedRef<HandleType>
|
type: MaybeComputedRef<HandleType>
|
||||||
isValidConnection?: ValidConnectionFunc | null
|
isValidConnection?: MaybeComputedRef<ValidConnectionFunc | null>
|
||||||
edgeUpdaterType?: MaybeComputedRef<HandleType>
|
edgeUpdaterType?: MaybeComputedRef<HandleType>
|
||||||
onEdgeUpdate?: (event: MouseTouchEvent, connection: Connection) => void
|
onEdgeUpdate?: (event: MouseTouchEvent, connection: Connection) => void
|
||||||
onEdgeUpdateEnd?: (event: MouseTouchEvent) => void
|
onEdgeUpdateEnd?: (event: MouseTouchEvent) => void
|
||||||
@@ -59,7 +59,7 @@ export default function useHandle({
|
|||||||
if ((isMouseTriggered && event.button === 0) || !isMouseTriggered) {
|
if ((isMouseTriggered && event.button === 0) || !isMouseTriggered) {
|
||||||
const node = findNode(resolveUnref(nodeId))
|
const node = findNode(resolveUnref(nodeId))
|
||||||
|
|
||||||
let isValidConnectionHandler = isValidConnection || isValidConnectionProp.value || alwaysValid
|
let isValidConnectionHandler = resolveUnref(isValidConnection) || isValidConnectionProp.value || alwaysValid
|
||||||
|
|
||||||
if (!isValidConnectionHandler && node) {
|
if (!isValidConnectionHandler && node) {
|
||||||
isValidConnectionHandler = (!isTarget ? node.isValidTargetPos : node.isValidSourcePos) || alwaysValid
|
isValidConnectionHandler = (!isTarget ? node.isValidTargetPos : node.isValidSourcePos) || alwaysValid
|
||||||
@@ -235,7 +235,7 @@ export default function useHandle({
|
|||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let isValidConnectionHandler = isValidConnection || isValidConnectionProp.value || alwaysValid
|
let isValidConnectionHandler = resolveUnref(isValidConnection) || isValidConnectionProp.value || alwaysValid
|
||||||
|
|
||||||
const node = findNode(resolveUnref(nodeId))
|
const node = findNode(resolveUnref(nodeId))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user