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:
parent
4a25db599e
commit
721c30e464
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue