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

Function formatScreenshotDiffRegionEntryLines

src/utils/output.ts:408–434  ·  view source on GitHub ↗
(region: ScreenshotDiffRegion)

Source from the content-addressed store, hash-verified

406}
407
408function formatScreenshotDiffRegionEntryLines(region: ScreenshotDiffRegion): string[] {
409 const share =
410 region.shareOfDiffPercentage === 0 && region.differentPixels > 0
411 ? '<0.01'
412 : String(region.shareOfDiffPercentage);
413 const rect = region.rect;
414 const lines = [
415 ` ${region.index}. ${region.location} x=${rect.x} y=${rect.y} ` +
416 `${rect.width}x${rect.height}, ${share}% of diff, change=${region.dominantChange}`,
417 ];
418
419 const detailLine = formatScreenshotRegionDetails(region);
420 if (detailLine) {
421 lines.push(` ${detailLine}`);
422 }
423
424 const bestMatch = region.currentOverlayMatches?.[0];
425 if (bestMatch) {
426 const label = bestMatch.label ? ` "${bestMatch.label}"` : '';
427 lines.push(
428 ` overlaps @${bestMatch.ref}${label}, ` +
429 `${bestMatch.regionCoveragePercentage}% of region`,
430 );
431 }
432
433 return lines;
434}
435
436function formatScreenshotDiffOcrLines(data: ScreenshotDiffResult, useColor: boolean): string[] {
437 const ocrMatches = data.ocr?.matches ?? [];

Callers 1

Calls 2

pushMethod · 0.80

Tested by

no test coverage detected