Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52e36b5c5a |
@@ -94,6 +94,8 @@ final class CaptureModel: ObservableObject {
|
|||||||
@Published var strokes: [[CGPoint]] = []
|
@Published var strokes: [[CGPoint]] = []
|
||||||
/// Whether the pen is active (drag draws instead of selecting)
|
/// Whether the pen is active (drag draws instead of selecting)
|
||||||
@Published var isDrawing = false
|
@Published var isDrawing = false
|
||||||
|
/// Current drawing color
|
||||||
|
@Published var drawColor: NSColor = .systemRed
|
||||||
|
|
||||||
enum CaptureMode {
|
enum CaptureMode {
|
||||||
case screenshot
|
case screenshot
|
||||||
@@ -120,7 +122,7 @@ final class CaptureModel: ObservableObject {
|
|||||||
let ctx = NSGraphicsContext.current!.cgContext
|
let ctx = NSGraphicsContext.current!.cgContext
|
||||||
// CGImage draws with a flipped Y in NSGraphicsContext
|
// CGImage draws with a flipped Y in NSGraphicsContext
|
||||||
ctx.draw(image, in: NSRect(origin: .zero, size: size))
|
ctx.draw(image, in: NSRect(origin: .zero, size: size))
|
||||||
NSColor.systemRed.setStroke()
|
drawColor.setStroke()
|
||||||
ctx.setLineWidth(3)
|
ctx.setLineWidth(3)
|
||||||
ctx.setLineCap(.round)
|
ctx.setLineCap(.round)
|
||||||
ctx.setLineJoin(.round)
|
ctx.setLineJoin(.round)
|
||||||
@@ -285,6 +287,16 @@ struct ResultView: View {
|
|||||||
.foregroundStyle(model.isDrawing ? .primary : .secondary)
|
.foregroundStyle(model.isDrawing ? .primary : .secondary)
|
||||||
.help("Toggle drawing on the screenshot")
|
.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 {
|
if !model.strokes.isEmpty {
|
||||||
Button {
|
Button {
|
||||||
model.clearAnnotations()
|
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))
|
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)
|
.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))
|
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)
|
.allowsHitTesting(false)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>Icon</string>
|
<string>Icon</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.3.2</string>
|
<string>1.3.3</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>32</string>
|
<string>33</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user