From f00de043365717590bcfab5c35f7456be0d111e6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 4 Jul 2022 11:14:47 +0200 Subject: [PATCH] FP editor: fix incorrect mirroring of zones in footprint. This is due to a call to Mirror() with incorrect parameter. Unfortunately, depending on FP items, one Mirror parameter has the opposite meaning about mirror axis. Fixes #11952 https://gitlab.com/kicad/code/kicad/issues/11952 --- pcbnew/tools/edit_tool.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7221f9eb7f..2be84e1082 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1175,6 +1175,12 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) if( IsFootprintEditor() ) m_commit->Modify( selection.Front() ); + // Set the mirroring options. We are mirroring here Left to Right. + // Unfortunately, the mirror function do not have the same parameter for all items + // So we need these 2 parameters to avoid mistakes + const bool mirrorLeftRight = true; + const bool mirrorAroundXaxis = false; + for( EDA_ITEM* item : selection ) { // only modify items we can mirror @@ -1200,28 +1206,28 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) case PCB_FP_SHAPE_T: { FP_SHAPE* shape = static_cast( item ); - shape->Mirror( mirrorPoint, false ); + shape->Mirror( mirrorPoint, mirrorAroundXaxis ); break; } case PCB_FP_ZONE_T: { FP_ZONE* zone = static_cast( item ); - zone->Mirror( mirrorPoint, false ); + zone->Mirror( mirrorPoint, mirrorLeftRight ); break; } case PCB_FP_TEXT_T: { FP_TEXT* text = static_cast( item ); - text->Mirror( mirrorPoint, false ); + text->Mirror( mirrorPoint, mirrorAroundXaxis ); break; } case PCB_FP_TEXTBOX_T: { FP_TEXTBOX* textbox = static_cast( item ); - textbox->Mirror( mirrorPoint, false ); + textbox->Mirror( mirrorPoint, mirrorAroundXaxis ); break; }