Compare commits

..
1 Commits
Author SHA1 Message Date
TZGyn 52e36b5c5a Add drawing color picker to the result window
A compact ColorPicker appears next to the Draw button when drawing is
enabled; strokes render and export in the chosen color (defaults to
system red).

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4-flash-0731
2026-08-23 13:33:32 +08:00
2 changed files with 17 additions and 5 deletions
+15 -3
View File
@@ -94,6 +94,8 @@ final class CaptureModel: ObservableObject {
@Published var strokes: [[CGPoint]] = []
/// Whether the pen is active (drag draws instead of selecting)
@Published var isDrawing = false
/// Current drawing color
@Published var drawColor: NSColor = .systemRed
enum CaptureMode {
case screenshot
@@ -120,7 +122,7 @@ final class CaptureModel: ObservableObject {
let ctx = NSGraphicsContext.current!.cgContext
// CGImage draws with a flipped Y in NSGraphicsContext
ctx.draw(image, in: NSRect(origin: .zero, size: size))
NSColor.systemRed.setStroke()
drawColor.setStroke()
ctx.setLineWidth(3)
ctx.setLineCap(.round)
ctx.setLineJoin(.round)
@@ -285,6 +287,16 @@ struct ResultView: View {
.foregroundStyle(model.isDrawing ? .primary : .secondary)
.help("Toggle drawing on the screenshot")
if model.isDrawing {
ColorPicker("", selection: Binding(
get: { Color(nsColor: model.drawColor) },
set: { model.drawColor = NSColor($0) }
), supportsOpacity: false)
.labelsHidden()
.frame(width: 28)
.help("Drawing color")
}
if !model.strokes.isEmpty {
Button {
model.clearAnnotations()
@@ -429,7 +441,7 @@ struct ScreenshotPane: View {
path.addLine(to: CGPoint(x: origin.x + point.x * scale, y: origin.y + point.y * scale))
}
}
context.stroke(path, with: .color(.red), lineWidth: 2.5)
context.stroke(path, with: .color(Color(nsColor: model.drawColor)), lineWidth: 2.5)
}
.allowsHitTesting(false)
@@ -443,7 +455,7 @@ struct ScreenshotPane: View {
path.addLine(to: CGPoint(x: origin.x + point.x * scale, y: origin.y + point.y * scale))
}
}
context.stroke(path, with: .color(.red), lineWidth: 2.5)
context.stroke(path, with: .color(Color(nsColor: model.drawColor)), lineWidth: 2.5)
}
.allowsHitTesting(false)
}
+2 -2
View File
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
<key>CFBundleIconFile</key>
<string>Icon</string>
<key>CFBundleShortVersionString</key>
<string>1.3.2</string>
<string>1.3.3</string>
<key>CFBundleVersion</key>
<string>32</string>
<string>33</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>