Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
[super touchesEnded:touches withEvent:event];
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];

[self triggerAction];
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
[super touchesCancelled:touches withEvent:event];
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];

[self triggerAction];
}

- (void)triggerAction
Expand All @@ -69,7 +73,6 @@ - (void)triggerAction

- (void)reset
{
[self triggerAction];
[_gestureHandler.pointerTracker reset];
_hasBegan = NO;
[super reset];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,16 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];

[self triggerAction];
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];

[self triggerAction];
}

#else
Expand Down Expand Up @@ -181,10 +185,6 @@ - (BOOL)shouldCancelGesture

- (void)reset
{
if (self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}

[_gestureHandler.pointerTracker reset];

[super reset];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ - (void)interactionsMoved:(NSSet *)touches withEvent:(UIEvent *)event
// UIGestureRecognizerStateFailed here. Making the behavior explicit.
self.state = (self.state == UIGestureRecognizerStatePossible) ? UIGestureRecognizerStateFailed
: UIGestureRecognizerStateCancelled;

[self triggerAction];
[self reset];
return;
}
Expand Down Expand Up @@ -243,19 +245,22 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self interactionsEnded:touches withEvent:event];

[self triggerAction];
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[self interactionsCancelled:touches withEvent:event];

[self triggerAction];
}

#endif

- (void)reset
{
[self triggerAction];
[_gestureHandler.pointerTracker reset];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil];
self.enabled = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ - (void)interactionsEnded:(NSSet *)touches withEvent:(UIEvent *)event

if (_numberOfTaps == _tapsSoFar && _maxNumberOfTouches >= _minPointers) {
self.state = UIGestureRecognizerStateEnded;

[self triggerAction];
[self reset];
} else {
[self performSelector:@selector(cancel) withObject:nil afterDelay:_maxDelay];
Expand All @@ -141,6 +143,8 @@ - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
self.state = UIGestureRecognizerStateCancelled;

[self triggerAction];
[self reset];
}

Expand Down Expand Up @@ -200,12 +204,16 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self interactionsEnded:touches withEvent:event];

[self triggerAction];
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[self interactionsCancelled:touches withEvent:event];

[self triggerAction];
}

#endif
Expand Down Expand Up @@ -243,9 +251,6 @@ - (BOOL)shouldFailUnderCustomCriteria

- (void)reset
{
if (self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
[_gestureHandler.pointerTracker reset];

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil];
Expand Down
Loading