Merge pull request #6651 from element-hq/feature/bma/mention-pill-cut-off

Mention pill cut off
This commit is contained in:
Benoit Marty
2026-04-24 16:12:38 +02:00
committed by GitHub
5 changed files with 9 additions and 12 deletions
@@ -105,15 +105,12 @@ class MentionSpan(
bottom: Int,
paint: Paint
) {
// Extra vertical space to add below the baseline (y). This helps us center the span vertically
val extraVerticalSpace = y + paint.ascent() + paint.descent() - top
val availableWidth = (canvas.width - x).coerceAtLeast(0f)
val measuredWidth = measuredTextWidth + startPadding + endPadding
val pillWidth = minOf(availableWidth, measuredWidth.toFloat())
backgroundPaint.color = backgroundColor
val rect = RectF(x, top.toFloat(), x + pillWidth, y.toFloat() + extraVerticalSpace)
val rect = RectF(x, top.toFloat(), x + pillWidth, bottom.toFloat())
val radius = rect.height() / 2
canvas.drawRoundRect(rect, radius, radius, backgroundPaint)