-
-
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
82c57cd
commit 044452f
Showing
5 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
projects/f-examples/extensions/zoom-example/zoom-example.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,13 @@ | ||
<f-flow fDraggable (fLoaded)="onLoaded()"> | ||
<f-canvas [fZoom]="isZoomEnabled"> | ||
<f-connection fOutputId="output1" fInputId="input1" fBehavior="floating"></f-connection> | ||
<div fNode [fNodePosition]="{ x: 24, y: 24 }" fNodeOutput fOutputId="output1" fDragHandle>I'm a node</div> | ||
<div fNode [fNodePosition]="{ x: 244, y: 24 }" fNodeInput fInputId="input1" fDragHandle>I'm a node</div> | ||
</f-canvas> | ||
</f-flow> | ||
<div class="toolbar"> | ||
<button class="f-button" (click)="onZoomIn()">Zoom In</button> | ||
<button class="f-button" (click)="onZoomOut()">Zoom Out</button> | ||
<f-checkbox [checked]="isZoomEnabled" (change)="onZoomOnMouseWheelChanged($event)">Zoom on mouse wheel</f-checkbox> | ||
</div> | ||
|
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
47 changes: 47 additions & 0 deletions
47
projects/f-examples/extensions/zoom-example/zoom-example.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,47 @@ | ||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ViewChild } from '@angular/core'; | ||
import { FCanvasComponent, FCreateConnectionEvent, FFlowModule, FZoomDirective } from '@foblex/flow'; | ||
import { FCheckboxComponent } from '@foblex/f-docs'; | ||
|
||
@Component({ | ||
selector: 'zoom-example', | ||
styleUrls: [ './zoom-example.component.scss' ], | ||
templateUrl: './zoom-example.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
FFlowModule, | ||
FCheckboxComponent | ||
] | ||
}) | ||
export class ZoomExampleComponent { | ||
|
||
@ViewChild(FCanvasComponent, { static: true }) | ||
public fCanvas!: FCanvasComponent; | ||
|
||
@ViewChild(FZoomDirective, { static: true }) | ||
public fZoom!: FZoomDirective; | ||
|
||
public isZoomEnabled: boolean = true; | ||
|
||
constructor( | ||
private changeDetectorRef: ChangeDetectorRef | ||
) { | ||
} | ||
|
||
public onLoaded(): void { | ||
this.fCanvas.resetScaleAndCenter(false); | ||
} | ||
|
||
public onZoomIn(): void { | ||
this.fZoom.zoomIn(); | ||
} | ||
|
||
public onZoomOut(): void { | ||
this.fZoom.zoomOut(); | ||
} | ||
|
||
public onZoomOnMouseWheelChanged(checked: boolean): void { | ||
this.isZoomEnabled = checked; | ||
this.changeDetectorRef.detectChanges(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
projects/f-examples/zoom-example/zoom-example.component.ts
This file was deleted.
Oops, something went wrong.