Revision: 15624
          http://sourceforge.net/p/skim-app/code/15624
Author:   hofman
Date:     2025-07-08 16:12:55 +0000 (Tue, 08 Jul 2025)
Log Message:
-----------
include isSkimNotes check in hitTest: check

Modified Paths:
--------------
    trunk/PDFAnnotationLine_SKExtensions.m
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKPDFView.m
    trunk/SKPresentationView.m

Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m      2025-07-08 16:03:29 UTC (rev 
15623)
+++ trunk/PDFAnnotationLine_SKExtensions.m      2025-07-08 16:12:55 UTC (rev 
15624)
@@ -135,8 +135,10 @@
 - (BOOL)isConvertibleAnnotation { return YES; }
 
 - (BOOL)hitTest:(NSPoint)point {
+    if ([self shouldDisplay] == NO || [self isSkimNote] == NO)
+        return NO;
     CGFloat delta = fmax(4.0, 0.5 * [self lineWidth]);
-    return [self shouldDisplay] && 
SKPointNearLineFromPointToPoint(SKSubstractPoints(point, [self bounds].origin), 
[self startPoint], [self endPoint], delta);
+    return SKPointNearLineFromPointToPoint(SKSubstractPoints(point, [self 
bounds].origin), [self startPoint], [self endPoint], delta);
 }
 
 - (CGFloat)boundsOrder {

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2025-07-08 16:03:29 UTC (rev 15623)
+++ trunk/PDFAnnotation_SKExtensions.m  2025-07-08 16:12:55 UTC (rev 15624)
@@ -461,7 +461,7 @@
 }
 
 - (BOOL)hitTest:(NSPoint)point {
-    return [self shouldDisplay] ? NSPointInRect(point, [self bounds]) : NO;
+    return [self shouldDisplay] && [self isSkimNote] && NSPointInRect(point, 
[self bounds]);
 }
 
 - (CGFloat)boundsOrder {

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2025-07-08 16:03:29 UTC (rev 15623)
+++ trunk/SKPDFView.m   2025-07-08 16:12:55 UTC (rev 15624)
@@ -2220,13 +2220,9 @@
         NSPoint location = [self convertPoint:[sender draggingLocation] 
fromView:nil];
         PDFPage *page = [self pageForPoint:location nearest:NO];
         if (page) {
-            NSArray *annotations = [page annotations];
-            PDFAnnotation *annotation = nil;
-            NSInteger i = [annotations count];
             location = [self convertPoint:location toPage:page];
-            while (i-- > 0) {
-                annotation = [annotations objectAtIndex:i];
-                if ([annotation isSkimNote] && [annotation hitTest:location] &&
+            for (PDFAnnotation *annotation in [[page annotations] 
reverseObjectEnumerator]) {
+                if ([annotation hitTest:location] &&
                     ([pboard 
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor]] || [annotation 
hasBorder])) {
                     [self setHighlightAnnotation:annotation];
                     dragOp = NSDragOperationGeneric;
@@ -4194,7 +4190,7 @@
         for (PDFAnnotation *annotation in annotations) {
             if ([annotation shouldDisplay] == NO) {
                 continue;
-            } else if ([annotation isSkimNote] && [annotation hitTest:point]) {
+            } else if ([annotation hitTest:point]) {
                 newCurrentAnnotation = annotation;
                 break;
             } else if (NSPointInRect(point, [annotation bounds]) && (toolMode 
== SKToolModeText || IS_MARKUP(annotationMode)) && linkAnnotation == nil) {
@@ -4386,7 +4382,7 @@
         id annotations = [[page annotations] reverseObjectEnumerator];
         
         for (PDFAnnotation *annotation in annotations) {
-            if ([annotation isSkimNote] && [annotation hitTest:point]) {
+            if ([annotation hitTest:point]) {
                 [self removeAnnotation:annotation];
                 break;
             }

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2025-07-08 16:03:29 UTC (rev 15623)
+++ trunk/SKPresentationView.m  2025-07-08 16:12:55 UTC (rev 15624)
@@ -1097,7 +1097,7 @@
     NSPoint point = [self convertPointToPage:theEvent ? [theEvent 
locationInView:self] : [self convertPointFromScreen:[NSEvent mouseLocation]]];
     
     for (PDFAnnotation *annotation in [[page annotations] 
reverseObjectEnumerator]) {
-        if ([annotation isLink] && [annotation hitTest:point])
+        if ([annotation isLink] && NSPointInRect(point, [annotation bounds]))
             return annotation;
     }
     

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