getSelectionFromDrag

fun getSelectionFromDrag(dragX: Float, dragY: Float, centerAngle: Float, itemCount: Int, spreadDegrees: Float = RadialMenuDefaults.ICON_SPREAD_DEGREES, deadZonePx: Float = RadialMenuDefaults.DEAD_ZONE_PX, selectionDeadZoneDeg: Float = RadialMenuDefaults.SELECTION_DEAD_ZONE_DEG): Int?(source)

Determines which item index the user is dragging toward.

The algorithm computes the angle of the drag vector and finds the closest menu item. If the angular distance exceeds selectionDeadZoneDeg, no item is selected.

Return

Index of the selected item, or null if in dead zone or no match.

Parameters

dragX

Horizontal drag delta from touch origin in pixels.

dragY

Vertical drag delta from touch origin in pixels.

centerAngle

The menu's center angle from calculateCenterAngle.

itemCount

Number of items in the menu.

spreadDegrees

Angular spacing between items.

deadZonePx

Minimum drag distance to register.

selectionDeadZoneDeg

Maximum angle from nearest item to count as selected.