From 9159f5a00456b528e5cd15139e381c19975b9557 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Thu, 12 Oct 2023 02:21:47 +0300 Subject: [PATCH] Restore fill polygons on proper layers when flipping zones. (cherry picked from commit 0ea85ec9f503a033b2fb3d6b6d333e8875ce03dc) --- pcbnew/zone.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 7bdf7a38fd..21a32ab0ed 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -705,7 +705,20 @@ void ZONE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { Mirror( aCentre, aFlipLeftRight ); + std::map fillsCopy; + + for( auto& [oldLayer, shapePtr] : m_FilledPolysList ) + { + fillsCopy[oldLayer] = *shapePtr; + } + SetLayerSet( FlipLayerMask( GetLayerSet(), GetBoard()->GetCopperLayerCount() ) ); + + for( auto& [oldLayer, shape] : fillsCopy ) + { + PCB_LAYER_ID newLayer = FlipLayer( oldLayer, GetBoard()->GetCopperLayerCount() ); + SetFilledPolysList( newLayer, shape ); + } }