(-autoscroll:): Reimplement correctly.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18092 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-11-19 02:21:07 +00:00
parent e3222b9202
commit 7c754b0a27
2 changed files with 30 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2003-11-19 03:17 Alexander Malmberg <alexander@malmberg.org>
* Source/NSClipView.m (-autoscroll:): Reimplement correctly.
* Source/NSTextView.m (-mouseDown:): When the mouse is outside
the view, autoscroll smoothly using periodic events.
2003-11-18 21:43 Alexander Malmberg <alexander@malmberg.org>
* Source/NSEvent.m (-description): Remove a stray , that was messing

View file

@ -481,6 +481,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
- (BOOL) autoscroll: (NSEvent*)theEvent
{
NSPoint new;
NSPoint delta;
NSRect r;
if (_documentView == nil)
{
@ -489,12 +491,29 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
new = [_documentView convertPoint: [theEvent locationInWindow]
fromView: nil];
new = [self constrainScrollPoint: new];
if (NSPointInRect(new, [self documentVisibleRect]))
{
r = [self documentVisibleRect];
if (new.x < NSMinX(r))
delta.x = new.x - NSMinX(r);
else if (new.x > NSMaxX(r))
delta.x = new.x - NSMaxX(r);
else
delta.x = 0;
if (new.y < NSMinY(r))
delta.y = new.y - NSMinY(r);
else if (new.y > NSMaxY(r))
delta.y = new.y - NSMaxY(r);
else
delta.y = 0;
new.x = _bounds.origin.x + delta.x;
new.y = _bounds.origin.y + delta.y;
new = [self constrainScrollPoint: new];
if (NSEqualPoints(new, _bounds.origin))
return NO;
}
[self setBoundsOrigin: new];
return YES;