3D Viewer: Fix mouse panning in orthographic projection mode

Fixes https://gitlab.com/kicad/code/kicad/issues/5561
This commit is contained in:
Mikolaj Wielgus 2021-04-10 18:28:49 +02:00 committed by jean-pierre charras
parent 846e4aed42
commit 744e70df36
1 changed files with 4 additions and 4 deletions

View File

@ -97,10 +97,10 @@ void TRACK_BALL::Pan( const wxPoint& aNewMousePosition )
if( m_projectionType == PROJECTION_TYPE::ORTHO )
{
// With the orthographic projection, there is just a zoom factor
const float panFactor = m_zoom / 37.5f; // Magic number from CAMERA::rebuildProjection
m_camera_pos.x -= panFactor * ( m_lastPosition.x - aNewMousePosition.x );
m_camera_pos.y -= panFactor * ( aNewMousePosition.y - m_lastPosition.y );
m_camera_pos.x -= m_frustum.nw *
( m_lastPosition.x - aNewMousePosition.x ) / m_windowSize.x;
m_camera_pos.y -= m_frustum.nh *
( aNewMousePosition.y - m_lastPosition.y ) / m_windowSize.y;
}
else // PROJECTION_TYPE::PERSPECTIVE
{