From 1290228fbf26c565e8c02024e8e12666277641f2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 5 May 2024 19:48:14 +0100 Subject: [PATCH] Don't modify radius when editing center. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17192 --- common/eda_shape.cpp | 4 ++-- include/eda_shape.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 95eb1e128e..ae75beeace 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1990,13 +1990,13 @@ static struct EDA_SHAPE_DESC .SetAvailableFunc( isNotPolygonOrCircle ); propMgr.AddProperty( new PROPERTY( _HKI( "Center X" ), - &EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD, + &EDA_SHAPE::SetCenterX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD, ORIGIN_TRANSFORMS::ABS_X_COORD ), shapeProps ) .SetAvailableFunc( isCircle ); propMgr.AddProperty( new PROPERTY( _HKI( "Center Y" ), - &EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD, + &EDA_SHAPE::SetCenterY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD, ORIGIN_TRANSFORMS::ABS_Y_COORD ), shapeProps ) .SetAvailableFunc( isCircle ); diff --git a/include/eda_shape.h b/include/eda_shape.h index 15d57b50cf..74de5ddf40 100644 --- a/include/eda_shape.h +++ b/include/eda_shape.h @@ -144,6 +144,18 @@ public: m_endsSwapped = false; } + void SetCenterY( int y ) + { + m_end.y += y - m_start.y; + m_start.y = y; + } + + void SetCenterX( int x ) + { + m_end.x += x - m_start.x; + m_start.x = x; + } + /** * Return the ending point of the graphic. */