Revision: 16642
http://sourceforge.net/p/skim-app/code/16642
Author: hofman
Date: 2026-10-10 16:50:12 +0000 (Sat, 10 Oct 2026)
Log Message:
-----------
combine implementations
Modified Paths:
--------------
trunk/SKBasePDFView.m
Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m 2026-10-10 14:48:15 UTC (rev 16641)
+++ trunk/SKBasePDFView.m 2026-10-10 16:50:12 UTC (rev 16642)
@@ -347,23 +347,8 @@
[scrollView reflectScrolledClipView:clipView];
}
-- (void)verticallyScrollToTop {
- NSScrollView *scrollView = [self embeddedScrollView];
- NSClipView *clipView = [scrollView contentView];
- NSRect bounds = [clipView bounds];
- CGFloat inset = [clipView contentInsets].top;
- NSRect docRect = [[scrollView documentView] frame];
- if (NSHeight(docRect) <= NSHeight(bounds) - inset)
- return;
- if ([clipView isFlipped])
- bounds.origin.y = NSMinY(docRect) - inset;
- else
- bounds.origin.y = NSMaxY(docRect) - NSHeight(bounds) + inset;
- [clipView scrollToPoint:bounds.origin];
- [scrollView reflectScrolledClipView:clipView];
-}
-- (void)verticallyScrollToBottom {
+- (void)verticallyScrollToTop:(BOOL)toTop {
NSScrollView *scrollView = [self embeddedScrollView];
NSClipView *clipView = [scrollView contentView];
NSRect bounds = [clipView bounds];
@@ -372,9 +357,9 @@
if (NSHeight(docRect) <= NSHeight(bounds) - inset)
return;
if ([clipView isFlipped])
- bounds.origin.y = NSMaxY(docRect) - NSHeight(bounds);
+ bounds.origin.y = toTop ? NSMinY(docRect) - inset : NSMaxY(docRect) -
NSHeight(bounds);
else
- bounds.origin.y = NSMinY(docRect);
+ bounds.origin.y = toTop ? NSMaxY(docRect) - NSHeight(bounds) + inset :
NSMinY(docRect);
[clipView scrollToPoint:bounds.origin];
[scrollView reflectScrolledClipView:clipView];
}
@@ -544,25 +529,25 @@
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
if (currentPageIndex > pageIndex) {
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
} else if (currentPageIndex < pageIndex) {
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
if (keyDirection == 1) {
[self goToNextPage:sender];
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
} else {
[self goToPreviousPage:sender];
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
}
}
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
if (keyDirection == 1) {
[self goToNextPage:sender];
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
} else {
[self goToPreviousPage:sender];
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
}
}
}
@@ -618,25 +603,25 @@
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
if (currentPageIndex < pageIndex) {
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
} else if (currentPageIndex > pageIndex) {
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
if (keyDirection == -1) {
[self goToPreviousPage:sender];
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
} else {
[self goToNextPage:sender];
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
}
}
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
if (keyDirection == -1) {
[self goToPreviousPage:sender];
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
} else {
[self goToNextPage:sender];
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
}
}
}
@@ -651,9 +636,9 @@
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
if (currentPageIndex > pageIndex)
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
else if (currentPageIndex < pageIndex)
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
}
}
@@ -667,9 +652,9 @@
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
if (currentPageIndex < pageIndex)
- [self verticallyScrollToBottom];
+ [self verticallyScrollToTop:NO];
else if (currentPageIndex > pageIndex)
- [self verticallyScrollToTop];
+ [self verticallyScrollToTop:YES];
}
}
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