mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Fix layout
This commit is contained in:
parent
7b11a88231
commit
8f4f463265
2 changed files with 19 additions and 2 deletions
|
|
@ -437,7 +437,16 @@ public func lastTextLineFrameIfLastItemIsText(in layout: InstantPageV2Layout) ->
|
|||
else {
|
||||
return nil
|
||||
}
|
||||
let lineFrame = last.frame.offsetBy(dx: text.frame.minX, dy: text.frame.minY)
|
||||
// The stored line frame always has minX = 0 — alignment (center / right / natural-RTL) is
|
||||
// applied at render time by `v2FrameForLine`. Apply the same correction here so the returned
|
||||
// frame's `maxX` reflects the line's actual on-screen right edge, not just its width anchored
|
||||
// at the textItem's left. Without this, a right-aligned or RTL last line — whose visible right
|
||||
// edge sits at `textItem.width`, all the way at the right text inset — would feed the status
|
||||
// node a `contentWidth` equal to just `lineWidth`. The trail/wrap decision would then think
|
||||
// the date fits trailing the line, and place it directly on top of the line at the right text
|
||||
// inset where the line itself ends. The width is unchanged; only `origin.x` shifts.
|
||||
let displayedLineFrame = v2FrameForLine(last, boundingWidth: text.textItem.frame.width, alignment: text.textItem.alignment)
|
||||
let lineFrame = displayedLineFrame.offsetBy(dx: text.frame.minX, dy: text.frame.minY)
|
||||
var ascent: CGFloat = 0.0
|
||||
var descent: CGFloat = 0.0
|
||||
var leading: CGFloat = 0.0
|
||||
|
|
|
|||
|
|
@ -576,7 +576,15 @@ public class ChatMessageRichDataBubbleContentNode: ChatMessageBubbleContentNode
|
|||
isReplyThread = true
|
||||
}
|
||||
|
||||
let trailingWidthToMeasure: CGFloat = lastTextLineFrame?.width ?? 10000.0
|
||||
// Measure trailing extent from the line's actual visible RIGHT EDGE (after
|
||||
// alignment, in page coords) — not just its intrinsic width. A right-aligned
|
||||
// or RTL last line has `lineWidth` worth of glyphs but sits all the way at
|
||||
// the right text inset (lineFrame.maxX == text.frame.minX + textItem.width).
|
||||
// Feeding the status node just `lineWidth` would let the trail/wrap decision
|
||||
// place the date inline with the line — on top of it. `pageHorizontalInset`
|
||||
// is the offset between page-coords and status-node-local coords (the status
|
||||
// node sits at x=pageHorizontalInset in self, and pageView sits at self-x 0).
|
||||
let trailingWidthToMeasure: CGFloat = lastTextLineFrame.map { $0.maxX - pageHorizontalInset } ?? 10000.0
|
||||
|
||||
let dateLayoutInput: ChatMessageDateAndStatusNode.LayoutInput = .trailingContent(contentWidth: trailingWidthToMeasure, reactionSettings: ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions), preferAdditionalInset: false))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue