diff options
author | Michal Guminiak <michal.guminiak@teleca.com> | 2010-06-16 15:22:04 +0200 |
---|---|---|
committer | Tomas Junnonen <tomas.junnonen@nokia.com> | 2010-06-16 19:15:08 +0300 |
commit | 91f239442aa009e16e2c685d4451fb977945df4b (patch) | |
tree | b7e2d354c87f883af8451003383a4316ae77356b /src/corelib/widgets/mphysics2dpanning.cpp | |
parent | 05aec8a723ac504fdc79476b8c14315a9c6db295 (diff) |
Fixes: The MPannableViewport::setPosition() method should stop movement of the viewport.
RevBy: Tomas Junnonen
Details: If the position of the viewport is set programatically to
some position, the calculation should start again with velocity = 0.
Diffstat (limited to 'src/corelib/widgets/mphysics2dpanning.cpp')
-rw-r--r-- | src/corelib/widgets/mphysics2dpanning.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/corelib/widgets/mphysics2dpanning.cpp b/src/corelib/widgets/mphysics2dpanning.cpp index c2465d11..6170289c 100644 --- a/src/corelib/widgets/mphysics2dpanning.cpp +++ b/src/corelib/widgets/mphysics2dpanning.cpp @@ -280,9 +280,16 @@ void MPhysics2DPanning::setPosition(const QPointF &position) emit positionChanged(position); - // Starts the physics in case the position is set to border - // and it needs to slide back into range - start(); + if (inMotion()) { + // If we are in the middle of the movement, we should reduce the speed + // but not stop because we might be outside bounds. + d->velX = 0.0; + d->velY = 0.0; + } else { + // Starts the physics in case the position is set to border + // and it needs to slide back into range + start(); + } } } |