fix: web text maxLines
This commit is contained in:
5
doric-web/dist/index.js
vendored
5
doric-web/dist/index.js
vendored
@@ -7301,7 +7301,7 @@ var doric_web = (function (exports, axios, sandbox) {
|
||||
if (this.maxLines > 0) {
|
||||
const computedStyle = window.getComputedStyle(this.view);
|
||||
const currentContentHeight = this.view.clientHeight - pixelString2Number(computedStyle.paddingTop) - pixelString2Number(computedStyle.paddingBottom);
|
||||
let maxHeight = parseFloat(computedStyle.getPropertyValue('font-size')) * this.lineHeight() * this.maxLines;
|
||||
let maxHeight = Math.ceil(parseFloat(computedStyle.getPropertyValue('font-size')) * this.lineHeight() * this.maxLines);
|
||||
if (currentContentHeight > 0) {
|
||||
maxHeight = Math.min(maxHeight, Math.ceil(currentContentHeight));
|
||||
}
|
||||
@@ -7318,6 +7318,8 @@ var doric_web = (function (exports, axios, sandbox) {
|
||||
tempEle.style.font = style.font;
|
||||
tempEle.textContent = this.textElement.innerText;
|
||||
tempEle.style.whiteSpace = 'normal';
|
||||
this.view.style.overflow = 'hidden';
|
||||
tempEle.style.lineHeight = `${this.lineHeight()}em`;
|
||||
tempEle.style.width = this.view.style.width;
|
||||
document.body.appendChild(tempEle);
|
||||
const height = tempEle.offsetHeight;
|
||||
@@ -7331,6 +7333,7 @@ var doric_web = (function (exports, axios, sandbox) {
|
||||
tempEle.style.font = style.font;
|
||||
tempEle.style.whiteSpace = 'normal';
|
||||
this.view.style.overflow = 'hidden';
|
||||
tempEle.style.lineHeight = `${this.lineHeight()}em`;
|
||||
tempEle.style.width = this.view.style.width;
|
||||
document.body.appendChild(tempEle);
|
||||
while (start <= end) {
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user