Revision: 15594
          http://sourceforge.net/p/skim-app/code/15594
Author:   hofman
Date:     2025-07-03 09:47:31 +0000 (Thu, 03 Jul 2025)
Log Message:
-----------
return early when not clicking on a page or an annotation

Modified Paths:
--------------
    trunk/SKPDFView.m

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2025-07-03 09:33:54 UTC (rev 15593)
+++ trunk/SKPDFView.m   2025-07-03 09:47:31 UTC (rev 15594)
@@ -4179,8 +4179,11 @@
 - (BOOL)doSelectAnnotationWithEvent:(NSEvent *)theEvent {
     PDFAnnotation *newCurrentAnnotation = nil;
     NSPoint point = NSZeroPoint;
-    PDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
+    PDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:NO];
     
+    if (page == nil)
+        return NO;
+    
     if ([currentAnnotation page] == page && [currentAnnotation isResizable] && 
[currentAnnotation resizeHandleForPoint:point scaleFactor:[self scaleFactor]] 
!= 0) {
         newCurrentAnnotation = currentAnnotation;
     } else {
@@ -4207,7 +4210,10 @@
             newCurrentAnnotation = linkAnnotation;
     }
     
-    if (hideNotes == NO && [[self document] allowsNotes] && page != nil && 
newCurrentAnnotation != nil) {
+    if (newCurrentAnnotation == nil)
+        return NO;
+    
+    if (hideNotes == NO && [[self document] allowsNotes]) {
         BOOL isInk = toolMode == SKToolModeNote && annotationMode == 
SKNoteTypeInk;
         NSUInteger modifiers = [theEvent modifierFlags];
         if ((modifiers & NSEventModifierFlagOption) && [newCurrentAnnotation 
isMovable] &&
@@ -4227,10 +4233,10 @@
         }
     }
     
-    if (newCurrentAnnotation && newCurrentAnnotation != currentAnnotation)
+    if (newCurrentAnnotation != currentAnnotation)
         [self setCurrentAnnotation:newCurrentAnnotation];
     
-    return newCurrentAnnotation != nil;
+    return YES;
 }
 
 static NSArray *scaledDashPattern(NSArray *dashPattern, CGFloat scale) {

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

Reply via email to