fix(screenshot): apply maxImageDimension cap to match get_window_state#1691
fix(screenshot): apply maxImageDimension cap to match get_window_state#1691hippoley wants to merge 1 commit into
Conversation
Fixes trycua#1592 (Bug 1). ScreenshotTool called captureWindow(windowID:format:quality:) without maxImageDimension, so it defaulted to 0 (no resize) and returned native Retina resolution (2x logical). GetWindowStateTool passes config.maxImageDimension and registers the resize ratio in ImageResizeRegistry so ClickTool can reverse it. An agent using screenshot to see the screen and click with those pixel coordinates would miss every target on a Retina display because the coordinate spaces were mismatched. Fix: load ConfigStore.shared and pass config.maxImageDimension to captureWindow, matching the get_window_state code path exactly.
|
@nishantpurohit04 is attempting to deploy a commit to the Cua Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughScreenshot tool now loads shared configuration via ChangesScreenshot Config-Based Dimension Capping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem (Bug 1 from #1592)
screenshotreturns native Retina resolution (2× logical) whileclickcoordinates are calibrated against the downscaled image fromget_window_state. An agent usingscreenshotto see the screen and then callingclickwith those pixel coordinates misses every target on a Retina display.Root cause:
ScreenshotToolcalledcaptureWindow(windowID:format:quality:)withoutmaxImageDimension(defaults to0= no resize).GetWindowStateToolpassesconfig.maxImageDimensionand registers the resize ratio inImageResizeRegistrysoClickToolcan reverse it.Fix
Load
ConfigStore.sharedinScreenshotTooland passconfig.maxImageDimensiontocaptureWindow, matching theGetWindowStateToolcode path exactly.Before:
captureWindow(windowID:, format:, quality:)→ native 2× resolutionAfter:
captureWindow(windowID:, format:, quality:, maxImageDimension: config.maxImageDimension)→ same downscaled resolution asget_window_stateFixes #1592 (Bug 1)
Summary by CodeRabbit