Skip to content

Commit

Permalink
fix: fix fixed height of title
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Dec 30, 2024
1 parent fa1c5b3 commit c5e5ee3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vrender-components/src/title/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ export class Title extends AbstractComponent<Required<TitleAttrs>> {

if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
const subTitleYStart = this._mainTitle ? this._mainTitle.AABBBounds.y2 : 0;
const subTitleYStart = this._mainTitle
? isValid(fixedMainTitleHeight)
? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值
this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
: this._mainTitle.AABBBounds.y2
: 0;
const subTitleHeight = subtextStyle.height ?? height;
if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
Expand Down

0 comments on commit c5e5ee3

Please sign in to comment.