From bc3c8b19c65a5c8ccf03113c03919cc7e7e77622 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Aug 2023 18:44:47 +0100 Subject: [PATCH] Don't include annotations in boundingbox when not including text. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15411 Fixes https://gitlab.com/kicad/code/kicad/-/issues/15411 --- pcbnew/footprint.cpp | 15 ++++++++++++--- pcbnew/footprint_edit_frame.cpp | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 1e40ac294c..4c28a2737c 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1008,9 +1008,18 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible continue; } - // Treat dimension objects as text - if( !aIncludeText && BaseType( item->Type() ) == PCB_DIMENSION_T ) - continue; + // If we're not including text then drop annotations as well + if( !aIncludeText ) + { + if( BaseType( item->Type() ) == PCB_DIMENSION_T ) + continue; + + if( item->GetLayer() == Cmts_User || item->GetLayer() == Dwgs_User + || item->GetLayer() == Eco1_User || item->GetLayer() == Eco2_User ) + { + continue; + } + } bbox.Merge( item->GetBoundingBox() ); } diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index da242d5c36..11c6def294 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -699,7 +699,7 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) { for( const BOARD_ITEM* item : footprint->GraphicalItems() ) { - if( item->Type() == PCB_TEXT_T ) + if( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T ) continue; hasGraphicalItem = true;