Change boolean 'isSourceHandle' parameter to handleType: HandleType in 'onEdgeUpdateStart' function

- In order to make the function better extendable in the future.
This commit is contained in:
Andreas Schultz
2022-04-04 09:53:19 +02:00
parent e8aa8737ae
commit 68ec5d87d7
4 changed files with 8 additions and 5 deletions
+3 -2
View File
@@ -137,10 +137,11 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
(event: React.MouseEvent<SVGGElement, MouseEvent>, isSourceHandle: boolean) => {
const nodeId = isSourceHandle ? target : source;
const handleId = isSourceHandle ? targetHandleId : sourceHandleId;
const handleType = isSourceHandle ? 'target' : 'source'
const isValidConnection = () => true;
const isTarget = isSourceHandle;
onEdgeUpdateStart?.(event, edgeElement, isSourceHandle);
onEdgeUpdateStart?.(event, edgeElement, handleType);
const _onEdgeUpdate = onEdgeUpdateEnd
? (evt: MouseEvent): void => onEdgeUpdateEnd(evt, edgeElement)
@@ -156,7 +157,7 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
isTarget,
isValidConnection,
connectionMode,
isSourceHandle ? 'target' : 'source',
handleType,
_onEdgeUpdate
);
},