Make GetCenter() return the boundingbox center by default.
Leaves pads and markers returning the position. Fixes https://gitlab.com/kicad/code/kicad/issues/1924
This commit is contained in:
parent
4b73db90a4
commit
7c46cb0a05
|
@ -120,12 +120,14 @@ public:
|
|||
/**
|
||||
* Function GetCenter()
|
||||
*
|
||||
* This defaults to the same point as returned by GetPosition(), unless
|
||||
* overridden
|
||||
* This defaults to the center of the bounding box if not overridden.
|
||||
*
|
||||
* @return centre point of the item
|
||||
*/
|
||||
virtual wxPoint GetCenter() const { return GetPosition(); }
|
||||
virtual wxPoint GetCenter() const
|
||||
{
|
||||
return GetBoundingBox().GetCenter();
|
||||
}
|
||||
|
||||
void SetX( int aX )
|
||||
{
|
||||
|
|
|
@ -72,6 +72,11 @@ public:
|
|||
wxPoint GetPosition() const override { return m_Pos; }
|
||||
void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
|
||||
|
||||
wxPoint GetCenter() const override
|
||||
{
|
||||
return GetPosition();
|
||||
}
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
|
||||
{
|
||||
return HitTestMarker( aPosition, aAccuracy );
|
||||
|
|
|
@ -239,6 +239,8 @@ public:
|
|||
void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; m_shapesDirty = true; }
|
||||
const wxPoint& GetOffset() const { return m_offset; }
|
||||
|
||||
wxPoint GetCenter() const override { return GetPosition(); }
|
||||
|
||||
/**
|
||||
* Has meaning only for custom shape pads.
|
||||
* add a free shape to the shape list.
|
||||
|
|
Loading…
Reference in New Issue