From 3c902c7e677ec36035a730aec01038fcebbd1ee0 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 21 Jul 2009 22:19:18 +0000 Subject: - Clean up logic flow, moving column and row capture to within trackMouse:inRect:ofView:untilMouseUp: instead of hitTestForEvent:. --- Source/SPTextAndLinkCell.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/SPTextAndLinkCell.m b/Source/SPTextAndLinkCell.m index d1e8338e..eee3f517 100644 --- a/Source/SPTextAndLinkCell.m +++ b/Source/SPTextAndLinkCell.m @@ -177,12 +177,6 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) { // Hit the link if it falls within the link rectangle for this cell, set when drawing if (p.x > linkRect.origin.x && p.x < (linkRect.origin.x + linkRect.size.width)) { - // Capture the clicked row and cell - NSTableView *tableView = (NSTableView *)[self controlView]; - p = [[[NSApp mainWindow] contentView] convertPoint:[event locationInWindow] toView:tableView]; - lastLinkColumn = [tableView columnAtPoint:p]; - lastLinkRow = [tableView rowAtPoint:p]; - // Return a trackable hit return NSCellHitContentArea | NSCellHitTrackableArea; @@ -222,6 +216,12 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) { BOOL mouseClicked = [linkButton trackMouse:theEvent inRect:linkRect ofView:controlView untilMouseUp:NO]; if (mouseClicked) { + // Capture the clicked row and cell + NSTableView *tableView = (NSTableView *)[self controlView]; + p = [[[NSApp mainWindow] contentView] convertPoint:[theEvent locationInWindow] toView:tableView]; + lastLinkColumn = [tableView columnAtPoint:p]; + lastLinkRow = [tableView rowAtPoint:p]; + // Remove highlight, and follow the link [linkButton highlight:NO withFrame:linkRect inView:controlView]; [linkTarget performSelector:linkAction withObject:self]; -- cgit v1.2.3