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

Function keyboardTipContinueTapTarget

scripts/integration/cli.mjs:1661–1705  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

1659}
1660
1661function keyboardTipContinueTapTarget(snapshot) {
1662 const nodes = compactQueryNodes(snapshot);
1663 const rootFrame = nodes
1664 .map((node) => node.frame)
1665 .filter(validFrame)
1666 .sort((a, b) => b.width * b.height - a.width * a.height)[0];
1667 const continueButton =
1668 nodes.find(
1669 (node) =>
1670 node.label === "Continue" &&
1671 node.id !== "fixture.continue" &&
1672 String(node.role ?? "")
1673 .toLowerCase()
1674 .includes("button") &&
1675 validFrame(node.frame),
1676 ) ??
1677 nodes.find(
1678 (node) =>
1679 node.label === "Continue" &&
1680 String(node.role ?? "")
1681 .toLowerCase()
1682 .includes("button") &&
1683 validFrame(node.frame),
1684 );
1685
1686 if (rootFrame && continueButton?.frame) {
1687 return {
1688 normalized: true,
1689 x:
1690 (continueButton.frame.x +
1691 continueButton.frame.width / 2 -
1692 rootFrame.x) /
1693 rootFrame.width,
1694 y:
1695 (continueButton.frame.y +
1696 continueButton.frame.height / 2 -
1697 rootFrame.y) /
1698 rootFrame.height,
1699 };
1700 }
1701
1702 return {
1703 selector: { label: "Continue", elementType: "Button" },
1704 };
1705}
1706
1707function compactQueryNodes(snapshot) {
1708 const nodes = [];

Callers 1

Calls 2

compactQueryNodesFunction · 0.70
validFrameFunction · 0.70

Tested by

no test coverage detected