mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
PR:Fix mention pill cut off (#6622)
* Fix mention pill cut off * trigger CI after screenshots * trigger CI after screenshots
This commit is contained in:
+1
-4
@@ -105,15 +105,12 @@ class MentionSpan(
|
|||||||
bottom: Int,
|
bottom: Int,
|
||||||
paint: Paint
|
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 availableWidth = (canvas.width - x).coerceAtLeast(0f)
|
||||||
val measuredWidth = measuredTextWidth + startPadding + endPadding
|
val measuredWidth = measuredTextWidth + startPadding + endPadding
|
||||||
val pillWidth = minOf(availableWidth, measuredWidth.toFloat())
|
val pillWidth = minOf(availableWidth, measuredWidth.toFloat())
|
||||||
|
|
||||||
backgroundPaint.color = backgroundColor
|
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
|
val radius = rect.height() / 2
|
||||||
canvas.drawRoundRect(rect, radius, radius, backgroundPaint)
|
canvas.drawRoundRect(rect, radius, radius, backgroundPaint)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user