diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 8e3526125b..f58a264f08 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -65,7 +65,20 @@ public: bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override { - return TextHitTest( aRect, aContained, aAccuracy ); + if( m_flags & (STRUCT_DELETED | SKIP_STRUCT ) ) + return false; + + EDA_RECT rect = aRect; + + rect.Inflate( aAccuracy ); + + EDA_RECT textBox = GetTextBox(); + textBox.RevertYAxis(); + + if( aContained ) + return rect.Contains( textBox ); + + return rect.Intersects( textBox, GetTextAngle() ); } int GetPenWidth() const override; diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 5ff05d2da1..850f16363a 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -361,9 +361,10 @@ void SYMBOL_EDIT_FRAME::setupUIConditions() auto canEditLib = [this] ( const SELECTION& sel ) { - return !getTargetLibId().GetLibNickname().empty() - && m_libMgr->LibraryExists( getTargetLibId().GetLibNickname() ) - && !m_libMgr->IsLibraryReadOnly( getTargetLibId().GetLibNickname() ); + const wxString libName = getTargetLibId().GetLibNickname(); + + return !libName.empty() && m_libMgr->LibraryExists( libName ) + && !m_libMgr->IsLibraryReadOnly( libName ); }; mgr->SetConditions( ACTIONS::saveAll,