mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
(-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:
parent
4b5c544ef0
commit
759ed191da
2 changed files with 30 additions and 4 deletions
|
@ -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>
|
2003-11-18 21:43 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSEvent.m (-description): Remove a stray , that was messing
|
* Source/NSEvent.m (-description): Remove a stray , that was messing
|
||||||
|
|
|
@ -481,6 +481,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
- (BOOL) autoscroll: (NSEvent*)theEvent
|
- (BOOL) autoscroll: (NSEvent*)theEvent
|
||||||
{
|
{
|
||||||
NSPoint new;
|
NSPoint new;
|
||||||
|
NSPoint delta;
|
||||||
|
NSRect r;
|
||||||
|
|
||||||
if (_documentView == nil)
|
if (_documentView == nil)
|
||||||
{
|
{
|
||||||
|
@ -489,12 +491,29 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
|
|
||||||
new = [_documentView convertPoint: [theEvent locationInWindow]
|
new = [_documentView convertPoint: [theEvent locationInWindow]
|
||||||
fromView: nil];
|
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;
|
return NO;
|
||||||
}
|
|
||||||
|
|
||||||
[self setBoundsOrigin: new];
|
[self setBoundsOrigin: new];
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue