diff --git a/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealOverlayScope.kt b/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealOverlayScope.kt index 48f2971..f34af50 100644 --- a/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealOverlayScope.kt +++ b/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealOverlayScope.kt @@ -6,7 +6,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.layout.layout import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntSize -import androidx.compose.ui.unit.LayoutDirection /** * Scope for overlay content which provides Modifiers to align an element relative to the @@ -86,7 +85,7 @@ internal class RevealOverlayScopeInstance( constraints.copy(maxWidth = layoutSize.width), ) - layout(layoutSize.width, layoutSize.height) { + layout(constraints.maxWidth, constraints.maxHeight) { placeable.placeRelative( x = horizontalArrangement.align( size = placeable.width, @@ -121,12 +120,14 @@ internal class RevealOverlayScopeInstance( constraints.copy(maxHeight = layoutSize.height), ) - layout(layoutSize.width, layoutSize.height) { - placeable.placeRelative( + layout(constraints.maxWidth, constraints.maxHeight) { + // Using place() instead of placeRelative() because layoutSize and the value + // returned by horizontalAlignment.align() are RTL-aware + placeable.place( x = layoutSize.left + horizontalAlignment.align( size = placeable.width, space = layoutSize.width, - layoutDirection = LayoutDirection.Ltr, // Ltr because we use placeRelative() + layoutDirection = layoutDirection, ), y = verticalArrangement.align( size = placeable.height, diff --git a/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealScope.kt b/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealScope.kt index 916e773..c9e4ca9 100644 --- a/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealScope.kt +++ b/reveal-core/src/main/kotlin/com/svenjacobs/reveal/RevealScope.kt @@ -25,17 +25,17 @@ public interface RevealScope { * effect is shown for the element, the effect is finished. * * @param key Unique key to identify the revealable content. Also see documentation of [Key]. - * @param padding Additional padding around the reveal area. Positive values increase area while - * negative values decrease it. Defaults to 8 dp on all sides. * @param shape Shape of the reveal effect around the element. Defaults to a rounded rect * with a corner size of 4 dp. + * @param padding Additional padding around the reveal area. Positive values increase area while + * negative values decrease it. Defaults to 8 dp on all sides. * * @see Key */ public fun Modifier.revealable( key: Key, - padding: PaddingValues = PaddingValues(8.dp), shape: RevealShape = RevealShape.RoundRect(4.dp), + padding: PaddingValues = PaddingValues(8.dp), ): Modifier } @@ -43,7 +43,7 @@ internal class RevealScopeInstance( private val revealState: RevealState, ) : RevealScope { - override fun Modifier.revealable(key: Key, padding: PaddingValues, shape: RevealShape): Modifier = + override fun Modifier.revealable(key: Key, shape: RevealShape, padding: PaddingValues): Modifier = this.then( Modifier .onGloballyPositioned { layoutCoordinates ->