diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index b4dbd3ba67..ce84688ce0 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -111,19 +111,19 @@ public: const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override { - /* "Zoom to Fit" calls this with "aIncludeAllVisible" as true. Since that - * feature always ignored the page and border, this function returns a bbox - * without them as well when passed true. This technically is not all things - * visible, but it keeps behavior consistent. - * - * When passed false, this function returns a bbox of just the board edge. - * This allows things like fabrication text or anything else outside the board - * edge to be ignored, and just zooms up to the board itself. - * - * Calling "GetBoardBoundingBox(true)" when edge cuts are turned off will return bbox of - * entire page and border, so we make sure to do "GetBoardBoundingBox(false)" instead. - */ - if( aIncludeAllVisible || ( !aIncludeAllVisible && !m_pcb->IsLayerVisible( Edge_Cuts ) ) ) + /* "Zoom to Fit" calls this with "aIncludeAllVisible" as true. Since that feature + * always ignored the page and border, this function returns a bbox without them + * as well when passed true. This technically is not all things visible, but it + * keeps behavior consistent. + * + * When passed false, this function returns a bbox of just the board edge. This + * allows things like fabrication text or anything else outside the board edge to + * be ignored, and just zooms up to the board itself. + * + * Calling "GetBoardBoundingBox(true)" when edge cuts are turned off will return + * the entire page and border, so we call "GetBoardBoundingBox(false)" instead. + */ + if( aIncludeAllVisible || !m_pcb->IsLayerVisible( Edge_Cuts ) ) return GetBoardBoundingBox( false ); else return GetBoardBoundingBox( true ); diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 530e0a61fe..2845bdfcb7 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -1016,6 +1016,9 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) && PgmOrNull() && !PgmOrNull()->m_Printing; + if( aBoardEdgesOnly ) + visible.set( Edge_Cuts ); + // Check shapes, dimensions, texts, and fiducials for( BOARD_ITEM* item : m_drawings ) {