Revision: 14914
http://sourceforge.net/p/skim-app/code/14914
Author: hofman
Date: 2025-02-04 16:39:44 +0000 (Tue, 04 Feb 2025)
Log Message:
-----------
Update line points in annotation values to woraround 10.13 setBounds bug
Modified Paths:
--------------
trunk/PDFAnnotationLine_SKExtensions.m
Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m 2025-02-02 10:10:45 UTC (rev
14913)
+++ trunk/PDFAnnotationLine_SKExtensions.m 2025-02-04 16:39:44 UTC (rev
14914)
@@ -63,22 +63,26 @@
@implementation PDFAnnotationLine (SKExtensions)
static void (*original_setBounds)(id, SEL, NSRect) = NULL;
-static void (*original_setStartPoint)(id, SEL, NSPoint) = NULL;
-static void (*original_setEndPoint)(id, SEL, NSPoint) = NULL;
static void replacement_setBounds(id self, SEL _cmd , NSRect newBounds) {
- NSPoint startPoint = [self startPoint];
- NSPoint endPoint = [self endPoint];
+ NSArray *points = [self valueForAnnotationKey:@"/L"];
+ if ([points isKindOfClass:[NSArray class]] && [points count] == 4) {
+ NSPoint d = SKSubstractPoints(newBounds.origin, [self bounds].origin);
+ if (NSEqualPoints(d, NSZeroPoint))
+ points = nil;
+ else
+ points = @[@([points[0] doubleValue] + d.x), @([points[1]
doubleValue] + d.y), @([points[2] doubleValue] + d.x), @([points[3]
doubleValue] + d.y)];
+ } else if (points) {
+ points = nil;
+ }
original_setBounds(self, _cmd, newBounds);
- original_setStartPoint(self, @selector(setStartPoint:), startPoint);
- original_setEndPoint(self, @selector(setEndPoint:), endPoint);
+ if (points)
+ [self setValue:points forAnnotationKey:@"/L"];
}
+ (void)load {
if (@available(macOS 10.14, *)) {} else {
original_setBounds = (void (*)(id, SEL,
NSRect))SKReplaceInstanceMethodImplementation(self, @selector(setBounds:),
(IMP)replacement_setBounds);
- original_setStartPoint = (void (*)(id, SEL, NSPoint))[self
instanceMethodForSelector:@selector(setStartPoint:)];
- original_setEndPoint = (void (*)(id, SEL, NSPoint))[self
instanceMethodForSelector:@selector(setEndPoint:)];
}
}
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