Swiftgram/submodules/LegacyComponents/Sources/TGPaintPanGestureRecognizer.m
Ilya Laktyushin 7741978b7e Video Editing
2020-05-23 13:26:53 +03:00

39 lines
1.0 KiB
Objective-C

#import "TGPaintPanGestureRecognizer.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
@implementation TGPaintPanGestureRecognizer
- (void)touchesBegan:(NSSet *)inTouches withEvent:(UIEvent *)event
{
_touches = [inTouches copy];
[super touchesBegan:inTouches withEvent:event];
if (inTouches.count == 1 && self.shouldRecognizeTap != nil && self.shouldRecognizeTap())
self.state = UIGestureRecognizerStateBegan;
}
- (void)touchesMoved:(NSSet *)inTouches withEvent:(UIEvent *)event
{
_touches = [inTouches copy];
if (inTouches.count > 1) {
self.state = UIGestureRecognizerStateCancelled;
} else {
[super touchesMoved:inTouches withEvent:event];
}
}
- (void)touchesEnded:(NSSet *)inTouches withEvent:(UIEvent *)event
{
_touches = [inTouches copy];
[super touchesEnded:inTouches withEvent:event];
}
- (void)touchesCancelled:(NSSet *)inTouches withEvent:(UIEvent *)event
{
_touches = [inTouches copy];
[super touchesCancelled:inTouches withEvent:event];
}
@end