mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 03:02:19 +00:00
Fix for CPScrollView performance issue.
[#93 state:resolved] Reviewed by ross.
This commit is contained in:
1 parent
6b6a6a6f1d
commit
4d39466f14
2 files changed
+14
-29
No files matched your search
+14
-5
@@ -137,10 +137,7 @@ import "CPView.j"
|
|||||||
*/
|
*/
|
||||||
- (void)viewBoundsChanged:(CPNotification)aNotification
|
- (void)viewBoundsChanged:(CPNotification)aNotification
|
||||||
{
|
{
|
||||||
var superview = [self superview];
|
[self viewFrameChanged:aNotification];
|
||||||
|
|
||||||
if([superview isKindOfClass:[CPScrollView class]])
|
|
||||||
[superview reflectScrolledClipView:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -149,9 +146,21 @@ import "CPView.j"
|
|||||||
*/
|
*/
|
||||||
- (void)viewFrameChanged:(CPNotification)aNotification
|
- (void)viewFrameChanged:(CPNotification)aNotification
|
||||||
{
|
{
|
||||||
|
var oldScrollPoint = [self bounds].origin;
|
||||||
|
|
||||||
|
// Call scrollToPoint: because the current scroll point may no longer make
|
||||||
|
// sense given the new frame of the document view.
|
||||||
|
[self scrollToPoint:oldScrollPoint];
|
||||||
|
|
||||||
|
// scrollToPoint: takes care of reflectScrollClipView: for us, so bail if
|
||||||
|
// the scroll points are not equal (meaning scrollToPoint: didn't early bail).
|
||||||
|
if (!CGPointEqualToPoint(oldScrollPoint, [self bounds].origin))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// ... and we're in a scroll view of course.
|
||||||
var superview = [self superview];
|
var superview = [self superview];
|
||||||
|
|
||||||
if([superview isKindOfClass:[CPScrollView class]])
|
if ([superview isKindOfClass:[CPScrollView class]])
|
||||||
[superview reflectScrolledClipView:self];
|
[superview reflectScrolledClipView:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,30 +227,6 @@ import "CPScroller.j"
|
|||||||
|
|
||||||
[_contentView setFrame:contentViewFrame];
|
[_contentView setFrame:contentViewFrame];
|
||||||
|
|
||||||
// The reason we have to do this is because this is called on a frame size change, so when the frame changes,
|
|
||||||
// so does the the float value, so we have to update the clip view accordingly.
|
|
||||||
if (_hasVerticalScroller && (shouldShowVerticalScroller || wasShowingVerticalScroller))
|
|
||||||
{
|
|
||||||
//[self _verticalScrollerDidScroll:_verticalScroller];
|
|
||||||
var value = [_verticalScroller floatValue],
|
|
||||||
contentBounds = [_contentView bounds];
|
|
||||||
|
|
||||||
contentBounds.origin.y = value * (_CGRectGetHeight([documentView frame]) - _CGRectGetHeight(contentBounds));
|
|
||||||
|
|
||||||
[_contentView scrollToPoint:contentBounds.origin];
|
|
||||||
}
|
|
||||||
if (_hasHorizontalScroller && (shouldShowHorizontalScroller || wasShowingHorizontalScroller))
|
|
||||||
{
|
|
||||||
//[self _horizontalScrollerDidScroll:_horizontalScroller];
|
|
||||||
|
|
||||||
var value = [_horizontalScroller floatValue],
|
|
||||||
contentBounds = [_contentView bounds];
|
|
||||||
|
|
||||||
contentBounds.origin.x = value * (_CGRectGetWidth([documentView frame]) - _CGRectGetWidth(contentBounds));
|
|
||||||
|
|
||||||
[_contentView scrollToPoint:contentBounds.origin];
|
|
||||||
}
|
|
||||||
|
|
||||||
--_recursionCount;
|
--_recursionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user