-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Added custom connections example
- Loading branch information
1 parent
377b610
commit fcfce91
Showing
9 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
projects/f-examples/connections/custom-connections/custom-connections.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<f-flow fDraggable (fLoaded)="onLoaded()"> | ||
<f-canvas> | ||
<f-connection [fReassignDisabled]="true" | ||
fOutputId="1" fInputId="2" fBehavior="fixed" fType="segment" | ||
class="gradient-color" | ||
fStartColor="var(--connection-gradient-1)" fEndColor="var(--connection-gradient-2)"> | ||
</f-connection> | ||
<div fNode fDragHandle [fNodePosition]="{ x: 0, y: 0 }" fNodeOutput fOutputId="1" fOutputConnectableSide="bottom"> | ||
I'm a node | ||
</div> | ||
<div fNode fDragHandle [fNodePosition]="{ x: 300, y: 0 }" fNodeInput fInputId="2" fInputConnectableSide="top"> | ||
I'm a node | ||
</div> | ||
|
||
<f-connection [fReassignDisabled]="true" fOutputId="3" fInputId="4" fBehavior="floating"> | ||
</f-connection> | ||
<div fNode fDragHandle [fNodePosition]="{ x: 0, y: 150 }" fNodeOutput fOutputId="3" fOutputConnectableSide="right"> | ||
I'm a node | ||
</div> | ||
<div fNode fDragHandle [fNodePosition]="{ x: 300, y: 150 }" fNodeInput fInputId="4" fInputConnectableSide="left"> | ||
I'm a node | ||
</div> | ||
</f-canvas> | ||
</f-flow> |
35 changes: 35 additions & 0 deletions
35
projects/f-examples/connections/custom-connections/custom-connections.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@use "../../flow-common"; | ||
|
||
::ng-deep custom-connections { | ||
.f-connection { | ||
|
||
.f-connection-drag-handle { | ||
fill: none; | ||
stroke: none; | ||
} | ||
|
||
.f-connection-selection { | ||
fill: none; | ||
stroke-width: 20; | ||
} | ||
|
||
.f-connection-path { | ||
fill: none; | ||
stroke-width: 6; | ||
} | ||
|
||
&:not(.gradient-color) { | ||
.f-connection-path { | ||
stroke: #db2777; | ||
stroke-width: 4; | ||
} | ||
} | ||
&:hover { | ||
stroke: var(--minimap-view-color); | ||
} | ||
} | ||
} | ||
|
||
.f-node { | ||
@include flow-common.node; | ||
} |
22 changes: 22 additions & 0 deletions
22
projects/f-examples/connections/custom-connections/custom-connections.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ChangeDetectionStrategy, Component, ViewChild } from '@angular/core'; | ||
import { FCanvasComponent, FFlowModule } from '@foblex/flow'; | ||
|
||
@Component({ | ||
selector: 'custom-connections', | ||
styleUrls: [ './custom-connections.component.scss' ], | ||
templateUrl: './custom-connections.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
FFlowModule | ||
] | ||
}) | ||
export class CustomConnectionsComponent { | ||
|
||
@ViewChild(FCanvasComponent, { static: true }) | ||
public fCanvas!: FCanvasComponent; | ||
|
||
public onLoaded(): void { | ||
this.fCanvas.resetScaleAndCenter(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Custom Connections | ||
|
||
## Description | ||
|
||
This guide shows how to customize connections between connectors, allowing for custom connection styles to be applied to connections between connectors. | ||
|
||
## Example | ||
|
||
::: ng-component <custom-connections></custom-connections> [height]="600" | ||
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-connections/custom-connections.component.html | ||
[component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-connections/custom-connections.component.ts | ||
[component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connections/custom-connections/custom-connections.component.scss | ||
[common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss | ||
::: | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<router-outlet></router-outlet> | ||
<button class="take-screenshot" (click)="takeScreenshot()"> | ||
Take Screenshot | ||
</button> | ||
<!--<button class="take-screenshot" (click)="takeScreenshot()">--> | ||
<!-- Take Screenshot--> | ||
<!--</button>--> |