Skip to content

Commit

Permalink
Prevent overshoot on fling damping (#2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteblair authored Nov 28, 2020
1 parent c4b0245 commit 35bfa37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/util/inputHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ bool InputHandler::update(float _dt) {

if (isFlinging) {

m_velocityPan -= _dt * DAMPING_PAN * m_velocityPan;
m_velocityPan -= min(_dt * DAMPING_PAN, 1.f) * m_velocityPan;
m_view.translate(_dt * m_velocityPan.x, _dt * m_velocityPan.y);

m_velocityZoom -= _dt * DAMPING_ZOOM * m_velocityZoom;
m_velocityZoom -= min(_dt * DAMPING_ZOOM, 1.f) * m_velocityZoom;
m_view.zoom(m_velocityZoom * _dt);
}

Expand Down

0 comments on commit 35bfa37

Please sign in to comment.