Revision: 13110 http://sourceforge.net/p/skim-app/code/13110 Author: hofman Date: 2022-10-21 22:23:10 +0000 (Fri, 21 Oct 2022) Log Message: ----------- Don't use constrainBounds as that restricts to view pixel. Scroll by screen pixel in each step.
Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2022-10-21 16:37:04 UTC (rev 13109) +++ trunk/SKPDFView.m 2022-10-21 22:23:10 UTC (rev 13110) @@ -1087,13 +1087,23 @@ } - (void)pacerScroll:(NSTimer *)timer { - NSClipView *clipView = [[self scrollView] contentView]; + NSScrollView *scrollView = [self scrollView]; + NSClipView *clipView = [scrollView contentView]; NSRect startBounds = [clipView bounds]; + NSRect docRect = [[scrollView documentView] frame]; + if (NSHeight(docRect) + [scrollView contentInsets].top <= NSHeight(startBounds)) + return; NSRect bounds = startBounds; - bounds.origin = [clipView convertPointToBacking:bounds.origin]; - bounds.origin.y -= [[timer userInfo] doubleValue]; - bounds.origin = [clipView convertPointFromBacking:bounds.origin]; - bounds = [clipView constrainBoundsRect:bounds]; + CGFloat offset = [clipView convertSizeFromBacking:NSMakeSize(0.0, 1.0)].height; + if ([clipView isFlipped]) { + bounds.origin.y += offset; + if (NSMaxY(docRect) < NSMaxY(bounds)) + bounds.origin.y = NSMaxY(docRect) - NSHeight(bounds); + } else { + bounds.origin.y -= offset; + if (NSMinY(docRect) > NSMinY(bounds)) + bounds.origin.y = NSMinY(docRect); + } if (NSEqualPoints(bounds.origin, startBounds.origin) == NO) [clipView scrollToPoint:bounds.origin]; } @@ -1106,14 +1116,16 @@ if (pacerTimer) { [self stopPacer]; } else if (pacerSpeed > 0.0 && [[self document] isLocked] == NO) { + CGFloat interval; + SEL selector; if ([self hasReadingBar]) { - pacerTimer = [[NSTimer scheduledTimerWithTimeInterval:PACER_LINE_HEIGHT / pacerSpeed target:self selector:@selector(pacerMoveReadingBar:) userInfo:nil repeats:YES] retain]; + interval = PACER_LINE_HEIGHT / pacerSpeed; + selector = @selector(pacerMoveReadingBar:); } else { - CGFloat pxPerPt = [self backingScale] * [self scaleFactor]; - CGFloat pxStep = ceil(0.25 * pxPerPt); - CGFloat interval = pxStep / (pacerSpeed * pxPerPt); - pacerTimer = [[NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(pacerScroll:) userInfo:[NSNumber numberWithFloat:pxStep] repeats:YES] retain]; + interval = 1.0 / (pacerSpeed * [self backingScale] * [self scaleFactor]); + selector = @selector(pacerScroll:); } + pacerTimer = [[NSTimer scheduledTimerWithTimeInterval:interval target:self selector:selector userInfo:nil repeats:YES] retain]; [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewPacerStartedOrStoppedNotification object:self]; } } 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