MCPcopy Create free account
hub / github.com/AccessKit/accesskit / offset_at_point

Method offset_at_point

platforms/atspi-common/src/node.rs:1409–1423  ·  view source on GitHub ↗
(&self, x: i32, y: i32, coord_type: CoordType)

Source from the content-addressed store, hash-verified

1407 }
1408
1409 pub fn offset_at_point(&self, x: i32, y: i32, coord_type: CoordType) -> Result<i32> {
1410 self.resolve_for_text_with_context(|node, _, context| {
1411 let window_bounds = context.read_root_window_bounds();
1412 let point = window_bounds.atspi_point_to_accesskit_point(
1413 Point::new(x.into(), y.into()),
1414 Some(node),
1415 coord_type,
1416 );
1417 let point = node.transform().inverse() * point;
1418 node.text_position_at_point(point)
1419 .to_global_usv_index()
1420 .try_into()
1421 .map_err(|_| Error::TooManyCharacters)
1422 })
1423 }
1424
1425 pub fn n_selections(&self) -> Result<i32> {
1426 self.resolve_for_text(|node| {

Callers 1

get_offset_at_pointMethod · 0.45

Calls 7

inverseMethod · 0.80
transformMethod · 0.80
to_global_usv_indexMethod · 0.80

Tested by

no test coverage detected