paintConnection method
void
paintConnection(
- Canvas canvas,
- Connection connection,
- Node sourceNode,
- Node targetNode, {
- bool isSelected = false,
- double? animationValue,
- ConnectionStyleOverrides? styleOverrides,
Implementation
void paintConnection(
Canvas canvas,
Connection connection,
Node sourceNode, // Can be either Node or ObservableNode
Node targetNode, { // Can be either Node or ObservableNode
bool isSelected = false,
double? animationValue,
ConnectionStyleOverrides? styleOverrides,
}) {
// Get effective style from connection instance or theme
final effectiveStyle = connection.getEffectiveStyle(
theme.connectionTheme.style,
);
// Get or create path using the cache with connection style
final path = _pathCache.getOrCreatePath(
connection: connection,
sourceNode: sourceNode,
targetNode: targetNode,
connectionStyle: effectiveStyle, // Use effective style
);
if (path == null) {
return; // Failed to create path
}
// Draw the connection using the cached path
_drawConnectionWithPath(
canvas,
connection,
path,
sourceNode,
targetNode,
isSelected: isSelected,
animationValue: animationValue,
styleOverrides: styleOverrides,
);
}