aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-10 00:00:26 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-10 00:00:26 +0000
commit7faafe50af3d0d3b3c1eeb40af77d57328fcc0cb (patch)
tree9242d250e810306e99f0a1e8990b2cb4701a03af /AppKit
parentd03dd0aa069a4e655f29f2216e84ac9a47dc66f8 (diff)
[Author: dmaclach]
Forgot NSAnimationContext when adding duration support. R=thomasvl DELTA=13 (13 added, 0 deleted, 0 changed) TBR=thomasvl
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMNSAnimation+Duration.h17
-rw-r--r--AppKit/GTMNSAnimation+Duration.m15
2 files changed, 21 insertions, 11 deletions
diff --git a/AppKit/GTMNSAnimation+Duration.h b/AppKit/GTMNSAnimation+Duration.h
index 54b3070..fa1d86f 100644
--- a/AppKit/GTMNSAnimation+Duration.h
+++ b/AppKit/GTMNSAnimation+Duration.h
@@ -16,25 +16,26 @@
// the License.
//
+// Categories for changing the duration of an animation based on the current
+// event. Right now they track the state of the shift and control keys to slow
+// down animations similar to how minimize window animations occur.
+
#import <AppKit/AppKit.h>
#import "GTMDefines.h"
-// A category for changing the duration of an animation based on the current
-// event. Right now it tracks the state of the shift and control keys to slow
-// down animations appropriately similar to how minimize window animations
-// occur.
@interface NSAnimation (GTMNSAnimationDurationAdditions)
- (void)gtm_setDuration:(NSTimeInterval)duration;
@end
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#import <QuartzCore/QuartzCore.h>
-// A category for changing the duration of an animation based on the current
-// event. Right now it tracks the state of the shift and control keys to slow
-// down animations appropriately similar to how minimize window animations
-// occur.
+@interface NSAnimationContext (GTMNSAnimationDurationAdditions)
+- (void)gtm_setDuration:(NSTimeInterval)duration;
+@end
+
@interface CAAnimation (GTMCAAnimationDurationAdditions)
- (void)gtm_setDuration:(CFTimeInterval)duration;
@end
diff --git a/AppKit/GTMNSAnimation+Duration.m b/AppKit/GTMNSAnimation+Duration.m
index f8d0ced..89e3f3e 100644
--- a/AppKit/GTMNSAnimation+Duration.m
+++ b/AppKit/GTMNSAnimation+Duration.m
@@ -23,11 +23,11 @@ static NSTimeInterval GTMCurrentDurationMultiplier(void) {
NSUInteger modifiers = [event modifierFlags];
NSTimeInterval duration = 1.0;
if (modifiers & NSShiftKeyMask) {
- duration *= 0.2;
+ duration *= 5.0;
}
- // These are additive, so shift+control returns 0.1 * duration.
+ // These are additive, so shift+control returns 10 * duration.
if (modifiers & NSControlKeyMask) {
- duration *= 0.5;
+ duration *= 2.0;
}
return duration;
}
@@ -43,6 +43,15 @@ static NSTimeInterval GTMCurrentDurationMultiplier(void) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+@implementation NSAnimationContext (GTMNSAnimationDurationAdditions)
+
+- (void)gtm_setDuration:(NSTimeInterval)duration {
+ duration = duration * GTMCurrentDurationMultiplier();
+ [self setDuration:duration];
+}
+
+@end
+
@implementation CAAnimation (GTMCAAnimationDurationAdditions)
- (void)gtm_setDuration:(CFTimeInterval)duration {