parent
2b4c2efc85
commit
a0afcd5a62
|
@ -517,6 +517,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
|
|||
bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT arect = aRect;
|
||||
arect.Normalize();
|
||||
arect.Inflate( aAccuracy );
|
||||
|
||||
EDA_RECT arcRect;
|
||||
|
|
|
@ -776,6 +776,36 @@ bool D_PAD::HitTest( const wxPoint& aPosition ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool D_PAD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT arect = aRect;
|
||||
arect.Normalize();
|
||||
arect.Inflate( aAccuracy );
|
||||
|
||||
if( !arect.Intersects( GetBoundingBox() ) )
|
||||
return false;
|
||||
|
||||
if( aContained )
|
||||
return arect.Contains( GetBoundingBox() );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case PAD_SHAPE_CIRCLE:
|
||||
return arect.IntersectsCircle( GetPosition(), GetBoundingRadius() );
|
||||
case PAD_SHAPE_RECT:
|
||||
break;
|
||||
case PAD_SHAPE_OVAL:
|
||||
break;
|
||||
case PAD_SHAPE_TRAPEZOID:
|
||||
break;
|
||||
case PAD_SHAPE_ROUNDRECT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
|
||||
{
|
||||
|
|
|
@ -483,6 +483,8 @@ public:
|
|||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "PAD" );
|
||||
|
|
Loading…
Reference in New Issue