Skip to content

Commit a92dd31

Browse files
author
Michael Kuntscher
committed
Adds property for long press touch cancellation
1 parent 6ae17e5 commit a92dd31

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

AsyncDisplayKit/ASTextNode.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
187187
*/
188188
@property (nonatomic, weak) id<ASTextNodeDelegate> delegate;
189189

190+
/**
191+
@abstract If YES and a long press is recognized, touches are cancelled. Default is NO
192+
*/
193+
@property (nonatomic, assign) BOOL longPressCancelsTouches;
194+
195+
190196
@end
191197

192198
/**

AsyncDisplayKit/ASTextNode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ - (void)didLoad
240240
// If we are view-backed, support gesture interaction.
241241
if (!self.isLayerBacked) {
242242
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_handleLongPress:)];
243-
_longPressGestureRecognizer.cancelsTouchesInView = NO;
243+
_longPressGestureRecognizer.cancelsTouchesInView = self.longPressCancelsTouches;
244244
_longPressGestureRecognizer.delegate = self;
245245
[self.view addGestureRecognizer:_longPressGestureRecognizer];
246246
}

0 commit comments

Comments
 (0)