-
-
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.
- Loading branch information
1 parent
8fb4399
commit 4f23af5
Showing
16 changed files
with
178 additions
and
30 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
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 |
---|---|---|
|
@@ -29,7 +29,6 @@ | |
.simple-node { | ||
@include flow-common.node; | ||
width: unset; | ||
padding: 24px; | ||
} | ||
|
||
img { | ||
|
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
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
46 changes: 46 additions & 0 deletions
46
projects/f-examples/resize-handle/resize-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,46 @@ | ||
<f-flow fDraggable (fLoaded)="onLoaded()"> | ||
<f-canvas> | ||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 0, y: 0 }"> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.LEFT_TOP"></div> | ||
<div class="node-content"> | ||
Node with Left Top ResizeHandle | ||
</div> | ||
</div> | ||
|
||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 350, y: 0 }"> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.RIGHT_TOP"></div> | ||
<div class="node-content"> | ||
Node with Right Top ResizeHandle | ||
</div> | ||
</div> | ||
|
||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 0, y: 100 }"> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.RIGHT_BOTTOM"></div> | ||
<div class="node-content"> | ||
Node with Right Bottom ResizeHandle | ||
</div> | ||
</div> | ||
|
||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 350, y: 100 }"> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.LEFT_BOTTOM"></div> | ||
<div class="node-content"> | ||
Node with Left Bottom ResizeHandle | ||
</div> | ||
</div> | ||
|
||
<div fNode fDragHandle | ||
[fNodePosition]="{ x: 50, y: 200 }"> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.LEFT_TOP"></div> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.RIGHT_TOP"></div> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.LEFT_BOTTOM"></div> | ||
<div fResizeHandle [fResizeHandleType]="eResizeHandleType.RIGHT_BOTTOM"></div> | ||
<div class="node-content"> | ||
Node with all ResizeHandles | ||
</div> | ||
</div> | ||
</f-canvas> | ||
</f-flow> |
51 changes: 51 additions & 0 deletions
51
projects/f-examples/resize-handle/resize-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 resize-handle { | ||
@include flow-common.connection; | ||
} | ||
|
||
.f-node { | ||
position: relative; | ||
@include flow-common.node; | ||
padding: 24px; | ||
} | ||
|
||
.node-content { | ||
width: 100%; | ||
height: 100%; | ||
overflow: auto; | ||
} | ||
|
||
.f-resize-handle { | ||
// z-index: 10; | ||
overflow: visible; | ||
position: absolute; | ||
width: 12px; | ||
height: 12px; | ||
background-color: var(--node-background-color); | ||
border: 1px solid var(--node-border-color); | ||
|
||
&.f-resize-handle-left-top { | ||
top: -6px; | ||
left: -6px; | ||
cursor: nwse-resize; | ||
} | ||
|
||
&.f-resize-handle-right-top { | ||
top: -6px; | ||
right: -6px; | ||
cursor: nesw-resize; | ||
} | ||
|
||
&.f-resize-handle-left-bottom { | ||
bottom: -6px; | ||
left: -6px; | ||
cursor: nesw-resize; | ||
} | ||
|
||
&.f-resize-handle-right-bottom { | ||
bottom: -6px; | ||
right: -6px; | ||
cursor: nwse-resize; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
projects/f-examples/resize-handle/resize-handle.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,28 @@ | ||
import { ChangeDetectionStrategy, Component, ViewChild } from '@angular/core'; | ||
import { | ||
EFResizeHandleType, | ||
FCanvasComponent, | ||
FFlowModule | ||
} from '@foblex/flow'; | ||
|
||
@Component({ | ||
selector: 'resize-handle', | ||
styleUrls: [ './resize-handle.component.scss' ], | ||
templateUrl: './resize-handle.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
FFlowModule, | ||
] | ||
}) | ||
export class ResizeHandleComponent { | ||
|
||
@ViewChild(FCanvasComponent, { static: true }) | ||
public fCanvas!: FCanvasComponent; | ||
|
||
public onLoaded(): void { | ||
this.fCanvas.resetScaleAndCenter(false); | ||
} | ||
|
||
protected readonly eResizeHandleType = EFResizeHandleType; | ||
} |
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
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
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
4 changes: 3 additions & 1 deletion
4
...ow/src/f-draggable/node-resize/get-node-resize-restrictions/i-node-resize-restrictions.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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { IRect } from '@foblex/2d'; | ||
import { IRect, ISize } from '@foblex/2d'; | ||
|
||
export interface INodeResizeRestrictions { | ||
|
||
parentRect: IRect; | ||
|
||
childRect: IRect | null; | ||
|
||
minSize: ISize; | ||
} |
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
3 changes: 1 addition & 2 deletions
3
...e-resize/get-normalized-children-nodes-rect/get-normalized-children-nodes-rect.request.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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { FNodeBase } from '../../../f-node'; | ||
import { IRect } from '@foblex/2d'; | ||
|
||
export class GetNormalizedChildrenNodesRectRequest { | ||
|
||
constructor( | ||
public fNode: FNodeBase, | ||
public rect: IRect | ||
public paddings: [ number, number, number, number ] | ||
) { | ||
} | ||
} |
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
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
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 @@ | ||
# Resize Handle | ||
|
||
## Description | ||
|
||
Learn how to enhance the interactivity of your flow diagrams by adding a [ResizeHandle](./docs/f-resize-handle-directive) to nodes. This example demonstrates the process of making nodes dynamically resizable, allowing users to easily modify the dimensions of nodes within an Angular application powered by Foblex Flow. | ||
|
||
## Example | ||
|
||
::: ng-component <resize-handle></resize-handle> [height]="600" | ||
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/resize-handle/resize-handle.component.html | ||
[component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/resize-handle/resize-handle.component.ts | ||
[component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/resize-handle/resize-handle.component.scss | ||
[common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss | ||
::: | ||
|
||
|