feat(edgeUpdate): add onEdgeUpdateStart handler closes #1120

This commit is contained in:
moklick
2021-04-30 16:09:46 +02:00
parent b2213bd9b5
commit 3232a33e9e
6 changed files with 21 additions and 2 deletions
+4 -1
View File
@@ -44,6 +44,7 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
onMouseMove,
onMouseLeave,
edgeUpdaterRadius,
onEdgeUpdateStart,
}: WrapEdgeProps): JSX.Element | null => {
const addSelectedElements = useStoreActions((actions) => actions.addSelectedElements);
const setConnectionNodeId = useStoreActions((actions) => actions.setConnectionNodeId);
@@ -138,6 +139,8 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
const isValidConnection = () => true;
const isTarget = isSourceHandle;
onEdgeUpdateStart?.(event, edgeElement);
onMouseDown(
event,
handleId,
@@ -150,7 +153,7 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
connectionMode
);
},
[id, source, target, type, sourceHandleId, targetHandleId, setConnectionNodeId, setPosition]
[id, source, target, type, sourceHandleId, targetHandleId, setConnectionNodeId, setPosition, edgeElement]
);
const onEdgeUpdaterSourceMouseDown = useCallback(