Fix DmAvatar rendering in RTL layout
This commit is contained in:
parent
9d70e459b8
commit
6609c93181
1 changed files with 8 additions and 2 deletions
|
|
@ -48,10 +48,11 @@ fun DmAvatars(
|
||||||
val boxSize = userAvatarData.size.dp * SIZE_RATIO
|
val boxSize = userAvatarData.size.dp * SIZE_RATIO
|
||||||
val boxSizePx = boxSize.toPx()
|
val boxSizePx = boxSize.toPx()
|
||||||
val otherAvatarRadius = otherUserAvatarData.size.dp.toPx() / 2
|
val otherAvatarRadius = otherUserAvatarData.size.dp.toPx() / 2
|
||||||
|
val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.size(boxSize),
|
modifier = modifier.size(boxSize),
|
||||||
) {
|
) {
|
||||||
// Draw user avatar and cut top right corner
|
// Draw user avatar and cut top end corner
|
||||||
Avatar(
|
Avatar(
|
||||||
avatarData = userAvatarData,
|
avatarData = userAvatarData,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -61,10 +62,15 @@ fun DmAvatars(
|
||||||
}
|
}
|
||||||
.drawWithContent {
|
.drawWithContent {
|
||||||
drawContent()
|
drawContent()
|
||||||
|
val xOffset = if (isRtl) {
|
||||||
|
size.width - boxSizePx + otherAvatarRadius
|
||||||
|
} else {
|
||||||
|
boxSizePx - otherAvatarRadius
|
||||||
|
}
|
||||||
drawCircle(
|
drawCircle(
|
||||||
color = Color.Black,
|
color = Color.Black,
|
||||||
center = Offset(
|
center = Offset(
|
||||||
x = boxSizePx - otherAvatarRadius,
|
x = xOffset,
|
||||||
y = size.height - (boxSizePx - otherAvatarRadius),
|
y = size.height - (boxSizePx - otherAvatarRadius),
|
||||||
),
|
),
|
||||||
radius = otherAvatarRadius / 0.9f,
|
radius = otherAvatarRadius / 0.9f,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue