Skip to content

Commit

Permalink
Comments to explain the fix region
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Oct 2, 2013
1 parent 9198e83 commit 72efe35
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions OHAttributedLabel/Source/OHAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -656,18 +656,19 @@ -(void)drawActiveLinkHighlightForRect:(CGRect)rect
}
continue; // with next run
}

CFRange fullRunRange = CTRunGetStringRange(run);

// Fix for issue #136
CFRange fullRunRange = CTRunGetStringRange(run);
CFRange inRunRange;
inRunRange.location = (CFIndex)activeLinkRange.location - (CFIndex)fullRunRange.location;
inRunRange.length = (CFIndex)activeLinkRange.length;
if (inRunRange.location < 0) {
inRunRange.length += inRunRange.location;
inRunRange.location = 0;
}

// End Fix #136
CGRect linkRunRect = CTRunGetTypographicBoundsForRangeAsRect(run, line, lineOrigins[lineIndex], inRunRange, ctx);

linkRunRect = CGRectIntegral(linkRunRect); // putting the rect on pixel edges
linkRunRect = CGRectInset(linkRunRect, -1, -1); // increase the rect a little
if (CGRectIsEmpty(unionRect))
Expand Down

0 comments on commit 72efe35

Please sign in to comment.