Fix broken MODULE::HitTest()

HitTest was using a rotated bounding box, but the bounding box
is already right.
This commit is contained in:
jean-pierre charras 2020-09-19 19:37:58 +02:00
parent 55089f4732
commit 121ccc3a10
2 changed files with 11 additions and 4 deletions

View File

@ -729,7 +729,7 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
bool MODULE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool MODULE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = m_BoundaryBox.GetBoundingBoxRotated( GetPosition(), m_Orient ); EDA_RECT rect = m_BoundaryBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );
return rect.Inflate( aAccuracy ).Contains( aPosition ); return rect.Inflate( aAccuracy ).Contains( aPosition );
} }
@ -746,7 +746,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
arect.Inflate( aAccuracy ); arect.Inflate( aAccuracy );
if( aContained ) if( aContained )
return arect.Contains( m_BoundaryBox.GetBoundingBoxRotated( GetPosition(), m_Orient ) ); return arect.Contains( m_BoundaryBox );
else else
{ {
// If the rect does not intersect the bounding box, skip any tests // If the rect does not intersect the bounding box, skip any tests
@ -1591,7 +1591,7 @@ extern bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_
wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr ); wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr );
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{ {
std::shared_ptr<SHAPE> shape ( new SHAPE_NULL ); std::shared_ptr<SHAPE> shape ( new SHAPE_NULL );

View File

@ -146,11 +146,18 @@ public:
/** /**
* Function GetFootprintRect() * Function GetFootprintRect()
* Returns the area of the module footprint excluding any text. * Build and returns the boundary box of the module footprint excluding any text.
* @return EDA_RECT - The rectangle containing the footprint. * @return EDA_RECT - The rectangle containing the footprint.
*/ */
EDA_RECT GetFootprintRect() const; EDA_RECT GetFootprintRect() const;
/**
* Returns the last calculated bounding box of the footprint (does not recalculate it).
* (call CalculateBoundingBox() to recalculate it)
* @return EDA_RECT - The rectangle containing the footprint
*/
EDA_RECT GetBoundingBoxBase() const { return m_BoundaryBox; }
/** /**
* Returns the bounding box containing pads when the footprint * Returns the bounding box containing pads when the footprint
* is on the front side, orientation 0, position 0,0. * is on the front side, orientation 0, position 0,0.