-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME
21 lines (15 loc) · 944 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
When working with multiple screens and mouse location in Cocoa you have to go through converting the point coordinates to the current screen coordinates.
For example if you have a second monitor on the left and you want to get the mouse position relative to that screen, [NSEvent mousePosition] will return something like (-1200, 130), which is often not what you want. This class provides three simple methods to simplify conversion of points to the current screen coordinates:
/*
Returns the screen where the mouse resides
*/
+ (NSScreen *)currentScreenForMouseLocation;
/*
Allows you to convert a point from global coordinates to the current screen coordinates.
*/
- (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint;
/*
Allows to flip the point coordinates, so y is 0 at the top instead of the bottom. x remains the same
*/
- (NSPoint)flipPoint:(NSPoint)aPoint;
License: MIT