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

Function buttonPoint

scripts/integration/cli.mjs:1501–1515  ·  view source on GitHub ↗
(snapshot, label)

Source from the content-addressed store, hash-verified

1499}
1500
1501function buttonPoint(snapshot, label) {
1502 const escapedLabel = label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1503 const match = snapshot.match(
1504 new RegExp(
1505 `Button(?:\\s+#[^:\\n]+)?:\\s+${escapedLabel}\\s+@([0-9.]+),([0-9.]+)\\s+([0-9.]+)x([0-9.]+)`,
1506 ),
1507 );
1508 if (!match) {
1509 return null;
1510 }
1511 return {
1512 x: Math.round(Number(match[1]) + Number(match[3]) / 2),
1513 y: Math.round(Number(match[2]) + Number(match[4]) / 2),
1514 };
1515}
1516
1517function buttonCandidatePoints(snapshot, label) {
1518 const point = buttonPoint(snapshot, label);

Callers 2

openButtonPointFunction · 0.85
buttonCandidatePointsFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected