fix: TextContent 的行高问题

This commit is contained in:
unanmed 2025-02-25 21:42:16 +08:00
parent bca679d4b1
commit 72f02726ba
2 changed files with 10 additions and 2 deletions

View File

@ -113,7 +113,11 @@ export class Text extends RenderItem<ETextEvent> {
this.measure(); this.measure();
this.length = width; this.length = width;
this.descent = actualBoundingBoxAscent; this.descent = actualBoundingBoxAscent;
this.size(width, actualBoundingBoxAscent + actualBoundingBoxDescent); this.size(
width,
Math.abs(actualBoundingBoxAscent) +
Math.abs(actualBoundingBoxDescent)
);
} }
protected handleProps( protected handleProps(

View File

@ -877,7 +877,8 @@ export class TextContentParser {
private getHeight(metrics: TextMetrics) { private getHeight(metrics: TextMetrics) {
return ( return (
metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent Math.abs(metrics.actualBoundingBoxAscent) +
Math.abs(metrics.actualBoundingBoxDescent)
); );
} }
@ -966,6 +967,9 @@ export class TextContentParser {
if (metrics.width > width) { if (metrics.width > width) {
end = mid; end = mid;
} else if (metrics.width === width) { } else if (metrics.width === width) {
if (height > this.lineHeight) {
this.lineHeight = height;
}
return mid; return mid;
} else { } else {
start = mid; start = mid;