Commit 3b9963c8 authored by liujiaxin's avatar liujiaxin

scale text

parent c5a90dac
...@@ -42,7 +42,7 @@ export class ScaleTextDirective implements AfterViewInit { ...@@ -42,7 +42,7 @@ export class ScaleTextDirective implements AfterViewInit {
this.Element.nativeElement.childNodes.forEach(n => n.remove()); this.Element.nativeElement.childNodes.forEach(n => n.remove());
this.Element.nativeElement.append(span); this.Element.nativeElement.append(span);
setTimeout(() => { setTimeout(() => {
const fitWidth = this.Element.nativeElement.offsetWidth; const fitWidth = this.Element.nativeElement.offsetWidth - this.offsetX;
const textWidth = span.offsetWidth; const textWidth = span.offsetWidth;
console.log(textWidth, fitWidth); console.log(textWidth, fitWidth);
if (textWidth > fitWidth) { if (textWidth > fitWidth) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment