MCPcopy Index your code
hub / github.com/callstack/agent-device / formatScreenshotDiffNonTextLines

Function formatScreenshotDiffNonTextLines

src/utils/output.ts:468–490  ·  view source on GitHub ↗
(data: ScreenshotDiffResult, useColor: boolean)

Source from the content-addressed store, hash-verified

466}
467
468function formatScreenshotDiffNonTextLines(data: ScreenshotDiffResult, useColor: boolean): string[] {
469 const nonTextDeltas = data.nonTextDeltas ?? [];
470 if (nonTextDeltas.length === 0) return [];
471
472 const shownNonTextDeltas = nonTextDeltas.slice(0, 8);
473 const lines = [
474 ` ${formatMuted(
475 `Non-text visual deltas (showing ${shownNonTextDeltas.length}/${nonTextDeltas.length}; px):`,
476 useColor,
477 )}`,
478 ` ${formatMuted('item | region | slot | kind | bboxCurrent | nearestText', useColor)}`,
479 ];
480
481 for (const delta of shownNonTextDeltas) {
482 lines.push(
483 ` ${delta.index} | ${delta.regionIndex ? `r${delta.regionIndex}` : '-'} | ` +
484 `${delta.slot} | ${delta.likelyKind} | ${formatRect(delta.rect)} | ` +
485 `${delta.nearestText ? JSON.stringify(delta.nearestText) : '-'}`,
486 );
487 }
488
489 return lines;
490}
491
492function formatRect(rect: Rect): string {
493 return `x=${rect.x},y=${rect.y},w=${rect.width},h=${rect.height}`;

Callers 1

formatScreenshotDiffTextFunction · 0.85

Calls 3

formatMutedFunction · 0.85
formatRectFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected