Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37f404b8 authored by Xiaoqian (Daisy) Dai's avatar Xiaoqian (Daisy) Dai Committed by Android (Google) Code Review
Browse files

Merge "screen capture: fix the dimension pill's position during draggin" into main

parents 59e1eee0 9d138e9b
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -374,14 +374,23 @@ fun RegionBox(
                                        Modifier.layout { measurable, _ ->
                                            val pillInnerPlaceable =
                                                measurable.measure(Constraints())
                                            val pillVerticalSpacingPx =
                                                with(density) { pillVerticalSpacingDp.toPx() }
                                            // Center the pill horizontally relative to the region
                                            // box's width, and position it vertically below the
                                            // box.
                                            // box's width.
                                            val pillX =
                                                (currentRect.width - pillInnerPlaceable.width) / 2

                                            // Calculate the Y position of the pill, and restrict it
                                            // to stay within the screen bounds.
                                            val pillY =
                                                currentRect.height +
                                                    with(density) { pillVerticalSpacingDp.toPx() }
                                                (currentRect.height + pillVerticalSpacingPx)
                                                    .coerceAtMost(
                                                        state.screenHeight -
                                                            currentRect.top -
                                                            pillInnerPlaceable.height -
                                                            pillVerticalSpacingPx
                                                    )
                                            layout(
                                                pillInnerPlaceable.width,
                                                pillInnerPlaceable.height,