Revision: 14807
          http://sourceforge.net/p/skim-app/code/14807
Author:   hofman
Date:     2024-12-10 10:17:03 +0000 (Tue, 10 Dec 2024)
Log Message:
-----------
pass old value instead of old bounds to update method

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-12-09 17:13:57 UTC (rev 14806)
+++ trunk/SKMainWindowController.m      2024-12-10 10:17:03 UTC (rev 14807)
@@ -2686,9 +2686,6 @@
             // Update the UI, we should always do that unless the value did 
not really change or we're just changing the mod date or user name
             if ([keyPath isEqualToString:SKNPDFAnnotationModificationDateKey] 
== NO && [keyPath isEqualToString:SKNPDFAnnotationUserNameKey] == NO && 
[keyPath isEqualToString:SKNPDFAnnotationTextKey] == NO) {
                 PDFPage *page = [note page];
-                NSRect oldRect = NSZeroRect;
-                if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] && 
[oldValue isEqual:[NSNull null]] == NO)
-                    oldRect = [oldValue rectValue];
                 
                 [self updateThumbnailAtPageIndex:[note pageIndex]];
                 
@@ -2699,7 +2696,7 @@
                     }
                 }
                 
-                [pdfView updatedAnnotation:note forKey:keyPath 
fromRect:oldRect];
+                [pdfView updatedAnnotation:note forKey:keyPath 
fromValue:oldValue];
                 [secondaryPdfView updatedAnnotation:note];
                 
                 if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey]) {

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2024-12-09 17:13:57 UTC (rev 14806)
+++ trunk/SKPDFView.h   2024-12-10 10:17:03 UTC (rev 14807)
@@ -256,7 +256,7 @@
 
 - (void)undoManagerDidOpenOrCloseUndoGroup;
 
-- (void)updatedAnnotation:(PDFAnnotation *)annotation forKey:(nullable 
NSString *)key fromRect:(NSRect)oldRect;
+- (void)updatedAnnotation:(PDFAnnotation *)annotation forKey:(nullable 
NSString *)key fromValue:(nullable id)oldValue;
 
 @end
 

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2024-12-09 17:13:57 UTC (rev 14806)
+++ trunk/SKPDFView.m   2024-12-10 10:17:03 UTC (rev 14807)
@@ -2834,7 +2834,7 @@
     [self goToRect:[annotation bounds] onPage:[annotation page]];
 }
 
-- (void)updatedAnnotation:(PDFAnnotation *)annotation forKey:(NSString *)key 
fromRect:(NSRect)oldRect {
+- (void)updatedAnnotation:(PDFAnnotation *)annotation forKey:(NSString *)key 
fromValue:(id)oldValue {
     BOOL updateHighlight = key == nil || [key 
isEqualToString:SKNPDFAnnotationBoundsKey] || [key 
isEqualToString:SKNPDFAnnotationDrawsImageKey];
     // these properties don't notify automatically because they don't use the 
annotationValue
     if ([annotation isNote] && ([key isEqualToString:SKNPDFAnnotationImageKey] 
|| [key isEqualToString:SKNPDFAnnotationDrawsImageKey]))
@@ -2843,8 +2843,8 @@
         PDFPage *page = [annotation page];
         CGFloat margin = (([annotation isResizable] || [annotation isNote]) ? 
HANDLE_SIZE  : 1.0) / [self scaleFactor];
         [self setNeedsDisplayInRect:NSInsetRect([annotation bounds], -margin, 
-margin) ofPage:page];
-        if (NSEqualRects(oldRect, NSZeroRect) == NO)
-            [self setNeedsDisplayInRect:NSInsetRect(oldRect, -margin, -margin) 
ofPage:page];
+        if ([key isEqualToString:SKNPDFAnnotationBoundsKey] && [oldValue 
isKindOfClass:[NSValue class]])
+            [self setNeedsDisplayInRect:NSInsetRect([oldValue rectValue], 
-margin, -margin) ofPage:page];
     } else {
         [loupeController updateContents];
     }
@@ -2851,7 +2851,7 @@
 }
 
 - (void)updatedAnnotation:(PDFAnnotation *)annotation {
-    [self updatedAnnotation:annotation forKey:nil fromRect:NSZeroRect];
+    [self updatedAnnotation:annotation forKey:nil fromValue:nil];
 }
 
 - (void)setNeedsDisplayForReadingBarBounds:(NSRect)rect onPage:(PDFPage *)page 
{

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