Pl_editor: add missing HitTest() for WS_DRAW_ITEM_BITMAP item.
This commit is contained in:
parent
27a5ed1a9f
commit
ce9b1e3da5
|
@ -368,10 +368,32 @@ void WS_DRAW_ITEM_BITMAP::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4
|
||||||
const EDA_RECT WS_DRAW_ITEM_BITMAP::GetBoundingBox() const
|
const EDA_RECT WS_DRAW_ITEM_BITMAP::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
auto* bitmap = static_cast<const WS_DATA_ITEM_BITMAP*>( m_peer );
|
auto* bitmap = static_cast<const WS_DATA_ITEM_BITMAP*>( m_peer );
|
||||||
EDA_RECT rect = bitmap->m_ImageBitmap->GetBoundingBox();
|
wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
|
||||||
|
|
||||||
rect.Move( m_pos );
|
// Size is in mils, convert to iu (0.001 mm)
|
||||||
return rect;
|
bm_size.x *= 25.4;
|
||||||
|
bm_size.y *= 25.4;
|
||||||
|
|
||||||
|
EDA_RECT bbox;
|
||||||
|
bbox.SetSize( bm_size );
|
||||||
|
bbox.SetOrigin( m_pos.x - bm_size.x/2, m_pos.y - bm_size.y/2 );
|
||||||
|
|
||||||
|
return bbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
|
{
|
||||||
|
EDA_RECT bbox = GetBoundingBox();
|
||||||
|
bbox.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
return bbox.Contains( aPosition );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
|
||||||
|
{
|
||||||
|
return WS_DRAW_ITEM_BASE::HitTest( aRect, aContains, aAccuracy );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,11 @@ class WS_DRAW_ITEM_TEXT; // Forward declaration
|
||||||
|
|
||||||
#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
|
#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
|
||||||
|
|
||||||
// A coordinate is relative to a page corner.
|
/**
|
||||||
// Any of the 4 corners can be a reference.
|
* A coordinate is relative to a page corner.
|
||||||
// The default is the right bottom corner
|
* Any of the 4 corners can be a reference.
|
||||||
|
* The default is the right bottom corner
|
||||||
|
*/
|
||||||
enum CORNER_ANCHOR
|
enum CORNER_ANCHOR
|
||||||
{
|
{
|
||||||
RB_CORNER, // right bottom corner
|
RB_CORNER, // right bottom corner
|
||||||
|
@ -58,10 +60,11 @@ enum PAGE_OPTION
|
||||||
SUBSEQUENT_PAGES
|
SUBSEQUENT_PAGES
|
||||||
};
|
};
|
||||||
|
|
||||||
// a coordinate point
|
/**
|
||||||
// The position is always relative to the corner anchor
|
* A coordinate point
|
||||||
// Note the coordinate is from the anchor point
|
* The position is always relative to the corner anchor
|
||||||
// to the opposite corner.
|
* Note the coordinate is from the anchor point to the opposite corner.
|
||||||
|
*/
|
||||||
class POINT_COORD
|
class POINT_COORD
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -78,13 +81,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Work sheet structure type definitions.
|
/**
|
||||||
// Basic items are:
|
* Work sheet structure type definitions.
|
||||||
// * segment and rect (defined by 2 points)
|
* Basic items are:
|
||||||
// * text (defined by a coordinate), the text and its justifications
|
* * segment and rect (defined by 2 points)
|
||||||
// * poly polygon defined by a coordinate, and a set of list of corners
|
* * text (defined by a coordinate), the text and its justifications
|
||||||
// ( because we use it for logos, there are more than one polygon
|
* * poly polygon defined by a coordinate, and a set of list of corners
|
||||||
// in this description
|
* ( because we use it for logos, there are more than one polygon
|
||||||
|
* in this description
|
||||||
|
*/
|
||||||
class WS_DATA_ITEM
|
class WS_DATA_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -295,7 +300,7 @@ class WS_DATA_ITEM_TEXT : public WS_DATA_ITEM
|
||||||
public:
|
public:
|
||||||
wxString m_TextBase; // The basic text, with format symbols
|
wxString m_TextBase; // The basic text, with format symbols
|
||||||
wxString m_FullText; // The expanded text, shown on screen
|
wxString m_FullText; // The expanded text, shown on screen
|
||||||
double m_Orient; // Orientation in degrees
|
double m_Orient; // Orientation in degrees
|
||||||
EDA_TEXT_HJUSTIFY_T m_Hjustify;
|
EDA_TEXT_HJUSTIFY_T m_Hjustify;
|
||||||
EDA_TEXT_VJUSTIFY_T m_Vjustify;
|
EDA_TEXT_VJUSTIFY_T m_Vjustify;
|
||||||
bool m_Italic;
|
bool m_Italic;
|
||||||
|
|
|
@ -287,6 +287,8 @@ public:
|
||||||
|
|
||||||
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
|
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
|
||||||
|
|
||||||
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||||
|
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||||
|
|
Loading…
Reference in New Issue