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

Function keyboardTipContinueTapTarget

scripts/integration/js-api.mjs:435–472  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

433}
434
435function keyboardTipContinueTapTarget(snapshot) {
436 const nodes = compactQueryNodes(snapshot);
437 const rootFrame = nodes
438 .map((node) => node.frame)
439 .filter(validFrame)
440 .sort((a, b) => b.width * b.height - a.width * a.height)[0];
441 const continueButton =
442 nodes.find(
443 (node) =>
444 node.label === "Continue" &&
445 node.id !== "fixture.continue" &&
446 String(node.role ?? "")
447 .toLowerCase()
448 .includes("button") &&
449 validFrame(node.frame),
450 ) ??
451 nodes.find(
452 (node) =>
453 node.label === "Continue" &&
454 String(node.role ?? "")
455 .toLowerCase()
456 .includes("button") &&
457 validFrame(node.frame),
458 );
459
460 if (!rootFrame || !continueButton?.frame) {
461 return null;
462 }
463
464 return {
465 x:
466 (continueButton.frame.x + continueButton.frame.width / 2 - rootFrame.x) /
467 rootFrame.width,
468 y:
469 (continueButton.frame.y + continueButton.frame.height / 2 - rootFrame.y) /
470 rootFrame.height,
471 };
472}
473
474function compactQueryNodes(snapshot) {
475 const nodes = [];

Callers 1

resolveKeyboardTipPromptFunction · 0.70

Calls 2

compactQueryNodesFunction · 0.70
validFrameFunction · 0.70

Tested by

no test coverage detected