From 1cf292279ce14ea5f42fea2949c7c45d82e227dc Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sun, 20 Sep 2009 15:40:05 -0700 Subject: [PATCH] Improved scrolling for tablview and outlineview -- no longer sets non-integral scroll positions. Reviewed by me. --- AppKit/CPScrollView.j | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j index 4c223422d..8dc645c28 100644 --- a/AppKit/CPScrollView.j +++ b/AppKit/CPScrollView.j @@ -506,7 +506,8 @@ case CPScrollerKnobSlot: case CPScrollerKnob: - default: contentBounds.origin.y = value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds)); + // We want integral bounds! + default: contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds))); } [_contentView scrollToPoint:contentBounds.origin]; @@ -535,7 +536,8 @@ case CPScrollerKnobSlot: case CPScrollerKnob: - default: contentBounds.origin.x = value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds)); + // We want integral bounds! + default: contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds))); } [_contentView scrollToPoint:contentBounds.origin]; @@ -675,8 +677,9 @@ var documentFrame = [[self documentView] frame], contentBounds = [_contentView bounds]; - contentBounds.origin.x += [anEvent deltaX] * _horizontalLineScroll; - contentBounds.origin.y += [anEvent deltaY] * _verticalLineScroll; + // We want integral bounds! + contentBounds.origin.x = ROUND(contentBounds.origin.x + [anEvent deltaX] * _horizontalLineScroll); + contentBounds.origin.y = ROUND(contentBounds.origin.y + [anEvent deltaY] * _verticalLineScroll); [_contentView scrollToPoint:contentBounds.origin]; [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)];