Help repair invalid rotation settings
We had a period where we were writing invalid rotations leading to values too large by a factor of 100. This clamps the stored values while repairing those affected Fixes https://gitlab.com/kicad/code/kicad/issues/11090
This commit is contained in:
parent
e278e77314
commit
f218da6ea5
|
@ -135,12 +135,22 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
||||||
m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
|
m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
|
||||||
[this] () -> int
|
[this] () -> int
|
||||||
{
|
{
|
||||||
return m_RotationAngle.AsTenthsOfADegree();
|
int rot = m_RotationAngle.AsTenthsOfADegree();
|
||||||
|
|
||||||
|
// Don't store values larger than 360 degrees
|
||||||
|
return rot % 3600;
|
||||||
},
|
},
|
||||||
[this] ( int aVal )
|
[this] ( int aVal )
|
||||||
{
|
{
|
||||||
if( aVal )
|
if( aVal )
|
||||||
m_RotationAngle = EDA_ANGLE( aVal, TENTHS_OF_A_DEGREE_T );
|
m_RotationAngle = EDA_ANGLE( aVal, TENTHS_OF_A_DEGREE_T );
|
||||||
|
|
||||||
|
// A misconfiguration allowed some angles to be stored as tenth of a degree but read
|
||||||
|
// as tens of degrees. By disallowing storage of values larger than 360, we can weed out
|
||||||
|
// those invalid values here.
|
||||||
|
while( m_RotationAngle > ANGLE_360 )
|
||||||
|
m_RotationAngle = m_RotationAngle / 100;
|
||||||
|
|
||||||
},
|
},
|
||||||
900 ) );
|
900 ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue