Eeschema: Add collision-based selection code to circles and text

This commit is contained in:
Seth Hillbrand 2017-10-06 13:58:27 -07:00 committed by jean-pierre charras
parent 47f37efdec
commit f685cfaf3d
3 changed files with 4 additions and 15 deletions

View File

@ -146,11 +146,8 @@ void LIB_CIRCLE::SetOffset( const wxPoint& aOffset )
bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
{
/*
* FIXME: This fails to take into account the radius around the center
* point.
*/
return aRect.Contains( m_Pos.x, -m_Pos.y );
wxPoint center(m_Pos.x, -m_Pos.y);
return aRect.IntersectsCircle( center, m_Radius );
}

View File

@ -447,11 +447,7 @@ void LIB_FIELD::SetOffset( const wxPoint& aOffset )
bool LIB_FIELD::Inside( EDA_RECT& rect ) const
{
/*
* FIXME: This fails to take into account the size and/or orientation of
* the text.
*/
return rect.Contains( GetTextPos().x, -GetTextPos().y );
return rect.Intersects( GetBoundingBox() );
}

View File

@ -268,11 +268,7 @@ void LIB_TEXT::SetOffset( const wxPoint& aOffset )
bool LIB_TEXT::Inside( EDA_RECT& rect ) const
{
/*
* FIXME: This should calculate the text size and justification and
* use rectangle intersect.
*/
return rect.Contains( GetTextPos().x, -GetTextPos().y );
return rect.Intersects( GetBoundingBox() );
}