Fixing kinetic scrolling with thinkpad 'scrollwheel'

Since it generates lots of wheel events, it was re-triggering the bouncer
animation before it was completed. The result was a 'jittering' (d)effect.

I also increased the friction factor to make it scroll slower.


svn path=/trunk/KDE/kdelibs/; revision=1026404
This commit is contained in:
Adenilson Cavalcanti Da Silva 2009-09-21 18:38:53 +00:00
parent 543f6fa81c
commit da3ece21e8

View File

@ -173,6 +173,7 @@ void KineticScrolling::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void KineticScrolling::wheelReleaseEvent(QGraphicsSceneWheelEvent *event) void KineticScrolling::wheelReleaseEvent(QGraphicsSceneWheelEvent *event)
{ {
if (d->direction == KineticScrollingPrivate::None) {
mousePressEvent(0); mousePressEvent(0);
/* Core */ /* Core */
@ -184,6 +185,7 @@ void KineticScrolling::wheelReleaseEvent(QGraphicsSceneWheelEvent *event)
/* After */ /* After */
d->mScrollVelocity = kinMovement().y(); d->mScrollVelocity = kinMovement().y();
startAnimationTimer(30); startAnimationTimer(30);
}
} }
@ -201,7 +203,7 @@ void KineticScrolling::timerEvent(QTimerEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if (d->direction == KineticScrollingPrivate::None) { if (d->direction == KineticScrollingPrivate::None) {
d->mScrollVelocity *= 0.9; d->mScrollVelocity *= 0.8;
if (qAbs(d->mScrollVelocity) < 5.0) { if (qAbs(d->mScrollVelocity) < 5.0) {
if (d->timerID) if (d->timerID)
killTimer(d->timerID); killTimer(d->timerID);