diff --git a/balloon-compose/src/main/kotlin/com/skydoves/balloon/compose/Balloon.kt b/balloon-compose/src/main/kotlin/com/skydoves/balloon/compose/Balloon.kt index fc1d66c7..fc9f4a3b 100644 --- a/balloon-compose/src/main/kotlin/com/skydoves/balloon/compose/Balloon.kt +++ b/balloon-compose/src/main/kotlin/com/skydoves/balloon/compose/Balloon.kt @@ -132,11 +132,18 @@ public fun Balloon( .padding(start = paddingStart, end = paddingEnd) .onGloballyPositioned { coordinates -> val originalSize = coordinates.size - val calculatedWidth = if (originalSize.width > screenWidth) { - screenWidth - } else { - originalSize.width - } + val calculatedWidth = + if (screenWidth * builder.widthRatio != 0f) { + ( + screenWidth * builder.widthRatio - + with(density) { builder.marginRight.dp.toPx() } - + with(density) { builder.marginLeft.dp.toPx() } + ).toInt() + } else if (originalSize.width > screenWidth) { + screenWidth + } else { + originalSize.width + } val size = IntSize( width = calculatedWidth, height = coordinates.size.height, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2018081a..752777e7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.7.0" +agp = "8.6.1" dokka = "1.9.20" kotlin = "2.0.20" kotlinBinaryCompatibility = "0.16.3"