diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 3a2e0e54d7..ae54a6a0df 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -81,7 +81,7 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override; - bool HitTest( const wxPoint& aPosition ) const override + virtual bool HitTest( const wxPoint& aPosition ) const override { return TextHitTest( aPosition ); } @@ -89,7 +89,7 @@ public: /** @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect, * bool aContained = true, int aAccuracy ) const */ - bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override + virtual bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override { return TextHitTest( aRect, aContained, aAccuracy ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 0e6bbb7649..8aec4465f1 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -181,25 +181,6 @@ void TEXTE_MODULE::SetLocalCoord() } } - -bool TEXTE_MODULE::HitTest( const wxPoint& aPosition ) const -{ - wxPoint rel_pos; - EDA_RECT area = GetTextBox( -1, -1 ); - - /* Rotate refPos to - angle to test if refPos is within area (which - * is relative to an horizontal text) - */ - rel_pos = aPosition; - RotatePoint( &rel_pos, GetTextPos(), -GetDrawRotation() ); - - if( area.Contains( rel_pos ) ) - return true; - - return false; -} - - const EDA_RECT TEXTE_MODULE::GetBoundingBox() const { double angle = GetDrawRotation(); diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index df07ac8a25..9c4c9ae217 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -184,7 +184,15 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override; - bool HitTest( const wxPoint& aPosition ) const override; + virtual bool HitTest( const wxPoint& aPosition ) const override + { + return TextHitTest( aPosition ); + } + + virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override + { + return TextHitTest( aRect, aContained, aAccuracy ); + } wxString GetClass() const override {