mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
Fix fast scrolling with Shift+Scroll
When holding down the shift key, multiply wheel and touchpad scroll distances by 10 to re-implement the fast scrolling feature that broke when we added animated/smooth scrolling. BUG: 420889 FIXED-IN: 1.11.3
This commit is contained in:
parent
8b008b02fc
commit
777ac37ea2
|
@ -3126,16 +3126,19 @@ void PageView::wheelEvent(QWheelEvent *e)
|
|||
d->scroller->scrollTo(QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value()), 0); // sync scroller with scrollbar
|
||||
}
|
||||
} else {
|
||||
// When the shift key is held down, scroll ten times faster
|
||||
int multiplier = e->modifiers() & Qt::ShiftModifier ? 10 : 1;
|
||||
|
||||
if (delta != 0 && delta % QWheelEvent::DefaultDeltasPerStep == 0) {
|
||||
// number of scroll wheel steps Qt gives to us at the same time
|
||||
int count = abs(delta / QWheelEvent::DefaultDeltasPerStep);
|
||||
int count = abs(delta / QWheelEvent::DefaultDeltasPerStep) * multiplier;
|
||||
if (delta < 0) {
|
||||
slotScrollDown(count);
|
||||
} else {
|
||||
slotScrollUp(count);
|
||||
}
|
||||
} else {
|
||||
d->scroller->scrollTo(d->scroller->finalPosition() - e->angleDelta() / 4.0, 0);
|
||||
d->scroller->scrollTo(d->scroller->finalPosition() - e->angleDelta() * multiplier / 4.0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue