feat(props): add mouse event to onConnectStart and onConnectStop

This commit is contained in:
Nate Amack
2020-08-04 12:22:38 -06:00
parent 97ec24fa14
commit fddb3e777d
4 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ function onMouseDown(
setConnectionNodeId({ connectionNodeId: nodeId, connectionHandleType: handleType });
if (onConnectStart) {
onConnectStart({ nodeId, handleType });
onConnectStart(evt, { nodeId, handleType });
}
function resetRecentHandle(): void {
@@ -142,7 +142,7 @@ function onMouseDown(
setConnectionNodeId({ connectionNodeId: null, connectionHandleType: null });
if (onConnectStop) {
onConnectStop();
onConnectStop(evt);
}
document.removeEventListener('mousemove', onMouseMove);
+11 -11
View File
@@ -1,4 +1,4 @@
import { CSSProperties, MouseEvent } from 'react';
import { CSSProperties, MouseEvent as ReactMouseEvent } from 'react';
export type ElementId = string;
@@ -154,13 +154,13 @@ export interface WrapNodeProps {
isDraggable: boolean;
isConnectable: boolean;
selectNodesOnDrag: boolean;
onClick?: (evt: MouseEvent, node: Node) => void;
onMouseEnter?: (evt: MouseEvent, node: Node) => void;
onMouseMove?: (evt: MouseEvent, node: Node) => void;
onMouseLeave?: (evt: MouseEvent, node: Node) => void;
onContextMenu?: (evt: MouseEvent, node: Node) => void;
onNodeDragStart?: (evt: MouseEvent, node: Node) => void;
onNodeDragStop?: (evt: MouseEvent, node: Node) => void;
onClick?: (evt: ReactMouseEvent, node: Node) => void;
onMouseEnter?: (evt: ReactMouseEvent, node: Node) => void;
onMouseMove?: (evt: ReactMouseEvent, node: Node) => void;
onMouseLeave?: (evt: ReactMouseEvent, node: Node) => void;
onContextMenu?: (evt: ReactMouseEvent, node: Node) => void;
onNodeDragStart?: (evt: ReactMouseEvent, node: Node) => void;
onNodeDragStop?: (evt: ReactMouseEvent, node: Node) => void;
style?: CSSProperties;
className?: string;
sourcePosition?: Position;
@@ -202,8 +202,8 @@ export type OnConnectStartParams = {
nodeId: ElementId | null;
handleType: HandleType | null;
};
export type OnConnectStartFunc = (params: OnConnectStartParams) => void;
export type OnConnectStopFunc = () => void;
export type OnConnectStartFunc = (evt: ReactMouseEvent, params: OnConnectStartParams) => void;
export type OnConnectStopFunc = (evt: MouseEvent) => void;
export type SetConnectionId = {
connectionNodeId: ElementId | null;
@@ -235,7 +235,7 @@ export interface EdgeCompProps {
labelStyle?: CSSProperties;
labelShowBg?: boolean;
labelBgStyle?: CSSProperties;
onClick?: (evt: MouseEvent, edge: Edge) => void;
onClick?: (evt: ReactMouseEvent, edge: Edge) => void;
animated?: boolean;
selected?: boolean;
data?: any;