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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user