Revision: 14568
http://sourceforge.net/p/skim-app/code/14568
Author: hofman
Date: 2024-10-22 13:44:15 +0000 (Tue, 22 Oct 2024)
Log Message:
-----------
Auto size anchored notes drawing its image
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2024-10-21 22:51:44 UTC (rev 14567)
+++ trunk/SKMainWindowController_UI.m 2024-10-22 13:44:15 UTC (rev 14568)
@@ -1736,7 +1736,7 @@
return [self interactionMode] != SKPresentationMode && [self
hasOverview] == NO && [annotation isSkimNote] && [annotation isEditable];
} else if (action == @selector(autoSizeNote:)) {
PDFAnnotation *annotation = [pdfView currentAnnotation];
- return [self interactionMode] != SKPresentationMode && [self
hasOverview] == NO && [annotation isSkimNote] && ([annotation isText] ||
(([[annotation type] isEqualToString:SKNCircleString] || [[annotation type]
isEqualToString:SKNSquareString]) && [[pdfView currentSelection]
hasCharacters]));
+ return [self interactionMode] != SKPresentationMode && [self
hasOverview] == NO && [annotation isResizable] && ([annotation isText] ||
[annotation isNote] || (([[annotation type] isEqualToString:SKNCircleString] ||
[[annotation type] isEqualToString:SKNSquareString]) && [[pdfView
currentSelection] hasCharacters]));
} else if (action == @selector(alignLeft:) || action ==
@selector(alignRight:) || action == @selector(alignCenter:)) {
PDFAnnotation *annotation = [pdfView currentAnnotation];
return [self interactionMode] != SKPresentationMode && [self
hasOverview] == NO && [annotation isSkimNote] && [annotation isEditable] &&
[annotation isText];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2024-10-21 22:51:44 UTC (rev 14567)
+++ trunk/SKPDFView.m 2024-10-22 13:44:15 UTC (rev 14568)
@@ -3549,6 +3549,29 @@
if (NSEqualRects(bounds, [currentAnnotation bounds]) == NO)
[currentAnnotation setBounds:bounds];
+ } else if ([currentAnnotation isNote]) {
+
+ PDFPage *page = [currentAnnotation page];
+ NSRect pageBounds = [page boundsForBox:[self displayBox]];
+ NSRect bounds = [currentAnnotation bounds];
+ NSSize size = [currentAnnotation image] ? [[currentAnnotation image]
size] : SKNPDFAnnotationNoteSize;
+
+ if (NSWidth(pageBounds) < size.width) {
+ size.width *= size.width / NSWidth(pageBounds);
+ size.height *= size.width / NSWidth(pageBounds);
+ }
+ if (NSHeight(pageBounds) < size.height) {
+ size.width *= size.width / NSHeight(pageBounds);
+ size.height *= size.height / NSHeight(pageBounds);
+ }
+ size.width = round(size.width);
+ size.height = round(size.height);
+ bounds.size = size;
+
+ bounds = SKConstrainRect(bounds, pageBounds);
+ if (NSEqualRects(bounds, [currentAnnotation bounds]) == NO)
+ [currentAnnotation setBounds:bounds];
+
} else if ([[[self currentSelection] pages]
containsObject:[currentAnnotation page]]) {
NSRect bounds = [[self currentSelection]
boundsForPage:[currentAnnotation 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