Skip to content

Commit

Permalink
Add braces as necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-sasha committed May 11, 2023
1 parent 3afd661 commit 536f951
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,12 @@ internal data class DesktopDropdownMenuPositionProvider(
}

fun Int.coerceWithSizeIntoRange(size: Int, min: Int, max: Int) =
if (isLtr)
if (isLtr) {
coerceWithSizeIntoRangePreferMin(size, min, max)
else
}
else {
coerceWithSizeIntoRangePreferMax(size, min, max)
}

// The min margin above and below the menu, relative to the screen.
val verticalMargin = with(density) { MenuVerticalMargin.roundToPx() }
Expand All @@ -415,10 +417,12 @@ internal data class DesktopDropdownMenuPositionProvider(
val contentOffsetY = with(density) { contentOffset.y.roundToPx() }

// Compute horizontal position.
val preferredX = if (isLtr)
val preferredX = if (isLtr) {
anchorBounds.left + contentOffsetX
else
}
else {
anchorBounds.right - contentOffsetX - popupContentSize.width
}
val x = preferredX.coerceWithSizeIntoRange(
size = popupContentSize.width,
min = 0,
Expand Down

0 comments on commit 536f951

Please sign in to comment.