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,7 +19,7 @@
19 19
 	<key>CFBundleSignature</key>
20 20
 	<string>????</string>
21 21
 	<key>CFBundleVersion</key>
22
-	<string>140</string>
22
+	<string>142</string>
23 23
 	<key>LSApplicationCategoryType</key>
24 24
 	<string>public.app-category.utilities</string>
25 25
 	<key>LSMinimumSystemVersion</key>

+ 7
- 4
OtaClock/MainWindow.m View File

@@ -17,8 +17,8 @@
17 17
 #define CONFIG_KEEP_POSITION @"keep_position"
18 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 23
 #define EYE_BLINK 0
24 24
 #define EYE_TOP_RIGHT 4
@@ -135,10 +135,13 @@
135 135
             newSize.width *= i;
136 136
             frame.size = newSize;
137 137
             found = YES;
138
+            startScale = i;
138 139
             
139 140
             NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
140 141
             [defaults setInteger:i forKey:CONFIG_START_SCALE];
141 142
             [defaults synchronize];
143
+            
144
+            break;
142 145
         }
143 146
     }
144 147
     
@@ -226,8 +229,8 @@
226 229
     mousePoint.x -= [self frame].origin.x;
227 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 235
     NSInteger eyeState = EYE_BOTTOM_LEFT;
233 236
     if (top && right) {

Loading…
Cancel
Save