Skip to main content

SelectionHandle

Function SelectionHandle 

Source
pub fn SelectionHandle(
    __arg0: HandleKind,
    __arg1: Point,
    __arg2: f32,
    __arg3: f32,
    __arg4: Color,
    on_drag: impl Fn(Point) + 'static,
    on_drag_end: impl Fn() + 'static,
    on_long_press: impl Fn() + 'static,
    on_tap: impl Fn() + 'static,
)
Expand description

A finger-draggable selection/cursor handle rendered in the overlay.

  • kind — which lollipop to draw (cursor dot, selection start/end).
  • tip — window-space position of the text edge at the line BOTTOM (the caret/selection endpoint).
  • line_height — the line box the stem spans (up from tip).
  • radius / color — dot radius and accent fill.
  • on_drag — invoked with the current drag position (window space) on every pointer down/move so the field can map it to a text offset and move the caret / extend the selection.
  • on_drag_end — invoked when the finger lifts, so the field can settle (e.g. show the contextual menu).
  • on_long_press — invoked once when the finger rests on the handle past the long-press timeout without dragging it, so the field can (re)open the contextual menu even when the selection range has not changed.
  • on_tap — invoked when the finger lifts after a quick press that did not drag the handle beyond [HANDLE_TAP_SLOP_PX] (and was not a long-press), so the collapsed cursor handle can open its action popup.