mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Fix DmAvatar rendering in RTL layout
This commit is contained in:
+8
-2
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user