From de1c3a83fd1b9c0ddb67f8562b811921a52e9e14 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 26 Jan 2021 22:59:36 +0000 Subject: [PATCH] Hittesting for background-body-filled shapes (and other fills). Fixes https://gitlab.com/kicad/code/kicad/issues/7286 --- eeschema/lib_circle.cpp | 5 ++++- eeschema/lib_rectangle.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 2fe1ab1f61..db372a6709 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -54,7 +54,10 @@ bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const if( abs( dist - GetRadius() ) <= mindist ) return true; - return false; + if( m_fill == FILL_TYPE::NO_FILL ) + return false; + + return dist <= GetRadius(); } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 8cd9f6245b..7be72bd160 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -250,7 +250,10 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const if( TestSegmentHit( aPosition, start, end, mindist ) ) return true; - return false; + if( m_fill == FILL_TYPE::NO_FILL ) + return false; + + return GetBoundingBox().Contains( aPosition ); }