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

Commit 5311d56f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "multiPointerDraggable set an order for PointerEventScopes" into main

parents ac428bae d441a8bc
Loading
Loading
Loading
Loading
+44 −37
Original line number Diff line number Diff line
@@ -241,6 +241,10 @@ internal class MultiPointerDraggableNode(
                }
            }

            // The order is important here: we want to make sure that the previous PointerEventScope
            // is initialized first. This ensures that the following PointerEventScope doesn't
            // receive more events than the first one.
            launch {
                awaitPointerEventScope {
                    while (isActive) {
                        try {
@@ -258,7 +262,9 @@ internal class MultiPointerDraggableNode(
                                onDragEnd = { controller ->
                                    val viewConfiguration = currentValueOf(LocalViewConfiguration)
                                    val maxVelocity =
                                    viewConfiguration.maximumFlingVelocity.let { Velocity(it, it) }
                                        viewConfiguration.maximumFlingVelocity.let {
                                            Velocity(it, it)
                                        }
                                    val velocity = velocityTracker.calculateVelocity(maxVelocity)
                                    controller.onStop(
                                        velocity =
@@ -284,6 +290,7 @@ internal class MultiPointerDraggableNode(
                }
            }
        }
    }

    /**
     * Detect drag gestures in the given [orientation].