From f39105a8f492627e47f77416f3d552f53a01bc51 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 3 Dec 2015 09:45:45 -0800 Subject: [PATCH] Optimize --- AsyncDisplayKit/ASTextNode.mm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/AsyncDisplayKit/ASTextNode.mm b/AsyncDisplayKit/ASTextNode.mm index 17d9e78b74..531cc228d1 100644 --- a/AsyncDisplayKit/ASTextNode.mm +++ b/AsyncDisplayKit/ASTextNode.mm @@ -831,15 +831,18 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation { [super touchesMoved:touches withEvent:event]; - CGPoint point = [[touches anyObject] locationInView:self.view]; - NSRange range = NSMakeRange(0, 0); - [self _linkAttributeValueAtPoint:point - attributeName:NULL - range:&range - inAdditionalTruncationMessage:NULL]; + // If touch has moved out of the current highlight range, clear the highlight. + if (_highlightRange.length > 0) { + NSRange range = NSMakeRange(0, 0); + CGPoint point = [[touches anyObject] locationInView:self.view]; + [self _linkAttributeValueAtPoint:point + attributeName:NULL + range:&range + inAdditionalTruncationMessage:NULL]; - if (!NSEqualRanges(_highlightRange, range)) { - [self _clearHighlightIfNecessary]; + if (!NSEqualRanges(_highlightRange, range)) { + [self _clearHighlightIfNecessary]; + } } }