Re-organize points to allow missing radius

Not all rectangles want/need the radius point, but we will only be able
to drag one point at a time.  So we re-organize which point of an
overlapping set is selected

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21605
This commit is contained in:
Seth Hillbrand 2025-08-31 07:07:10 -07:00
parent 9d7db3d135
commit 8c6f057f6c
3 changed files with 10 additions and 7 deletions

View File

@ -57,8 +57,11 @@ EDIT_POINT* EDIT_POINTS::FindPoint( const VECTOR2I& aLocation, KIGFX::VIEW *aVie
if( m_allowPoints )
{
for( EDIT_POINT& point : m_points )
// Check from the end so that we get the topmost point
for( auto r_it = m_points.rbegin(); r_it != m_points.rend(); ++r_it )
{
EDIT_POINT& point = *r_it;
if( point.WithinPoint( aLocation, size ) )
return &point;
}

View File

@ -62,7 +62,7 @@ enum ARC_POINTS
enum RECTANGLE_POINTS
{
RECT_TOPLEFT, RECT_RADIUS, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_CENTER
RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_CENTER, RECT_RADIUS
};
@ -392,12 +392,12 @@ public:
VECTOR2I botRight = aRect.GetEnd();
aPoints.AddPoint( topLeft );
aPoints.AddPoint( VECTOR2I( botRight.x - aRect.GetCornerRadius(), topLeft.y ) );
aPoints.Point( RECT_RADIUS ).SetDrawCircle();
aPoints.AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
aPoints.AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
aPoints.AddPoint( botRight );
aPoints.AddPoint( aRect.GetCenter() );
aPoints.AddPoint( VECTOR2I( botRight.x - aRect.GetCornerRadius(), topLeft.y ) );
aPoints.Point( RECT_RADIUS ).SetDrawCircle();
aPoints.AddLine( aPoints.Point( RECT_TOPLEFT ), aPoints.Point( RECT_TOPRIGHT ) );
aPoints.Line( RECT_TOP ).SetConstraint( new EC_PERPLINE( aPoints.Line( RECT_TOP ) ) );

View File

@ -71,11 +71,11 @@ const unsigned int PCB_POINT_EDITOR::COORDS_PADDING = pcbIUScale.mmToIU( 20 );
enum RECT_POINTS
{
RECT_TOP_LEFT,
RECT_RADIUS,
RECT_TOP_RIGHT,
RECT_BOT_RIGHT,
RECT_BOT_LEFT,
RECT_CENTER,
RECT_RADIUS,
RECT_MAX_POINTS, // Must be last
};
@ -207,12 +207,12 @@ public:
std::swap( topLeft.y, botRight.y );
aPoints.AddPoint( topLeft );
aPoints.AddPoint( VECTOR2I( botRight.x - aRectangle.GetCornerRadius(), topLeft.y ) );
aPoints.Point( RECT_RADIUS ).SetDrawCircle();
aPoints.AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
aPoints.AddPoint( botRight );
aPoints.AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
aPoints.AddPoint( aRectangle.GetCenter() );
aPoints.AddPoint( VECTOR2I( botRight.x - aRectangle.GetCornerRadius(), topLeft.y ) );
aPoints.Point( RECT_RADIUS ).SetDrawCircle();
aPoints.AddLine( aPoints.Point( RECT_TOP_LEFT ), aPoints.Point( RECT_TOP_RIGHT ) );
aPoints.Line( RECT_TOP ).SetConstraint( new EC_PERPLINE( aPoints.Line( RECT_TOP ) ) );