From 5d1bb686ac79b9375d40c9dfee4b41142e72638d Mon Sep 17 00:00:00 2001 From: Albert Chang Date: Thu, 4 Apr 2024 21:46:31 +0900 Subject: [PATCH] Fix content rect calculation in SelectionManager Fix a typo in `SelectionManager.getContentRect()` that results in an invalid rect being calculated, causing text toolbar to not show under certain conditions. Fixes: b/332782845 Test: manual Change-Id: I153b99f4146d870182af2898d9a675ed6ffa15e4 --- .../compose/foundation/text/selection/SelectionManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt index dea1991539aa9..eb8c53d7d1e6c 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.kt @@ -591,7 +591,7 @@ internal class SelectionManager(private val selectionRegistrar: SelectionRegistr if (visibleRect.width < 0 || visibleRect.height < 0) return null val rootRect = visibleRect.translate(containerCoordinates.positionInRoot()) - return rootRect.copy(bottom = visibleRect.bottom + HandleHeight.value * 4) + return rootRect.copy(bottom = rootRect.bottom + HandleHeight.value * 4) } // This is for PressGestureDetector to cancel the selection.