From e5cdf3785bbec98572e2f3b235d0755e012cc348 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 18 Apr 2024 10:27:20 +0100 Subject: [PATCH] Make SCH_SHAPE::Normalize() upside-down-coords-aware. Also fixes some typos in EE_POINT_EDITOR. --- eeschema/sch_shape.cpp | 11 ++++++++--- eeschema/tools/ee_point_editor.cpp | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index 949e7ce031..58f00f1be2 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -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 ); diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index c38c5cf91b..2e3854a2cb 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -635,7 +635,7 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid ) const case SCH_SHAPE_T: { SCH_SHAPE* shape = static_cast( 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( item ); - bool invertY = true; + bool invertY = shape->GetLayer() == LAYER_DEVICE; switch( shape->GetShape() ) {