I have question about NSView:
Imagine a Custom View where the mouseDown, mouseDrag and mouseUp methods are overriden so the user can drag a point (NSRect) on the screen.
You don't need to convert to the local coordinate system manually. You can convert the point to the local coordinate system by sending the convertPoint:fromView:
message to your view. Sending nil
as the parameter to fromView
will convert the point from the view's parent window (wherever that is). You can also send any other view to get the coordinates converted from that space as well:
// convert from the window's coordinate system to the local coordinate system
NSPoint clickPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
// convert from some other view's cooridinate system
NSPoint otherPoint = [self convertPoint:somePoint fromView:someSuperview];