Revision: 9682 http://sourceforge.net/p/skim-app/code/9682 Author: hofman Date: 2018-02-12 13:00:13 +0000 (Mon, 12 Feb 2018) Log Message: ----------- Workaround for bug where line annotation changes its startPoint and endPoint when its bounds changes on 10.13
Modified Paths: -------------- trunk/PDFAnnotationLine_SKExtensions.m Modified: trunk/PDFAnnotationLine_SKExtensions.m =================================================================== --- trunk/PDFAnnotationLine_SKExtensions.m 2018-02-09 16:09:26 UTC (rev 9681) +++ trunk/PDFAnnotationLine_SKExtensions.m 2018-02-12 13:00:13 UTC (rev 9682) @@ -68,6 +68,7 @@ @implementation PDFAnnotationLine (SKExtensions) static void (*original_drawWithBox_inContext)(id, SEL, PDFDisplayBox, CGContextRef) = NULL; +static void (*original_setBounds)(id, SEL, NSRect) = NULL; static inline void addLineTipToPath(CGMutablePathRef path, NSPoint point, CGFloat angle, PDFLineStyle lineStyle, CGFloat lineWidth) { CGAffineTransform transform = CGAffineTransformRotate(CGAffineTransformMakeTranslation(point.x, point.y), angle); @@ -141,9 +142,19 @@ } } +- (void)replacement_setBounds:(NSRect)newBounds { + NSPoint startPoint = [self startPoint]; + NSPoint endPoint = [self endPoint]; + original_setBounds(self, _cmd, newBounds); + [self setStartPoint:startPoint]; + [self setEndPoint:endPoint]; +} + + (void)load { if (RUNNING(10_11)) original_drawWithBox_inContext = (void (*)(id, SEL, PDFDisplayBox, CGContextRef))SKReplaceInstanceMethodImplementationFromSelector(self, @selector(drawWithBox:inContext:), @selector(replacement_drawWithBox:inContext:)); + if (RUNNING(10_13)) + original_setBounds = (void (*)(id, SEL, NSRect))SKReplaceInstanceMethodImplementationFromSelector(self, @selector(setBounds:), @selector(replacement_setBounds:)); } - (id)initSkimNoteWithBounds:(NSRect)bounds { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit