* fixed bug in autoscrolling that caused the content to jump between the
view's top and bottom if you moved the pointer above the view and reached the top * increased auto-scrolling speed to 40 scroll steps per second and changed _PerformAutoScrolling() to behave as R5: do soft scrolling git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30463 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
077496d6d5
commit
cad2c3d0a5
@ -4665,20 +4665,13 @@ BTextView::_PerformAutoScrolling()
|
|||||||
if (CountLines() > 1) {
|
if (CountLines() > 1) {
|
||||||
// scroll in Y only if multiple lines!
|
// scroll in Y only if multiple lines!
|
||||||
|
|
||||||
float lineHeight = 0;
|
// R5 does a pretty soft auto-scroll, we try to do the same by
|
||||||
float vertDiff = 0;
|
// simply scrolling the distance between cursor and border
|
||||||
if (fWhere.y > bounds.bottom) {
|
if (fWhere.y > bounds.bottom) {
|
||||||
lineHeight = LineHeight(_LineAt(bounds.LeftBottom()));
|
scrollBy.y = fWhere.y - bounds.bottom;
|
||||||
vertDiff = fWhere.y - bounds.bottom;
|
|
||||||
} else if (fWhere.y < bounds.top) {
|
} else if (fWhere.y < bounds.top) {
|
||||||
lineHeight = LineHeight(_LineAt(bounds.LeftTop()));
|
scrollBy.y = fWhere.y - bounds.top; // negative value
|
||||||
vertDiff = fWhere.y - bounds.top; // negative value
|
|
||||||
}
|
}
|
||||||
// Always scroll vertically line by line or by multiples of that
|
|
||||||
// based on the distance of the cursor from the border of the view
|
|
||||||
// TODO: Refine this, I can't even remember how beos works here
|
|
||||||
scrollBy.y = lineHeight > 0 ? lineHeight * (int32)(floorf(vertDiff)
|
|
||||||
/ lineHeight) : 0;
|
|
||||||
|
|
||||||
// prevent from scrolling out of view
|
// prevent from scrolling out of view
|
||||||
if (scrollBy.y != 0.0) {
|
if (scrollBy.y != 0.0) {
|
||||||
@ -4686,7 +4679,7 @@ BTextView::_PerformAutoScrolling()
|
|||||||
+ fLayoutData->bottomInset);
|
+ fLayoutData->bottomInset);
|
||||||
if (bounds.bottom + scrollBy.y > bottomMax)
|
if (bounds.bottom + scrollBy.y > bottomMax)
|
||||||
scrollBy.y = bottomMax - bounds.bottom;
|
scrollBy.y = bottomMax - bounds.bottom;
|
||||||
else if (bounds.top + scrollBy.y < 0)
|
if (bounds.top + scrollBy.y < 0)
|
||||||
scrollBy.y = -bounds.top;
|
scrollBy.y = -bounds.top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5285,7 +5278,8 @@ BTextView::TextTrackState::TextTrackState(BMessenger messenger)
|
|||||||
fRunner(NULL)
|
fRunner(NULL)
|
||||||
{
|
{
|
||||||
BMessage message(_PING_);
|
BMessage message(_PING_);
|
||||||
fRunner = new (nothrow) BMessageRunner(messenger, &message, 300000);
|
const bigtime_t scrollSpeed = 25 * 1000; // 40 scroll steps per second
|
||||||
|
fRunner = new (nothrow) BMessageRunner(messenger, &message, scrollSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user