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

Commit 55d0ea08 authored by Jonathan He's avatar Jonathan He Committed by Android (Google) Code Review
Browse files

Merge "Add unit tests for region box state class" into main

parents cce2249e 3a2ba19b
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ import kotlin.math.min
import kotlin.math.roundToInt

// The different modes of interaction that the user can have with the RegionBox.
private enum class DragMode {
enum class DragMode {
    DRAWING,
    MOVING,
    RESIZING,
@@ -166,9 +166,8 @@ private fun getTappedOrHoveredZone(
 * @param minSizePx The minimum size of the box in pixels.
 * @param touchAreaPx The size of the touch area for resizing in pixels.
 */
private class RegionBoxState(private val minSizePx: Float, private val touchAreaPx: Float) {
class RegionBoxState(private val minSizePx: Float, private val touchAreaPx: Float) {
    var rect by mutableStateOf<Rect?>(null)
        private set

    var dragMode by mutableStateOf(DragMode.NONE)

@@ -194,7 +193,7 @@ private class RegionBoxState(private val minSizePx: Float, private val touchArea
    var isHoveringButton by mutableStateOf(false)

    // The offset of the initial press when the user starts a drag gesture.
    private var newBoxStartOffset by mutableStateOf(Offset.Zero)
    var newBoxStartOffset by mutableStateOf(Offset.Zero)

    // Must remember the screen size for the drag logic. Initial values are set to 0.
    var screenWidth by mutableStateOf(0f)
+1219 −0

File added.

Preview size limit exceeded, changes collapsed.