diff options
Diffstat (limited to 'AppKit')
-rw-r--r-- | AppKit/GTMNSAnimation+Duration.h | 2 | ||||
-rw-r--r-- | AppKit/GTMNSAnimation+Duration.m | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/AppKit/GTMNSAnimation+Duration.h b/AppKit/GTMNSAnimation+Duration.h index ee4be84..4ed7ef9 100644 --- a/AppKit/GTMNSAnimation+Duration.h +++ b/AppKit/GTMNSAnimation+Duration.h @@ -23,6 +23,8 @@ // Given a "normal" duration for an animation, return what it should be based // on the current system state. For example, holding down the shift and/or // control keys modifies the normal duration for an animation making it slower. +// Currently only modifies the duration if the current event is of type +// NSLeftMouseUp and only the control and/or shift modifiers are down. NSTimeInterval GTMModifyDurationBasedOnCurrentState(NSTimeInterval duration); // Categories for changing the duration of an animation based on the current diff --git a/AppKit/GTMNSAnimation+Duration.m b/AppKit/GTMNSAnimation+Duration.m index 327a349..884cd32 100644 --- a/AppKit/GTMNSAnimation+Duration.m +++ b/AppKit/GTMNSAnimation+Duration.m @@ -20,13 +20,19 @@ NSTimeInterval GTMModifyDurationBasedOnCurrentState(NSTimeInterval duration) { NSEvent *event = [NSApp currentEvent]; - NSUInteger modifiers = [event modifierFlags]; - if (modifiers & NSShiftKeyMask) { - duration *= 5.0; - } - // These are additive, so shift+control returns 10 * duration. - if (modifiers & NSControlKeyMask) { - duration *= 2.0; + if ([event type] == NSLeftMouseUp) { + NSUInteger modifiers = [event modifierFlags]; + if (!(modifiers & (NSAlternateKeyMask | + NSCommandKeyMask | + NSFunctionKeyMask))) { + if (modifiers & NSShiftKeyMask) { + duration *= 5.0; + } + // These are additive, so shift+control returns 10 * duration. + if (modifiers & NSControlKeyMask) { + duration *= 2.0; + } + } } return duration; } |