Output new font size when it changes
This commit is contained in:
parent
6150c4ce6b
commit
08fa52d88e
1 changed files with 6 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ import {
|
||||||
Directive,
|
Directive,
|
||||||
ElementRef, HostListener,
|
ElementRef, HostListener,
|
||||||
Input,
|
Input,
|
||||||
|
Output,
|
||||||
|
EventEmitter,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnInit,
|
OnInit,
|
||||||
Renderer2
|
Renderer2
|
||||||
|
|
@ -25,6 +27,9 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
||||||
@Input('useMaxFontSize') useMaxFontSize = true;
|
@Input('useMaxFontSize') useMaxFontSize = true;
|
||||||
|
|
||||||
@Input('modelToWatch') modelToWatch: any;
|
@Input('modelToWatch') modelToWatch: any;
|
||||||
|
|
||||||
|
@Output() fontSizeChanged = new EventEmitter();
|
||||||
|
|
||||||
private fontSize = 1000;
|
private fontSize = 1000;
|
||||||
private speed = 1.05;
|
private speed = 1.05;
|
||||||
private done = false;
|
private done = false;
|
||||||
|
|
@ -42,6 +47,7 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit, OnChanges, Af
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fontSize = fontSize;
|
this.fontSize = fontSize;
|
||||||
|
this.fontSizeChanged.emit(fontSize);
|
||||||
return this.el.nativeElement.style.setProperty('font-size', (fontSize).toString() + 'px');
|
return this.el.nativeElement.style.setProperty('font-size', (fontSize).toString() + 'px');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue