Feature: Draggable edge
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
} from '../../types';
|
||||
|
||||
type ValidConnectionFunc = (connection: Connection) => boolean;
|
||||
type SetSourceIdFunc = (params: SetConnectionId) => void;
|
||||
export type SetSourceIdFunc = (params: SetConnectionId) => void;
|
||||
|
||||
interface BaseHandleProps {
|
||||
type: HandleType;
|
||||
@@ -40,7 +40,7 @@ type Result = {
|
||||
isHoveringHandle: boolean;
|
||||
};
|
||||
|
||||
function onMouseDown(
|
||||
export function onMouseDown(
|
||||
event: ReactMouseEvent,
|
||||
nodeId: ElementId,
|
||||
setConnectionNodeId: SetSourceIdFunc,
|
||||
@@ -67,7 +67,7 @@ function onMouseDown(
|
||||
y: event.clientY - containerBounds.top,
|
||||
});
|
||||
setConnectionNodeId({ connectionNodeId: nodeId, connectionHandleType: handleType });
|
||||
|
||||
|
||||
if (onConnectStart) {
|
||||
onConnectStart(event, { nodeId, handleType });
|
||||
}
|
||||
@@ -136,7 +136,7 @@ function onMouseDown(
|
||||
|
||||
function onMouseUp(event: MouseEvent) {
|
||||
const { connection, isValid } = checkElementBelowIsValid(event);
|
||||
|
||||
|
||||
if (onConnectStop) {
|
||||
onConnectStop(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user