diff --git a/src/components/Edges/wrapEdge.tsx b/src/components/Edges/wrapEdge.tsx index 431032dc..afbea66a 100644 --- a/src/components/Edges/wrapEdge.tsx +++ b/src/components/Edges/wrapEdge.tsx @@ -1,4 +1,4 @@ -import React, { memo, ComponentType, useCallback } from 'react'; +import React, { memo, ComponentType, useCallback, useState } from 'react'; import cc from 'classcat'; import { useStoreActions } from '../../store/hooks'; @@ -41,13 +41,14 @@ export default (EdgeComponent: ComponentType) => { const addSelectedElements = useStoreActions((actions) => actions.addSelectedElements); const setConnectionNodeId = useStoreActions((actions) => actions.setConnectionNodeId); const setPosition = useStoreActions((actions) => actions.setConnectionPosition); + const [updating, setUpdating] = useState(false); const inactive = !elementsSelectable && !onClick; const edgeClasses = cc([ 'react-flow__edge', `react-flow__edge-${type}`, className, - { selected, animated, inactive }, + { selected, animated, inactive, updating }, ]); const onEdgeClick = useCallback( @@ -104,6 +105,9 @@ export default (EdgeComponent: ComponentType) => { [id, target, targetHandleId, handleEdgeUpdater] ); + const onEdgeUpdaterMouseEnter = useCallback(() => setUpdating(true), [setUpdating]); + const onEdgeUpdaterMouseOut = useCallback(() => setUpdating(false), [setUpdating]); + if (isHidden) { return null; } @@ -111,12 +115,16 @@ export default (EdgeComponent: ComponentType) => { return ( {handleEdgeUpdate && ( - + @@ -146,12 +154,16 @@ export default (EdgeComponent: ComponentType) => { markerEndId={markerEndId} /> {handleEdgeUpdate && ( - + diff --git a/src/style.css b/src/style.css index 9f6191e9..5f3a31b3 100644 --- a/src/style.css +++ b/src/style.css @@ -60,6 +60,12 @@ stroke-dasharray: 5; animation: dashdraw 0.5s linear infinite; } + + &.updating { + .react-flow__edge-path { + stroke: #777; + } + } } @keyframes dashdraw {