according to 'frame()' can get the coordinate of relative to app ,
let mousePos = NSEvent.mouseLocation(); but this coordinate obtained are relative to the screen.
the resulting coordinates have inconsistent references. How do I transform one of these ？
let mousePos = NSEvent.mouseLocation();
You’ll want :convertPointFromScreen on NSWindow.
let mouseLocation = NSEvent.mouseLocation()
//let window = context.document.documentWindowController().window()
let window = NSApp.mainWindow()
let converted = window.convertPointFromScreen(mouseLocation)