* fix random jumps when scrolling very fast using a touchpad or mouse wheel.

The problem was this: The value in BufferView::scrollDocView(int value) is
relative to the d->scrollbarParameters_.min/max interval and _not_ absolute.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22675 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-01-26 00:47:22 +00:00
parent 8c9342ca29
commit ab1a045d10

View File

@ -508,7 +508,12 @@ void BufferView::scrollDocView(int value)
return; return;
} }
int par_pos = 0; // cut off at the top
if (value < d->scrollbarParameters_.min)
value = d->scrollbarParameters_.min;
// find paragraph at target positin
int par_pos = d->scrollbarParameters_.min;
for (size_t i = 0; i != d->par_height_.size(); ++i) { for (size_t i = 0; i != d->par_height_.size(); ++i) {
par_pos += d->par_height_[i]; par_pos += d->par_height_[i];
if (par_pos >= value) { if (par_pos >= value) {
@ -521,7 +526,15 @@ void BufferView::scrollDocView(int value)
<< "\tanchor_ref_ = " << d->anchor_pit_ << "\tanchor_ref_ = " << d->anchor_pit_
<< "\tpar_pos = " << par_pos); << "\tpar_pos = " << par_pos);
// cut off at the end of the buffer
if (value > par_pos) {
value = d->scrollbarParameters_.max;
d->anchor_pit_ = d->par_height_.size() - 1;
}
// set pixel offset of screen to anchor pit
d->anchor_ypos_ = par_pos - value; d->anchor_ypos_ = par_pos - value;
updateMetrics(); updateMetrics();
buffer_.changed(); buffer_.changed();
} }