Pcbnew: fix incorrect PCB_TEXT::TextHitTest( const EDA_RECT& aRect,... ).

It was not taking in account the text rotation in block selection.
Fixes #8366
https://gitlab.com/kicad/code/kicad/issues/8366
This commit is contained in:
jean-pierre charras 2021-05-06 18:48:23 +02:00
parent 68085820ff
commit 1b9a8564af
2 changed files with 22 additions and 0 deletions

View File

@ -138,6 +138,25 @@ const EDA_RECT PCB_TEXT::GetBoundingBox() const
}
bool PCB_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
return EDA_TEXT::TextHitTest( aPoint, aAccuracy );
}
bool PCB_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
{
EDA_RECT rect = aRect;
rect.Inflate( aAccuracy );
if( aContains )
return rect.Contains( GetBoundingBox() );
else
return rect.Intersects( GetTextBox(), GetDrawRotation() );
}
void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
{
wxPoint pt = GetTextPos();

View File

@ -92,6 +92,9 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override;
bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override
{
return TextHitTest( aPosition, aAccuracy );