-
-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add custom path connection type with control points #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
|
Implement drag and drop logic for this points similar to dnd features inside library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for custom connection paths with user-defined control points, addressing the need for manual path routing in industrial diagrams (P&ID, circuit diagrams, process flows).
- Added
CUSTOM_PATHenum value andFCustomPathBuilderclass to render paths through arbitrary control points with rounded corners - Extended connection API with
fControlPointsinput across all connection components - Included comprehensive example demonstrating L-shaped, Z-shaped, and multi-segment industrial-style paths
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/app/examples.config.ts |
Registers new example component with metadata |
public/markdown/examples/custom-path-control-points.md |
Documentation for custom path feature with usage examples |
projects/f-flow/src/f-connection/f-snap-connection/f-snap-connection.component.ts |
Adds fControlPoints property to snap connection |
projects/f-flow/src/f-connection/f-connection/f-connection.component.ts |
Adds @Input() fControlPoints to main connection component |
projects/f-flow/src/f-connection/f-connection-for-create/f-connection-for-create.component.ts |
Adds fControlPoints property to connection creation component |
projects/f-flow/src/f-connection/f-connection-builder/i-f-connection-builder-request.ts |
Extends interface with optional controlPoints field |
projects/f-flow/src/f-connection/f-connection-builder/f-connection-factory.ts |
Registers FCustomPathBuilder for CUSTOM_PATH type |
projects/f-flow/src/f-connection/common/f-connection-base.ts |
Adds abstract fControlPoints property and passes to builder |
projects/f-flow/src/f-connection/common/e-f-connection-type.ts |
Adds CUSTOM_PATH enum value |
projects/f-flow/src/f-connection/common/domain/index.ts |
Exports new FCustomPathBuilder |
projects/f-flow/src/f-connection/common/domain/f-custom-path.builder.ts |
Core implementation of custom path rendering with bezier curves |
projects/f-flow/src/f-connection/common/domain/f-custom-path.builder.spec.ts |
Comprehensive unit tests for path builder |
projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.ts |
Example component with three path patterns |
projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.scss |
Styling for example component |
projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.html |
Template demonstrating custom paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @Input() | ||
| public override fType: EFConnectionType | string = EFConnectionType.STRAIGHT; | ||
|
|
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fControlPoints property should be decorated with @Input() to allow parent components to bind values. The main FConnectionComponent uses @Input() for this property (line 72-73), but FSnapConnectionComponent is missing this decorator.
| @Input() |
|
|
||
| @Input() | ||
| public override fType: EFConnectionType | string = EFConnectionType.STRAIGHT; | ||
|
|
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fControlPoints property should be decorated with @Input() to allow parent components to bind values. The main FConnectionComponent uses @Input() for this property (line 72-73), but FConnectionForCreateComponent is missing this decorator.
| @Input() |
| private _buildLastLineSegment(index: number, point: IPoint): string { | ||
| // Add small offset to ensure proper rendering | ||
| return `L${point.x + 0.0002} ${point.y + 0.0002}`; |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0.0002 lacks explanation for why this specific value is needed for proper rendering. Consider extracting this to a named constant with a comment explaining the technical reason (e.g., RENDERING_OFFSET = 0.0002 // Prevents SVG rendering artifacts at path endpoints).
| return `${index === 0 ? 'M' : 'L'}${point.x} ${point.y}`; | ||
| } | ||
|
|
||
| private _buildLastLineSegment(index: number, point: IPoint): string { |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index parameter is unused in this method. Consider removing it or adding a comment explaining why it's kept for consistency with other segment builders.
| private _buildLastLineSegment(index: number, point: IPoint): string { | |
| private _buildLastLineSegment(point: IPoint): string { |
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
Co-authored-by: siarheihuzarevich <13272876+siarheihuzarevich@users.noreply.github.com>
…path Add drag-and-drop for custom path control points
Enables user-defined connection paths via control points for industrial diagrams (P&ID, circuit diagrams, process flows) where automatic routing is insufficient.
Changes
CUSTOM_PATHtoEFConnectionTypeenumFCustomPathBuilderrenders paths through arbitrary control points with configurable rounded corners via quadratic bezier curvescontrolPoints?: IPoint[]toIFConnectionBuilderRequestandfControlPointsinput to all connection componentscustom-path-control-pointscomponent demonstrates L-shaped, Z-shaped, and multi-segment pathsUsage
Backward compatible - existing connection types unchanged.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.ionode index.js --exec install(dns block)fonts.googleapis.comng build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.