override func mouseDown(with event: NSEvent) {
let startPoint = event.locationInWindow
print(startPoint) //for top left it prints (0, 900)
To my knowledge the screen's origin is defined as the top left corner of the screen.
But NSView's mouse down event gives the screen's bottom left as the origin(top left coordinates are 0,900).
I have already tried using:
self.convert(event.locationInWindow, from: nil)
But the results are the same.
Is there a way to convert these coordinates to screen coordinates?
CGWindowListCreateImagein which (according to the documentation) the origin is the top-left corner.NSEvent.mouseLocationis suppose to return the coordinates in "screen coordinates". But I'm still getting the coordinates with respect to bottom left as the origin.