Browse Source

Fix mouse eye center point working with all scalings

Thomas Buck 8 years ago
parent
commit
ec9f81362e
2 changed files with 8 additions and 5 deletions
  1. 1
    1
      OtaClock/Info.plist
  2. 7
    4
      OtaClock/MainWindow.m

+ 1
- 1
OtaClock/Info.plist View File

19
 	<key>CFBundleSignature</key>
19
 	<key>CFBundleSignature</key>
20
 	<string>????</string>
20
 	<string>????</string>
21
 	<key>CFBundleVersion</key>
21
 	<key>CFBundleVersion</key>
22
-	<string>140</string>
22
+	<string>142</string>
23
 	<key>LSApplicationCategoryType</key>
23
 	<key>LSApplicationCategoryType</key>
24
 	<string>public.app-category.utilities</string>
24
 	<string>public.app-category.utilities</string>
25
 	<key>LSMinimumSystemVersion</key>
25
 	<key>LSMinimumSystemVersion</key>

+ 7
- 4
OtaClock/MainWindow.m View File

17
 #define CONFIG_KEEP_POSITION @"keep_position"
17
 #define CONFIG_KEEP_POSITION @"keep_position"
18
 #define CONFIG_KEEP_ON_TOP @"keep_on_top"
18
 #define CONFIG_KEEP_ON_TOP @"keep_on_top"
19
 
19
 
20
-#define MOUSE_CENTER_X 337
21
-#define MOUSE_CENTER_Y 237
20
+#define MOUSE_CENTER_X 67
21
+#define MOUSE_CENTER_Y 47
22
 
22
 
23
 #define EYE_BLINK 0
23
 #define EYE_BLINK 0
24
 #define EYE_TOP_RIGHT 4
24
 #define EYE_TOP_RIGHT 4
135
             newSize.width *= i;
135
             newSize.width *= i;
136
             frame.size = newSize;
136
             frame.size = newSize;
137
             found = YES;
137
             found = YES;
138
+            startScale = i;
138
             
139
             
139
             NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
140
             NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
140
             [defaults setInteger:i forKey:CONFIG_START_SCALE];
141
             [defaults setInteger:i forKey:CONFIG_START_SCALE];
141
             [defaults synchronize];
142
             [defaults synchronize];
143
+            
144
+            break;
142
         }
145
         }
143
     }
146
     }
144
     
147
     
226
     mousePoint.x -= [self frame].origin.x;
229
     mousePoint.x -= [self frame].origin.x;
227
     mousePoint.y -= [self frame].origin.y;
230
     mousePoint.y -= [self frame].origin.y;
228
     
231
     
229
-    BOOL top = (mousePoint.y > MOUSE_CENTER_Y);
230
-    BOOL right = (mousePoint.x > MOUSE_CENTER_X);
232
+    BOOL top = (mousePoint.y > (MOUSE_CENTER_Y * startScale));
233
+    BOOL right = (mousePoint.x > (MOUSE_CENTER_X * startScale));
231
     
234
     
232
     NSInteger eyeState = EYE_BOTTOM_LEFT;
235
     NSInteger eyeState = EYE_BOTTOM_LEFT;
233
     if (top && right) {
236
     if (top && right) {

Loading…
Cancel
Save