forked from myell0w/MTLocation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MTTouchesMovedGestureRecognizer.m
68 lines (48 loc) · 1.63 KB
/
MTTouchesMovedGestureRecognizer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// WildcardGestureRecognizer.m
// Created by Raymond Daly on 10/31/10.
// Copyright 2010 Floatopian LLC. All rights reserved.
//
#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])) {
self.cancelsTouchesInView = NO;
}
return self;
}
- (void)dealloc {
[touchesMovedCallback_ release], touchesMovedCallback_ = nil;
[touchesBeganTimestamp_ release], touchesBeganTimestamp_ = nil;
[super dealloc];
}
/*- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (touches.count >= 2) {
self.touchesBeganTimestamp = [NSDate date];
}
}*/
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if (/*self.touchesBeganTimestamp != nil && [self.touchesBeganTimestamp timeIntervalSinceNow] < kMTTouchesMinimumDuration &&*/
touches.count == 1 && self.touchesMovedCallback) {
self.touchesMovedCallback(touches, event);
}
}
/*- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
self.touchesBeganTimestamp = nil;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
self.touchesBeganTimestamp = nil;
}*/
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer {
return NO;
}
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer {
return NO;
}
@end