Permalink
Browse files

Commented out touches-count-stuff, not working yet

  • Loading branch information...
1 parent be29fe6 commit c3a8bba08a6130eb741f5700f67befa18edc2d97 @myell0w myell0w committed Mar 10, 2011
Showing with 23 additions and 9 deletions.
  1. +1 −0 MTTouchesMovedGestureRecognizer.h
  2. +22 −9 MTTouchesMovedGestureRecognizer.m
@@ -9,6 +9,7 @@ typedef void (^TouchesEventBlock)(NSSet * touches, UIEvent * event);
@interface MTTouchesMovedGestureRecognizer : UIGestureRecognizer {
TouchesEventBlock touchesMovedCallback_;
+ NSDate *touchesBeganTimestamp_;
}
@property(copy) TouchesEventBlock touchesMovedCallback;
@@ -6,10 +6,20 @@
#import "MTTouchesMovedGestureRecognizer.h"
+#define kMTTouchesMinimumDuration 0.5
+
+
+@interface MTTouchesMovedGestureRecognizer ()
+
+@property (nonatomic, retain) NSDate *touchesBeganTimestamp;
+
+@end
+
@implementation MTTouchesMovedGestureRecognizer
@synthesize touchesMovedCallback = touchesMovedCallback_;
+@synthesize touchesBeganTimestamp = touchesBeganTimestamp_;
- (id)init {
if ((self = [super init])) {
@@ -21,28 +31,31 @@ - (id)init {
- (void)dealloc {
[touchesMovedCallback_ release], touchesMovedCallback_ = nil;
+ [touchesBeganTimestamp_ release], touchesBeganTimestamp_ = nil;
[super dealloc];
}
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- NSLog(@"Began: %d", touches.count);
-}
+/*- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+ if (touches.count >= 2) {
+ self.touchesBeganTimestamp = [NSDate date];
+ }
+}*/
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- NSLog(@"Moved: %d", touches.count);
- if (touches.count == 1 && self.touchesMovedCallback) {
+ if (/*self.touchesBeganTimestamp != nil && [self.touchesBeganTimestamp timeIntervalSinceNow] < kMTTouchesMinimumDuration &&*/
+ touches.count == 1 && self.touchesMovedCallback) {
self.touchesMovedCallback(touches, event);
}
}
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- NSLog(@"Ended: %d", touches.count);
+/*- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+ self.touchesBeganTimestamp = nil;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
- NSLog(@"Cancelled: %d", touches.count);
-}
+ self.touchesBeganTimestamp = nil;
+}*/
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer {
return NO;

0 comments on commit c3a8bba

Please sign in to comment.