Commit scroll adjustment patch by Benhur Stein.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26678 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2008-06-17 20:20:15 +00:00
parent 4b24e5cd48
commit ec6135aade
3 changed files with 45 additions and 7 deletions

View file

@ -42,6 +42,10 @@
DEFINE_RINT_IF_MISSING
@interface NSClipView (Private)
- (void) _scrollToPoint: (NSPoint)aPoint;
@end
/*
* Return the biggest integral (in device space) rect contained in rect.
* Conversion to/from device space is done using view.
@ -538,7 +542,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
*/
- (void) viewFrameChanged: (NSNotification*)aNotification
{
[self scrollToPoint: _bounds.origin];
[self _scrollToPoint: _bounds.origin];
/* If document frame does not completely cover _bounds */
if (NSContainsRect([_documentView frame], _bounds) == NO)
@ -817,3 +821,26 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
return self;
}
@end
@implementation NSClipView (Private)
- (void) _scrollToPoint: (NSPoint)aPoint
{
NSRect proposedBounds;
NSRect proposedVisibleRect;
NSRect newVisibleRect;
NSRect newBounds;
// give documentView a chance to adjust its visible rectangle
proposedBounds = _bounds;
proposedBounds.origin = aPoint;
proposedVisibleRect = [self convertRect: proposedBounds
toView: _documentView];
newVisibleRect = [_documentView adjustScroll: proposedVisibleRect];
newBounds = [self convertRect: newVisibleRect fromView: _documentView];
[self scrollToPoint: newBounds.origin];
}
@end