Make SetPosition and SetOrientation simply adjust the bounding box rather than continously recalculate it.

SetPosition is called on every pixel of a move operation which could be performance impacting on some systems.
This commit is contained in:
Marek Roszko 2020-09-13 20:15:46 -04:00 committed by Seth Hillbrand
parent 4a25db599e
commit 721c30e464
2 changed files with 9 additions and 9 deletions

View File

@ -1232,9 +1232,9 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
}
void MODULE::SetPosition( const wxPoint& newpos )
void MODULE::SetPosition( const wxPoint& aPos )
{
wxPoint delta = newpos - m_Pos;
wxPoint delta = aPos - m_Pos;
m_Pos += delta;
@ -1273,7 +1273,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
}
}
CalculateBoundingBox();
m_BoundaryBox.Move( delta );
}
@ -1334,13 +1334,13 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
}
void MODULE::SetOrientation( double newangle )
void MODULE::SetOrientation( double aNewAngle )
{
double angleChange = newangle - m_Orient; // change in rotation
double angleChange = aNewAngle - m_Orient; // change in rotation
NORMALIZE_ANGLE_180( newangle );
NORMALIZE_ANGLE_180( aNewAngle );
m_Orient = newangle;
m_Orient = aNewAngle;
for( auto pad : m_pads )
{
@ -1370,7 +1370,7 @@ void MODULE::SetOrientation( double newangle )
}
}
CalculateBoundingBox();
m_BoundaryBox = m_BoundaryBox.GetBoundingBoxRotated( GetPosition(), angleChange );
}

View File

@ -211,7 +211,7 @@ public:
wxPoint GetPosition() const override { return m_Pos; }
void SetOrientation( double newangle );
void SetOrientation( double aNewAngle );
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
double GetOrientation() const { return m_Orient; }