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
commit 10c9112e03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 12 deletions

View file

@ -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)

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e171ced0a7f9994d1e9addb093959fb455727d81912aecb377742541181535a
size 35733
oid sha256:c9e68f504334bf51de555c27936d2561f3def8c7920189512594b74ba9770105
size 35720

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba17ec26a4807e2cad64769b98140e2d77f133e39be72090a1f44ca143427833
size 34106
oid sha256:7523890541aefd0f65533247e0bb0b5c306946b19ab7d27cc8ff0d6e69e85478
size 34166

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8366d3c9ea45d6b7e24184b5ba9756cfcfe8a592ec19b107be1168b307840192
size 49433
oid sha256:cc5c6f3dc41efa8c969c70ad36c1c4ada0feaf279767d0e2165a5837f568e2e7
size 49441

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:79cc95b3838f24e85a87d5f0116575ad74e2abc03b77a28464d7fa82fb357840
size 47343
oid sha256:d091d25da896e86e0851cd3d440f7b4b05dfaac6240d9639b06e9e362c20f5ca
size 47304