Fix annotation position shift in editor and export

Use flipped container with Auto Layout for correct coordinate
mapping. Use lockFocusFlipped(true) in renderer so exported
annotations match canvas positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 07:21:05 +02:00
co-authored by Claude Opus 4.6
parent 0fce3e6d28
commit 519706dd41
2 changed files with 24 additions and 17 deletions
+4 -2
View File
@@ -28,9 +28,11 @@ enum AnnotationRenderer {
static func render(annotations: [AnnotationItem], onto image: NSImage) -> NSImage {
let size = image.size
let result = NSImage(size: size)
result.lockFocus()
result.lockFocusFlipped(true)
image.draw(in: NSRect(origin: .zero, size: size))
image.draw(in: NSRect(origin: .zero, size: size),
from: .zero, operation: .sourceOver, fraction: 1,
respectFlipped: true, hints: nil)
if let context = NSGraphicsContext.current?.cgContext {
for item in annotations {