Revision: 15824
http://sourceforge.net/p/skim-app/code/15824
Author: hofman
Date: 2025-11-24 18:08:48 +0000 (Mon, 24 Nov 2025)
Log Message:
-----------
combine some cases and use local variable
Modified Paths:
--------------
trunk/SKBasePDFView.m
Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m 2025-11-24 17:31:15 UTC (rev 15823)
+++ trunk/SKBasePDFView.m 2025-11-24 18:08:48 UTC (rev 15824)
@@ -418,23 +418,17 @@
CGFloat height = NSHeight(bounds) - inset;
CGFloat offset = fmax(height - [scrollView verticalPageScroll], 0.5 *
height);
NSRect docRect = [[scrollView documentView] frame];
+ CGFloat scroll = NSMinY([clipView bounds]) - NSMinY(bounds);
// check whether we have scrolled and in which direction
// consider all implementation details as they are wrong and can change
- if ([clipView isFlipped] == NO) {
- if (NSMinY([clipView bounds]) < NSMinY(bounds) - 1.0)
- bounds.origin.y = fmax(NSMinY(docRect), NSMinY(bounds) -
offset);
- else if (NSMinY([clipView bounds]) > NSMinY(bounds) + 1.0)
- bounds.origin.y = fmin(NSMaxY(docRect) - height,
NSMinY(bounds) + offset);
- else
- return;
- } else {
- if (NSMinY([clipView bounds]) > NSMinY(bounds) + 1.0)
- bounds.origin.y = fmin(NSMaxY(docRect) - NSHeight(bounds),
NSMinY(bounds) + offset);
- else if (NSMinY([clipView bounds]) < NSMinY(bounds) - 1.0)
- bounds.origin.y = fmax(NSMinY(docRect) - inset, NSMinY(bounds)
- offset);
- else
- return;
- }
+ if ([clipView isFlipped] == NO)
+ inset = 0.0;
+ if (scroll < -1.0)
+ bounds.origin.y = fmax(NSMinY(docRect) - inset, NSMinY(bounds) -
offset);
+ else if (scroll > 1.0)
+ bounds.origin.y = fmin(NSMaxY(docRect) - height - inset,
NSMinY(bounds) + offset);
+ else
+ return;
[clipView scrollToPoint:bounds.origin];
[scrollView reflectScrolledClipView:clipView];
} else if (page) {
@@ -470,23 +464,17 @@
CGFloat height = NSHeight(bounds) - inset;
CGFloat offset = fmax(height - [scrollView verticalPageScroll], 0.5 *
height);
NSRect docRect = [[scrollView documentView] frame];
+ CGFloat scroll = NSMinY([clipView bounds]) - NSMinY(bounds);
// check whether we have scrolled and in which direction
// consider all implementation details as they are wrong and can change
- if ([clipView isFlipped] == NO) {
- if (NSMinY([clipView bounds]) > NSMinY(bounds) + 1.0)
- bounds.origin.y = fmin(NSMaxY(docRect) - height,
NSMinY(bounds) + offset);
- else if (NSMinY([clipView bounds]) < NSMinY(bounds) - 1.0)
- bounds.origin.y = fmax(NSMinY(docRect), NSMinY(bounds) -
offset);
- else
- return;
- } else {
- if (NSMinY([clipView bounds]) < NSMinY(bounds) + 1.0)
- bounds.origin.y = fmax(NSMinY(docRect) - inset, NSMinY(bounds)
- offset);
- else if (NSMinY([clipView bounds]) > NSMinY(bounds) - 1.0)
- bounds.origin.y = fmin(NSMaxY(docRect) - NSHeight(bounds),
NSMinY(bounds) + offset);
- else
- return;
- }
+ if ([clipView isFlipped] == NO)
+ inset = 0.0;
+ if (scroll > 1.0)
+ bounds.origin.y = fmin(NSMaxY(docRect) - height - inset,
NSMinY(bounds) + offset);
+ else if (scroll < -1.0)
+ bounds.origin.y = fmax(NSMinY(docRect) - inset, NSMinY(bounds) -
offset);
+ else
+ return;
[clipView scrollToPoint:bounds.origin];
[scrollView reflectScrolledClipView:clipView];
} else if (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