create local variables for performance and clarity

This commit is contained in:
Tom King 2016-03-08 08:54:07 -05:00
parent f4d5791717
commit 1457e97c59

View File

@ -891,15 +891,16 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
{ {
[super touchesMoved:touches withEvent:event]; [super touchesMoved:touches withEvent:event];
UITouch *touch = [touches anyObject];
CGPoint locationInView = [touch locationInView:self.view];
// on 3D Touch enabled phones, this gets fired with changes in force, and usually will get fired immediately after touchesBegan:withEvent: // on 3D Touch enabled phones, this gets fired with changes in force, and usually will get fired immediately after touchesBegan:withEvent:
if (CGPointEqualToPoint([[touches anyObject] previousLocationInView:self.view], [[touches anyObject] locationInView:self.view])) if (CGPointEqualToPoint([touch previousLocationInView:self.view], locationInView))
return; return;
// If touch has moved out of the current highlight range, clear the highlight. // If touch has moved out of the current highlight range, clear the highlight.
if (_highlightRange.length > 0) { if (_highlightRange.length > 0) {
NSRange range = NSMakeRange(0, 0); NSRange range = NSMakeRange(0, 0);
CGPoint point = [[touches anyObject] locationInView:self.view]; [self _linkAttributeValueAtPoint:locationInView
[self _linkAttributeValueAtPoint:point
attributeName:NULL attributeName:NULL
range:&range range:&range
inAdditionalTruncationMessage:NULL inAdditionalTruncationMessage:NULL