PreciseClickState

Records where an anchor was last touched, so a popup can open at the finger rather than centred on the anchor — COUI PreciseClickHelper / PreciseLongPressHelper, which stash the DOWN (x, y) and pass it to the click callback, after which PopupMenuLocateHelper.setAnchor collapses the anchor bounds to that single point.

The point is kept in window coordinates, because the composable that positions the popup is usually not the node that receives the touch (a preference hosts its popup inside its trailing action slot, while the whole row is what gets tapped), so an anchor-local offset would be measured against the wrong origin.

Offset.Unspecified means "no point recorded": the popup then falls back to centring on the anchor, which is also COUI's TalkBack path (PreciseClickHelper substitutes the view centre when TalkBack is enabled or the recorded point is still the initial (0, 0)).

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

The last recorded touch point in window coordinates, or Offset.Unspecified if none.

Functions

Link copied to clipboard
fun clear()

Discards the recorded point, restoring anchor-centred positioning.