Revision: 15250 http://sourceforge.net/p/skim-app/code/15250 Author: hofman Date: 2025-05-21 14:47:29 +0000 (Wed, 21 May 2025) Log Message: ----------- No need to override mouse over HUD windows. Get link annotation for event.
Modified Paths: -------------- trunk/SKPresentationView.m Modified: trunk/SKPresentationView.m =================================================================== --- trunk/SKPresentationView.m 2025-05-21 14:31:51 UTC (rev 15249) +++ trunk/SKPresentationView.m 2025-05-21 14:47:29 UTC (rev 15250) @@ -426,6 +426,8 @@ - (void)doDrawFreehandNoteWithEvent:(NSEvent *)theEvent; - (void)showHelpMenu; +- (PDFAnnotation *)linkAnotationForEvent:(NSEvent *)theEvent; + @end @implementation SKPresentationView @@ -612,20 +614,6 @@ return [transform transformPoint:point]; } -- (PDFAnnotation *)linkAnotationAtPoint:(NSPoint)point { - if ([[page annotations] count] == 0) - return nil; - - point = [self convertPointToPage:point]; - - for (PDFAnnotation *annotation in [[page annotations] reverseObjectEnumerator]) { - if ([annotation isLink] && [annotation hitTest:point]) - return annotation; - } - - return nil; -} - #pragma mark Accessors - (BOOL)canBecomeKeyView { @@ -801,7 +789,7 @@ if ([pageLayer opacity] <= 0.0) { [pageLayer setOpacity:1.0]; } else if ([NSApp willDragMouse] == NO) { - PDFDestination *link = [[self linkAnotationAtPoint:[theEvent locationInView:self]] destination]; + PDFDestination *link = [[self linkAnotationForEvent:theEvent] destination]; if (link) [self setPage:[link page]]; else @@ -1093,6 +1081,20 @@ [menu popUpMenuPositioningItem:nil atLocation:point inView:self]; } +- (PDFAnnotation *)linkAnotationForEvent:(NSEvent *)theEvent { + if ([[page annotations] count] == 0) + return nil; + + NSPoint point = theEvent ? [self convertPointToPage:[theEvent locationInView:self]] : [self convertPointFromScreen:[NSEvent mouseLocation]]; + + for (PDFAnnotation *annotation in [[page annotations] reverseObjectEnumerator]) { + if ([annotation isLink] && [annotation hitTest:point]) + return annotation; + } + + return nil; +} + #pragma mark Cursors and HUD windows - (void)cancelDelayedRequests { @@ -1128,12 +1130,9 @@ } - (void)setCursorForMouse:(NSEvent *)theEvent { - NSPoint point = theEvent ? [theEvent locationOnScreen] : [NSEvent mouseLocation]; - if (([navWindow isVisible] && NSPointInRect(point, [navWindow frame])) || ([cursorWindow isVisible] && NSPointInRect(point, [cursorWindow frame]))) - [[NSCursor arrowCursor] set]; - else if (pvFlags.cursorHidden) + if (pvFlags.cursorHidden) [[NSCursor emptyCursor] set]; - else if ([[self linkAnotationAtPoint:[self convertPointFromScreen:point]] destination]) + else if ([[self linkAnotationForEvent:theEvent] destination]) [[NSCursor pointingHandCursor] set]; else if (pvFlags.useArrowCursor) [[NSCursor arrowCursor] set]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit