-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f2bd7b
commit 8fb4399
Showing
10 changed files
with
127 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,6 @@ | |
} | ||
|
||
@mixin node { | ||
width: 100px; | ||
padding: 4px; | ||
color: var(--node-color); | ||
text-align: center; | ||
|
File renamed without changes.
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
30 changes: 30 additions & 0 deletions
30
projects/f-examples/drag-handle/drag-handle.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,30 @@ | ||
<f-flow fDraggable (fLoaded)="onLoaded()"> | ||
<f-canvas fZoom> | ||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 24, y: 24 }"> | ||
Node is the drag handle | ||
</div> | ||
|
||
<div fNode | ||
[fNodePosition]="{ x: 164, y: 84 }" class="drag-handle-inside"> | ||
<span fDragHandle class="f-icon f-drag-handle-icon"></span> | ||
Only the icon is the drag handle | ||
</div> | ||
|
||
<div fNode | ||
[fNodePosition]="{ x: 304, y: 24 }" class="drag-handle-outside"> | ||
<div fDragHandle> | ||
<span class="f-icon f-drag-handle-icon"></span> | ||
</div> | ||
Only the icon is the drag handle | ||
</div> | ||
|
||
<div fNode | ||
[fNodePosition]="{ x: 150, y: 170 }"> | ||
Only the image is the drag handle | ||
<div fDragHandle> | ||
<img src="https://material.angular.io/assets/img/examples/shiba2.jpg"> | ||
</div> | ||
</div> | ||
</f-canvas> | ||
</f-flow> |
51 changes: 51 additions & 0 deletions
51
projects/f-examples/drag-handle/drag-handle.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,51 @@ | ||
@use "../flow-common"; | ||
|
||
::ng-deep drag-handle { | ||
@include flow-common.connection; | ||
} | ||
|
||
.f-node { | ||
@include flow-common.node; | ||
cursor: default; | ||
|
||
img { | ||
display: block; | ||
pointer-events: none; | ||
width: 150px; | ||
} | ||
} | ||
|
||
.f-drag-handle { | ||
width: fit-content; | ||
cursor: move; | ||
} | ||
|
||
.drag-handle-inside { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
gap: 6px; | ||
} | ||
|
||
.f-icon { | ||
display: block; | ||
width: 28px; | ||
min-width: 28px; | ||
height: 28px; | ||
mask-repeat: no-repeat; | ||
} | ||
|
||
.drag-handle-outside { | ||
.f-drag-handle { | ||
background-color: var(--node-background-color); | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
left: -50px; | ||
padding: 4px; | ||
border: 0.5px solid var(--node-border-color); | ||
border-radius: var(--node-border-radius); | ||
} | ||
} | ||
|
||
|
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,26 @@ | ||
import { ChangeDetectionStrategy, Component, ViewChild } from '@angular/core'; | ||
import { | ||
FCanvasComponent, | ||
FFlowModule | ||
} from '@foblex/flow'; | ||
import { PointExtensions } from '@foblex/2d'; | ||
|
||
@Component({ | ||
selector: 'drag-handle', | ||
styleUrls: [ './drag-handle.component.scss' ], | ||
templateUrl: './drag-handle.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
FFlowModule, | ||
] | ||
}) | ||
export class DragHandleComponent { | ||
|
||
@ViewChild(FCanvasComponent, { static: true }) | ||
public fCanvas!: FCanvasComponent; | ||
|
||
public onLoaded(): void { | ||
this.fCanvas.fitToScreen(PointExtensions.initialize(100, 100), 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,16 @@ | ||
# Drag Handle | ||
|
||
## Description | ||
|
||
This example showcases how to add a [DragHandle](./docs/f-drag-handle-directive) for nodes, allowing users to move them easily within Angular and Foblex Flow. | ||
|
||
## Example | ||
|
||
::: ng-component <drag-handle></drag-handle> [height]="600" | ||
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/drag-handle/drag-handle.component.html | ||
[component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/drag-handle/drag-handle.component.ts | ||
[component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/drag-handle/drag-handle.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.