getNearestItemSelection

fun getNearestItemSelection(pointerX: Float, pointerY: Float, itemPositions: List<Offset>, deadZonePx: Float = RadialMenuDefaults.DEAD_ZONE_PX): Int?(source)

Selects the nearest item by Euclidean distance from the pointer.

This replaces angle-based selection when the menu is in edge-hug mode, since items are no longer arranged radially.

Return

Index of the nearest item, or null if within dead zone of the touch origin.

Since

1.0.3

Parameters

pointerX

Pointer X position in pixels (absolute screen coords).

pointerY

Pointer Y position in pixels (absolute screen coords).

itemPositions

List of item center positions from edgeHugLayout.

deadZonePx

Minimum distance from any item to register a selection.