3D viewer: fix a minor problem: to many rotations when typing Shift+z or Shift+y

more than once.

Fixes #4135
https://gitlab.com/kicad/code/kicad/issues/4135
This commit is contained in:
jean-pierre charras 2020-03-31 17:35:45 +02:00
parent 3a107e5484
commit 00d9e77e7f
1 changed files with 6 additions and 3 deletions

View File

@ -912,8 +912,11 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
m_camera.RotateX_T1( glm::radians( -90.0f ) );
m_camera.RotateZ_T1( glm::radians( -180.0f ) );
m_camera.RotateX_T1( glm::radians( -90.0f ) );
// The rotation angle should be 180.
// We use 179.999 (180 - epsilon) to avoid a full 360 deg rotation when
// using 180 deg if the previous rotated position was already 180 deg
m_camera.RotateZ_T1( glm::radians( 179.999f ) );
request_start_moving_camera();
return true;
@ -928,7 +931,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_camera.SetT0_and_T1_current_T();
m_camera.Reset_T1();
m_camera.RotateY_T1( glm::radians( 180.0f ) );
m_camera.RotateY_T1( glm::radians( 179.999f ) ); // Rotation = 180 - epsilon
request_start_moving_camera( glm::min( glm::max( m_camera.ZoomGet(), 0.5f ), 1.125f ) );
return true;