pub struct HitTestResult {
pub position: usize,
pub affinity: CursorAffinity,
pub block_id: usize,
pub offset_in_block: usize,
pub region: HitRegion,
pub tooltip: Option<String>,
pub table_id: Option<usize>,
}Expand description
Result of crate::DocumentFlow::hit_test - maps a screen-space point to a
document position.
Fields§
§position: usizeAbsolute character position in the document.
affinity: CursorAffinityWhich side of a soft-wrap boundary the click landed on. When
the matched line’s Y range contained the click and position
equals that line’s char_range.start AND a preceding line in
the same block ends at the same position, the click is on the
upstream side of the boundary → Upstream. Otherwise
Downstream. At non-wrap positions the value is Downstream
(default) and does not affect anything.
block_id: usizeWhich block (paragraph) was hit, identified by stable block ID.
offset_in_block: usizeCharacter offset within the block (0 = start of block).
region: HitRegionWhat region of the layout was hit.
tooltip: Option<String>Tooltip text if the hit position has a tooltip. None otherwise.
table_id: Option<usize>When non-None, the hit position is inside a table cell. Identifies the table by its stable table ID. None for hits on top-level blocks, frame blocks, or outside any table.