Commit 5c9b0c97 authored by liujiaxin's avatar liujiaxin

scale text

parent 7f093726
......@@ -35,7 +35,7 @@ export class ScaleTextDirective implements AfterViewInit {
word-spacing: normal;
word-break: keep-all;
white-space: nowrap;
margin-left: 8px;
margin-left: 16px;
`;
const span = document.createElement('span');
span.innerHTML = `${this.Element.nativeElement.textContent}`;
......@@ -43,7 +43,7 @@ export class ScaleTextDirective implements AfterViewInit {
this.Element.nativeElement.childNodes.forEach(n => n.remove());
this.Element.nativeElement.append(span);
setTimeout(() => {
const fitWidth = this.Element.nativeElement.offsetWidth - 8;
const fitWidth = this.Element.nativeElement.offsetWidth - 16;
const textWidth = span.offsetWidth;
console.log(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