Skip to content
Browse files

Some conventions updates in VELCAAction's interface (and class extens…

…ion) documentation, and renamed the geometry change method

Reviewed by James Lawton.
  • Loading branch information...
1 parent f70a735 commit fb6eb6e9e92fde463cd982607bdc25134dc9f002 @jspahrsummers jspahrsummers committed Nov 24, 2011
Showing with 25 additions and 10 deletions.
  1. +7 −5 Framework/Velvet/Velvet/VELCAAction.h
  2. +18 −5 Framework/Velvet/Velvet/VELCAAction.m
View
12 Framework/Velvet/Velvet/VELCAAction.h
@@ -10,26 +10,28 @@
#import <QuartzCore/QuartzCore.h>
/**
- * A CAAction which finds NSViews contained in Velvet and animated them alongside.
- * We pass through to the default animation to animate the Velvet views.
+ * A `CAAction` which finds AppKit views contained in Velvet and animates them
+ * alongside. We pass through to the default animation to animate the Velvet
+ * views.
*/
@interface VELCAAction : NSObject <CAAction>
/**
* Initializes an action which proxies for the given action, and handles animation
- * of descendent VELNSViews to the VELView whose layer it acts on.
+ * of all descendent `VELNSView` instances along with the layer being acted upon.
*
* This is the designated initializer.
*/
- (id)initWithAction:(id <CAAction>)innerAction;
/**
- * Returns a caller-owned action, initialized with `initWithAction:`.
+ * Returns an action initialized with `initWithAction:`.
*/
+ (id)actionWithAction:(id <CAAction>)innerAction;
/**
- * Returns YES if objects of this class add features to actions for the given key.
+ * Returns `YES` if objects of this class add features to actions for the given
+ * key.
*/
+ (BOOL)interceptsActionForKey:(NSString *)key;
View
23 Framework/Velvet/Velvet/VELCAAction.m
@@ -13,8 +13,21 @@
@interface VELCAAction ()
+/**
+ * The action that this action is proxying, as specified at the time of
+ * initialization.
+ */
@property (nonatomic, strong) id <CAAction> innerAction;
-- (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer;
+
+/**
+ * Invoked whenever the geometry property `key` of `layer` has changed.
+ */
+- (void)geometryChangedForKey:(NSString *)key layer:(CALayer *)layer;
+
+/**
+ * Returns `YES` if objects of this class add features to actions for the given
+ * geometry property.
+ */
+ (BOOL)interceptsGeometryActionForKey:(NSString *)key;
@end
@@ -27,6 +40,7 @@ - (id)initWithAction:(id <CAAction>)innerAction {
if (self) {
self.innerAction = innerAction;
}
+
return self;
}
@@ -51,11 +65,11 @@ - (void)runActionForKey:(NSString *)key object:(id)anObject arguments:(NSDiction
return;
if ([[self class] interceptsGeometryActionForKey:key]) {
- [self handleGeometryChangeForKey:key layer:anObject];
+ [self geometryChangedForKey:key layer:anObject];
}
}
-- (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer {
+- (void)geometryChangedForKey:(NSString *)key layer:(CALayer *)layer {
// For all contained VELNSViews, render their NSView into their layer
// and hide the NSView. Now the visual element is part of the layer
// hierarchy we're animating.
@@ -84,8 +98,7 @@ - (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer {
}
+ (BOOL)interceptsGeometryActionForKey:(NSString *)key {
- return [key isEqualToString:@"position"]
- || [key isEqualToString:@"bounds"];
+ return [key isEqualToString:@"position"] || [key isEqualToString:@"bounds"];
}
+ (BOOL)interceptsActionForKey:(NSString *)key {

0 comments on commit fb6eb6e

Please sign in to comment.
Something went wrong with that request. Please try again.