Skip to content

Commit b80f414

Browse files
docs: add markdown documentation for custom path control points
Co-authored-by: siarheihuzarevich <[email protected]>
1 parent 6e23a6f commit b80f414

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Custom Path with Control Points
2+
3+
## Description
4+
5+
This feature allows you to create custom connection paths with multiple control points, ideal for industrial diagrams like P&ID (Piping and Instrumentation Diagrams), circuit diagrams, and process flow diagrams where precise manual positioning of connection paths is required.
6+
7+
Instead of relying on automatic path calculation, you can define exactly where the connection should route by providing an array of intermediate control points between the source and target nodes.
8+
9+
## Key Features
10+
11+
- **Multiple Control Points**: Define as many intermediate points as needed for complex paths
12+
- **Rounded Corners**: Automatically applies smooth corners at control points using quadratic bezier curves
13+
- **Flexible Routing**: Perfect for industrial diagrams requiring specific routing patterns
14+
- **Easy to Use**: Simply provide an array of points through the `fControlPoints` input
15+
16+
## Use Cases
17+
18+
- **P&ID Diagrams**: Route pipes and flow lines around equipment
19+
- **Circuit Diagrams**: Position wires and traces precisely
20+
- **Process Flow Diagrams**: Control flow paths through different process stages
21+
- **Architectural Plans**: Route connections along specific paths
22+
23+
## Example
24+
25+
::: ng-component <custom-path-control-points></custom-path-control-points> [height]="700"
26+
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.html
27+
[component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.ts
28+
[component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-path-control-points/custom-path-control-points.component.scss
29+
[common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss
30+
:::
31+
32+
## How to Use
33+
34+
To create a custom path connection, set the connection type to `custom-path` and provide an array of control points:
35+
36+
```html
37+
<f-connection
38+
fType="custom-path"
39+
fOutputId="output1"
40+
fInputId="input1"
41+
[fControlPoints]="[
42+
{ x: 150, y: 50 },
43+
{ x: 150, y: 100 }
44+
]"
45+
[fRadius]="8"
46+
>
47+
</f-connection>
48+
```
49+
50+
### Parameters
51+
52+
- **fType**: Set to `"custom-path"` to use the custom path builder
53+
- **fControlPoints**: Array of `{ x: number, y: number }` points defining the intermediate path
54+
- **fRadius**: (Optional) Controls the roundness of corners at control points (default: 8)
55+
56+
## Advanced Usage
57+
58+
You can dynamically update control points in your component:
59+
60+
```typescript
61+
export class MyComponent {
62+
public controlPoints = [
63+
{ x: 100, y: 50 },
64+
{ x: 100, y: 100 },
65+
{ x: 200, y: 100 }
66+
];
67+
68+
public updatePath() {
69+
// Modify control points based on user interaction
70+
this.controlPoints = [
71+
{ x: 150, y: 75 },
72+
{ x: 150, y: 125 }
73+
];
74+
}
75+
}
76+
```
77+
78+
## Future Enhancements
79+
80+
While the current implementation allows you to specify control points programmatically, future enhancements may include:
81+
82+
- Interactive drag handles for each control point
83+
- Visual controls for adding/removing control points
84+
- Snap-to-grid functionality for control points
85+
- Automatic control point optimization
86+
87+
## Tips
88+
89+
1. **Start Simple**: Begin with 1-2 control points and add more as needed
90+
2. **Use Rounded Corners**: Set `fRadius` to create smoother, more professional-looking paths
91+
3. **Plan Your Routes**: Sketch out your desired path before defining control points
92+
4. **Store Paths**: Save control point arrays in your data model for persistence

0 commit comments

Comments
 (0)