Revision: 14345
          http://sourceforge.net/p/skim-app/code/14345
Author:   hofman
Date:     2024-06-25 22:37:48 +0000 (Tue, 25 Jun 2024)
Log Message:
-----------
make sure new anchored note is positioned on displayed page

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2024-06-25 22:32:18 UTC (rev 14344)
+++ trunk/SKPDFView.m   2024-06-25 22:37:48 UTC (rev 14345)
@@ -2709,23 +2709,23 @@
             switch ([page intrinsicRotation]) {
                 case 0:
                     bounds = [[page 
selectionForRect:NSMakeRect(NSMinX(pageBounds), NSMinY(bounds), 
NSWidth(pageBounds), NSHeight(bounds))] boundsForPage:page];
-                    bounds.origin.x = floor(NSMinX(bounds)) - 
SKNPDFAnnotationNoteSize.width;
+                    bounds.origin.x = fmax(floor(NSMinX(bounds)) - 
SKNPDFAnnotationNoteSize.width, NSMinX(pageBounds));
                     bounds.origin.y = floor(NSMaxY(bounds)) - 
SKNPDFAnnotationNoteSize.height;
                     break;
                 case 90:
                     bounds = [[page 
selectionForRect:NSMakeRect(NSMinX(bounds), NSMinY(pageBounds), 
NSWidth(bounds), NSWidth(pageBounds))] boundsForPage:page];
                     bounds.origin.x = ceil(NSMinX(bounds));
-                    bounds.origin.y = floor(NSMinY(bounds)) - 
SKNPDFAnnotationNoteSize.height;
+                    bounds.origin.y = fmax(floor(NSMinY(bounds)) - 
SKNPDFAnnotationNoteSize.height, NSMinY(pageBounds));
                     break;
                 case 180:
                     bounds = [[page 
selectionForRect:NSMakeRect(NSMinX(pageBounds), NSMinY(bounds), 
NSWidth(pageBounds), NSHeight(bounds))] boundsForPage:page];
-                    bounds.origin.x = ceil(NSMaxX(bounds));
+                    bounds.origin.x = fmin(ceil(NSMaxX(bounds)), 
NSMaxX(pageBounds) - SKNPDFAnnotationNoteSize.width);
                     bounds.origin.y = ceil(NSMinY(bounds));
                     break;
                 case 270:
                     bounds = [[page 
selectionForRect:NSMakeRect(NSMinX(bounds), NSMinY(pageBounds), 
NSWidth(bounds), NSWidth(pageBounds))] boundsForPage:page];
                     bounds.origin.x = floor(NSMaxX(bounds)) - 
SKNPDFAnnotationNoteSize.height;
-                    bounds.origin.y = ceil(NSMaxY(bounds));
+                    bounds.origin.y = fmin(ceil(NSMaxY(bounds)), 
NSMaxY(pageBounds) - SKNPDFAnnotationNoteSize.width);
                     break;
                 default:
                     break;

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