mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 06:43:43 +00:00
fixed bug for baseline last
This commit is contained in:
parent
ff8a7015a5
commit
0a398301b0
@ -39,7 +39,7 @@ static CGFloat baselineOffset(const ASStackTextLayoutSpecStyle &style,
|
|||||||
case ASStackTextLayoutBaselineAlignmentFirst:
|
case ASStackTextLayoutBaselineAlignmentFirst:
|
||||||
return maxAscender - textChild.ascender;
|
return maxAscender - textChild.ascender;
|
||||||
case ASStackTextLayoutBaselineAlignmentLast:
|
case ASStackTextLayoutBaselineAlignmentLast:
|
||||||
return maxBaseline + textChild.descender - textChild.ascender;
|
return maxBaseline - baselineForItem(style, l);
|
||||||
case ASStackTextLayoutBaselineAlignmentNone:
|
case ASStackTextLayoutBaselineAlignmentNone:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ ASStackTextPositionedLayout ASStackTextPositionedLayout::compute(const ASStackPo
|
|||||||
// add the baseline offset. baselineOffset is only valid in the horizontal direction, so we always add to y
|
// add the baseline offset. baselineOffset is only valid in the horizontal direction, so we always add to y
|
||||||
l.position = p + CGPointMake(0, baselineOffset(textStyle, l, maxAscender, maxBaseline));
|
l.position = p + CGPointMake(0, baselineOffset(textStyle, l, maxAscender, maxBaseline));
|
||||||
|
|
||||||
// If we are a vertical stack, add the minDescender (it is negative) to the spacing after. This will alter the stack spacing to be on baselines instead of bounding boxes
|
// If we are a vertical stack, add the item's descender (it is negative) to the spacing after. This will alter the stack spacing to be on baselines instead of bounding boxes
|
||||||
CGFloat spacingAfterBaseline = (stackStyle.direction == ASStackLayoutDirectionVertical) ? textChild.descender : 0;
|
CGFloat spacingAfterBaseline = (stackStyle.direction == ASStackLayoutDirectionVertical) ? textChild.descender : 0;
|
||||||
p = p + directionPoint(stackStyle.direction, stackDimension(stackStyle.direction, l.size) + textChild.spacingAfter + spacingAfterBaseline, 0);
|
p = p + directionPoint(stackStyle.direction, stackDimension(stackStyle.direction, l.size) + textChild.spacingAfter + spacingAfterBaseline, 0);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user