Merge pull request #6651 from element-hq/feature/bma/mention-pill-cut-off
Mention pill cut off
This commit is contained in:
commit
3f7f5e25b5
5 changed files with 9 additions and 12 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:8e171ced0a7f9994d1e9addb093959fb455727d81912aecb377742541181535a
|
oid sha256:c9e68f504334bf51de555c27936d2561f3def8c7920189512594b74ba9770105
|
||||||
size 35733
|
size 35720
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:ba17ec26a4807e2cad64769b98140e2d77f133e39be72090a1f44ca143427833
|
oid sha256:7523890541aefd0f65533247e0bb0b5c306946b19ab7d27cc8ff0d6e69e85478
|
||||||
size 34106
|
size 34166
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:8366d3c9ea45d6b7e24184b5ba9756cfcfe8a592ec19b107be1168b307840192
|
oid sha256:cc5c6f3dc41efa8c969c70ad36c1c4ada0feaf279767d0e2165a5837f568e2e7
|
||||||
size 49433
|
size 49441
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:79cc95b3838f24e85a87d5f0116575ad74e2abc03b77a28464d7fa82fb357840
|
oid sha256:d091d25da896e86e0851cd3d440f7b4b05dfaac6240d9639b06e9e362c20f5ca
|
||||||
size 47343
|
size 47304
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue