Skip to content

Commit

Permalink
fix text align
Browse files Browse the repository at this point in the history
  • Loading branch information
leaferjs committed Jun 3, 2024
1 parent 56edb15 commit 83801c5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/partner/text/src/TextLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export function layoutText(drawData: ITextDrawData, style: ITextData): void {
row = rows[i]
row.x = x

switch (textAlign) {
case 'center':
row.x += (width - row.width) / 2
break
case 'right':
row.x += width - row.width
if (row.width < width || (row.width > width && !__clipText)) {
switch (textAlign) {
case 'center':
row.x += (width - row.width) / 2
break
case 'right':
row.x += width - row.width
}
}

if (row.paraStart && paraSpacing && i > 0) starY += paraSpacing
Expand Down

0 comments on commit 83801c5

Please sign in to comment.