added final connection state to onReconnectEnd
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Reconnectable edges have a anchors around their handles to reconnect the edge.
|
||||
import { XYHandle, type Connection, EdgePosition } from '@xyflow/system';
|
||||
import { XYHandle, type Connection, EdgePosition, FinalConnectionState } from '@xyflow/system';
|
||||
|
||||
import { EdgeAnchor } from '../Edges/EdgeAnchor';
|
||||
import type { EdgeWrapperProps, Edge } from '../../types/edges';
|
||||
@@ -68,9 +68,9 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
|
||||
setReconnecting(true);
|
||||
onReconnectStart?.(event, edge, handleType);
|
||||
|
||||
const _onReconnectEnd = (evt: MouseEvent | TouchEvent) => {
|
||||
const _onReconnectEnd = (evt: MouseEvent | TouchEvent, connectionState: FinalConnectionState) => {
|
||||
setReconnecting(false);
|
||||
onReconnectEnd?.(evt, edge, handleType);
|
||||
onReconnectEnd?.(evt, edge, handleType, connectionState);
|
||||
};
|
||||
|
||||
const onConnectEdge = (connection: Connection) => onReconnect?.(edge, connection);
|
||||
|
||||
@@ -14,6 +14,8 @@ import type {
|
||||
EdgePosition,
|
||||
StepPathOptions,
|
||||
OnError,
|
||||
ConnectionState,
|
||||
FinalConnectionState,
|
||||
} from '@xyflow/system';
|
||||
|
||||
import { EdgeTypes, InternalNode, Node } from '.';
|
||||
@@ -78,7 +80,12 @@ export type EdgeWrapperProps<EdgeType extends Edge = Edge> = {
|
||||
onMouseLeave?: EdgeMouseHandler<EdgeType>;
|
||||
reconnectRadius?: number;
|
||||
onReconnectStart?: (event: ReactMouseEvent, edge: EdgeType, handleType: HandleType) => void;
|
||||
onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
|
||||
onReconnectEnd?: (
|
||||
event: MouseEvent | TouchEvent,
|
||||
edge: EdgeType,
|
||||
handleType: HandleType,
|
||||
connectionState: FinalConnectionState
|
||||
) => void;
|
||||
rfId?: string;
|
||||
edgeTypes?: EdgeTypes;
|
||||
onError?: OnError;
|
||||
|
||||
Reference in New Issue
Block a user