Make SCH_SHAPE::Normalize() upside-down-coords-aware.

Also fixes some typos in EE_POINT_EDITOR.
This commit is contained in:
Jeff Young 2024-04-18 10:27:20 +01:00
parent 79166510e9
commit e5cdf3785b
2 changed files with 10 additions and 5 deletions

View File

@ -76,15 +76,20 @@ void SCH_SHAPE::Normalize()
{
if( GetShape() == SHAPE_T::RECTANGLE )
{
VECTOR2I size = GetEnd() - GetPosition();
bool invertY = m_layer == LAYER_DEVICE;
if( size.y < 0 )
VECTOR2I size = GetEnd() - GetPosition();
bool swapY = invertY ? size.y > 0
: size.y < 0;
bool swapX = size.x < 0;
if( swapY )
{
SetStartY( GetStartY() + size.y );
SetEndY( GetStartY() - size.y );
}
if( size.x < 0 )
if( swapX )
{
SetStartX( GetStartX() + size.x );
SetEndX( GetStartX() - size.x );

View File

@ -635,7 +635,7 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const
case SCH_SHAPE_T:
{
SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( item );
bool invertY = true;
bool invertY = shape->GetLayer() == LAYER_DEVICE;
switch( shape->GetShape() )
{
@ -981,7 +981,7 @@ void EE_POINT_EDITOR::updatePoints()
case SCH_SHAPE_T:
{
SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( item );
bool invertY = true;
bool invertY = shape->GetLayer() == LAYER_DEVICE;
switch( shape->GetShape() )
{