Skip to content

Commit

Permalink
feat: positioning support for fText
Browse files Browse the repository at this point in the history
  • Loading branch information
msibhuiyan committed Dec 23, 2024
1 parent 5203562 commit 52811e3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions projects/f-flow/src/f-connection/common/f-connection-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export abstract class FConnectionBase extends MIXIN_BASE

public abstract fText: string;

public abstract fTextStartOffset: string;

public abstract fConnectionCenter: ElementRef<HTMLDivElement>;

private penultimatePoint: IPoint = PointExtensions.initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class FConnectionTextPathDirective implements IHasHostElement, OnInit {
}

public ngOnInit(): void {
this.hostElement.setAttribute('startOffset', '50%');
this.hostElement.setAttribute('startOffset', this.base.fTextStartOffset || '50%');
this.hostElement.setAttribute('text-anchor', `middle`);
this.symbolWidth = this.getSymbolWidth(this.base.fText || '');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface IHasConnectionText {

fText: string;
fTextStartOffset: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ let uniqueId: number = 0;
})
export class FConnectionForCreateComponent
extends FConnectionBase implements AfterViewInit, OnInit, OnDestroy {

public override fId: string = `f-connection-for-create-${ uniqueId++ }`;

public override fText: string = '';

public override fId: string = `f-connection-for-create-${ uniqueId++ }`;

public override fText: string = '';
public override fTextStartOffset: string = '';

private _fStartColor: string = 'black';
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ export class FConnectionComponent
@Input('fConnectionId')
public override fId: string = `f-connection-${ uniqueId++ }`;

private _fTextStartOffset: string = '';
@Input()
public override set fTextStartOffset(value: string) {
this._fTextStartOffset = value;
this.fComponentsStore.componentDataChanged();
}
public override get fTextStartOffset(): string {
return this._fTextStartOffset;
}

private _fText: string = '';
@Input()
public override set fText(value: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ let uniqueId: number = 0;
})
export class FSnapConnectionComponent
extends FConnectionBase implements AfterViewInit, OnInit, OnDestroy {

public override fId: string = `f-snap-connection-${ uniqueId++ }`;

public override fText: string = '';

public override fTextStartOffset: string = '';

private _fStartColor: string = 'black';
@Input()
public override set fStartColor(value: string) {
Expand Down

0 comments on commit 52811e3

Please sign in to comment.