Fix vertical offset when capturing the secondary display
The first ScreenCaptureKit Y-flip used the wrong reference edges, shifting
cropped selections on displays below the main screen. Convert each selection
per-display as scY = appKitY - NSScreen.maxY + SCDisplay.maxY, which
matches both the main and secondary displays.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4-flash-0731
This commit is contained in:
@@ -180,12 +180,12 @@ final class ScreenCapture {
|
||||
config.height = Int(CGFloat(display.height) * backingScale)
|
||||
config.showsCursor = true
|
||||
|
||||
// ScreenCaptureKit's Y axis is flipped relative to AppKit
|
||||
// NSScreen frames. Convert the selection into SCDisplay space
|
||||
// using the matching NSScreen's top edge, then crop there.
|
||||
// ScreenCaptureKit uses a different origin than AppKit for
|
||||
// screens stacked around the main display: per-display,
|
||||
// SCDisplay y = appKitY - NSScreen.maxY + SCDisplay.maxY.
|
||||
let scRect = CGRect(
|
||||
x: rect.minX,
|
||||
y: screen.frame.maxY - rect.maxY + display.frame.minY,
|
||||
y: rect.minY - screen.frame.maxY + display.frame.maxY,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user