Commit 7f093726 authored by liujiaxin's avatar liujiaxin

scale text

parent 43d814f2
...@@ -35,7 +35,7 @@ export class ScaleTextDirective implements AfterViewInit { ...@@ -35,7 +35,7 @@ export class ScaleTextDirective implements AfterViewInit {
word-spacing: normal; word-spacing: normal;
word-break: keep-all; word-break: keep-all;
white-space: nowrap; white-space: nowrap;
margin-left: ${this.offsetX}px margin-left: 8px;
`; `;
const span = document.createElement('span'); const span = document.createElement('span');
span.innerHTML = `${this.Element.nativeElement.textContent}`; span.innerHTML = `${this.Element.nativeElement.textContent}`;
...@@ -43,7 +43,7 @@ export class ScaleTextDirective implements AfterViewInit { ...@@ -43,7 +43,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 - this.offsetX; const fitWidth = this.Element.nativeElement.offsetWidth - 8;
const textWidth = span.offsetWidth; const textWidth = span.offsetWidth;
console.log(textWidth, fitWidth); console.log(textWidth, fitWidth);
if (textWidth > fitWidth) { if (textWidth > fitWidth) {
......
...@@ -610,8 +610,10 @@ img.c-icon {right: 0px; top: 4px; position: absolute; width: 36px;} ...@@ -610,8 +610,10 @@ img.c-icon {right: 0px; top: 4px; position: absolute; width: 36px;}
} }
.q-qo{ .q-qo{
overflow: hidden; overflow: hidden;
width: 100%; width: calc(100% - 42px);
height: 100%; height: 100%;
text-indent: -42px; text-indent: -42px;
padding-left: 42px; /*padding-left: 42px;*/
position: absolute;
left: 42px;
} }
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