Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #358 from migrant/master
Browse files Browse the repository at this point in the history
NIAttributedLabel
  • Loading branch information
jverkoey committed Mar 26, 2013
2 parents 92e481e + 3cbbe8a commit 16e0ecc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/attributedlabel/src/NIAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,20 @@ - (NSTextCheckingResult *)linkAtPoint:(CGPoint)point {
CGPoint relativePoint = CGPointMake(point.x-CGRectGetMinX(rect),
point.y-CGRectGetMinY(rect));
CFIndex idx = CTLineGetStringIndexForPosition(line, relativePoint);
foundLink = [self linkAtIndex:idx];

NSUInteger offset = 0;
for (NIAttributedLabelImage *labelImage in self.images) {
if (labelImage.index < idx) {
offset++;
}

}

foundLink = [self linkAtIndex:idx - offset];;
if (foundLink) {
return foundLink;
NSTextCheckingResult *result = [NSTextCheckingResult linkCheckingResultWithRange:NSMakeRange(foundLink.range.location + offset, foundLink.range.length) URL:foundLink.URL];

return result;
}
}
}
Expand Down

0 comments on commit 16e0ecc

Please sign in to comment.