MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / element_center

Function element_center

packages/server/src/main/tap_target.rs:148–155  ·  view source on GitHub ↗
(node: &Value)

Source from the content-addressed store, hash-verified

146}
147
148fn element_center(node: &Value) -> Option<(f64, f64)> {
149 let frame = node.get("frame")?;
150 let x = frame.get("x")?.as_f64()?;
151 let y = frame.get("y")?.as_f64()?;
152 let width = frame.get("width")?.as_f64()?;
153 let height = frame.get("height")?.as_f64()?;
154 (width > 0.0 && height > 0.0).then_some((x + width / 2.0, y + height / 2.0))
155}
156
157fn element_size(node: &Value) -> Option<(f64, f64)> {
158 let frame = node.get("frame")?;

Callers 1

find_element_tap_targetFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected