Add missing rect hittest

This commit is contained in:
Seth Hillbrand 2021-01-06 10:02:01 -08:00
parent 2a088e5c7b
commit db394286c7
2 changed files with 19 additions and 0 deletions

View File

@ -254,6 +254,23 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
} }
bool LIB_RECTANGLE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
if( m_flags & (STRUCT_DELETED | SKIP_STRUCT ) )
return false;
EDA_RECT sel = aRect;
if ( aAccuracy )
sel.Inflate( aAccuracy );
if( aContained )
return sel.Contains( GetBoundingBox() );
return sel.Intersects( GetBoundingBox() );
}
wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const
{ {
return wxString::Format( _( "Rectangle, width %s height %s" ), return wxString::Format( _( "Rectangle, width %s height %s" ),

View File

@ -58,6 +58,8 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
int GetPenWidth() const override; int GetPenWidth() const override;
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;