diff --git a/Sources/Kapture/ResultWindow.swift b/Sources/Kapture/ResultWindow.swift index b28702c..42cd8b2 100644 --- a/Sources/Kapture/ResultWindow.swift +++ b/Sources/Kapture/ResultWindow.swift @@ -195,14 +195,15 @@ final class CaptureModel: ObservableObject { return rep.cgImage ?? image } - func addStroke(_ points: [CGPoint]) { + /// `widthPx` is the stroke thickness in IMAGE PIXELS (the preview + /// converts the slider value so exports match what was drawn). + func addStroke(_ points: [CGPoint], widthPx: CGFloat) { guard points.count > 1 else { return } if tool == .redact { - // Redaction: a filled black bar from start to end, as thick as the - // current stroke width (drawn as a rect for clean edges). - strokes.append(Stroke(points: points, width: max(strokeWidth, 12), color: .black, isRedaction: true)) + // Redaction: a filled black bar from start to end. + strokes.append(Stroke(points: points, width: max(widthPx, 12), color: .black, isRedaction: true)) } else { - strokes.append(Stroke(points: points, width: strokeWidth, color: drawColor)) + strokes.append(Stroke(points: points, width: widthPx, color: drawColor)) } redoStack = [] } @@ -575,7 +576,8 @@ struct ScreenshotPane: View { for point in stroke.points.dropFirst() { path.addLine(to: CGPoint(x: origin.x + point.x * scale, y: origin.y + point.y * scale)) } - context.stroke(path, with: .color(Color(nsColor: stroke.color)), lineWidth: stroke.width) + // stroke.width is in image pixels; scale to view points + context.stroke(path, with: .color(Color(nsColor: stroke.color)), lineWidth: stroke.width * scale) } } } @@ -636,7 +638,7 @@ struct ScreenshotPane: View { .onEnded { _ in if model.tool != .select { if currentStroke.count > 1 { - model.addStroke(currentStroke) + model.addStroke(currentStroke, widthPx: model.strokeWidth / max(scale, 0.01)) } currentStroke = [] } else { diff --git a/build-app.sh b/build-app.sh index 523f98d..2b7dd9f 100755 --- a/build-app.sh +++ b/build-app.sh @@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST' CFBundleIconFile Icon CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleVersion - 91 + 92 LSUIElement NSHighResolutionCapable