Commit e04b6a04 authored by Marco Mattila's avatar Marco Mattila

Use the boundary of the object and not just the boundary of the text in SCH_TEXT hit testing.

parent b739b2b0
......@@ -643,13 +643,21 @@ void SCH_TEXT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return TextHitTest( aPosition, aAccuracy );
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( aAccuracy );
return bBox.Contains( aPosition );
}
bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
return TextHitTest( aRect, aContained, aAccuracy );
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( aAccuracy );
if( aContained )
return aRect.Contains( bBox );
return aRect.Intersects( bBox );
}
......@@ -1019,11 +1027,6 @@ wxString SCH_LABEL::GetSelectMenuText() const
}
bool SCH_LABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return TextHitTest( aPosition, aAccuracy );
}
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T )
......@@ -1454,11 +1457,6 @@ wxString SCH_GLOBALLABEL::GetSelectMenuText() const
}
bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return TextHitTest( aPosition, aAccuracy );
}
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
SCH_TEXT( pos, text, aType )
......@@ -1802,9 +1800,3 @@ wxString SCH_HIERLABEL::GetSelectMenuText() const
msg.Printf( _( "Hierarchical Label %s" ), GetChars( tmp ) );
return msg;
}
bool SCH_HIERLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
return TextHitTest( aPosition, aAccuracy );
}
......@@ -262,8 +262,6 @@ public:
bool IsReplaceable() const { return true; }
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
EDA_ITEM* Clone() const;
private:
......@@ -315,8 +313,6 @@ public:
BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; }
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
EDA_ITEM* Clone() const;
private:
......@@ -370,8 +366,6 @@ public:
BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; }
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
EDA_ITEM* Clone() const;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment