From 5507748fa927513286501212a2189fe42270b024 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 12 Oct 2022 15:12:49 +0100 Subject: [PATCH] Make sure bounding box is not degenerate. --- eeschema/sch_line.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 886fc427ab..17db7770a6 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -190,14 +190,13 @@ void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const const BOX2I SCH_LINE::GetBoundingBox() const { - int width = m_stroke.GetWidth() / 2; - int extra = m_stroke.GetWidth() & 0x1; + int width = GetPenWidth() / 2; int xmin = std::min( m_start.x, m_end.x ) - width; int ymin = std::min( m_start.y, m_end.y ) - width; - int xmax = std::max( m_start.x, m_end.x ) + width + extra; - int ymax = std::max( m_start.y, m_end.y ) + width + extra; + int xmax = std::max( m_start.x, m_end.x ) + width + 1; + int ymax = std::max( m_start.y, m_end.y ) + width + 1; BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );