From f7b2937e5b4b05a717b32b59c93ca4211929959e Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Fri, 4 Sep 2009 10:26:44 -0400 Subject: [PATCH] Fixing overshut being stopped in case of normal (non-kinetic) scrolling. TODO: cleanup some duplicated code. --- kineticview.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/kineticview.cpp b/kineticview.cpp index f0304b7..f733666 100644 --- a/kineticview.cpp +++ b/kineticview.cpp @@ -35,7 +35,7 @@ KineticView::KineticView( QGraphicsWidget *parent ) : QGraphicsWidget( parent ), mScrollVelocity( 0 ), - timerID( 0 ), overshut( 40 ) + timerID( 0 ), overshut( 50 ) { setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -116,7 +116,6 @@ void KineticView::setScrollValue( int value ) return; - overshut: mScrollVelocity = 5; startTimer( 80 ); @@ -141,8 +140,23 @@ void KineticView::mouseReleaseEvent( QGraphicsSceneMouseEvent *event ) { KineticScrolling::mouseReleaseEvent( static_cast( event ) ); + if ( mWindow->pos().y() > 0 ) { + direction = UP; + goto overshut; + } else if ( abs( mWindow->pos().y() ) > + abs( mViewPort->size().height() - mWindow->size().height() ) ) { + direction = DOWN; + goto overshut; + } else + direction = NONE; + mScrollVelocity = kin_movement(); startTimer( 50 ); + return; + +overshut: + mScrollVelocity = 5; + startTimer( 80 ); } void KineticView::timerEvent( QTimerEvent *event ) -- 2.11.4.GIT