Revision: 14788
          http://sourceforge.net/p/skim-app/code/14788
Author:   hofman
Date:     2024-12-08 15:50:11 +0000 (Sun, 08 Dec 2024)
Log Message:
-----------
Only redisplay main pdfview for annotation change when it is active, and not 
when the selection highlight is drawn by the highlight layer. Only the 
seleection highlight needs to be redrawn, the note is updated by the 
PDFPageView.

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-12-08 15:21:54 UTC (rev 14787)
+++ trunk/SKMainWindowController.m      2024-12-08 15:50:11 UTC (rev 14788)
@@ -2706,15 +2706,8 @@
                     }
                 }
                 
-                [pdfView setNeedsDisplayForAnnotation:note];
+                [pdfView setNeedsDisplayForAnnotation:note fromRect:oldRect];
                 [secondaryPdfView setNeedsDisplayForAnnotation:note];
-                if (NSIsEmptyRect(oldRect) == NO) {
-                    if ([note isResizable]) {
-                        CGFloat margin = 4.0 / [pdfView scaleFactor];
-                        oldRect = NSInsetRect(oldRect, -margin, -margin);
-                    }
-                    [pdfView setNeedsDisplayInRect:oldRect ofPage:page];
-                }
                 
                 if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey]) {
                     if ([note isNote]) {

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2024-12-08 15:21:54 UTC (rev 14787)
+++ trunk/SKPDFView.h   2024-12-08 15:50:11 UTC (rev 14788)
@@ -256,6 +256,8 @@
 
 - (void)undoManagerDidOpenOrCloseUndoGroup;
 
+- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation 
fromRect:(NSRect)oldRect;
+
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2024-12-08 15:21:54 UTC (rev 14787)
+++ trunk/SKPDFView.m   2024-12-08 15:50:11 UTC (rev 14788)
@@ -2834,17 +2834,23 @@
     [self goToRect:[annotation bounds] onPage:[annotation page]];
 }
 
-- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation {
+- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation 
fromRect:(NSRect)oldRect {
     PDFPage *page = [annotation page];
-    NSRect rect = [annotation displayRect];
-    if (annotation == currentAnnotation) {
-        CGFloat margin = (([annotation isResizable] || [annotation isNote]) ? 
HANDLE_SIZE  : 1.0) / [self scaleFactor];
-        rect = NSInsetRect(rect, -margin, -margin);
+    [self annotationsChangedOnPage:page];
+    if (annotation == currentAnnotation && atomic_load(&highlightLayerState) 
!= SKLayerUse) {
+        NSRect rect = NSUnionRect([annotation displayRect], oldRect);
+        if (annotation == currentAnnotation) {
+            CGFloat margin = (([annotation isResizable] || [annotation 
isNote]) ? HANDLE_SIZE  : 1.0) / [self scaleFactor];
+            rect = NSInsetRect(rect, -margin, -margin);
+        }
+        [self setNeedsDisplayInRect:rect ofPage:page];
     }
-    [self setNeedsDisplayInRect:rect ofPage:page];
-    [self annotationsChangedOnPage:page];
 }
 
+- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation {
+    [self setNeedsDisplayForAnnotation:annotation fromRect:NSZeroRect];
+}
+
 - (void)setNeedsDisplayForReadingBarBounds:(NSRect)rect onPage:(PDFPage *)page 
{
     [self setNeedsDisplayInRect:[SKReadingBar bounds:rect forBox:[self 
displayBox] onPage:page] ofPage:page];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to