diff --git a/src/container/EdgeRenderer/index.tsx b/src/container/EdgeRenderer/index.tsx index 0a447695..b0818914 100644 --- a/src/container/EdgeRenderer/index.tsx +++ b/src/container/EdgeRenderer/index.tsx @@ -24,6 +24,7 @@ interface EdgeRendererProps { connectionLineType: ConnectionLineType; connectionLineStyle?: CSSProperties; connectionLineComponent?: ConnectionLineComponent; + connectionLineContainerStyle?: CSSProperties; onEdgeClick?: (event: React.MouseEvent, node: Edge) => void; onEdgeDoubleClick?: (event: React.MouseEvent, edge: Edge) => void; defaultMarkerColor: string; @@ -75,6 +76,15 @@ const EdgeRenderer = (props: EdgeRendererProps) => { const { connectionLineType, defaultMarkerColor, connectionLineStyle, connectionLineComponent } = props; const renderConnectionLine = connectionNodeId && connectionHandleType; + let { connectionLineContainerStyle } = props + if (connectionLineContainerStyle?.zIndex === undefined) { + // if not set already, set the zIndex to the max level of the any edge + connectionLineContainerStyle = { + ...connectionLineContainerStyle, + zIndex: edgeTree.find(({ isMaxLevel }) => isMaxLevel)?.level + } + } + return ( <> {edgeTree.map(({ level, edges, isMaxLevel }) => ( @@ -179,22 +189,29 @@ const EdgeRenderer = (props: EdgeRendererProps) => { /> ); })} - {renderConnectionLine && isMaxLevel && ( - - )} ))} + {renderConnectionLine && + + + + } ); }; diff --git a/src/container/FlowRenderer/index.tsx b/src/container/FlowRenderer/index.tsx index 57b0ba11..ced447d9 100644 --- a/src/container/FlowRenderer/index.tsx +++ b/src/container/FlowRenderer/index.tsx @@ -18,6 +18,7 @@ interface FlowRendererProps | 'edgeTypes' | 'snapGrid' | 'connectionLineType' + | 'connectionLineContainerStyle' | 'arrowHeadColor' | 'onlyRenderVisibleElements' | 'selectNodesOnDrag' diff --git a/src/container/GraphView/index.tsx b/src/container/GraphView/index.tsx index f39cf1bd..e5db5604 100644 --- a/src/container/GraphView/index.tsx +++ b/src/container/GraphView/index.tsx @@ -50,6 +50,7 @@ const GraphView = ({ connectionLineType, connectionLineStyle, connectionLineComponent, + connectionLineContainerStyle, selectionKeyCode, multiSelectionKeyCode, zoomActivationKeyCode, @@ -125,6 +126,7 @@ const GraphView = ({ connectionLineType={connectionLineType} connectionLineStyle={connectionLineStyle} connectionLineComponent={connectionLineComponent} + connectionLineContainerStyle={connectionLineContainerStyle} onEdgeUpdate={onEdgeUpdate} onlyRenderVisibleElements={onlyRenderVisibleElements} onEdgeContextMenu={onEdgeContextMenu} diff --git a/src/container/ReactFlow/index.tsx b/src/container/ReactFlow/index.tsx index f51b9a31..2951da3b 100644 --- a/src/container/ReactFlow/index.tsx +++ b/src/container/ReactFlow/index.tsx @@ -87,6 +87,7 @@ const ReactFlow = forwardRef( connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, + connectionLineContainerStyle, deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', multiSelectionKeyCode = 'Meta', @@ -169,6 +170,7 @@ const ReactFlow = forwardRef( connectionLineType={connectionLineType} connectionLineStyle={connectionLineStyle} connectionLineComponent={connectionLineComponent} + connectionLineContainerStyle={connectionLineContainerStyle} selectionKeyCode={selectionKeyCode} deleteKeyCode={deleteKeyCode} multiSelectionKeyCode={multiSelectionKeyCode} diff --git a/src/types/component-props.ts b/src/types/component-props.ts index e55093a2..8d5380a3 100644 --- a/src/types/component-props.ts +++ b/src/types/component-props.ts @@ -81,6 +81,7 @@ export interface ReactFlowProps extends HTMLAttributes { connectionLineType?: ConnectionLineType; connectionLineStyle?: CSSProperties; connectionLineComponent?: ConnectionLineComponent; + connectionLineContainerStyle?: CSSProperties; deleteKeyCode?: KeyCode | null; selectionKeyCode?: KeyCode | null; multiSelectionKeyCode?: KeyCode | null;