-
-
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
ec697c3
commit 2b16407
Showing
27 changed files
with
277 additions
and
135 deletions.
There are no files selected for viewing
30 changes: 15 additions & 15 deletions
30
.../f-flow/get-flow-state/get-flow-state-connections/get-flow-state-connections.execution.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,28 +1,28 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { inject, Injectable } from '@angular/core'; | ||
import { GetFlowStateConnectionsRequest } from './get-flow-state-connections-request'; | ||
import { FExecutionRegister, IExecution } from '@foblex/mediator'; | ||
import { FComponentsStore } from '../../../../f-storage'; | ||
import { IFFlowStateConnection } from '../i-f-flow-state-connection'; | ||
import { FConnectionBase } from '../../../../f-connection'; | ||
|
||
@Injectable() | ||
@FExecutionRegister(GetFlowStateConnectionsRequest) | ||
export class GetFlowStateConnectionsExecution implements IExecution<GetFlowStateConnectionsRequest, IFFlowStateConnection[]> { | ||
|
||
constructor( | ||
private fComponentsStore: FComponentsStore, | ||
) { | ||
} | ||
private _fComponentsStore = inject(FComponentsStore); | ||
|
||
public handle(request: GetFlowStateConnectionsRequest): IFFlowStateConnection[] { | ||
return this.fComponentsStore.fConnections.map((x) => { | ||
return { | ||
id: x.fId, | ||
fOutputId: x.fOutputId, | ||
fInputId: x.fInputId, | ||
fType: x.fType, | ||
fBehavior: x.fBehavior, | ||
isSelected: x.isSelected() | ||
} | ||
}); | ||
return this._fComponentsStore.fConnections.map(this._mapToConnectionState); | ||
} | ||
|
||
private _mapToConnectionState(x: FConnectionBase): IFFlowStateConnection { | ||
return { | ||
id: x.fId, | ||
fOutputId: x.fOutputId, | ||
fInputId: x.fInputId, | ||
fType: x.fType, | ||
fBehavior: x.fBehavior, | ||
isSelected: x.isSelected() | ||
} | ||
} | ||
} |
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
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,5 +1,9 @@ | ||
export * from './add-line-alignment-to-store'; | ||
|
||
export * from './line-alignment-preparation'; | ||
|
||
export * from './remove-line-alignment-from-store'; | ||
|
||
export * from './line-alignment.drag-handler'; | ||
|
||
export * from './providers'; |
3 changes: 3 additions & 0 deletions
3
projects/f-flow/src/domain/f-line-alignment/line-alignment-preparation/index.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,3 @@ | ||
export * from './line-alignment-preparation.execution'; | ||
|
||
export * from './line-alignment-preparation.request'; |
37 changes: 37 additions & 0 deletions
37
...omain/f-line-alignment/line-alignment-preparation/line-alignment-preparation.execution.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,37 @@ | ||
import { inject, Injectable } from '@angular/core'; | ||
import { LineAlignmentPreparationRequest } from './line-alignment-preparation.request'; | ||
import { IRect, ISize, RectExtensions } from '@foblex/2d'; | ||
import { FExecutionRegister, FMediator, IExecution } from '@foblex/mediator'; | ||
import { GetFlowHostElementRequest } from '../../f-flow'; | ||
import { GetNormalizedElementRectRequest } from '../../get-normalized-element-rect'; | ||
import { FComponentsStore } from '../../../f-storage'; | ||
|
||
@Injectable() | ||
@FExecutionRegister(LineAlignmentPreparationRequest) | ||
export class LineAlignmentPreparationExecution implements IExecution<LineAlignmentPreparationRequest, void> { | ||
|
||
private _fMediator = inject(FMediator); | ||
private _fComponentsStore = inject(FComponentsStore); | ||
|
||
public handle(request: LineAlignmentPreparationRequest): void { | ||
// this.size = this._getFlowHostSize(); | ||
// this.rects = []; | ||
// const draggedNodeRects = request.fNodes.map((x) => { | ||
// return this._fMediator.execute<IRect>(new GetNormalizedElementRectRequest(x.hostElement, false)); | ||
// }); | ||
// this.draggedNodeRect = RectExtensions.union(draggedNodeRects) || RectExtensions.initialize(); | ||
// | ||
// const allNodesExcludeCurrents = this._fComponentsStore.fNodes.filter((x) => { | ||
// return !request.fNodes.includes(x); | ||
// }); | ||
// | ||
// this.rects = allNodesExcludeCurrents.map((x) => { | ||
// return this._fMediator.execute<IRect>(new GetNormalizedElementRectRequest(x.hostElement, false)); | ||
// }); | ||
} | ||
|
||
private _getFlowHostSize(): ISize { | ||
return this._fMediator.send<HTMLElement>(new GetFlowHostElementRequest()) | ||
.getBoundingClientRect(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../domain/f-line-alignment/line-alignment-preparation/line-alignment-preparation.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { FNodeBase } from '../../../f-node'; | ||
|
||
export class LineAlignmentPreparationRequest { | ||
|
||
constructor( | ||
public fNodes: FNodeBase[] | ||
) { | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
projects/f-flow/src/domain/f-line-alignment/line-alignment.drag-handler.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,26 @@ | ||
import { IPoint, Point, PointExtensions } from '@foblex/2d'; | ||
import { IDraggableItem } from '../../f-draggable'; | ||
import { FComponentsStore } from '../../f-storage'; | ||
|
||
export class LineAlignmentDragHandler implements IDraggableItem { | ||
|
||
private readonly _onPointerDownPosition = PointExtensions.initialize(); | ||
|
||
constructor( | ||
private _fComponentsStore: FComponentsStore, | ||
public minDistance: IPoint, | ||
public maxDistance: IPoint, | ||
) { | ||
//this._onPointerDownPosition = { ...fNode.position }; | ||
} | ||
|
||
public onPointerMove(difference: IPoint): void { | ||
} | ||
|
||
private _getPosition(difference: IPoint): IPoint { | ||
return Point.fromPoint(this._onPointerDownPosition).add(difference); | ||
} | ||
|
||
public onPointerUp(): void { | ||
} | ||
} |
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,9 +1,12 @@ | ||
import { AddLineAlignmentToStoreExecution } from './add-line-alignment-to-store'; | ||
import { RemoveLineAlignmentFromStoreExecution } from './remove-line-alignment-from-store'; | ||
import { LineAlignmentPreparationExecution } from './line-alignment-preparation'; | ||
|
||
export const F_LINE_ALIGNMENT_FEATURES = [ | ||
|
||
AddLineAlignmentToStoreExecution, | ||
|
||
LineAlignmentPreparationExecution, | ||
|
||
RemoveLineAlignmentFromStoreExecution | ||
]; |
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
6 changes: 6 additions & 0 deletions
6
...nding-box-normalized-position/calculate-nodes-bounding-box-normalized-position.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,3 +1,9 @@ | ||
import { FNodeBase } from '../../../f-node'; | ||
|
||
export class CalculateNodesBoundingBoxNormalizedPositionRequest { | ||
|
||
constructor( | ||
public fNodes?: FNodeBase[], | ||
) { | ||
} | ||
} |
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,22 @@ | ||
export function LogExecutionTime(label?: string): MethodDecorator { | ||
return function ( | ||
target: Object, | ||
propertyKey: string | symbol, | ||
descriptor: TypedPropertyDescriptor<any> | ||
): TypedPropertyDescriptor<any> | void { | ||
const originalMethod = descriptor.value; | ||
descriptor.value = function (...args: any[]) { | ||
console.time(label || String(propertyKey)); | ||
const result = originalMethod.apply(this, args); | ||
|
||
if (result instanceof Promise) { | ||
return result.finally(() => console.timeEnd(label || String(propertyKey))); | ||
} | ||
|
||
console.timeEnd(label || String(propertyKey)); | ||
return result; | ||
}; | ||
|
||
return descriptor; | ||
}; | ||
} |
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
Oops, something went wrong.