* BufferView::scrollDocView(): take care of the general case before the particular top and bottom cases as those don't work very well when the document starts or ends with a big inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22710 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-01-29 13:34:18 +00:00
parent e55019967f
commit ddec18ca01

View File

@ -501,6 +501,13 @@ docstring BufferView::contextMenu(int x, int y) const
void BufferView::scrollDocView(int value) void BufferView::scrollDocView(int value)
{ {
int const offset = value - d->scrollbarParameters_.position;
// If the offset is less than 2 screen height, prefer to scroll instead.
if (abs(offset) <= 2 * height_) {
scroll(offset);
return;
}
// cut off at the top // cut off at the top
if (value <= d->scrollbarParameters_.min) { if (value <= d->scrollbarParameters_.min) {
DocIterator dit = doc_iterator_begin(buffer_.inset()); DocIterator dit = doc_iterator_begin(buffer_.inset());
@ -518,14 +525,6 @@ void BufferView::scrollDocView(int value)
return; return;
} }
int const offset = value - d->scrollbarParameters_.position;
// If the offset is less than 2 screen height, prefer to scroll instead.
if (abs(offset) <= 2 * height_) {
scroll(offset);
return;
}
// find paragraph at target position // find paragraph at target position
int par_pos = d->scrollbarParameters_.min; int par_pos = d->scrollbarParameters_.min;
pit_type i = 0; pit_type i = 0;